1 package org.jahia.services.search; 2 3 import java.io.Serializable ; 4 5 12 public class SiteIndexationStatus implements Serializable { 13 14 public static final int IDLE_STATUS = 0; 15 public static final int ERROR_STATUS = 1; 16 public static final int SUCCESS_STATUS = 2; 17 18 private long startingTime; 19 20 private long endTime; 21 22 private boolean done = false; 23 24 private boolean shutdown = false; 25 26 private int nbDocsToIndex = 0; 27 28 private int nbIndexedDocs = 0; 29 30 private int status = IDLE_STATUS; 31 32 private int siteId = 0; 33 34 public SiteIndexationStatus(int siteId) { 35 this.siteId = siteId; 36 } 37 38 public int getSiteId() { 39 return siteId; 40 } 41 42 public void setSiteId(int siteId) { 43 this.siteId = siteId; 44 } 45 46 public long getStartingTime() { 47 return startingTime; 48 } 49 50 public void setStartingTime(long startingTime) { 51 this.startingTime = startingTime; 52 } 53 54 public long getEndTime() { 55 return endTime; 56 } 57 58 public void setEndTime(long endTime) { 59 this.endTime = endTime; 60 } 61 62 public synchronized boolean isDone() { 63 return done; 64 } 65 66 public synchronized void setDone(boolean done) { 67 this.done = done; 68 } 69 70 public int getStatus() { 71 return status; 72 } 73 74 public void setStatus(int status) { 75 this.status = status; 76 } 77 78 public synchronized boolean isShutdown() { 79 return shutdown; 80 } 81 82 public synchronized void setShutdown(boolean shutdown) { 83 this.shutdown = shutdown; 84 if ( !this.isDone() ){ 85 setDone(false); 86 setEndTime(System.currentTimeMillis()); 87 setStatus(SiteIndexationStatus.ERROR_STATUS); 88 } 89 } 90 91 public synchronized int getNbDocsToIndex() { 92 return nbDocsToIndex; 93 } 94 95 public synchronized void setNbDocsToIndex(int nbDocsToIndex) { 96 this.nbDocsToIndex = nbDocsToIndex; 97 } 98 99 public synchronized int getNbIndexedDocs() { 100 return nbIndexedDocs; 101 } 102 103 public synchronized void setNbIndexedDocs(int nbIndexedDocs) { 104 this.nbIndexedDocs = nbIndexedDocs; 105 } 106 107 } 108 | Popular Tags |