6.5. Workflow Configuration

By default, a single three-step workflow is created per Content Section. There are currently no configuration parameters which allow automatic customization.

To create custom workflows for your content section, there are a couple of options. Workflows may be created via the Workflows tab on the Section Administration UI. For most cases, this method will suffice. This process is described in the CMS Administrator Guide.

The other way to create custom workflows is to create them programmatically via custom application loaders or elsewhere in custom code. See Example 6-4 for an example of programmatic workflow creation.

	
WorkflowTemplate wf = new WorkflowTemplate();
wf.setLabel("My Workflow");
wf.setDescription("This workflow requires two levels of approval.");

CMSTask authoring = new CMSTask();
authoring.setLabel("Authoring");
authoring.setDescription("Create content.");


Role author = (Role)m_tasks.get("Authoring");
if (author != null)
    authoring.assignGroup(author.getGroup());

authoring.setTaskType(CMSTask.AUTHOR);

CMSTask approval = new CMSTask();
approval.setLabel("First approval");
approval.setDescription("Approve content.");
approval.addDependency(authoring);

Role approver = (Role)m_tasks.get("Approval");
if (approver != null)
    approval.assignGroup(approver.getGroup());

approval.setTaskType(CMSTask.EDIT);

CMSTask approval2 = new CMSTask();
approval2.setLabel("Second approval");
approval2.setDescription("Approve content.");
approval2.addDependency(approval);

Role approver2 = (Role)m_tasks.get("Approval2");
if (approver2 != null)
    approval2.assignGroup(approver.getGroup());

approval2.setTaskType(CMSTask.EDIT);


CMSTask deploy = new CMSTask();
deploy.setLabel("Deploy");
deploy.setDescription("Deploy content.");
deploy.addDependency(approval2);

Role publisher = (Role)m_tasks.get("Publishing");
if (publisher != null)
    deploy.assignGroup(publisher.getGroup());

deploy.setTaskType(CMSTask.DEPLOY);

wf.addTask(authoring);
wf.addTask(approval);
wf.addTask(approval2);
wf.addTask(deploy);

m_section.addWorkflowTemplate(wf);

Example 6-4. Programmatic creation of custom workflow