⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jahiahomepagelink.java

📁 java 写的一个新闻发布系统
💻 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 org.jahia.exceptions.JahiaException;import org.jahia.utils.JahiaConsole;/** * A JahiaHomepageLink holds information used to define homepage of type Link. * Home page definition of this type holds a page id that refers to the page that * should be used as Home page. * * @author Khue ng * @see HomepageTypes.HOMEPAGE_LINK * @version 1.0 */public final class JahiaHomepageLink extends JahiaHomepage{	private static String CLASS_NAME = JahiaHomepageLink.class.getName();		private static final String PAGEID = "pageid";	private JahiaHomepagesPersistance hpp;	/**	 * 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	 */	JahiaHomepageLink(	Integer id,						String name,						String descr,						Integer type,						String siteKey,						Hashtable props,						Integer aclID ){			super(id,name,descr,type,siteKey,props,aclID);		}        //-------------------------------------------------------------------------    /**     * Return the internal page id that refers to a Jahia Page.     *     * @return int the internal page id or -1 if not defined.     */    public int getPageID(){    	Integer pageID = (Integer)props.get(PAGEID);    	if ( pageID == null ){    		return -1;    	}    	return pageID.intValue();	}	    //-------------------------------------------------------------------------    /**     * Set the page ID     *     * @param int the id     */    public void setPageID(int id){		props.put(PAGEID,new Integer(id));    }    //--------------------------------------------------------------------------    /**     * Save its state.     *     */    void save()    throws JahiaException {    	    	hpp.getInstance().save(this);    	saveProperties();    }    //--------------------------------------------------------------------------    /**     * Delete.     *     */    void delete()    throws JahiaException {    	hpp.getInstance().delete(getID());    	deleteProperties();    }	    //-------------------------------------------------------------------------    /**     * Load extra properties from storage     *     */    void loadProperties() throws JahiaException{				if ( props == null )			props = new Hashtable();				String value = null;		value = hpp.getInstance().getProperty(this,PAGEID);		if ( value != null ){			try {				props.put(PAGEID,new Integer(value));			} catch ( Throwable t ){				t.printStackTrace();			}			}	}	    //-------------------------------------------------------------------------    /**     * Save extra properties in storage     *     */    void saveProperties() throws JahiaException{				deleteProperties();					String value = null;				value = Integer.toString(getPageID());		if ( value != null )			hpp.getInstance().addProperty(this,PAGEID,value);    }    //-------------------------------------------------------------------------    /**     * Delete extra properties in storage     *     */    void deleteProperties() throws JahiaException{				hpp.getInstance().deleteProperties(this);	    }    //--------------------------------------------------------------------------    /**     * Return a string representation of the home page and it's internal state.     *     * @return A string representation of this home page.     */    public String toString (){    	    	StringBuffer buff= new StringBuffer("String rep. of a ");    	buff.append(CLASS_NAME);    	buff.append(" bean		:\n");    	buff.append("		 id	:");    	buff.append(getID());    	// TODO . complete    	return buff.toString();    	    }    //--------------------------------------------------------------------------    /**     * Return a clone.     *     * @return Object the clone.     */    public Object clone (){    	    	Hashtable hash = null;    	if ( getProperties() != null ){    		hash = new Hashtable();    		if ( props.get(PAGEID) != null )    			hash.put(PAGEID,new Integer(getPageID()));    	}    	    	JahiaHomepageLink clone =     			new JahiaHomepageLink(	new Integer(getID()),	    									getName(),    									getDescr(),    									new Integer(getType()),    									getSiteKey(),    									hash,    									new Integer(getAclID()) ); 		return clone;   									    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -