private Map<Long, ActionDescriptor> getActionsMap(JiraWorkflow workflow) { return Maps.uniqueIndex(workflow.getAllActions(), new Function<ActionDescriptor, Long>() { @Override public Long apply(final ActionDescriptor actionDescriptor) { return (long) actionDescriptor.getId(); } }); } }
public Map<ActionDescriptor, Collection<FunctionDescriptor>> getPostFunctionsForWorkflow(JiraWorkflow workflow) { Map<ActionDescriptor, Collection<FunctionDescriptor>> transitionPostFunctionMap = new HashMap<ActionDescriptor, Collection<FunctionDescriptor>>(); Collection<ActionDescriptor> actions = workflow.getAllActions(); for (final ActionDescriptor actionDescriptor : actions) { Collection<FunctionDescriptor> postFunctions = workflow.getPostFunctionsForTransition(actionDescriptor); transitionPostFunctionMap.put(actionDescriptor, postFunctions); } return transitionPostFunctionMap; }
private Collection<ActionDescriptor> getActionsForIssue(MutableIssue issue) { return workflowManager.getWorkflow(issue).getAllActions(); }
protected boolean upgradeWorkflow(JiraWorkflow workflow, boolean isSystemWorkflow) { boolean updated = false; for (Iterator actions = workflow.getAllActions().iterator(); actions.hasNext();) { ActionDescriptor action = (ActionDescriptor) actions.next(); RestrictionDescriptor restrictionDescriptor = action.getRestriction(); if (restrictionDescriptor != null && restrictionDescriptor.getConditionsDescriptor() != null) { updated = upgradeConditions(action.getRestriction().getConditionsDescriptor(), action, workflow, isSystemWorkflow) || updated; } } return updated; }
@Override public List<Project> getProjectsForFieldScreen(final FieldScreen fieldScreen) { final WorkflowActionsBean actionsBean = getActionsBean(); final Set<Project> projects = Sets.newTreeSet(ProjectNameComparator.COMPARATOR); final Set<String> matchingWorkflows = Sets.newHashSet(); final Collection<JiraWorkflow> activeWorkflows = workflowManager.getActiveWorkflows(); for (final JiraWorkflow activeWorkflow : activeWorkflows) { final Collection<ActionDescriptor> allActions = activeWorkflow.getAllActions(); for (final ActionDescriptor actionDescriptor : allActions) { final FieldScreen fieldScreenForView = actionsBean.getFieldScreenForView(actionDescriptor); if (fieldScreenForView != null && fieldScreenForView.equals(fieldScreen)) { matchingWorkflows.add(activeWorkflow.getName()); break; } } } final Set<FieldScreenScheme> fieldScreenSchemes = Sets.newHashSet(fieldScreenSchemeManager.getFieldScreenSchemes(fieldScreen)); projects.addAll(projectWorkflowSchemeHelper.getProjectsForWorkflow(matchingWorkflows).values()); projects.addAll(issueTypeScreenSchemeHelper.getProjectsForFieldScreenSchemes(fieldScreenSchemes).values()); return Lists.newArrayList(projects); }
@Override public String[] getCustomFieldIdsForWorkflowScreens(JiraWorkflow workflow) { Set<String> ids = new HashSet<String>(); Collection<ActionDescriptor> allActions = workflow.getAllActions(); for (ActionDescriptor action : allActions) { if(FIELDSCREEN_VIEW.equals(action.getView()) && action.getMetaAttributes().containsKey(FIELDSCREEN_ID_NAME)) { String screenId = (String) action.getMetaAttributes().get(FIELDSCREEN_ID_NAME); if(StringUtils.isNumeric(screenId)) { FieldScreen screen = fieldScreenManager.getFieldScreen(Long.parseLong(screenId)); for(FieldScreenTab tab : screen.getTabs()) { List<FieldScreenLayoutItem> items = tab.getFieldScreenLayoutItems(); for(FieldScreenLayoutItem item : items) { ids.add(item.getFieldId()); } } } } } return ids.toArray(new String[0]); }
private Set<String> getExtensionClassnames(JiraWorkflow workflow) { Set<String> uniqueClassnames = new HashSet<String>(); Collection<ActionDescriptor> allActions = workflow.getAllActions(); for (ActionDescriptor action : allActions) { uniqueClassnames.addAll(workflowScreensHelper.getClassnamesForScreenFromAction(action)); uniqueClassnames.addAll(getFunctionClassnames(action)); uniqueClassnames.addAll(getValidatorClassnames(action)); if(null != action.getRestriction()) { uniqueClassnames.addAll(getConditionClassnames(action.getRestriction().getConditionsDescriptor())); } } return uniqueClassnames; }
Collection<ActionDescriptor> allActions = workflow.getAllActions(); for (ActionDescriptor action : allActions)
protected boolean upgradeWorkflow(JiraWorkflow workflow, boolean isSystemWorkflow) { boolean workflowUpdated = false; for (Iterator transitions = workflow.getAllActions().iterator(); transitions.hasNext();) { boolean addUpdatedFunction = false; boolean hasDisplayedMergeWarning = false;
for (ActionDescriptor actionDescriptor : workflow.getAllActions())
@Override public MultiMap getAssociatedWorkflows(ProjectRole projectRole, ErrorCollection errorCollection) { Collection<JiraWorkflow> workflows = workflowManager.getWorkflows(); MultiMap associatedWorkflows = new MultiHashMap(workflows.size()); for (JiraWorkflow jiraWorkflow : workflows) { Collection<ActionDescriptor> actions = jiraWorkflow.getAllActions(); for (ActionDescriptor actionDescriptor : actions) { RestrictionDescriptor restriction = actionDescriptor.getRestriction(); if (restriction != null) { ConditionsDescriptor conditionsDescriptor = restriction.getConditionsDescriptor(); if (conditionsDescriptorContainsProjectRoleCondition(conditionsDescriptor, projectRole.getId())) { associatedWorkflows.put(jiraWorkflow, actionDescriptor); // workflow matches, don't need to check the conditions on any more actions } } } } return associatedWorkflows; }
@Override public ExtensionRemovalResult removeExtensionsWithClassnames(JiraWorkflow jiraWorkflow, Set<String> classesToRemove) { ExtensionRemovalResultImpl result = new ExtensionRemovalResultImpl(); Collection<ActionDescriptor> allActions = jiraWorkflow.getAllActions(); for (ActionDescriptor action : allActions) { Map<String,Set<String>> removedFunctions = removePostFunctionsWithClassnames(action,classesToRemove); Map<String,Set<String>> removedValidators = removeValidatorsWithClassnames(action, classesToRemove); Map<String,Set<String>> removedConditions = removeConditionsWithClassnames(action, classesToRemove); result.addAction(action.getName() + "(" + action.getId() + ")",removedFunctions,removedValidators,removedConditions); } return result; }
for (final JiraWorkflow workflow : (Iterable<JiraWorkflow>) workflowManager.getWorkflows()) for (final ActionDescriptor actionDescriptor : (Iterable<ActionDescriptor>) workflow.getAllActions()) for (final ActionDescriptor actionDescriptor : (Iterable<ActionDescriptor>) draftWorkflow.getAllActions())