0
我試圖從Post函數中通過ScriptRunner從JIRA問題中刪除組件。我試着做它用不同的方式,但它的非工作:如何使用scriptrunner從JIRA問題中刪除組件?
Collection<GenericValue> col = issue.componentObjects.asCollection()
log.debug logPref + "Deleting: " + issue.componentObjects.removeAll(col)
log.debug logPref + "Deleting: " + col.removeAll([null])
第一行返回true,第二個消除假的,但無論如何組件在自己的位置。 也試過:
import com.atlassian.jira.bc.project.component.ProjectComponentManager
import com.atlassian.jira.component.ComponentAccessor
def projectComponentManager = ComponentAccessor.getComponent(ProjectComponentManager)
projectComponentManager.updateIssueProjectComponents(issue, [])
但得到:
No signature of method: com.atlassian.jira.bc.project.component.DefaultProjectComponentManager.updateIssueProjectComponents() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl, java.util.ArrayList) values: [IID-44017, []]
以下:
import com.atlassian.jira.bc.JiraServiceContextImpl
import com.atlassian.jira.bc.project.component.ProjectComponentService
import com.atlassian.jira.component.ComponentAccessor
def jiraServiceContext = new JiraServiceContextImpl(ComponentAccessor.getJiraAuthenticationContext().getUser().getDirectoryUser())
issue.getComponentObjects().each { it ->
ComponentAccessor.getComponent(ProjectComponentService).deleteComponentForIssues(jiraServiceContext, it.id)
}
掛起我的JIRA實例,並拋出:
2016-09-15 14:09:38,727 http-bio-8080-exec-19 WARN viktork 848x207x1 d9pyfm 10.30.0.198 /secure/CommentAssignIssue.jspa [jira.notification.type.UserCFValue] Exception occurred while working out recipients from a custom field value. Returning empty list.
java.lang.IllegalStateException: There is no ID mapped for the user key 'pmo lead'
at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySetForUserKey(DefaultUserPropertyManager.java:47)
at com.atlassian.jira.user.DefaultUserPropertyManager.getPropertySet(DefaultUserPropertyManager.java:31)
at com.atlassian.jira.user.preferences.DefaultUserPreferencesManager.getExtendedPreferences(DefaultUserPreferencesManager.java:28)
at com.atlassian.jira.notification.NotificationRecipient.getFormatPreference(NotificationRecipient.java:53)
at com.atlassian.jira.notification.NotificationRecipient.<init>(NotificationRecipient.java:66)
有沒有人有一個工作方法?我的JIRA版本6.4.7是