📄 jahiadata.java
字号:
//// ____.// __/\ ______| |__/\. _______// __ .____| | \ | +----+ \// _______| /--| | | - \ _ | : - \_________// \\______: :---| : : | : | \________>// |__\---\_____________:______: :____|____:_____\// /_____|//// . . . i n j a h i a w e t r u s t . . .////// JahiaData// EV 30.10.2000// EV 23.12.2000 settings is not anymore in JahiaData, but in ParamBean//// params()// fields()// containers()// gui()////package org.jahia.data;import javax.servlet.http.*; // HttpServletRequest, HttpServletResponseimport org.jahia.utils.*; // JahiaConsoleimport org.jahia.settings.*; // SettingsBean, JahiaPrivateSettingsimport org.jahia.params.*; // ParamBeanimport org.jahia.gui.*; // GuiBeanimport org.jahia.registries.*; // ServicesRegistryimport org.jahia.data.fields.*; // JahiaFieldSetimport org.jahia.data.containers.*; // JahiaContainerSetimport org.jahia.services.pages.JahiaPage;import org.jahia.exceptions.JahiaException;import org.jahia.services.usermanager.JahiaUser;public class JahiaData { private ParamBean jParams; private JahiaPrivateSettings jSettings; private JahiaFieldSet fieldSet; private JahiaContainerSet containerSet; private GuiBean guiBean; /*** * constructor * Build a JahiaData and optionaly can force to create or not the fields set or containers set. * This is used in particular situation where fields and conternaer sets are not required, * i.e. : when some engines are called from JahiaAdministration Servlet * * @author NK * @param ParamBean jParams * @param boolean doBuildData */ public JahiaData (ParamBean jParams, boolean doBuildData) throws JahiaException { this.jParams = jParams; if ( doBuildData ){ buildData(); // throws JahiaException } else { guiBean = new GuiBean( this.params() ); } } // end constructor /*** * constructor * EV 30.10.2000 * EV 18.11.2000 added jSettings in parameters * */ public JahiaData (ParamBean jParams) throws JahiaException { this.jParams = jParams; buildData(); // throws JahiaException } // end constructor /*** * buildData * EV 30.10.2000 * */ private void buildData() throws JahiaException { try { // Get the current page and user JahiaPage currentPage = params().getPage(); JahiaUser currentUser = params().getUser(); if (currentPage != null) { if (currentUser != null) { // test if the user has read access to the current page. if (currentPage.checkReadAccess (currentUser)) { fieldSet = ServicesRegistry.getInstance().getJahiaFieldService( ).buildFieldStructureForPage( this ); containerSet = ServicesRegistry.getInstance().getJahiaContainersService( ).buildContainerStructureForPage( this ); guiBean = new GuiBean( this.params() ); } } else { throw new JahiaException ("No user present !", "No current user defined in the params in buildData() method.", JahiaException.USER_ERROR, JahiaException.ERROR); } } else { String errorMsg = "Page does not exist : " + jParams.getPageID(); JahiaConsole.println ( "OperationManager", errorMsg + " -> BAILING OUT" ); throw new JahiaException ("404 Page not found", errorMsg, JahiaException.PAGE_ERROR, JahiaException.ERROR ); } } catch (JahiaException je) { if (je.getSeverity() > JahiaException.WARNING) { JahiaConsole.println( "JahiaData", "Error in buildData -> BAILING OUT" ); throw je; } else { JahiaConsole.println( "JahiaData", "Warning in buildData. Continuing..." ); } } } // end buildData; /*** * accessor methods * EV 30.10.2000 * */ public ParamBean params() { return jParams; } public JahiaPage page() { return jParams.getPage(); } // for upward compatibility public JahiaFieldSet fields() { return fieldSet; } public JahiaContainerSet containers() { return containerSet; } public GuiBean gui() { return guiBean; } // end accessor methods} // end JahiaData
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -