@Override public boolean apply(final JiraWorkflow workflow) { return !workflow.isActive(); } }));
@Override public boolean apply(final JiraWorkflow workflow) { return workflow.isActive(); } }));
public JiraWorkflow createDraftWorkflow(ApplicationUser user, String parentWorkflowName) { if (user == null) { throw new IllegalArgumentException("You can not create a draft workflow with a null user."); } final JiraWorkflow parentWorkflow = getWorkflow(parentWorkflowName); if (parentWorkflow == null) { throw new IllegalArgumentException("You can not create a draft workflow from a parent that does not exist."); } if (!parentWorkflow.isActive()) { throw new IllegalStateException("You can not create a draft workflow from a parent workflow that is not active."); } JiraWorkflow draftWorkflow = draftWorkflowStore.createDraftWorkflow(user, parentWorkflow); eventPublisher.publish(new DraftWorkflowCreatedEvent(draftWorkflow)); return draftWorkflow; }
public boolean isParentWorkflowActive(JiraWorkflow workflow) { //not an draft workflow? Well you don't have a parent so your parent is active for the purposes // of this method. if(!workflow.isDraftWorkflow()) { return true; } JiraWorkflow parentWorkflow = workflowManager.getWorkflow(workflow.getName()); return parentWorkflow != null && parentWorkflow.isActive(); }
public boolean isParentWorkflowActive(JiraWorkflow workflow) { //not an draft workflow? Well you don't have a parent so your parent is active for the purposes // of this method. if(!workflow.isDraftWorkflow()) { return true; } JiraWorkflow parentWorkflow = workflowManager.getWorkflow(workflow.getName()); return parentWorkflow != null && parentWorkflow.isActive(); } }
@Override public void copyAndDeleteDraftsForInactiveWorkflowsIn(ApplicationUser user, Iterable<JiraWorkflow> workflows) { if (workflows == null || isEmpty(workflows)) { return; } for (final JiraWorkflow workflow : workflows) { final String parentWorkflowName = workflow.getName(); final JiraWorkflow draftWorkflow = getDraftWorkflow(parentWorkflowName); //We should only create a copy and delete the draft, if the parentworkflow //is not active, and the draft actually exists. For a workflow that's still //active, we want to keep the draft around. if (!workflow.isActive() && draftWorkflow != null) { String username = user == null ? null : user.getName(); StringBuilder builder = new StringBuilder(); final String parentDescription = stripToNull(draftWorkflow.getDescription()); if (parentDescription != null) { builder.append(parentDescription).append(" "); } builder.append(getI18nBean(user).getText("admin.workflows.manager.draft.auto.generated", parentWorkflowName)); copyWorkflow(username, getClonedWorkflowName(parentWorkflowName, user), builder.toString(), draftWorkflow); deleteDraftWorkflow(parentWorkflowName); } } }
if (workflow.isActive())
return; if (!liveJiraWorkflow.isActive())
return getRedirect(builder.asUrlString()); else if (!workflow.isActive())