private List<JiraWorkflow> getDraftWorkflows() { if (draftWorkflows == null) { final ImmutableList.Builder<JiraWorkflow> results = ImmutableList.builder(); final List<JiraWorkflow> allWorkflows = workflowManager.getWorkflowsIncludingDrafts(); for (final JiraWorkflow jiraWorkflow : allWorkflows) { if (jiraWorkflow.isDraftWorkflow()) { results.add(jiraWorkflow); } } draftWorkflows = results.build(); } return draftWorkflows; }
@Override public boolean apply(JiraWorkflow jiraWorkflow) { if(null == jiraWorkflow) { return false; } if(jiraWorkflow.isDraftWorkflow() && !parentWorkflowChecker.isParentWorkflowActive(jiraWorkflow)) { return false; } else { return true; } } });
protected File getZipFile(JiraWorkflow workflow) throws IOException { String cleanWorkflowName = workflow.getName().replaceAll(CLEAN_FILENAME_PATTERN, "-"); String fileName; if (workflow.isDraftWorkflow()) { fileName = cleanWorkflowName.concat("-draft.jwb");//NON-NLS } else { fileName = cleanWorkflowName.concat(".jwb");//NON-NLS } File baseFolder = new File(jiraHome.getExportDirectory(), BASE_EXPORT_FOLDER); FileUtils.forceMkdir(baseFolder); return new File(baseFolder, fileName); }
private JiraWorkflow getWorkflowForEdit() { if (workflow.isDraftWorkflow()) { return workflow; } else { return workflowManager.getWorkflowClone(workflow.getName()); } }
protected void doValidation() { //draft workflows are not allowed to change name! if (workflow.isDraftWorkflow()) { newWorkflowName = workflow.getName(); } workflowService.validateUpdateWorkflowNameAndDescription(getJiraServiceContext(), workflow, StringUtils.trim(newWorkflowName)); }
public void visit(final JiraWorkflow workflow, final ActionDescriptor actionDescriptor, final Set<JiraWorkflow> workflowsToSave) { final String c = (String) actionDescriptor.getMetaAttributes().get( WorkflowHandler.COMMIT_COMMAND_MAPPING); if (c != null && lowerCaseCommand.equals(c.toLowerCase())) { transitions.add(new WorkflowTransition(workflow.getName(), workflow.isDraftWorkflow(), actionDescriptor.getId(), actionDescriptor.getName(), workflow.isSystemWorkflow())); } } });
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(); } }
public void visit(final JiraWorkflow workflow, final ActionDescriptor actionDescriptor, final Set<JiraWorkflow> workflowsToSave) { transitions.add(new WorkflowTransition(workflow.getName(), workflow.isDraftWorkflow(), actionDescriptor.getId(), actionDescriptor.getName(), workflow.isSystemWorkflow())); } });
WorkflowHandler.COMMIT_COMMAND_MAPPING); final WorkflowTransition transition = new WorkflowTransition(workflow.getName(), workflow.isDraftWorkflow(), actionDescriptor.getId(), actionDescriptor.getName(), workflow.isSystemWorkflow()); if (transitionSet.contains(transition))
public boolean isStepOnDraftWithNoTransitionsOnParentWorkflow(final JiraServiceContext jiraServiceContext, final JiraWorkflow workflow, final int stepId) { if (workflow.isDraftWorkflow()) { //need to check the parent's step to see if it has any available actions. final JiraWorkflow parentWorkflow = getWorkflow(jiraServiceContext, workflow.getName()); final StepDescriptor originalStep = parentWorkflow.getDescriptor().getStep(stepId); //if the step exists on the original workflow (may not, it could be a new step added to the draft, //in which case we don't care) if (originalStep != null) { final List<?> availableActions = originalStep.getActions(); if ((availableActions == null) || availableActions.isEmpty()) { return true; } } } return false; }
/** * Appends "(Draft)" to the end of the workflow name for an draft workflow. * * @param workflow The workflow to create the display name for. * @return A String with the workflow name plus an optional (Draft). */ public static String getWorkflowDisplayName(final JiraWorkflow workflow) { if (workflow == null) { return null; } if (workflow.isDraftWorkflow()) { return workflow.getName() + " (" + getI18nBean().getText("common.words.draft") + ")"; } return workflow.getName(); }
@Override public Option<RecordRequest> onWorkflowUpdatedEvent(WorkflowUpdatedEvent event) { if (event.getWorkflow().isDraftWorkflow()) { return Option.none(); //for now we ignore any changes to draft workflows } else { return Option.some(workflowUpdated(event.getOriginalWorkflow(), event.getWorkflow())); } }
if (!workflow.isDraftWorkflow())
/** * This method is used to determine if workflowstep belongs to a draft workflow and is present on the original * workflow that was used to create the draft. * This means this step cannot be deleted, and cannot be associated with a different status. * @param stepDescriptor The stepDescriptor in being edited. * @return True if the step is an existing step and the workflow is a draft workflow */ public boolean isOldStepOnDraft(StepDescriptor stepDescriptor) { // First check if it is a draft workflow if (!workflow.isDraftWorkflow()) { return false; } // Does this step exist in the live workflow? JiraWorkflow jiraWorkflow = workflowService.getWorkflow(getJiraServiceContext(), workflow.getName()); return jiraWorkflow.getDescriptor().getStep(stepDescriptor.getId()) != null; }
public void saveWorkflowWithoutAudit(JiraWorkflow workflow) throws WorkflowException { if (workflow.isDraftWorkflow()) { // Save the passed workflow over the existing draft draftWorkflowStore.updateDraftWorkflowWithoutAudit(workflow.getName(), workflow); } try { getConfiguration().saveWorkflow(workflow.getName(), workflow.getDescriptor(), true); workflow.reset(); } catch (FactoryException e) { throw new WorkflowException(e); } }
if (workflow.isDraftWorkflow())
if (currentWorkflow.isDraftWorkflow() && !newWorkflowName.equals(currentWorkflow.getName()))
private String redirectToEdit(JiraWorkflow workflow) { final String mode = workflow.isDraftWorkflow() ? "draft" : "live"; UrlBuilder builder; if (parseFromAction(this) == WorkflowViewMode.DIAGRAM) { builder = new UrlBuilder("WorkflowDesigner.jspa") .addParameter("workflowMode", mode).addParameter("wfName", workflow.getName()); } else { builder = new UrlBuilder("ViewWorkflowSteps.jspa") .addParameter("workflowMode", mode).addParameter("workflowName", workflow.getName()); } if (getProject() != null) { builder.addParameter("project", getProject()); } if (getIssueType() != null) { builder.addParameter("issueType", getIssueType()); } return getRedirect(builder.asUrlString()); }