This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void doWorkflow(List<IdentifiableObjectData> updatedComponents) throws Exception { | |
if (updatedComponents.isEmpty()) | |
return; | |
try { | |
// Build the array of components | |
ArrayOfstring arrayOfComponents = new ArrayOfstring(); | |
for (final IdentifiableObjectData component : updatedComponents) { | |
arrayOfComponents.getString().add(component.getId().getValue()); | |
} | |
// Start the bundle workflow activity | |
StartWorkflowInstructionData startWorkflowInstructionData = new StartWorkflowInstructionData(); | |
// Provide a process title | |
ObjectFactory factory = new ObjectFactory(); | |
startWorkflowInstructionData.setProcessInstanceTitle( | |
factory.createStartWorkflowInstructionDataProcessInstanceTitle("Workflow instance created by the Updater Script")); | |
ProcessInstanceData process = Tridion.INSTANCE.getService() | |
.startWorkflow(publication.getId(), startWorkflowInstructionData, readBackOptions); | |
// Add components to workflow | |
Tridion.INSTANCE.getService().addToWorkflow(arrayOfComponents, | |
process.getActivities().getValue().getActivityData().get(0).getId().getValue(), readBackOptions); | |
log.info("Components added to workflow successfully!"); | |
} | |
catch(Exception e) { | |
log.error("Exception adding components to Workflow", e); | |
} | |
} |