[opencms-dev] excluding modules from export or what would be the best strategy?

CMS_QUEST cms_questioner at gmx.de
Mon May 4 22:51:48 CEST 2015


Am 04.05.2015 um 10:22 schrieb Christoph Kukulies:
> In the Intranet-site I have some modules that are different from the 
> outside (Internet)  site ,
> mainly in the way that the Email sender/recipient of the contact form 
> are different.
>
> To prevent the danger of overwriting the outside site inadvertently I 
> would like to exclude
> these modules from being exported.
>
> Or would there be a way of "wiring" these adresses in opencms-system.xml
> and use them as properties symbolically in the JSP-code? I would opt 
> for that if it's possible.
> Can I put extra properties in opencms-system.xml? Or what would be the 
> best strategy?
>
1) You could update the module with the new Parameters.
2) Export the module
3) Setting back the old parameters and update the module again.

An ugly workaround but I think it would work.

CmsModule module = OpenCms.getModuleManager().getModule(moduleName);
|java.util.SortedMap<java.lang.String,java.lang.String>| old_parameters 
|*= module.getParameters 
<http://documentation.opencms.org/javadoc/core/org/opencms/module/CmsModule.html#getParameters%28%29>*()|

//update the module with the new parameters
module.|*setParameters 
<http://documentation.opencms.org/javadoc/core/org/opencms/module/CmsModule.html#setParameters%28java.util.SortedMap%29>*(newParameters)
OpenCms.getModuleManager().updateModule(m_cms, module);||
//export module
CmsModuleImportExportHandler moduleExportHandler = new 
CmsModuleImportExportHandler();
moduleExportHandler.setFileName(filename);
moduleExportHandler.setAdditionalResources(resources);
moduleExportHandler.setModuleName(module.getName());
moduleExportHandler.setDescription("description");

OpenCms.getImportExportManager().exportData(
                 m_cms,
                 moduleExportHandler,
                 new CmsShellReport(m_cms.getRequestContext().getLocale()));

//set back the parameters and update the module
module.|*setParameters 
<http://documentation.opencms.org/javadoc/core/org/opencms/module/CmsModule.html#setParameters%28java.util.SortedMap%29>*(oldParameters)||
|||OpenCms.getModuleManager().updateModule(m_cms, module);||
|||
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20150504/3dfcabdd/attachment.htm>


More information about the opencms-dev mailing list