Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations The dynamic model feature enables dynamic customization of models without requiring a restart of the Alfresco server, and is also applicable to a multi- tenant environment. This also includes dynamic reloading of the web client UI customizations. Customizations of workows can be done easily. By the end of this chapter you will have learned: • The advantages of workow • How to enable dynamic customization of workow without requiring a restart of the Alfresco server • The process of customizing an existing workow • How to remove workow for a specic staging submission • How to congure a ZERO workow • How to implement workow viewer to see the pending list of workows Dynamic deployment You are able to dynamically deploy workow in Alfresco WCM by using workow types, workow denitions, web client congurations, and property les. Since version 3.0, Alfresco supports dynamic deploy of models, workows, messages, and web-client conguration changes to facilitate dynamic customization without requiring a restart of the Alfresco server. Let's discuss how to dynamically deploy models, workows, messages, and web-client changes. Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 204 ] The following are the advantages of dynamic deployment: • There is no need to restart the Alfresco server every time you make changes to the les. • Both the content as well as the les are stored in the repository. It is easier to maintain and move content along with the les. • You can activate and inactivate the dynamic models by keeping the model XML le in the repository. • You can deploy and undeploy the workow denitions as and when required. • In a multi-tenant setup, the les that are dened in the <extension> folder are available to all tenants. If you would like to customize workow for a specic tenant only, then a dynamic deployment is the best choice. Dynamic models Dynamic models are nothing but XML-based model les. Creating a dynamic custom model is the same as creating a regular custom model. For this example, create a custom content type that has two properties. Create a le named dynamicWCMWorkflowModel on your personal computer with the downloaded content. Download the complete code sample from Packt's website. Deploying a model le The Task Model can also be dynamically deployed without restarting the server. This can be achieved by two ways: • Uploading or creating the model le in the new 'Models' space (Company Home | Data Dictionary | Models). • Using pre-registered URLs provided by the Alfresco Repository Admin Console. Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 205 ] First approach Dynamic workow models are stored in the new 'Models' space (Company Home | Data Dictionary | Models). Upload a custom XML model le, dynamicWCMWorkflowModel, to the 'Models' space. By default, the model will not be active unless the Model Active checkbox is selected during the upload. To activate a previously inactive model, select View Details and then select the Modify properties icon. In the Modify Content Properties page, select the Model Active checkbox. To deactivate a model, select View Details and then select the Modify properties icon. In the Modify Content Properties page, unselect the Model Active checkbox. Follow these steps to deploy a model dynamically: 1. Go to Company Home | Data Dictionary | Models. 2. In the header click on Add Content. 3. The Add Content Wizard is displayed. Upload the custom XML le. 4. In the Name textbox type dynamicWCMWorkowModel. 5. Click on OK. 6. The Modify Content Properties dialog is displayed. Check the Model Active property, as shown in the following screenshot: 7. Click on OK. Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 206 ] To verify the changes, log out and log in if required. Updating a custom model You can directly edit or update the XML model le. If the model is active, then it will be reloaded. If the le is checked out, then the working copy will be ignored until such a time as the le is checked in. Second approach Deployment of model les can be achieved as an administrator using the URL http://<server-name>:<port>/alfresco/faces/jsp/admin/ repoadmin-console.jsp You can use the following commands to activate or deploy the model. activate model dynamicWCMWorkflowModel.xml: This command is used to set the repository model to active and load into runtime data dictionary. deploy model alfresco/extension/dynamicWCMWorkflowModel.xml: This command uploads the model to the repository and loads it into runtime data dictionary. This will also set the repository model as active. Dynamic Resource Bundles Creating a Dynamic Resource Bundle is the same as creating a regular property le. For this example, create labels for two properties that are dened in the model le. Create a le named dynamicWCMWorkflowMessages on your personal computer with the following content: dynamic_processTask.workflow.title=Dynamic Workflow dynamic_processTask.workflow.description=Dynamic Workflow for approval Deploying a Resource Bundle The Resource Bundle can also be dynamically deployed without restarting the server. This can be achieved by two ways: • Uploading or creating the message le in the new Messages space (Company Home | Data Dictionary | Messages). • Using the Repository Admin Console provided by Alfresco. Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 207 ] First approach The associated message Resource Bundles are stored in the new Messages space (Company Home | Data Dictionary | Messages). Upload the custom Resource Bundle by uploading each of the message property les (for all locales) to the Messages space. The messages will not be applied until they are explicitly reloaded or when the server is restarted. Follow these steps to create a message: 1. Go to Company Home | Data Dictionary | Messages. 2. In the header, click on Add Content. 3. The Add Content Wizard is displayed. Upload the custom property le. 4. In the Name textbox type dynamicWCMWorkowMessages.properties. 5. Click on OK. The custom conguration will not be applied until it is explicitly reloaded (refer to the following section) or the server is restarted. Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 208 ] Reloading the Resource Bundle If the Resource Bundle le has been added, edited, or updated, it can be dynamically reloaded by using the Alfresco Repository Admin Console via: http://<server-name>:<port>/alfresco/faces/jsp/admin/ repoadmin-console.jsp This has a single command, reload, which will cause the Resource Bundle to be reloaded. reload messages dynamicWCMWorkflowMessages Updating a Resource Bundle You can directly edit or update the Resource Bundle le. Use the reload command to reect the changes. If the le is checked out, then the working copy will be ignored until such a time as the le is checked in. Second approach They can be dynamically reloaded by using the Alfresco Repository Admin Console via: http://<server-name>:<port>/alfresco/faces/jsp/admin/ repoadmin-console.jsp . The command deploy messages <resource bundle base name> will cause the message resource to be re-registered. deploy messages alfresco/extension/dynamicWCMWorkflowMessages Dynamic workows Dynamic workows are nothing but XML-based Process Denition les. Creating a dynamic Process Denition is the same as creating a regular Process Denition le. For this example, create a custom Process Denition. Create a le named dynamicProcessDefinition on your personal computer with the downloaded content. Download the code samples from Packt publisher's book website. Deploying a Process Denition le The Process Denition can also be dynamically deployed without restarting the server. Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 209 ] This can be achieved by three ways: • Uploading or creating the Process Denition le in the new Workow Denitions space (Company Home | Data Dictionary | Workow Denitions). • Using JBoss jBPM Process Designer tool. • Using pre-registered URLs provided by Alfresco workow console. First approach The Process Denitions are stored in the new Workow Denitions space (Company Home | Data Dictionary | Workow Denitions). Upload a custom XML Process Denition le to the Workow Denitions space. By default, the Process Denition will not be deployed unless the Workow Deployed checkbox is selected during the upload. Follow these steps to create a Process Denition: 1. Go to Company Home | Data Dictionary | Workow Denitions. 2. In the header click on Add Content. 3. The Add Content Wizard is displayed. Upload the custom XML le. 4. In the Name textbox type dynamicProcessdenition.xml. Click on OK. 5. Select the Workow Deployed checkbox. By default, the Process Denition will not be deployed unless the Workow Deployed checkbox is selected during the upload. 6. In the Workow Engine Id type jbpm. The completed denition is shown in the following screenshot: Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 210 ] 7. Click on OK. To verify the changes, log out and log in. To undeploy a Process Denition, select View Details and then select the Modify properties icon. In the Modify Content Properties page, unselect the Workow Deployed checkbox. Second approach JBoss jBPM also includes a graphical designer tool for authoring business processes. The most important feature of the graphical designer tool is that it includes support for both the tasks—that of the business analyst as well as the technical developer. This enables a smooth transition from business process modeling to the practical implementation. Follow these steps for conguring the jBPM: 1. To implement this you have to download jBPM plugins from: http://sourceforge.net/projects/jbpm/files/jBPM%20Process%20 Designer/jbpm-jpdl-designer-3.1.7 2. Once the installation is over, restart Eclipse. 3. Go to File | New | Project. Expand jBoss JBPM and select Process Project as shown in the following screenshot: Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 211 ] 4. Enter the Project Name and click on Next. 5. Select the jBPM location as mentioned in the following screenshot and click on Finish: 6. Copy the Process Denition code and paste it in the src/main/jpd package. 7. The process should look like the next screenshot: 8. Deploy it as mentioned ahead. Download from Wow! eBook <www.wowebook.com> . types, workow denitions, web client congurations, and property les. Since version 3.0, Alfresco supports dynamic deploy of models, workows, messages, and web- client conguration changes. Let's discuss how to dynamically deploy models, workows, messages, and web- client changes. Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 204 ] The following. http://<server-name>:<port>/alfresco/faces/jsp/admin/ repoadmin-console.jsp . The command deploy messages <resource bundle base name> will cause the message resource to be re-registered. deploy