📄 jahiahomepage.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .////// NK - 17 Dec. 2001 ://package org.jahia.services.homepages;import java.util.Hashtable;import java.util.Enumeration;import java.util.Comparator;import org.jahia.exceptions.JahiaException;import org.jahia.services.pages.JahiaPage;import org.jahia.services.sites.JahiaSite;import org.jahia.utils.JahiaConsole;/** * Abstract class for all jahia homepage definitions. * Bean of these classes holds information used to define different type of * homepage definition. * * @author Khue ng * @version 1.0 */public abstract class JahiaHomepage implements Cloneable, Comparator{ protected int id = -1; protected String name; protected String descr; protected int type; protected String siteKey; protected int aclID; protected Hashtable props = new Hashtable(); /** * Constructor */ private JahiaHomepage(){}; /** * Constructor, subclass must have exact constructor signature. * * @param Integer id, the unique identifier * @param String name, the name * @param String descr, the descr * @param Integer type, the type * @param String sitekey, the site key * @param Hashtable props, the properties * @param Integer aclID, the acl */ JahiaHomepage( Integer id, String name, String descr, Integer type, String siteKey, Hashtable props, Integer aclID ){ this.id = id.intValue(); this.name = name; this.descr = descr; this.type = type.intValue(); this.siteKey = siteKey; if ( props != null ) this.props = props; this.aclID = aclID.intValue(); } //------------------------------------------------------------------------- /** * Set the home page unique identifier. * * @param int id, the id. */ void setID(int id){ this.id = id; } //------------------------------------------------------------------------- /** * Return the homepage unique identifier. * * @return int the id. */ public int getID(){ return id; } //------------------------------------------------------------------------- /** * Return the homepage name * * @return String the home page name. */ public String getName(){ return name; } //------------------------------------------------------------------------- /** * Set the homepage name * * @param String the home page name. */ public void setName(String name){ this.name = name; } //------------------------------------------------------------------------- /** * Return the homepage descr * * @return String the home page descr. */ public String getDescr(){ return descr; } //------------------------------------------------------------------------- /** * Set the homepage descr * * @param String the home page descr. */ public void setDescr(String descr){ this.descr = descr; } //------------------------------------------------------------------------- /** * Return the homepage type. * * @return int the home page type. */ public int getType(){ return type; } //------------------------------------------------------------------------- /** * Return the homepage Site's key. * * @return String the site key. */ public String getSiteKey(){ return siteKey; } //------------------------------------------------------------------------- /** * Set the acl ID. * * @param int id, the acl id. */ void setAclID(int id){ this.aclID = id; } //------------------------------------------------------------------------- /** * Return the acl id * * @return int, the acl ID. */ public int getAclID(){ return aclID; } //-------------------------------------------------------------------------- /** * Get home page's properties list. * * @return Hashtable Return a reference on the homepage's properties list, or null if no * property is present. */ public Hashtable getProperties (){ return props; } //-------------------------------------------------------------------------- /** * Set home page's properties list. * * @param Hashtable . */ void setProperties (Hashtable props){ if ( props == null ) return; this.props = props; } //-------------------------------------------------------------------------- /** * Retrieve the requested home page property. * * @param key Property's name. * * @return Return the property's value of the specified key, or null if the * property does not exist. */ Object getProperty (String key){ return props.get(key); } //-------------------------------------------------------------------------- /** * Remove the specified property from the properties list. * * @param key Property's name. */ void removeProperty (String key){ props.remove(key); } //-------------------------------------------------------------------------- /** * Add (or update if not already in the property list) * * @param String Property's name. * @param Object Property's value. */ void setProperty (String key, Object value){ props.put(key,value); } //-------------------------------------------------------------------------- /** * Save its state. * */ abstract void save() throws JahiaException ; //-------------------------------------------------------------------------- /** * Delete. * */ abstract void delete() throws JahiaException ; //------------------------------------------------------------------------- /** * Load extra properties from storage * * @param int the template id */ abstract void loadProperties() throws JahiaException; //------------------------------------------------------------------------- /** * Save extra properties in storage * */ abstract void saveProperties() throws JahiaException; //-------------------------------------------------------------------------- /** * Return a string representation of the home page and it's internal state. * * @return A string representation of this home page. */ public abstract String toString (); //-------------------------------------------------------------------------- /** * Return a cloje object * * @return Object the clone. */ public abstract Object clone (); //------------------------------------------------------------------------- /** * Compare between two objects, sort by their name * * @param Object * @param Object */ public int compare(Object c1, Object c2) throws ClassCastException { return ((JahiaHomepage)c1) .getName().compareToIgnoreCase(((JahiaHomepage)c2).getName().toLowerCase()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -