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
Trang 1Following are the steps to be followed to deploy a workflow via JBoss jBPM Process Designer This will deploy workflow 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 file
dynamicProcessdefinition.
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:
Trang 2Display of workflow images
If Hot Deployment is done, then we can see the workflow images that show the current status of workflow in Alfresco Explorer under the workflow outline section The screenshots can be seen in the following sections when you test the workflows that are deployed through jPDL
Modify these files:
• /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 modified 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 workflow console can be used (as an alternative to the Alfresco Explorer) to deploy and undeploy Process Definitions Its primary use is to test newly-developed workflow definitions However, it also supports the debugging/diagnosis of current
"in-flight" workflows This can be deployed via http://<server-name>:<port>/ alfresco/faces/jsp/admin/workflow-console.jsp
The command deploy <workflow-name> will cause the workflow to be deployed
deploy alfresco/extension/dynamicProcessdefinition.xml
Dynamic Alfresco Explorer
A dynamic web client configuration file will have the same name as a custom web client configuration file For example, create a web-client-config-custom.xml file, with the following content, to support the dynamic content type that you created earlier:
Trang 3<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 configurations can also be dynamically deployed without restarting the server
This can be achieved by two ways:
• Upload or create the Process Definition file in the new Workflow Definitions
space (Company Home | Data Dictionary | Workflow Definitions).
• 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 file to the Web Client
Extension space.
Trang 4The custom configuration 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 file has been added, edited, or updated,
it can be dynamically reloaded by using the Alfresco Explorer configuration
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
configuration to be reloaded
Using the dynamic approach you can deploy workflow 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 Workflows and then restart the
Trang 5Testing the workflow
To assign workflow for a specific project, refer to the Associating workflows to web
project section in Chapter 5 While submitting, the content task appears in user's
dashlet On clicking on the task, you find the screen shown in the following
screenshot The highlighted section, Workflow Outline, displays the diagram of the
deployed Process Definition This is visible since we have made hot deployment of the workflow Now you can approve or reject the workflow:
Trang 6Customization of existing workflow to use e-mail notifications
Alfresco provides an inbuilt Web Site Submission workflow to be associated with the web project If you want to make change in the existing workflow, following are the location of the files to make the changes
1 The Process Definition file is present in the specified location:
<install-alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/ alfresco/workflow/submit_processdefinition.xml.
2 The Task Model file 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 file, which is used to load model, Process Definition, 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 notification at the submission of content It is easy to customize the workflow 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);
Trang 7<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 Definition using a dynamic approach and test the workflow
Trang 8If you want to deploy changes manually, you have to make changes in the
bootstrap-context.xml file 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 notification at the submission of content to the
Staging box
Remove workflow for specific staging
submission
We have already configured workflows for blogs and training web content There can be various reasons why you don't want to follow a complete process of workflow and have to submit the content directly If we think of the out-of-the-box feature, then we have to remove the workflow for those web forms so that web content can be submitted directly This is not a good practice sometimes when you are configuring a workflow or sometimes when you are removing a workflow 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 files:
1 Create a package com.book.web.bean.wcm, in Eclipse, in your project For
more details refer Chapter 2, Installation and Configuration.
2 Create a Java file ExtendedSubmitDialog and copy the downloaded content from the Packt website
Trang 94 Open the file 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 file in <install-alfresco>/ tomcat/webapps/alfresco/WEB-INF/lib Please refer to Chapter 2,
Installation and Configuration 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 modified content to the workflow
1 Go to Company Home | Web Projects | Cignex.
2 Submit Selected option is provided under Modified Items of My sandbox.
3 On click of Submit Selected, the Submit Items wizard is opened and you
will notice that one more workflow is configured
Trang 104 Select No workflow now and click on OK.