本文整理汇总了Java中com.atlassian.jira.issue.MutableIssue类的典型用法代码示例。如果您正苦于以下问题:Java MutableIssue类的具体用法?Java MutableIssue怎么用?Java MutableIssue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MutableIssue类属于com.atlassian.jira.issue包,在下文中一共展示了MutableIssue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
@Override
public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException {
MutableIssue issue = getIssue(transientVars);
String script = (String) args.get(FIELD);
Map<String, Object> parameters = new HashMap<>();
parameters.put("issue", issue);
parameters.put("issueImpl", IssueImpl.class.cast(issue));
parameters.put("transientVars", transientVars);
parameters.put("args", args);
parameters.put("ps", ps);
try {
scriptManager.executeScript(script, parameters);
} catch (Exception ex) {
log.error("Error", ex);
throw ex;
}
}
示例2: fixIssueAssignment
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
private void fixIssueAssignment(final NotificationEvent notificationEvent, final EventData eventData, final IssueResult result) {
final MutableIssue issue = result.getIssue();
if (issue.getAssignee() == null) {
logger.debug("Created issue " + issue.getKey() + "; Assignee: null");
} else {
logger.debug("Created issue " + issue.getKey() + "; Assignee: " + issue.getAssignee().getName());
}
final String assigneeId = eventData.getJiraIssueAssigneeUserId();
if ((assigneeId == null) && (issue.getAssigneeId() != null)) {
logger.debug("Issue needs to be UNassigned");
assignIssue(issue, notificationEvent, eventData);
} else if ((assigneeId != null) && (!issue.getAssigneeId().equals(assigneeId))) {
final String errorMessage = "Issue assignment failed";
logger.error(errorMessage);
jiraSettingsService.addHubError(errorMessage, eventData.getHubProjectName(), eventData.getHubProjectVersion(), eventData.getJiraProjectName(), eventData.getJiraAdminUsername(), eventData.getJiraIssueCreatorUsername(),
"fixIssueAssignment");
} else {
logger.debug("Issue assignment is correct");
}
}
示例3: assignIssue
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
private void assignIssue(final MutableIssue issue, final NotificationEvent notificationEvent, final EventData eventData) {
final ApplicationUser user = jiraContext.getJiraIssueCreatorUser();
final String assigneeId = eventData.getJiraIssueAssigneeUserId();
final AssignValidationResult assignValidationResult = jiraServices.getIssueService().validateAssign(user, issue.getId(), assigneeId);
final ErrorCollection errors = assignValidationResult.getErrorCollection();
if (assignValidationResult.isValid() && !errors.hasAnyErrors()) {
logger.debug("Assigning issue to user ID: " + assigneeId);
jiraServices.getIssueService().assign(user, assignValidationResult);
updateIssue(issue, assignValidationResult, user, assigneeId);
} else {
final StringBuilder sb = new StringBuilder("Unable to assign issue ");
sb.append(issue.getKey());
sb.append(": ");
for (final String errorMsg : errors.getErrorMessages()) {
sb.append(errorMsg);
sb.append("; ");
}
final String errorMessage = sb.toString();
logger.error(errorMessage);
jiraSettingsService.addHubError(errorMessage, eventData.getHubProjectName(), eventData.getHubProjectVersion(), eventData.getJiraProjectName(), eventData.getJiraAdminUsername(), eventData.getJiraIssueCreatorUsername(),
"assignIssue");
}
}
示例4: getValidActions
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
private Collection<ValidatedAction> getValidActions(
Collection<ActionDescriptor> actionsToValidate,
ApplicationUser user,
MutableIssue issue,
IssueInputParameters parameters,
String comment) {
Collection<ValidatedAction> validations =
new ArrayList<ValidatedAction>();
for (ActionDescriptor ad : actionsToValidate) {
IssueInputParametersImpl input = new IssueInputParametersImpl();
if (comment != null) {
input.setComment(comment);
}
IssueService.TransitionValidationResult validation =
issueService.validateTransition(user, issue.getId(), ad.getId(), input);
if (validation.isValid()) {
validations.add(new ValidatedAction(ad, validation));
}
}
return validations;
}
示例5: handle
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
@Override
public Either<CommitHookHandlerError, Comment> handle(ApplicationUser user, MutableIssue issue, String commandName, List<String> args, Date commitDate)
{
final CommentService.CommentParameters commentParameters = CommentService.CommentParameters.builder()
.issue(issue)
.body(args.isEmpty() ? null : args.get(0))
.created(commitDate)
.build();
final CommentService.CommentCreateValidationResult validationResult = commentService.validateCommentCreate(user, commentParameters);
if (validationResult.isValid())
{
return Either.value(commentService.create(user, validationResult, true));
}
else
{
return Either.error(CommitHookHandlerError.fromErrorCollection(
CMD_TYPE.getName(), issue.getKey(), validationResult.getErrorCollection()));
}
}
示例6: testFindCommitInLogEntriesForProject
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
/**
* Tests that we find a particular commit in the log entries for a project.
*
* @param user
* @param issue
* @throws IndexException
* @throws URISyntaxException
* @throws RepositoryException
* @throws IOException
*/
@SuppressWarnings("deprecation")
@Test
public void testFindCommitInLogEntriesForProject(final User user, final MutableIssue issue) throws IndexException, URISyntaxException, RepositoryException, IOException {
new NonStrictExpectations() {{
issueManager.getIssueObject(anyString); result = issue;
permissionManager.hasPermission(Permissions.VIEW_VERSION_CONTROL, withAny(issue), user); result = true;
changeHistoryManager.getPreviousIssueKeys(anyLong); result = new ArrayList<String>();
repositoryManager.parseRepositoryId("id"); result = "id"; minTimes = 1;
repositoryManager.getRepository("id"); result = new GitRepository("id"); minTimes = 1;
}};
// Create the index for the test repository
testIndex();
// Look for a particular commit
final Iterator<LogEntry<GitRepository, GitCommitKey>> logEntries =
commitIndexer.getAllLogEntriesByProject("GCV", user, 0, 5, false).iterator();
Assert.assertTrue("Expected to find marker commit in history", hasCommit("095014f90aac621901d29e1e3986ad5f9e52361a", logEntries));
}
示例7: testFindCommitInLogEntriesForVersion
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
/**
* Tests that we find a particular commit in the log entries for a version.
*
* @param version
* @param user
* @param issue
* @throws IndexException
* @throws URISyntaxException
* @throws RepositoryException
* @throws IOException
*/
@SuppressWarnings("deprecation")
@Test
public void testFindCommitInLogEntriesForVersion(final Version version, final User user, final MutableIssue issue) throws IndexException, URISyntaxException, RepositoryException, IOException {
new NonStrictExpectations() {{
versionManager.getIssuesWithFixVersion(version); result = Arrays.asList(new Issue[] { issue });
issueManager.getIssueObject(anyString); result = issue;
issue.getKey(); result = "GCV-1";
permissionManager.hasPermission(Permissions.VIEW_VERSION_CONTROL, withAny(issue), user); result = true;
changeHistoryManager.getPreviousIssueKeys(anyLong); result = new ArrayList<String>();
repositoryManager.parseRepositoryId("id"); result = "id"; minTimes = 1;
repositoryManager.getRepository("id"); result = new GitRepository("id"); minTimes = 1;
}};
// Create the index for the test repository
testIndex();
// Look for a particular commit
final Iterator<LogEntry<GitRepository, GitCommitKey>> logEntries =
commitIndexer.getAllLogEntriesByVersion(version, user, 0, 5, false).iterator();
Assert.assertTrue("Expected to find marker commit in history", hasCommit("095014f90aac621901d29e1e3986ad5f9e52361a", logEntries));
}
示例8: updateIssue
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
private Issue updateIssue(final MutableIssue issueToUpdate, final AssignValidationResult assignValidationResult, final ApplicationUser userMakingChange, final String assigneeId) {
issueToUpdate.setAssigneeId(assigneeId);
final UpdateIssueRequest issueUpdate = UpdateIssueRequest.builder().eventDispatchOption(EventDispatchOption.ISSUE_UPDATED).sendMail(false).build();
logger.debug("Updating issue with assigned user ID: " + assigneeId);
final Issue updatedIssue = jiraServices.getIssueManager().updateIssue(userMakingChange, issueToUpdate, issueUpdate);
return updatedIssue;
}
示例9: handle
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
@Override
public Either<CommitHookHandlerError, Worklog> handle(ApplicationUser user, MutableIssue issue, String commandName,
List<String> args, Date commitDate)
{
JiraServiceContextImpl jiraServiceContext = new JiraServiceContextImpl(user);
String worklog = args.get(0);
Pair<String, String> durationAndComment = splitWorklogToDurationAndComment(worklog);
WorklogResult result = worklogService.validateCreate(
jiraServiceContext,
WorklogInputParametersImpl.builder().issue(issue)
.timeSpent(durationAndComment.first())
.comment(durationAndComment.second()).startDate(commitDate != null ? commitDate : new Date()).build());
if (!jiraServiceContext.getErrorCollection().hasAnyErrors())
{
return Either.value(worklogService.createAndAutoAdjustRemainingEstimate(jiraServiceContext, result, true));
}
else
{
return Either.error(CommitHookHandlerError.fromErrorCollection(CMD_TYPE.getName(), issue.getKey(),
jiraServiceContext.getErrorCollection()));
}
}
示例10: testHandleCommand_ShouldLogWithSuccess
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
@Test
public void testHandleCommand_ShouldLogWithSuccess()
{
MutableIssue sampleIssue = sampleIssue();
handler.handle(sampleUser(), sampleIssue, "time", Arrays.asList("1h 44m"), null);
verify(worklogService).validateCreate(any(JiraServiceContext.class), worklogParamsCaptor.capture());
WorklogInputParametersImpl worklogParams = worklogParamsCaptor.getValue();
assertThat(worklogParams.getTimeSpent()).isEqualTo("1h 44m");
assertThat(worklogParams.getComment()).isEmpty();
assertThat(worklogParams.getIssue()).isEqualTo(sampleIssue);
}
示例11: testHandleCommandWithComment_ShouldLogWithSuccess
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
@Test
public void testHandleCommandWithComment_ShouldLogWithSuccess()
{
MutableIssue sampleIssue = sampleIssue();
handler.handle(sampleUser(), sampleIssue, "time", Arrays.asList("2w 3d 1h 44m Total work logged in !!! "), null);
verify(worklogService).validateCreate(any(JiraServiceContext.class), worklogParamsCaptor.capture());
WorklogInputParametersImpl worklogParams = worklogParamsCaptor.getValue();
assertThat(worklogParams.getTimeSpent()).isEqualTo("2w 3d 1h 44m");
assertThat(worklogParams.getComment()).isEqualTo("Total work logged in !!!");
assertThat(worklogParams.getIssue()).isEqualTo(sampleIssue);
}
示例12: setDefaultSecurityLevel
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
private void setDefaultSecurityLevel(MutableIssue issue) throws Exception {
GenericValue project = issue.getProject();
if (
// isEnterprise() &&
project != null) {
IssueSecurityLevelManager issueSecurityLevelManager = ManagerFactory.getIssueSecurityLevelManager();
final Long levelId = issueSecurityLevelManager.getSchemeDefaultSecurityLevel(project);
if (levelId != null) {
issue.setSecurityLevel(issueSecurityLevelManager.getIssueSecurity(levelId));
}
}
}
示例13: addAdjacentNodesToGraph
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
private void addAdjacentNodesToGraph(Graph graph, Long issueId) {
if (!knownIssueIds.contains(issueId)) {
MutableIssue issueObject = issueManager.getIssueObject(issueId);
Node newNode = new Node(issueObject);
knownIssueIds.add(issueId);
graph.addNode(newNode);
}
if (this.includeOutwardLinks) {
for (IssueLink currentOutwardLink : issueLinkManager.getOutwardLinks(issueId)) {
if (includeLink(currentOutwardLink)) {
if (!knownIssueIds.contains(currentOutwardLink.getDestinationId())) {
addAdjacentNodesToGraph(graph, currentOutwardLink.getDestinationId());
}
addLink(graph, currentOutwardLink);
}
}
}
if (this.includeInwardLinks) {
for (IssueLink currentInwardLink : issueLinkManager.getInwardLinks(issueId)) {
if (includeLink(currentInwardLink)) {
if (!knownIssueIds.contains(currentInwardLink.getSourceId())) {
addAdjacentNodesToGraph(graph, currentInwardLink.getSourceId());
}
addLink(graph, currentInwardLink);
}
}
}
}
示例14: addLabels
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
public void addLabels(final MutableIssue issue, final List<String> labels) {
for (final String label : labels) {
logger.debug("Adding label: " + label);
jiraServices.getLabelManager().addLabel(jiraContext.getJiraIssueCreatorUser(), issue.getId(), label, false);
}
}
示例15: migrateIssueToWorkflow
import com.atlassian.jira.issue.MutableIssue; //导入依赖的package包/类
@Override
public void migrateIssueToWorkflow(final MutableIssue arg0, final JiraWorkflow arg1, final Status arg2)
throws WorkflowException {
}