Dynamic Deployment and Customizations [ 212 ] Following are the steps to be followed to deploy a workow via JBoss jBPM Process Designer. This will deploy workow without restart of the server. 1. Ensure the Alfresco server is up and running. 2. Click on the source tab and copy the content of the le dynamicProcessdenition. 3. Click on the Deployment tab and enter the following information: ° Server Name = machine name where Alfresco is installed ° Server Port = port number assigned to Alfresco (default: 8080) ° Server Deployer = /alfresco/jbpm/deployprocess 4. Click on Test Connection 5. If all is OK, click on Deploy Process Archive The following screenshot shows the details provided earlier: Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 213 ] Display of workow images If Hot Deployment is done, then we can see the workow images that show the current status of workow in Alfresco Explorer under the workow outline section. The screenshots can be seen in the following sections when you test the workows that are deployed through jPDL. Modify these les: • /jsp/workflow/start-workflow-wizard/workflow-options.jsp • /jsp/workflow/manage-task-dialog.jsp Change the rendered and expanded value to true as highlighted. The modied code is as follows: <a:panel rendered="true" id="workflow-outline" label="#{msg.workflow_outline}" progressive="true" expanded="true" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle"> Third approach The workow console can be used (as an alternative to the Alfresco Explorer) to deploy and undeploy Process Denitions. Its primary use is to test newly-developed workow denitions. However, it also supports the debugging/diagnosis of current "in-ight" workows. This can be deployed via http://<server-name>:<port>/ alfresco/faces/jsp/admin/workflow-console.jsp . The command deploy <workflow-name> will cause the workow to be deployed. deploy alfresco/extension/dynamicProcessdefinition.xml Dynamic Alfresco Explorer A dynamic web client conguration le will have the same name as a custom web client conguration le. For example, create a web-client-config-custom.xml le, with the following content, to support the dynamic content type that you created earlier: <config evaluator="node-type" condition="dynamic:initializeTask" replace="true"> <property-sheet> <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" /> <show-property name="dynamic:property" /> Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 214 ] <show-association name="bpm:assignee" display-label-id="wf_reviewers" /> </property-sheet> </config> <config evaluator="node-type" condition="dynamic:reviewTask" replace="true"> <property-sheet> <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" /> <show-property name="bpm:taskId" /> <show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/> <show-property name="bpm:comment" component-generator="TextAreaGenerator" /> <separator name="sep2" display-label-id="wf_reviewers" component-generator="HeaderSeparatorGenerator" /> <show-association name="bpm:assignee" display-label-id="wf_reviewers" read-only="true"/> </property-sheet> </config> Deploying Alfresco Explorer customizations The web client congurations can also be dynamically deployed without restarting the server. This can be achieved by two ways: • Upload or create the Process Denition le in the new Workow Denitions space (Company Home | Data Dictionary | Workow Denitions). • Using the pre-registered URLs provided. Dynamic Alfresco Explorer customizations are stored in the new Web Client Extension space (Company Home | Data Dictionary | Web Client Extension). Upload a custom web-client-config-custom.xml le to the Web Client Extension space. Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 215 ] The custom conguration will not be applied until it is explicitly reloaded or when the server is restarted. Reloading web client customizations If the web-client-config-custom.xml le has been added, edited, or updated, it can be dynamically reloaded by using the Alfresco Explorer conguration console via: http://<server-name>:<port>/alfresco/faces/jsp/admin/ webclientconfig-console.jsp . This has a single command reload, which will cause the Alfresco Explorer conguration to be reloaded. Using the dynamic approach you can deploy workow in DM. In order to deploy it in WCM you have to make the change manually in web- client-config-wcm.xml, as discussed earlier (see the Deploying into WCM Project section) in Chapter 5, WCM Workows and then restart the server once. The dynamic approach can also be used if some changes are required after deployments so, no need to restart the server. Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 216 ] Testing the workow To assign workow for a specic project, refer to the Associating workows to web project section in Chapter 5. While submitting, the content task appears in user's dashlet. On clicking on the task, you nd the screen shown in the following screenshot. The highlighted section, Workow Outline, displays the diagram of the deployed Process Denition. This is visible since we have made hot deployment of the workow. Now you can approve or reject the workow: Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 217 ] Customization of existing workow to use e-mail notications Alfresco provides an inbuilt Web Site Submission workow to be associated with the web project. If you want to make change in the existing workow, following are the location of the les to make the changes. 1. The Process Denition le is present in the specied location: <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/ alfresco/workflow/submit_processdefinition.xml. 2. The Task Model le is also present at same location: <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/ alfresco/workflow/wcmWorkflowModel.xml. 3. The Resource Bundle is also present at same location: <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/ alfresco/workflow/wcm-workflow-messages.properties. 4. The Spring Context le, which is used to load model, Process Denition, and Resource Bundle is present at the location: <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/ alfresco/bootstrap-context.xml. 5. The Alfresco Explorer Dialog is located at: <install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/ alfresco/web-client-config-properties.xml. Consider a case where you want to add an e-mail notication at the submission of content. It is easy to customize the workow by adding the following code snippet that is highlighted: <task name="wcmwf:submittedTask" swimlane="initiator"> <timer duedate="5 seconds" transition="onsubmit"> <action class= "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> logger.log("WCM Submit Process: Triggering submit for " + bpm_workflowDescription); </script> </action> </timer> <event type="task-end"> <script> <variable name="submitfailed" access="write"/> Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 218 ] <expression>submitfailed = false;</expression> </script> <action class= "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> logger.log("WCM Submit Process: Start submit for " + bpm_workflowDescription + " (by " + person.properties.userName + ")"); </script> </action> <action class= "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> var mail = actions.create("mail"); mail.parameters.to = initiator.properties.email; mail.parameters.subject = "Submit Task " + bpm_workflowDescription; mail.parameters.from = person.properties.email; mail.parameters.text = "It's done"; mail.execute(bpm_package); </script> </action> <action class= "org.alfresco.repo.avm.wf.AVMSubmitPackageHandler"/> <action class="org.alfresco.repo.avm.wf.AVMDeployHandler"/> <action class= "org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> logger.log("WCM Submit Process: End submit for " + bpm_workflowDescription + " (by " + person.properties.userName + ")"); </script> </action> </event> </task> Deploy the Process Denition using a dynamic approach and test the workow. Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 219 ] If you want to deploy changes manually, you have to make changes in the bootstrap-context.xml le as mentioned previously in the fourth point. <props> <! WCM workflow definition > <prop key="engineId">jbpm</prop> <prop key="location"> alfresco/workflow/submit_processdefinition.xml</prop> <prop key="mimetype">text/xml</prop> <prop key="redeploy">true</prop> </props> You should receive an e-mail notication at the submission of content to the Staging box. Remove workow for specic staging submission We have already congured workows for blogs and training web content. There can be various reasons why you don't want to follow a complete process of workow and have to submit the content directly. If we think of the out-of-the-box feature, then we have to remove the workow for those web forms so that web content can be submitted directly. This is not a good practice sometimes when you are conguring a workow or sometimes when you are removing a workow for a particular web content. In order to make the task simpler we have to customize the submit dialog using APIs. Follow these steps to create two Java les: 1. Create a package com.book.web.bean.wcm, in Eclipse, in your project. For more details refer Chapter 2, Installation and Conguration. 2. Create a Java le ExtendedSubmitDialog and copy the downloaded content from the Packt website. Please download the complete code from the Packt website. 3. Create a Java le ExtendedSubmitConfigureWorkflowDialog and copy the downloaded content from the Packt website. Download from Wow! eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 220 ] 4. Open the le faces-config-custom.xml, located at <install-alfresco>/ tomcat/webapps/alfresco/WEB-INF and copy the downloaded content from the Packt website. 5. Run Ant to compile the code and create a JAR le in <install-alfresco>/ tomcat/webapps/alfresco/WEB-INF/lib . Please refer to Chapter 2, Installation and Conguration for compiling and deploying code to the installed Alfresco. 6. Start the Alfresco server. Test using Submit Items wizard Follow the steps mentioned ahead to submit all or selected modied content to the workow. 1. Go to Company Home | Web Projects | Cignex. 2. Submit Selected option is provided under Modied Items of My sandbox. 3. On click of Submit Selected, the Submit Items wizard is opened and you will notice that one more workow is congured. Download from Wow! eBook <www.wowebook.com> Chapter 6 [ 221 ] 4. Select No workow now and click on OK. Download from Wow! eBook <www.wowebook.com> . location: <install-alfresco>/tomcat/webapps/alfresco /WEB- INF/classes/ alfresco/bootstrap-context.xml. 5. The Alfresco Explorer Dialog is located at: <install-alfresco>/tomcat/webapps/alfresco /WEB- INF/classes/ alfresco /web- client-config-properties.xml. Consider. location: <install-alfresco>/tomcat/webapps/alfresco /WEB- INF/classes/ alfresco/workflow/wcmWorkflowModel.xml. 3. The Resource Bundle is also present at same location: <install-alfresco>/tomcat/webapps/alfresco /WEB- INF/classes/ alfresco/workflow/wcm-workflow-messages.properties. 4 eBook <www.wowebook.com> Dynamic Deployment and Customizations [ 220 ] 4. Open the le faces-config-custom.xml, located at <install-alfresco>/ tomcat/webapps/alfresco /WEB- INF and copy