📄 jahiacontainerlist.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .////// JahiaContainerList// EV 27.12.2000//// getID// getParentEntryID// getpageID// getctndefid// getAclID// setID// setAclID// checkReadAccess// checkWriteAccess// getDefinition// getContainers// getContainer//// addContainer//package org.jahia.data.containers;import java.util.*; // Vector, Enumerationimport org.jahia.utils.*; // JahiaConsoleimport org.jahia.registries.*; // Registriesimport org.jahia.exceptions.JahiaException;import org.jahia.services.usermanager.JahiaUser;import org.jahia.services.acl.JahiaBaseACL;import org.jahia.services.acl.ACLResourceInterface;import org.jahia.services.acl.ACLNotFoundException;/** * <p>Title: A JahiaContainerList is a list of JahiaContainer objects</p> * <p>Description: The JahiaContainerList object managed a list of * JahiaContainer object, that themselves contain JahiaField objects.</p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: Jahia Ltd</p> * @author Eric Vassalli * @version 1.0 */public class JahiaContainerList{ private int ID; private int parentEntryID; private int pageID; private int ctndefid; private int aclID; private int fullDataSize = 0; private boolean isContainersLoaded = false; // by default the container list is loaded without its containers. private Properties ctnListProperties = new Properties(); private JahiaContainerListPagination ctnListPagination; /** * @associates JahiaContainer */ private Vector containers = new Vector(); //------------------------------------------------------------------------- public JahiaContainerList( int ID, int parentEntryID, int pageID, int ctndefid, int aclID ) { this.ID = ID; this.parentEntryID = parentEntryID; this.pageID = pageID; this.ctndefid = ctndefid; this.aclID = aclID; } // end constructor //------------------------------------------------------------------------- public int getID() { return ID; } public int getParentEntryID() { return parentEntryID; } public int getPageID() { return pageID; } public int getctndefid() { return ctndefid; } public final int getAclID() { return aclID; } /** * Return true if this container list is loaded with its containers * * @author NK */ public boolean isContainersLoaded() { return isContainersLoaded; } public JahiaContainerListPagination getCtnListPagination() { return ctnListPagination; } public final JahiaBaseACL getACL() { JahiaBaseACL acl = null; try { acl = new JahiaBaseACL(getAclID()); } catch ( Throwable t ) { t.printStackTrace(); } return acl; } public void setID( int ID ) { this.ID = ID; } public void setAclID( int aclID ) { this.aclID = aclID; } public void setParentEntryID(int parentEntryID) { this.parentEntryID = parentEntryID; } public void setCtnListPagination( int windowSize, int windowOffset ) { this.ctnListPagination = new JahiaContainerListPagination(this.getFullSize(),windowSize,windowOffset); } public void setCtnListPagination( JahiaContainerListPagination cListPagination ) { this.ctnListPagination = cListPagination; } /** * By default the container list is loaded without its containers. * Set this state to true to indeicate you loaded its containers. * * @author NK */ public void setIsContainersLoaded( boolean value ) { this.isContainersLoaded = value; } // end accessor methods //------------------------------------------------------------------------- /** */ public JahiaContainer getContainer( int index ) throws JahiaException { if (index < containers.size()) { return (JahiaContainer) containers.elementAt(index); } else { String errorMsg = "Error in JahiaContainerList : trying to get entry " + index + " for container " + getDefinition().getName(); JahiaConsole.println( "JahiaContainerList", errorMsg + " -> BAILING OUT" ); throw new JahiaException( "Error in database synchronisation", errorMsg, JahiaException.DATABASE_ERROR, JahiaException.CRITICAL ); } } // end getContainer /*** * getContainers() * */ public Enumeration getContainers() { return containers.elements(); } // end getContainers /** * Returns the size of the container list (ie the number of elements in * the list). This now returns only the size that has been loaded. For * real full size of data set, see the full size call below. * @returns an integer specifying the number of elements in the container * list in memory for the current view. */ public int size() { if ( containers != null ) { return containers.size(); } return 0; } /** * Sets the full size of the container list stored in the database, not * just in memory. * @param fullDataSize an integer containing a value of the full data size. */ public void setFullSize(int fullDataSize) { if (fullDataSize >= 0) { this.fullDataSize = fullDataSize; } } /** * Returns the full size of the data set in the datasource. This function * has been added because of the introduction of scrollable container lists * which load only the set for the view. * @return the number of elements of this containerList in the database */ public int getFullSize() { return this.fullDataSize; } /*** * getDefinition * */ public JahiaContainerDefinition getDefinition() throws JahiaException { JahiaContainerDefinition theDef = JahiaContainerDefinitionsRegistry.getInstance( ).getDefinition( ctndefid ); if (theDef != null) { return theDef; } else { String msg = "JahiaContainer definition " + ctndefid + " not found in definition registry !"; throw new JahiaException( "Synchronisation error in database", msg, JahiaException.DATABASE_ERROR, JahiaException.CRITICAL ); } } // end getDefinition /*** * adds a container to the containerList * @author EV 27.12.2000 * */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -