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 workflows can be done easily.
By the end of this chapter you will have learned:
You are able to dynamically deploy workflow in Alfresco WCM by using workflow types, workflow definitions, web client configurations, and property files. Since version 3.0, Alfresco supports dynamic deploy of models, workflows, messages, and web-client configuration changes to facilitate dynamic customization without requiring a restart of the Alfresco server. Let's discuss how to dynamically deploy models, workflows, messages, and web-client changes.
The following are the advantages of dynamic deployment:
<extension>
folder are available to all tenants. If you would like to customize workflow for a specific tenant only, then a dynamic deployment is the best choice.Dynamic models are nothing but XML-based model files. 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 file named dynamicWCMWorkflowModel
on your personal computer with the downloaded content.
The Task Model can also be dynamically deployed without restarting the server.
This can be achieved by two ways:
Dynamic workflow models are stored in the new 'Models' space (Company Home | Data Dictionary | Models).
Upload a custom XML model file, 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:
To verify the changes, log out and log in if required.
Deployment of model files 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.
Creating a Dynamic Resource Bundle is the same as creating a regular property file. For this example, create labels for two properties that are defined in the model file. Create a file named dynamicWCMWorkflowMessages
on your personal computer with the following content:
dynamic_processTask.workflow.title=Dynamic Workflow dynamic_processTask.workflow.description=Dynamic Workflow for approval
The Resource Bundle can also be dynamically deployed without restarting the server.
This can be achieved by two ways:
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 files (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:
The custom configuration will not be applied until it is explicitly reloaded (refer to the following section) or the server is restarted.
If the Resource Bundle file 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
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 workflows are nothing but XML-based Process Definition files. Creating a dynamic Process Definition is the same as creating a regular Process Definition file. For this example, create a custom Process Definition. Create a file named dynamicProcessDefinition
on your personal computer with the downloaded content.
The Process Definition can also be dynamically deployed without restarting the server.
This can be achieved by three ways:
The Process Definitions are stored in the new Workflow Definitions space (Company Home | Data Dictionary | Workflow Definitions). Upload a custom XML Process Definition file to the Workflow Definitions space. By default, the Process Definition will not be deployed unless the Workflow Deployed checkbox is selected during the upload.
Follow these steps to create a Process Definition:
To verify the changes, log out and log in.
To undeploy a Process Definition, select View Details and then select the Modify properties icon. In the Modify Content Properties page, unselect the Workflow Deployed checkbox.
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 configuring the jBPM:
http://sourceforge.net/projects/jbpm/files/jBPM%20Process%20Designer/jbpm-jpdl-designer-3.1.7
src/main/jpd
package.Following are the steps to be followed to deploy a workflow via JBoss jBPM Process Designer. This will deploy workflow without restart of the server.
/alfresco/jbpm/deployprocess
The following screenshot shows the details provided earlier:
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">
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
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:
<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" /> <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>
The web client configurations can also be dynamically deployed without restarting the server.
This can be achieved by two ways:
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.
The custom configuration will not be applied until it is explicitly reloaded or when the server is restarted.
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 server once. The dynamic approach can also be used if some changes are required after deployments so, no need to restart the server.
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: