1 package org.jahia.services.search; 2 3 import java.io.*; 4 import java.util.*; 5 6 9 18 public class JahiaIndexableDocumentImpl implements JahiaIndexableDocument , 19 Serializable { 20 21 protected int siteId; 22 23 protected String key; 24 25 protected String keyFieldName = JahiaSearchConstant.OBJECT_KEY; 26 27 protected Hashtable fields; 28 29 protected Set unStoreFields = new HashSet (); 30 31 protected boolean toBeAdded = true; 32 33 protected boolean isCacheableWithRAMIndexer = true; 34 35 36 41 public JahiaIndexableDocumentImpl (int siteId, String key, 42 Hashtable fields) { 43 this.siteId = siteId; 44 this.key = key; 45 this.fields = fields; 46 if (this.fields == null) { 47 this.fields = new Hashtable (); 48 } 49 } 50 51 57 public JahiaIndexableDocumentImpl (int siteId, String keyFieldName, 58 String key, Hashtable fields) { 59 this.siteId = siteId; 60 if ( keyFieldName != null ){ 61 this.keyFieldName = keyFieldName; 62 } 63 this.key = key; 64 this.fields = fields; 65 if (this.fields == null) { 66 this.fields = new Hashtable (); 67 } 68 } 69 70 75 public boolean toBeAdded () { 76 return this.toBeAdded; 77 } 78 79 84 public boolean toBeRemoved () { 85 return !this.toBeAdded; 86 } 87 88 93 public void setBeAdded (boolean val) { 94 this.toBeAdded = val; 95 } 96 97 104 public boolean beforeAddingToSearchEngine () { 105 return true; 106 } 107 108 115 public boolean beforeRemovingFromSearchEngine () { 116 return true; 117 } 118 119 124 public int getSiteId () { 125 return this.siteId; 126 } 127 128 133 public void setSiteId (int siteId) { 134 this.siteId = siteId; 135 } 136 137 142 public String getKey () { 143 return this.key; 144 } 145 146 151 public void setKey (String key) { 152 this.key = key; 153 } 154 155 163 public void setKeyFieldName (String keyFieldName) { 164 if (keyFieldName != null && !"".equals (keyFieldName.trim ())) { 165 this.keyFieldName = keyFieldName; 166 } 167 } 168 169 174 public String getKeyFieldName () { 175 return this.keyFieldName; 176 } 177 178 184 public Hashtable getFields () { 185 return this.fields; 186 } 187 188 194 public void setField (String key, String val) { 195 if (key != null && val != null) { 196 String [] vals = {val}; 197 this.fields.put (key, vals); 198 } 199 } 200 201 207 public void setField (String key, String [] vals) { 208 if (key != null && vals != null && vals.length > 0) { 209 this.fields.put (key, vals); 210 } 211 } 212 213 216 public void removeField (String key) { 217 if (key != null) { 218 this.fields.remove (key); 219 } 220 } 221 222 233 public void unStoreField (String key) { 234 this.unStoreFields.add (key); 235 } 236 237 245 public boolean isFieldUnStored (String key) { 246 if (key == null) { 247 return false; 248 } 249 return (this.unStoreFields.contains (key)); 250 } 251 252 261 public boolean scheduled(IndexationJobDetail indexationJobDetail){ 262 return false; 263 } 264 265 266 270 public void doScheduledLoad(){ 271 } 273 274 279 public boolean isCacheableWithRAMIndexer() { 280 return this.isCacheableWithRAMIndexer; 281 } 282 283 public void setCacheableWithRAMIndexer(boolean cacheableWithRAMIndexer) { 284 this.isCacheableWithRAMIndexer = cacheableWithRAMIndexer; 285 } 286 287 } 288 | Popular Tags |