step3.setResolved(true);
step3.setSchemeId(scheme.getId());
APILocator.getWorkflowAPI().saveStep(step3);
// Save as Draft Step1 -> Step1
WorkflowAction saveDraft=new WorkflowAction();
saveDraft.setId(UUIDGenerator.generateUuid());
saveDraft.setName("Save as Draft");
saveDraft.setOrder(1);
saveDraft.setNextStep(step1.getId());
saveDraft.setRequiresCheckout(true);
saveDraft.setStepId(step1.getId());
saveDraft.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
APILocator.getWorkflowAPI().saveAction(saveDraft,
Arrays.asList(new Permission[] {
new Permission(
saveDraft.getPermissionType(),
saveDraft.getId(),
APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
PermissionAPI.PERMISSION_USE) }));
// Save as Draft Step1 -> Step1
WorkflowAction escalate=new WorkflowAction();
escalate.setId(UUIDGenerator.generateUuid());
escalate.setName("Save and Assign");
escalate.setOrder(2);
escalate.setNextStep(step1.getId());
escalate.setRequiresCheckout(true);
escalate.setStepId(step1.getId());
escalate.setAssignable(true);
escalate.setCommentable(true);
escalate.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
APILocator.getWorkflowAPI().saveAction(escalate,
Arrays.asList(new Permission[] {
new Permission(
escalate.getPermissionType(),
escalate.getId(),
APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
PermissionAPI.PERMISSION_USE) }));
// Send for review Step1 -> Step2
WorkflowAction sendReview=new WorkflowAction();
sendReview.setId(UUIDGenerator.generateUuid());
sendReview.setName("Send for review");
sendReview.setOrder(3);
sendReview.setNextStep(step2.getId());
sendReview.setRequiresCheckout(false);
sendReview.setStepId(step1.getId());
sendReview.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
APILocator.getWorkflowAPI().saveAction(sendReview,
Arrays.asList(new Permission[] {
new Permission(
sendReview.getPermissionType(),
sendReview.getId(),
APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
PermissionAPI.PERMISSION_USE) }));
// reject Step2 -> Step1
WorkflowAction reject=new WorkflowAction();
reject.setId(UUIDGenerator.generateUuid());
reject.setName("Reject");
reject.setOrder(1);
reject.setNextStep(step1.getId());
reject.setRequiresCheckout(false);
reject.setStepId(step2.getId());
reject.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
APILocator.getWorkflowAPI().saveAction(reject,
Arrays.asList(new Permission[] {
new Permission(
reject.getPermissionType(),
reject.getId(),
APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
PermissionAPI.PERMISSION_USE) }));
// publish Step2 -> Step3
WorkflowAction publish=new WorkflowAction();
publish.setId(UUIDGenerator.generateUuid());
publish.setName("Publish");
publish.setOrder(2);
publish.setNextStep(step3.getId());
publish.setRequiresCheckout(false);
publish.setStepId(step2.getId());
publish.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
APILocator.getWorkflowAPI().saveAction(publish,
Arrays.asList(new Permission[] {
new Permission(
publish.getPermissionType(),
publish.getId(),
APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
PermissionAPI.PERMISSION_USE) }));
WorkflowActionClass publishlet=new WorkflowActionClass();
publishlet.setActionId(publish.getId());
publishlet.setClazz(com.dotmarketing.portlets.workflows.actionlet.PublishContentActionlet.class.getCanonicalName());
publishlet.setName("publish");
publishlet.setOrder(1);
APILocator.getWorkflowAPI().saveActionClass(publishlet);