1 16 package org.jahia.services.homepages; 17 18 19 import java.util.Comparator ; 20 import java.util.Hashtable ; 21 22 import org.jahia.exceptions.JahiaException; 23 24 25 33 public abstract class JahiaHomepage implements Cloneable , Comparator 34 { 35 36 protected int id = -1; 37 protected String name; 38 protected String descr; 39 protected int type; 40 protected String siteKey; 41 protected int aclID; 42 43 protected Hashtable props = new Hashtable (); 44 45 46 49 private JahiaHomepage(){}; 50 51 52 63 JahiaHomepage( Integer id, 64 String name, 65 String descr, 66 Integer type, 67 String siteKey, 68 Hashtable props, 69 Integer aclID ){ 70 71 this.id = id.intValue(); 72 this.name = name; 73 this.descr = descr; 74 this.type = type.intValue(); 75 this.siteKey = siteKey; 76 if ( props != null ) 77 this.props = props; 78 this.aclID = aclID.intValue(); 79 } 80 81 87 void setID(int id){ 88 this.id = id; 89 } 90 91 92 98 public int getID(){ 99 return id; 100 } 101 102 108 public String getName(){ 109 return name; 110 } 111 112 118 public void setName(String name){ 119 this.name = name; 120 } 121 122 128 public String getDescr(){ 129 return descr; 130 } 131 132 138 public void setDescr(String descr){ 139 this.descr = descr; 140 } 141 142 148 public int getType(){ 149 return type; 150 } 151 152 158 public String getSiteKey(){ 159 return siteKey; 160 } 161 162 168 void setAclID(int id){ 169 this.aclID = id; 170 } 171 172 178 public int getAclID(){ 179 return aclID; 180 } 181 182 189 public Hashtable getProperties (){ 190 return props; 191 } 192 193 199 void setProperties (Hashtable props){ 200 if ( props == null ) 201 return; 202 this.props = props; 203 } 204 205 214 Object getProperty (String key){ 215 return props.get(key); 216 } 217 218 219 225 void removeProperty (String key){ 226 props.remove(key); 227 } 228 229 230 237 void setProperty (String key, Object value){ 238 props.put(key,value); 239 } 240 241 246 abstract void save() 247 throws JahiaException ; 248 249 254 abstract void delete() 255 throws JahiaException ; 256 257 263 abstract void loadProperties() 264 throws JahiaException; 265 266 271 abstract void saveProperties() throws JahiaException; 272 273 279 public abstract String toString (); 280 281 287 public abstract Object clone (); 288 289 290 297 public int compare(Object c1, Object c2) throws ClassCastException { 298 299 return ((JahiaHomepage)c1) 300 .getName().compareToIgnoreCase(((JahiaHomepage)c2).getName().toLowerCase()); 301 302 } 303 304 305 306 } 307 | Popular Tags |