If you would like to change the default behaviors or customize the default implementation components for some reasons, then this page might help you.
org.onehippo.forge.channelmanager.pagesupport.channel.event.DocumentCopyingPageCopyEventListener
component copies linked documents in a page and its components from the source channel to the target channel
on the event of page copying in the channel manager.
By default, the DocumentCopyingPageCopyEventListener
component is provided by
the built-in HST Addon Module.
The original component bean configuration is defined in "/src/main/resources/META-INF/hst-assembly/addon/org/onehippo/forge/channel-pagesup/cross-channel-page-copy-support.xml" in the source.
If you want to extend or customize the bean,
you can add a classpath resource (classpath:META-INF/hst-assembly/addon/org/onehippo/forge/channel-pagesup/cross-channel-page-copy-support.xml)
in your SITE application to shadow the file with a custom bean definition.
e.g, site/src/main/resources/META-INF/hst-assembly/addon/org/onehippo/forge/channel-pagesup/cross-channel-page-copy-support.xml
Since version 1.2.0, you can override DocumentCopyingPageCopyEventListener.onBeforePageCopyEvent(PageCopyEvent)
and DocumentCopyingPageCopyEventListener.onAfterPageCopyEvent(PageCopyEvent)
method to do something more just before and after the basic document content copying process.
For example, find all the document path HST component parameters in the HST page/component configurations and resolve the corresponding document path in case the relative document path changes to update the parameter value in the target page/component parameter value. See the following example:
package org.example; public class MyDocumentCopyingPageCopyEventListener extends DocumentCopyingPageCopyEventListener { @Override protected void onAfterPageCopyEvent(PageCopyEvent pageCopyEvent) { final HstRequestContext requestContext = pageCopyContext.getRequestContext(); final PageCopyContext pageCopyContext = pageCopyEvent.getPageCopyContext(); final String sourceContentBasePath = pageCopyContext.getEditingMount().getContentPath().intern(); final String targetContentBasePath = pageCopyContext.getTargetMount().getContentPath().intern(); final Node newPageNode = pageCopyContext.getNewPageNode(); // TODO: Maybe you can traverse newPageNode to find child component configuration nodes and investigate component parameter values // to adjust somethings for your needs here... } }
In case you want to override the default org.onehippo.forge.channelmanager.pagesupport.channel.event.DocumentCopyingPageCopyEventListener
component, you can add an XML file in site/src/main/resources/META-INF/hst-assembly/addon/overrides/org/onehippo/forge/channel-pagesup/
resource path.
e.g, site/src/main/resources/META-INF/hst-assembly/addon/overrides/org/onehippo/forge/channel-pagesup/custom-page-copy-listener.xml
.
And, override the bean definition like the following example:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd"> <bean id="defaultDocumentCopyingPageCopyEventListener" class="org.example.MyDocumentCopyingPageCopyEventListener" init-method="init" destroy-method="destroy"> <!-- flag whether or not to copy all the documents linked by the page and its components --> <property name="copyDocumentsLinkedBySourcePage" value="true" /> </bean> </beans>
org.onehippo.forge.channelmanager.pagesupport.document.management.DocumentManagementService
component is provided to manage document/folder workflows more easily.
The default implementation of DocumentManagementService
is
org.onehippo.forge.channelmanager.pagesupport.document.management.impl.DocumentWorkflowDocumentManagementService
,
and the component is registered by the DaemonModule
implementation,
org.onehippo.forge.channelmanager.pagesupport.document.management.impl.DocumentManagementServiceDaemonModule
,
with the following JCR configuration under /hippo:configuration/hippo:modules/
:
/channel-pagesup-document-management-service-module: jcr:primaryType: hipposys:module hipposys:className: org.onehippo.forge.channelmanager.pagesupport.document.management.impl.DocumentManagementServiceDaemonModule /hippo:moduleconfig: jcr:primaryType: nt:unstructured
If you have to extend or customize the default DocumentManagementService
component for some reasons,
then you may extend or replace the class, org.onehippo.forge.channelmanager.pagesupport.document.management.impl.DocumentWorkflowDocumentManagementService
,
with a custom one (which must implement org.onehippo.forge.channelmanager.pagesupport.document.management.DocumentManagementService
)
and set the FQCN of your custom implementation class to a string property, named "document.management.service",
in hippo:moduleconfig
node.
For example, if your custom implementation is org.example.MyDocumentManagementService
, then
you can change the configuration like this:
/channel-pagesup-document-management-service-module: jcr:primaryType: hipposys:module hipposys:className: org.onehippo.forge.channelmanager.pagesupport.document.management.impl.DocumentManagementServiceDaemonModule /hippo:moduleconfig: jcr:primaryType: nt:unstructured document.management.service: org.example.MyDocumentManagementService