如何使用java

时间:2017-01-17 10:17:27

标签: java jira jira-plugin atlassian-plugin-sdk

1 个答案:

答案 0 :(得分:1)

所以这是我的决议:

CustomField csUserField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName(fieldName);
IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
issueInputParameters.addCustomFieldValue(csUserField.getId(), value_string);
issueInputParameters.setSkipScreenCheck(true);
issueInputParameters.setRetainExistingValuesWhenParameterNotProvided(true, true);
UpdateValidationResult updateValidationResult = issueService.validateUpdate(user, issue.getId(), issueInputParameters);  
if (updateValidationResult.isValid())
{
    IssueResult updateResult = issueService.update(user, updateValidationResult);
    if (!updateResult.isValid())
    {
        log.warn("ISSUE has NOT been updated. Errors: {}\n", updateResult.getErrorCollection().toString());
    }
    else
    {
        log.warn("ISSUE has been updated.\n");
    }
}
else
{
    log.warn("ISSUE has NOT been updated. Errors: {}\n", updateResult.getErrorCollection().toString());
}