|
Integration
Configuration and setting for integrating Pojonode
Integrating PojonodeIntegrating Pojonode is straight forward once you defined your Java classes for your content model. The next step basically tells the framework the location of your POJO-based model and other settings like namespace mappings that are required by the framework to properly manage the operations on the content model. Note: Remember to copy the Pojonode jar (see featured downloads for latest version) in your Alfresco environment: <ALFRESCO_WAR_OR_WEBAPP>/WEB-INF/lib. In order to setup this configuration, you need to define a bean pojonode.modelConfig in one of your extension's Spring context configuration file: <bean id="pojonode.modelMappings" class="org.pojonode.model.ModelMappings">
<property name="namespaceMappings">
<props>
<prop key="pnd">http://www.pojonodedemo.org/1.0</prop>
</props>
</property>
<property name="models">
<set>
<bean class="org.pojonode.model.metamodel.PojonodeModel">
<property name="basePackage" value="org.pojonode.demo.model"/>
<property name="name" value="pnd:demoModel"/>
<property name="description" value="Pojonode Demo Content Model"/>
<property name="author" value="John Doe"/>
<property name="version" value="1.0"/>
</bean>
</set>
</property>
</bean>The namespaceMappings property of the pojonode.modelMappings bean will enable additional namespace resolving that Pojonode will require in order to handle the model mapping. The models property will list one or multiple instances of org.pojonode.model.metamodel.PojonodeModel which define a Pojonode model's properties. The basePackage property will specify the root package of your POJOs: where the framework should look for classes annotated with @Type or @Aspect Generating model configuration filesPojonode can currently generate the following configuration files for you, automatically, when Alfresco starts up:
Generating the Content Model XML DefinitionAlfresco relies on an XML definition in place for your custom content model. Although you can manage this yourself, Pojonode can generate this for you at startup. To configure the generation of the XML model, you would need to use an installer configured as a Spring bean. <bean parent="pojonode.alfModelXmlInstaller">
<property name="overwrite" value="true"/>
<property name="activate" value="true"/>
<property name="modelsToInstall">
<set>
<value>pnd:demoModel</value>
</set>
</property>
</bean>The overwrite property will allow you to overwrite an existing model file. activate is by default set to false and enabling it will trigger the automatic activation of the Alfresco model. Pojonode uses the Data Dictionary/Models Alfresco space to store the custom model it generates and activates it automatically. Based on your settings, Pojonode will create a node pojonode-MODELNAME.xml in this space (in the example above, it would be pojonode-sampleModel.xml as specified by the PojonodeModel}}'s {{{name property) Generating custom Web Client ConfigurationThis configuration indicates what properties and associations should be displayed in the Alfresco (JSF) Web Client. It relies heavily on the visible value of the @Property, @OneToOne, @OneToMany and @ManyToMany annotations. <bean parent="pojonode.alfWebClientConfigInstaller">
<property name="overwrite" value="true"/>
<property name="modelsToInstall">
<set>
<value>pnd:demoModel</value>
</set>
</property>
</bean>The custom configuration file is stored in Data Dictionary/Web Client Extension in a file web-client-config-custom.xml. You can read more on the topic in the Alfresco documentation here. |
Should be org.pojonode.service.model.PojonodeModelService?"
Ware! See the demo code for the latest correct XML if using the source build.