gpt4 book ai didi

com.atlassian.jira.workflow.WorkflowManager类的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 17:49:05 38 4
gpt4 key购买 nike

本文整理了Java中com.atlassian.jira.workflow.WorkflowManager类的一些代码示例,展示了WorkflowManager类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkflowManager类的具体详情如下:
包路径:com.atlassian.jira.workflow.WorkflowManager
类名称:WorkflowManager

WorkflowManager介绍

[英]The WorkflowManager is used to interface with the workflow implementation
[中]WorkflowManager用于与工作流实现接口

代码示例

代码示例来源:origin: com.atlassian.jira/jira-core

private Collection<JiraWorkflow> getWorkflows()
{
  if (workflows == null)
  {
    // Expensive call
    workflows = workflowManager.getWorkflows();
  }
  return workflows;
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
  public JiraWorkflow apply(String input)
  {
    return workflowManager.getWorkflow(input);
  }
}));

代码示例来源:origin: com.atlassian.jira/jira-core

private JiraWorkflow getWorkflow(PicoContainer parent, String workflowMode, String workflowName, HttpServletRequest request)
{
  // Use the WorkflowManager to get the required workflow
  WorkflowManager workflowManager = parent.getComponent(WorkflowManager.class);
  JiraWorkflow workflow;
  if (workflowMode.equals(JiraWorkflow.LIVE))
  {
    // get the "live" workflow
    workflow = workflowManager.getWorkflowClone(workflowName);
  }
  else if (workflowMode.equals(JiraWorkflow.DRAFT))
  {
    // get the draft workflow
    workflow = workflowManager.getDraftWorkflow(workflowName);
  }
  else
  {
    throw new IllegalStateException("Invalid workflow mode '" + workflowMode + "'. " + getFullRequestUrl(request));
  }
  return workflow;
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public void doUpgrade(boolean setupMode) throws Exception
{
  workflowManager.copyAndDeleteDraftsForInactiveWorkflowsIn(null, workflowManager.getWorkflows());
}

代码示例来源:origin: com.atlassian.studio/studio-jira-fisheye-plugin

for (final JiraWorkflow workflow : (Iterable<JiraWorkflow>) workflowManager.getWorkflows())
    final JiraWorkflow draftWorkflow = workflowManager.getDraftWorkflow(workflow.getName());
    for (final ActionDescriptor actionDescriptor : (Iterable<ActionDescriptor>) draftWorkflow.getAllActions())
    workflowManager.updateWorkflow(ctx.getUser().getName(), workflow);
    workflowManager.saveWorkflowWithoutAudit(workflow);

代码示例来源:origin: com.atlassian.jira.plugins/jira-fisheye-plugin

public void doUpgrade() throws FishEyeUpgradeException {
  for (Iterator workflows = workflowManager.getWorkflows().iterator(); workflows.hasNext();) {
    JiraWorkflow workflow = (JiraWorkflow) workflows.next();
    if (shouldUpgradeWorkflow(workflow)) {
      try {
        workflowManager.saveWorkflowWithoutAudit(workflow);
      } catch (WorkflowException e) {
        logError("Exception encountered when attempting to storing updated workflow " + workflow.getName(),
            e);
      }
    }
    //upgrade the draft workflow as well, if one exists
    JiraWorkflow draft = workflowManager.getDraftWorkflow(workflow.getName());
    if (draft != null) {
      if (shouldUpgradeWorkflow(draft)) {
        try {
          workflowManager.saveWorkflowWithoutAudit(draft);
        } catch (WorkflowException e) {
          logError("Exception encountered when attempting to storing updated draft workflow " +
              draft.getName(), e);
        }
      }
    }
  }
  properties.setBoolean(getUpgradeString(), true);
}

代码示例来源:origin: com.atlassian.jira/jira-core

public JiraWorkflow getDraftWorkflow(final JiraServiceContext jiraServiceContext, final String parentWorkflowName)
{
  if (!hasAdminPermission(jiraServiceContext))
  {
    jiraServiceContext.getErrorCollection().addErrorMessage(getI18nBean().getText("admin.workflows.service.error.no.admin.permission"));
    return null;
  }
  if (StringUtils.isEmpty(parentWorkflowName))
  {
    jiraServiceContext.getErrorCollection().addErrorMessage(getI18nBean().getText("admin.workflows.service.error.no.parent"));
    return null;
  }
  final JiraWorkflow parentWorkflow = workflowManager.getWorkflow(parentWorkflowName);
  if (parentWorkflow == null)
  {
    jiraServiceContext.getErrorCollection().addErrorMessage(getI18nBean().getText("admin.workflows.service.error.retrieve.no.parent"));
    return null;
  }
  return workflowManager.getDraftWorkflow(parentWorkflowName);
}

代码示例来源:origin: com.atlassian.jira/jira-core

public MultiMap getAssociatedWorkflows(EventType eventType, boolean statusCheck)
{
  MultiMap workflowTransitionMap = new MultiValueMap();
  Collection<JiraWorkflow> workflows = workflowManager.getWorkflows();
  Long eventTypeId = eventType.getId();
  for (final JiraWorkflow workflow : workflows)
  {
    Map<ActionDescriptor, Collection<FunctionDescriptor>> transitionPostFunctionMap = workflowManager.getPostFunctionsForWorkflow(workflow);
    Collection<ActionDescriptor> keys = transitionPostFunctionMap.keySet();
    for (final ActionDescriptor actionDescriptor : keys)
    {
      Collection<FunctionDescriptor> postFunctions = transitionPostFunctionMap.get(actionDescriptor);
      for (final FunctionDescriptor functionDescriptor : postFunctions)
      {
        if (functionDescriptor.getArgs().containsKey(EVENT_TYPE_ID) &&
            eventTypeId.equals(new Long((String) functionDescriptor.getArgs().get(EVENT_TYPE_ID))))
        {
          workflowTransitionMap.put(workflow.getName(), actionDescriptor);
          // Exit now as we only need one association for a status check
          if (statusCheck)
          {
            return workflowTransitionMap;
          }
        }
      }
    }
  }
  return workflowTransitionMap;
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public void doUpgrade(boolean setupMode) throws Exception
{
  DescriptorFactory descriptorFactory = DescriptorFactory.getFactory();
  WorkflowManager workflowManager = ComponentAccessor.getComponentOfType(WorkflowManager.class);
  for (JiraWorkflow workflow : workflowManager.getWorkflows())
  {
    if (workflow instanceof ConfigurableJiraWorkflow)
    {
      ConfigurableJiraWorkflow mutableWorkflow = (ConfigurableJiraWorkflow) workflow;
      try
      {
        Element upgradedDescriptor = upgradeDescriptor(mutableWorkflow.getDescriptor().asXML());
        WorkflowDescriptor workflowDescriptor = descriptorFactory.createWorkflowDescriptor(upgradedDescriptor);
        mutableWorkflow.setDescriptor(workflowDescriptor);
        workflowManager.saveWorkflowWithoutAudit(mutableWorkflow);
        log.debug("Upgraded workflow '{}'", mutableWorkflow.getName());
      }
      catch (Exception e)
      {
        throw new RuntimeException("Failed to upgrade workflow: " + workflow.getName(), e);
      }
    }
  }
}

代码示例来源:origin: com.atlassian.labs.hipchat/hipchat-for-jira-plugin

.getName();
final String workflowName = issueTypeWorkflow.getValue();
final JiraWorkflow workflow = workflowManager.getWorkflow(workflowName);
final Map<ActionDescriptor, Collection<FunctionDescriptor>> postFunctionsForWorkflow = workflowManager.getPostFunctionsForWorkflow(
    workflow);

代码示例来源:origin: com.atlassian.jira/jira-core

return null;
final JiraWorkflow parentWorkflow = workflowManager.getWorkflow(parentWorkflowName);
if (parentWorkflow == null)
  return null;
if (!workflowManager.isActive(parentWorkflow))
  return workflowManager.createDraftWorkflow(jiraServiceContext.getLoggedInApplicationUser(), parentWorkflowName);

代码示例来源:origin: com.atlassian.jira/jira-core

for (JiraWorkflow jiraWorkflow : workflowManager.getActiveWorkflows())
      JiraWorkflow workflow = workflowManager.getWorkflow(projectId, issueTypeId);
      List<Status> linkedStatuses = workflow.getLinkedStatusObjects();
      uniqueStatus.addAll(linkedStatuses);

代码示例来源:origin: com.atlassian.jira/jira-core

JiraWorkflow originalWorkflow = workflowManager.getWorkflow(issue);
    final boolean needsIndex = workflowManager.migrateIssueToWorkflowNoReindex(issue.getGenericValue(), targetWorkflow, ((IssueConstantImpl) targetStatus).getGenericValue());
    createChangeLog(issue.getGenericValue(), originalWfIdString, originalStatus, originalWorkflow, targetWorkflow, targetStatus);

代码示例来源:origin: com.atlassian.jira/jira-core

if (!workflowManager.getWorkflow(issue).equals(bulkEditBean.getTargetWorkflow()))
  workflowManager.migrateIssueToWorkflow(newIssue, bulkEditBean.getTargetWorkflow(), newStatus);

代码示例来源:origin: com.atlassian.jira/jira-core

final JiraWorkflow originalWorkflow = getWorkflowManager().getWorkflow(issue);
    final List<Status> linkedStatuses = getWorkflowManager().getWorkflow(issue).getLinkedStatusObjects();
    final WorkflowStore store = getWorkflowManager().getStore();

代码示例来源:origin: com.atlassian.jira/jira-core

final JiraWorkflow workflow = (existingProject == null) ? workflowManager.getDefaultWorkflow() : workflowManager.getWorkflow(
    existingProject.getId(), issueTypeMapper.getMappedId(issueTypeId));
if (!workflow.getLinkedStatusObjects().contains(existingStatus))

代码示例来源:origin: com.atlassian.jira/jira-core

private List<JiraWorkflow> getWorkflowsIncludingDrafts()
{
  // Cache this call as it is expensive.
  if (workflowsIncludingDrafts == null)
  {
    workflowsIncludingDrafts = workflowManager.getWorkflowsIncludingDrafts();
  }
  return workflowsIncludingDrafts;
}

代码示例来源:origin: com.atlassian.jira/jira-core

private void swapRoleInWorkflows(final ProjectRole role, final ProjectRole swapRole)
{
  ErrorCollection errorCollection = new SimpleErrorCollection();
  MultiMap associatedWorkflows = getAssociatedWorkflows(role, errorCollection);
  String moduleKey = "com.atlassian.jira.plugin.system.workflow:isuserinprojectrole-condition";
  String className = "com.atlassian.jira.workflow.condition.InProjectRoleCondition";
  for (Object o : associatedWorkflows.keySet())
  {
    if(!(associatedWorkflows.get(o) instanceof Collection))
    {
      throw new IllegalStateException("Associated workflows returned an unexpected map");
    }
    for (ActionDescriptor actionDescriptor: (Collection<ActionDescriptor>)associatedWorkflows.get(o))
    {
      JiraWorkflow jiraWorkflow = (JiraWorkflow) o;
      //JiraWorkflow clone = workflowManager.getWorkflowClone(jiraWorkflow.getName());
      workflowManager.replaceConditionInTransition(
          actionDescriptor,
          ImmutableMap.of("jira.projectrole.id", role.getId().toString(), "class.name", className),
          ImmutableMap.of("jira.projectrole.id", swapRole.getId().toString()));
      workflowManager.saveWorkflowWithoutAudit(jiraWorkflow);
    }
  }
}

代码示例来源:origin: com.atlassian.jira/jira-webhooks-plugin

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;
}

代码示例来源:origin: com.atlassian.jira/jira-core

@RequiresXsrfCheck
public String doAddWorkflow() throws Exception
{
  if (!WorkflowUtil.isAcceptableName(newWorkflowName,"newWorkflowName",this))
  {
    return INPUT;
  }
  else if (workflowManager.workflowExists(newWorkflowName))
  {
    addError("newWorkflowName", getText("admin.errors.a.workflow.with.this.name.already.exists"));
  }
  if (invalidInput())
  { return INPUT; }
  ConfigurableJiraWorkflow newWorkflow = new ConfigurableJiraWorkflow(newWorkflowName, workflowManager);
  newWorkflow.setDescription(description);
  workflowManager.createWorkflow(getLoggedInUser(), newWorkflow);
  UrlBuilder builder = new UrlBuilder("EditWorkflowDispatcher.jspa")
      .addParameter("wfName", newWorkflow.getName())
      .addParameter("atl_token", getXsrfToken());
  return returnCompleteWithInlineRedirect(builder.asUrlString());
}

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com