JiraWorkflow getExistingWorkflowByProjectId(String issueTypeId, long projectId) throws WorkflowException { JiraWorkflow workflow = workflowManager.getWorkflow(projectId, issueTypeId); if (workflow == null) { throw new WorkflowException("Could not find workflow associated with project '" + projectId + "', issuetype " + issueTypeId); } return workflow; }
private JiraWorkflow getExistingWorkflow(String issueTypeId) throws WorkflowException { JiraWorkflow workflow = workflowManager.getWorkflow(projectId, issueTypeId); if (workflow == null) { throw new WorkflowException("Could not find workflow associated with project '" + projectId + "', issuetype " + issueTypeId); } return workflow; }
/** Gets non-null target workflow for an issue type in the current project. */ private JiraWorkflow getTargetWorkflow(String issueTypeId) throws WorkflowException { String workflowName = targetScheme.getActualWorkflow(issueTypeId); JiraWorkflow workflow = workflowManager.getWorkflow(workflowName); if (workflow == null) { throw new WorkflowException("Could not find workflow associated with issuetype " + issueTypeId); } return workflow; }
/** Gets non-null target workflow for an issue type in the current project. */ JiraWorkflow getTargetWorkflow(String issueTypeId) throws WorkflowException { String workflowName = targetScheme.getActualWorkflow(issueTypeId); JiraWorkflow workflow = workflowManager.getWorkflow(workflowName); if (workflow == null) { throw new WorkflowException("Could not find workflow associated with issuetype " + issueTypeId); } return workflow; }
private Collection<JiraWorkflow> getSchemeActiveWorkflows() throws WorkflowException { try { Collection<String> names = getWorkflowSchemeManager().getActiveWorkflowNames(); Set<JiraWorkflow> workflows = new HashSet<JiraWorkflow>(); for (String name : names) { workflows.add(getWorkflow(name)); } return workflows; } catch (GenericEntityException e) { throw new WorkflowException(e); } }
@Override public boolean contains(String name) { // This is more efficient than the parent method as it does not create workflow objects // but simply looks at workflow names if (name == null) { throw new IllegalArgumentException("Name must not be null."); } // Cannot get access to a Map that stores the workflows - so need to loop over the // name array. try { for (int i = 0; i < getConfiguration().getWorkflowNames().length; i++) { String workflowName = getConfiguration().getWorkflowNames()[i]; if (name.equals(workflowName)) { return true; } } } catch (FactoryException e) { throw new WorkflowException(e); } return false; }
throw new WorkflowException("No initial actions exist for workflow with name '" + jiraWorkflow.getName() + "."); throw new WorkflowException("Issue workflow initialization error: unable to find Issue created with workflowId '" + wfId + "'. Did the IssueCreateFunction run successfully on workflow.initialize() ?"); throw new WorkflowException(e.getMessage(), e); throw new WorkflowException(e.getMessage(), e); throw new WorkflowException(e.getMessage(), e); throw new WorkflowException(e.getMessage(), e); throw new WorkflowException(e.getMessage(), e); "http://confluence.atlassian.com/x/3McB"; throw new WorkflowException(message, e); throw new WorkflowException(e.getMessage(), e);
if (workflow == null) throw new WorkflowException("No workflow for pid " + getPid() + ", issuetype " + getIssuetype()); final WorkflowDescriptor descriptor = workflow.getDescriptor(); final List initialActions = descriptor.getInitialActions(); if (initialActions.size() == 0) throw new WorkflowException("There are no initial actions for workflow " + workflow + ", descriptor " + descriptor + " associated with pid " + getPid() + " and issue type " + getIssuetype());
public void deleteWorkflow(JiraWorkflow workflow) throws WorkflowException { if (!Iterables.isEmpty(getWorkflowSchemeManager().getSchemesForWorkflowIncludingDrafts(workflow))) { throw new WorkflowException("The workflow is assigned to workflow schemes"); } try { //we need to delete the draft first since it needs a reference to the parent deleteDraftWorkflow(workflow.getName()); //TODO: Should we move this to the store? getConfiguration().removeWorkflow(workflow.getName()); eventPublisher.publish(new WorkflowDeletedEvent(workflow)); } catch (FactoryException e) { throw new WorkflowException("Error deleting workflow: " + e, e); } }
if (draftWorkflow == null) throw new WorkflowException("No draft workflow named '" + workflowName + "'"); throw new WorkflowException(e); throw new WorkflowException("Workflow '" + workflowName + "' could not be overwritten!");
public Collection<JiraWorkflow> getWorkflowsFromScheme(GenericValue scheme) throws WorkflowException { if (scheme != null) { // now, check if we have a workflow configured for this issue type try { Collection<GenericValue> schemeEntities = getWorkflowSchemeManager().getEntities(scheme); if (schemeEntities != null) { List<JiraWorkflow> result = new ArrayList<JiraWorkflow>(schemeEntities.size()); for (GenericValue schemeEntity : schemeEntities) { result.add(getWorkflow(schemeEntity.getString("workflow"))); } return result; } } catch (GenericEntityException e) { throw new WorkflowException(e); } } // Always return the default if nothing else is found return CollectionBuilder.newBuilder(getWorkflow(JiraWorkflow.DEFAULT_WORKFLOW_NAME)).asMutableList(); }
public void doWorkflowAction(WorkflowProgressAware from) { disableIndexingForThisThread(); Transaction txn = Txn.begin(); try { doWorkflowActionInsideTxn(txn, from); } finally { try { enableIndexingForThisThread(); } catch (IndexException e) { throw new WorkflowException(e.getMessage(), e); } txn.finallyRollbackIfNotCommitted(); } }
if (workflow.isActive()) throw new WorkflowException("Cannot save an active workflow."); throw new WorkflowException("Cannot change the system workflow.");
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); } }
public JiraWorkflow copyWorkflow(ApplicationUser user, String clonedWorkflowName, String clonedWorkflowDescription, JiraWorkflow workflowToClone) { final WorkflowDescriptor workflowDescriptor; try { workflowDescriptor = cloneDescriptor(workflowToClone.getDescriptor()); } catch (FactoryException e) { throw new WorkflowException("Unexpected exception copying a workflowDescriptor for workflow '" + clonedWorkflowName + "'!", e); } ConfigurableJiraWorkflow newWorkflow = new ConfigurableJiraWorkflow(clonedWorkflowName, workflowDescriptor, this); // Set description if we have one, otherwise set it to an empty string if (StringUtils.isNotEmpty(clonedWorkflowDescription)) { newWorkflow.setDescription(clonedWorkflowDescription); } else { newWorkflow.setDescription(""); } createActualWorkflow(user, newWorkflow); eventPublisher.publish(new WorkflowCopiedEvent(workflowToClone, newWorkflow)); return newWorkflow; }
throw new WorkflowException("Error renaming workflow '" + currentWorkflow + "' to '" + newName + "' " + e, e);
throw new WorkflowException(e); throw new WorkflowException(e);