gpt4 book ai didi

com.atlassian.jira.workflow.WorkflowManager.saveWorkflowWithoutAudit()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 18:31:05 29 4
gpt4 key购买 nike

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

WorkflowManager.saveWorkflowWithoutAudit介绍

[英]This method will save the workflow and it will not affect the updatedDate and updatedAuthorName meta attributes of the workflow. This should only ever be invoked by system operations such as upgrade tasks. All other saves should use the method #updateWorkflow(String,JiraWorkflow)
[中]此方法将保存工作流,并且不会影响工作流的UpdateDate和UpdateAuthorName元属性。这只能由系统操作(如升级任务)调用。所有其他保存都应使用#updateWorkflow(String,JiraWorkflow)方法

代码示例

代码示例来源: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.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

@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.studio/studio-jira-fisheye-plugin

workflowManager.saveWorkflowWithoutAudit(workflow);

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