public ViewWorkflowXml(JiraWorkflow workflow) { this.workflow = workflow; this.name = workflow.getName(); }
@Override public String apply(@Nullable final JiraWorkflow input) { return input.getName(); } };
@Override public String apply(@Nullable final JiraWorkflow input) { return input.getName(); } };
public JiraWorkflow getDraftFor(final String workflowName) { for (final JiraWorkflow draft : getDraftWorkflows()) { if (draft.getName().equals(workflowName)) { return draft; } } return null; }
@Override @Nonnull public ManagedConfigurationItem getManagedWorkflow(@Nonnull JiraWorkflow workflow) { return getManagedConfigurationEntity(workflow.getName(), ManagedConfigurationItemType.WORKFLOW); }
private Set<Map<String, String>> getTransitions(final int webHookListenerId, JiraWorkflow workflow) { Set<Map<String, String>> transitions = Sets.newHashSet(); final Map<ActionDescriptor, Collection<FunctionDescriptor>> actionToPostfunctionsMap = workflowManager.getPostFunctionsForWorkflow(workflow); for (Map.Entry<ActionDescriptor, Collection<FunctionDescriptor>> entry : actionToPostfunctionsMap.entrySet()) { if (isWebHookLinked(webHookListenerId, entry.getValue())) { transitions.add(ImmutableMap.of("workflow", workflow.getName(), "transition", entry.getKey().getName())); } } return transitions; }
public JiraWorkflow createDraftWorkflow(final ApplicationUser author, final JiraWorkflow parentWorkflow) throws DataAccessException, IllegalStateException, IllegalArgumentException { final JiraWorkflow draftWorkflow = delegate.createDraftWorkflow(author, parentWorkflow); draftWorkflowCache.remove(parentWorkflow.getName()); return draftWorkflow; }
@Override public String toString() { return asString("WorkflowTransition[Workflow=",workflow.getName(),",transition=",transition.getId(),"]"); } }
private JiraWorkflow getWorkflowForEdit() { if (workflow.isDraftWorkflow()) { return workflow; } else { return workflowManager.getWorkflowClone(workflow.getName()); } }
@VisibleForTesting Option<JiraWorkflow> draftOf(ErrorCollection errorCollection, JiraWorkflow jiraWorkflow) { JiraServiceContext jiraServiceContext = getServiceContext(errorCollection); JiraWorkflow existingDraftWorkflow = workflowService.getDraftWorkflow(jiraServiceContext, jiraWorkflow.getName()); return existingDraftWorkflow == null ? option(workflowService.createDraftWorkflow(jiraServiceContext, jiraWorkflow.getName())) : some(existingDraftWorkflow); }
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())); } } });
private boolean shouldUpgradeWorkflow(JiraWorkflow workflow) { //custom system workflows will not be automatically updated, but logged with detailed instructions boolean isSystemWorkflow; try { isSystemWorkflow = workflow.isSystemWorkflow(); } catch (WorkflowException e) { logError("Could not determine whether workflow '" + workflow.getName() + "' is System Workflow, " + "skipping. Error: ", e); return false; } return upgradeWorkflow(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 String getLastModifiedDateForDraft(final JiraWorkflow workflow) { final JiraWorkflow draft = getDraftFor(workflow.getName()); return getDateTimeFormatter().withStyle(DateTimeStyle.COMPLETE).format(draft.getUpdatedDate()); }
private RecordRequest workflowCreated(final JiraWorkflow workflow) { return new RecordRequest(AuditingCategory.WORKFLOWS, "jira.auditing.workflow.created") .forObject(AssociatedItem.Type.WORKFLOW, workflow.getDisplayName(), workflow.getName()) .withChangedValues(computeChangedValues(workflow)); }
@Override public RecordRequest onWorkflowDeletedEvent(final WorkflowDeletedEvent event) { return new RecordRequest(AuditingCategory.WORKFLOWS, "jira.auditing.workflow.deleted") .forObject(AssociatedItem.Type.WORKFLOW, event.getWorkflow().getDisplayName(), event.getWorkflow().getName()); }
private RecordRequest workflowUpdated(JiraWorkflow fromWorkflow, final JiraWorkflow toWorkflow) { return new RecordRequest(AuditingCategory.WORKFLOWS, "jira.auditing.workflow.updated") .forObject(AssociatedItem.Type.WORKFLOW, toWorkflow.getDisplayName(), toWorkflow.getName()) .withChangedValues(computeChangedValues(fromWorkflow, toWorkflow)); }
private WorkflowBean jiraWorkflowToWorkflowBean(JiraWorkflow jiraWorkflow) { String name = jiraWorkflow.getName(); String description = jiraWorkflow.getDescription(); int steps = jiraWorkflow.getDescriptor().getSteps().size(); boolean isDefault = jiraWorkflow.isDefault(); String updateDate = jiraWorkflow.getUpdatedDate() != null ? dateTimeFormatter.forLoggedInUser().format(jiraWorkflow.getUpdatedDate()) : null; ApplicationUser updateAuthor = jiraWorkflow.getUpdateAuthor(); String updateAuthorName = userManager.isUserExisting(updateAuthor)?updateAuthor.getDisplayName():null; return new WorkflowBean(name, description, updateDate, updateAuthorName, steps, isDefault); } }