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

📄 jahiacontainerstructure.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////                 . . . i n   j a h i a   w e   t r u s t . . .//////  JahiaContainerStructure////  getctndefid//  getObjectType//  getObjectDefID//  getObjectDef//  getRank//  setctndefid////  equals//package org.jahia.data.containers;import org.jahia.data.*;            // JahiaDataimport org.jahia.data.fields.*;     // JahiaFieldimport org.jahia.utils.*;           // JahiaConsoleimport org.jahia.registries.*;      // JahiaContainerDefinitionsRegistryimport org.jahia.exceptions.JahiaException;import org.jahia.services.pages.JahiaPage;import org.jahia.services.pages.JahiaPageDefinition;public class JahiaContainerStructure {    public static final int JAHIA_FIELD     =   1;    public static final int JAHIA_CONTAINER =   2;    public static final int ALL_TYPES       =   -1;    private int     subctndefid;    private int     objectType;    private Object  objectDef;    private int     objectDefID;    private int     rank;    /***        * constructor        *        */    public JahiaContainerStructure( int     subctndefid,                                    int     objectType,                                    int     objectDefID,                                    int     rank )    throws JahiaException    {        this.subctndefid = subctndefid;        this.objectType     = objectType;        this.objectDefID    = objectDefID;        this.rank           = rank;        switch (objectType) {            case (JAHIA_FIELD)      :                this.objectDef = JahiaFieldDefinitionsRegistry.getInstance().                        getDefinition(objectDefID);                break;            case (JAHIA_CONTAINER)  :                this.objectDef = JahiaContainerDefinitionsRegistry.getInstance().                    getDefinition(objectDefID);                break;        }    } // end constructor    /***        * constructor - by objectName and ctndefid        *        */    public JahiaContainerStructure( String      objectName,                                    int         subctndefid,                                    int         rank,                                    int         pageDefID )    throws JahiaException    {        this.subctndefid = subctndefid;        this.rank           = rank;				JahiaPageDefinition pageDef = ServicesRegistry.getInstance().getJahiaPageTemplateService().lookupPageTemplate(pageDefID);				if ( pageDef != null ){				        // determines structure object type (field or container ?) and definition id	        JahiaFieldDefinition fDef = JahiaFieldDefinitionsRegistry.getInstance(	                                        ).getDefinition(pageDef.getJahiaID(),objectName);	        if ((fDef != null) && (!fDef.getTitle(pageDefID).equals(""))) {	            this.objectType     = this.JAHIA_FIELD;	            this.objectDefID    = fDef.getID();	            this.objectDef      = fDef;	        } else {	        		            JahiaContainerDefinition cDef = JahiaContainerDefinitionsRegistry.getInstance(	                                        ).getDefinition(pageDef.getJahiaID(), objectName);	            if (cDef != null) {	                this.objectType     = this.JAHIA_CONTAINER;	                this.objectDefID    = cDef.getID();	                this.objectDef      = cDef;	            } else {	                String errorMsg = objectName + " is neither a field or a container -> not declared !";	                JahiaConsole.println( "JahiaContainerStructure", errorMsg + " -> BAILING OUT" );	                throw new JahiaException( "Cannot synchronize fields with database",	                                    errorMsg, JahiaException.DATABASE_ERROR, JahiaException.CRITICAL );	            }	        }		} else {            String errorMsg = " cannot found objectName's " + " page definition !";            JahiaConsole.println( "JahiaContainerStructure", errorMsg + " -> BAILING OUT" );            throw new JahiaException( "Cannot synchronize fields with database",                                errorMsg, JahiaException.DATABASE_ERROR, JahiaException.CRITICAL );		}    } // end constructor    /***        * accessor methods        *        */    public  int     getSubctndefid() {   return subctndefid;  }    public  int     getObjectType()     {   return objectType;      }    public  int     getObjectDefID()    {   return objectDefID;     }    public  Object  getObjectDef()      {   return objectDef;       }    public  int     getRank()           {   return rank;            }    public void setSubctndefid( int defID )  { this.subctndefid = defID; }    // end accessor methods    /***        * equals        *        */    public boolean equals( JahiaContainerStructure theStruct )    {        if ((theStruct.getSubctndefid()  == this.getSubctndefid()) &&            (theStruct.getObjectType()      == this.getObjectType()) &&            (theStruct.getObjectDefID()     == this.getObjectDefID()) &&            (theStruct.getRank()            == this.getRank())) {            return true;        } else {            return false;        }    } // end equals} // end JahiaContainerStructure

⌨️ 快捷键说明

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