KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > portlets > contentlet > factories > ReindexationProcessStatus


1 package com.dotmarketing.portlets.contentlet.factories;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.Date JavaDoc;
5 import java.util.Hashtable JavaDoc;
6 import java.util.Map JavaDoc;
7
8 import com.dotmarketing.util.LuceneUtils;
9 import com.dotmarketing.util.UtilMethods;
10
11 /** @author Hibernate CodeGenerator */
12 public class ReindexationProcessStatus implements Serializable JavaDoc {
13
14     private static final long serialVersionUID = 1L;
15
16     private static boolean inFullReindexation = false;
17     
18     private static int contentCountToIndex = -1;
19     
20     private static int contentCountIndexed = -1;
21
22     private static Date JavaDoc lastIndexationStartTime = null;
23
24     private static Date JavaDoc lastIndexationEndTime = null;
25     
26     public synchronized static boolean inFullReindexation () {
27         return inFullReindexation;
28     }
29     
30     public synchronized static void setInFullReindexation (boolean newValue) {
31         inFullReindexation = newValue;
32         if (!newValue) {
33             contentCountToIndex = -1;
34             lastIndexationEndTime = new Date JavaDoc ();
35         } else {
36             lastIndexationStartTime = new Date JavaDoc ();
37         }
38     }
39     
40     public synchronized static int getContentCountToIndex () {
41         return contentCountToIndex;
42     }
43
44     public synchronized static void setContentCountToIndex (int count) {
45         contentCountToIndex = count;
46         contentCountIndexed = 0;
47         setInFullReindexation (true);
48     }
49
50     public synchronized static int getLastIndexationProgress () {
51         return contentCountIndexed;
52     }
53
54     public synchronized static void updateIndexationProgress (int increment) {
55         contentCountIndexed += increment;
56     }
57
58     public synchronized static String JavaDoc currentIndexPath () {
59         return LuceneUtils.getCurrentLuceneDirPath();
60     }
61
62     public synchronized static String JavaDoc getNewIndexPath () {
63         return LuceneUtils.getNewLuceneDirPath();
64     }
65     
66     public synchronized static Map JavaDoc getProcessIndexationMap () {
67         Map JavaDoc theMap = new Hashtable JavaDoc ();
68         theMap.put("inFullReindexation", inFullReindexation());
69         theMap.put("contentCountToIndex", getContentCountToIndex());
70         theMap.put("lastIndexationProgress", getLastIndexationProgress());
71         theMap.put("currentIndexPath", currentIndexPath());
72         theMap.put("newIndexPath", getNewIndexPath());
73         theMap.put("lastIndexationStartTime", UtilMethods.dateToHTMLDate(lastIndexationStartTime) + " " +
74                 UtilMethods.dateToHTMLTime(lastIndexationStartTime));
75         theMap.put("lastIndexationEndTime", UtilMethods.dateToHTMLDate(lastIndexationEndTime) + " " +
76                 UtilMethods.dateToHTMLTime(lastIndexationEndTime));
77         return theMap;
78     }
79 }
Popular Tags