How to create new publication in WCM
Since WCM 1.2.2
1 Create new Java project
- Create new Java project with the structured like this:
- Note: src/main/java and src/main/resources are source folders
2 Configuration
- In configuration.xml, there is two required mandatory configurations:
For the publication plugin
<external-component-plugins>
<target-component>org.exoplatform.services.wcm.publication.WCMPublicationService</target-component>
<component-plugin>
<name>Date time publication</name>
<set-method>addPublicationPlugin</set-method>
<type>org.exoplatform.services.wcm.publication.lifecycle.datetime.DateTimePublicationPlugin</type>
<description>This publication lifecycle publish a web content or DMS document to a portal page with more states, version and date time.</description>
<init-params>
<values-param>
<name>repository</name>
<value>repository</value>
</values-param>
<values-param>
<name>workspace</name>
<value>collaboration</value>
</values-param>
</init-params>
</component-plugin>
</external-component-plugins>
- Note:
- target-component: always is org.exoplatform.services.wcm.publication.WCMPublicationService.
- name: your publication's name.
- description: your publication's description.
- set-method: always is addPublicationPlugin.
- type: your publication's class.
- init-params: not required, you can use it for your publication plugin or not.
And for the publication nodetype
<external-component-plugins>
<target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
<component-plugin>
<name>add.nodeType</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
<priority>99</priority>
<init-params>
<values-param>
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/wcm-datetime-publication-nodetypes.xml</value>
</values-param>
</init-params>
</component-plugin>
</external-component-plugins>
- Note: Just change the name of the xml file to match with your nodetype's configuration file.
3 Extends or implement the publication plugin
- If you want to re-use the existing publication in WCM, you can extend one of these plugins:
- org.exoplatform.services.wcm.publication.lifecycle.stageversion.StageAndVersionPublicationPlugin
- org.exoplatform.services.wcm.publication.lifecycle.simple.SimplePublicationPlugin
- If you want to create a new publication, you have to extend org.exoplatform.services.wcm.publicationWebpagePublicationPlugin, and you have to overwrite all abstract methods. Important method:
- getLifecycleType(): return the nodetype of the publication
4 Create new User interface (UI) for new publication
- All UI classes of the new publication are put in src/main/java, and all groovy templates are put in src/main/resources. If you want to use the template, use "classpath:path/in/src/main/resource/to/the/templates" (without quote) in ComponentConfig.