/** * Gets the module which corresponds to the given virtual file name.<p> * * @param fileName the file name * * @return the module which corresponds to the given file name */ private CmsModule getModuleForFileName(String fileName) { String moduleName = fileName; if (fileName.endsWith(SUFFIX)) { moduleName = fileName.substring(0, fileName.length() - SUFFIX.length()); } CmsModule result = OpenCms.getModuleManager().getModule(moduleName); return result; }
/** * @see org.opencms.workplace.list.A_CmsListDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { if (OpenCms.getModuleManager().getModule(getParamModule()) == null) { // just throw a dummy exception here since getModule does not produce an exception when a // module is not found throw new Exception(); } }
/** * Returns the visibility flag module parameter value.<p> * * @return the visibility flag module parameter value */ protected String getVisibilityFlag() { CmsModule module = OpenCms.getModuleManager().getModule(this.getClass().getPackage().getName()); if (module == null) { return VISIBILITY_ALL; } return module.getParameter(PARAM_VISIBILITY_FLAG, VISIBILITY_ALL); } }
/** * Collects all resource names belonging to a module in a Vector.<p> * * @param moduleName the name of the module * * @return Vector with path Strings of resources */ public static Vector getModuleResources(String moduleName) { Vector resNames = new Vector(OpenCms.getModuleManager().getModule(moduleName).getResources()); return resNames; }
/** * @see org.opencms.workplace.list.A_CmsListDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { if (OpenCms.getModuleManager().getModule(getParamModule()) == null) { // just throw a dummy exception here since getModule does not produce an exception when a // module is not found throw new Exception(); } }
/** * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { String moduleName = getParamModule(); // check module CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module == null) { throw new Exception(); } } }
/** * Returns <code>true</code> if the module has been created successful.<p> * * @return <code>true</code> if the module has been created successful */ public boolean success() { return OpenCms.getModuleManager().getModule(m_cloneInfo.getName()) != null; }
/** * Returns a parameter value from the module parameters.<p> * * @param name the name of the module * @param key the parameter to return the value for * @return the parameter value from the module parameters, or <code>null</code> if the parameter is not set */ public static String getModuleParam(String name, String key) { CmsModule module = OpenCms.getModuleManager().getModule(name); if (module != null) { return module.getParameter(key); } return null; }
/** * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { String moduleName = getParamModule(); // check module if (!isNewModule()) { CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module == null) { throw new Exception(); } } }
/** * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { String moduleName = getParamModule(); // check module CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module == null) { throw new Exception(); } // check export point Iterator it = module.getExportPoints().iterator(); while (it.hasNext()) { CmsExportPoint ep = (CmsExportPoint)it.next(); if (ep.getUri().equals(getParamExportpoint())) { // export point found return; } } throw new Exception(); } }
/** * Removes a module.<p> * * @param moduleName the name of the module to remove * @param report the report to write to * * @throws CmsException in case something goes wrong */ protected void removeModule(String moduleName, I_CmsReport report) throws CmsException { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, m_preserveLibModules.contains(moduleName), report); } }
/** * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { String moduleName = getParamModule(); // check module CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module == null) { throw new Exception(); } // check dependency Iterator it = module.getDependencies().iterator(); while (it.hasNext()) { CmsModuleDependency dep = (CmsModuleDependency)it.next(); if (dep.getName().equals(getParamDependency())) { // dependency found return; } } throw new Exception(); }
/** * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { String moduleName = getParamModule(); // check module CmsModule module = OpenCms.getModuleManager().getModule(moduleName); if (module == null) { throw new Exception(); } // check export point if (!isNewExportPoint()) { Iterator it = module.getExportPoints().iterator(); while (it.hasNext()) { CmsExportPoint ep = (CmsExportPoint)it.next(); if (ep.getUri().equals(getParamExportpoint())) { // export point found return; } } throw new Exception(); } }
/** * This method should handle every defined list multi action, * by comparing <code>{@link #getParamListAction()}</code> with the id * of the action to execute.<p> */ @Override public void executeListMultiActions() { if (getParamListAction().equals(LIST_MACTION_DELETE)) { String moduleName = getParamModule(); // execute the delete multiaction Iterator itItems = getSelectedItems().iterator(); while (itItems.hasNext()) { CmsModule module = (CmsModule)OpenCms.getModuleManager().getModule(moduleName).clone(); CmsListItem listItem = (CmsListItem)itItems.next(); String dependencyName = listItem.getId(); deleteDependency(module, dependencyName); } } // refresh the list Map objects = (Map)getSettings().getListObject(); if (objects != null) { objects.remove(CmsModulesList.class.getName()); } listSave(); }
/** * Initializes the module to work with depending on the dialog state and request parameters.<p> */ protected void initModule() { Object o; if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) { // this is the initial dialog call if (CmsStringUtil.isNotEmpty(m_paramModule)) { // edit an existing module, get it from manager o = OpenCms.getModuleManager().getModule(m_paramModule); } else { // create a new module o = null; } } else { // this is not the initial call, get module from session o = getDialogObject(); } if (!(o instanceof CmsModule)) { // create a new module m_module = new CmsModule(); } else { // reuse module stored in session m_module = (CmsModule)((CmsModule)o).clone(); } }
/** * Replaces a module with another revision.<p> * * @param moduleName the name of the module * @param importFile the name of the import file * * @throws Exception if something goes wrong */ public void replaceModule(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModule(importFile); }
/** * Replaces a module with another revision.<p> * * @param moduleName the name of the module * @param importFile the name of the import file * @throws Exception if something goes wrong */ public void replaceModuleFromDefault(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModuleFromDefault(importFile); }
/** * Replaces a module with another revision.<p> * * @param moduleName the name of the module * @param importFile the name of the import file * @throws Exception if something goes wrong */ public void replaceModuleFromDefault(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModuleFromDefault(importFile); }
/** * Replaces a module with another revision.<p> * * @param moduleName the name of the module * @param importFile the name of the import file * * @throws Exception if something goes wrong */ public void replaceModule(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModule(importFile); }
/** * Gets the module export handler containing all resources used in the module export.<p> * @return CmsModuleImportExportHandler with all module resources */ private CmsModuleImportExportHandler getExportHandler() { String moduleName = getParamModule(); // get the module CmsModule module = OpenCms.getModuleManager().getModule(moduleName); // create the handler description String handlerDescription = Messages.get().getBundle(getLocale()).key( Messages.GUI_MODULES_LIST_EXPORT_REPORT_HANDLER_NAME_1, moduleName); return CmsModuleImportExportHandler.getExportHandler(getCms(), module, handlerDescription); } }