MutableIssue copyIssue(MutableIssue issue) { return issueFactory.getIssue(issue.getGenericValue()); }
@Override public Issue updateIssue(ApplicationUser user, MutableIssue issue, UpdateIssueRequest updateIssueRequest) { validateUpdateIssueTextFieldsLength(issue); // Get the original issue before we store the new data GenericValue originalIssueGV = issue.getGenericValue(); // Generate all of our change items and give the fields a chance to store their changes if needed + build // up the modified text to analyze DefaultIssueChangeHolder issueChangeHolder = updateFieldValues(issue, new StringBuffer()); // Reset the fields as they all have been persisted to the db. issue.resetModifiedFields(); // Perform the update which will also fire the event and create the change group/items doUpdate(user, issue, originalIssueGV, issueChangeHolder, updateIssueRequest); return issue; }
public ActionDescriptor getActionDescriptor(WorkflowProgressAware workflowProgressAware) throws Exception { JiraWorkflow workflow = getWorkflow(workflowProgressAware.getIssue().getGenericValue()); return workflow.getDescriptor().getAction(workflowProgressAware.getAction()); }
GenericValue changeGroup = ChangeLogUtils.createChangeGroup(user, issue.getGenericValue(), issue.getGenericValue(), changeHolder.getChangeItems(), false); transientVars.put("changeGroup", changeGroup);
/** * Migrates given issue to new workflow and sets new status on it. * * @param issue issue to migrate * @param newWorkflow new workflow * @param status new status * @throws WorkflowException if migration fails */ public void migrateIssueToWorkflow(MutableIssue issue, JiraWorkflow newWorkflow, Status status) throws WorkflowException { final GenericValue issueGV = issue.getGenericValue(); migrateIssueToWorkflow(issueGV, newWorkflow, status != null ? ((StatusImpl) status).getGenericValue() : null); issue.setWorkflowId(issueGV.getLong("workflowId")); issue.setStatusId(issueGV.getString("status")); }
private void moveIssueInTxn(Transaction txn, MutableIssue originalIssueObject, MutableIssue updatedIssueObject, String originalWfId) throws GenericEntityException { // Only migrate the issue if the target workflow is different from the current workflow if (!isWorkflowMatch(getCurrentIssueType(), getTargetIssueType())) { migrateIssueToWorkflow(updatedIssueObject, getIssue().getString("type"), getWorkflowForType(getTargetPid(), getTargetIssueType()), getTargetStatus()); } // Log and set new details for target updatedIssueObject.setUpdated(new Timestamp(System.currentTimeMillis())); IssueChangeHolder issueChangeHolder = moveIssueDetails(updatedIssueObject, originalIssueObject.getKey(), originalWfId); //create and store the changelog for this whole process GenericValue updateLog = ChangeLogUtils.createChangeGroup(getLoggedInUser(), originalIssueObject.getGenericValue(), updatedIssueObject.getGenericValue(), issueChangeHolder.getChangeItems(), false); // remember the old issue key so we can do fast URL redirects if (projectIsMoved()) issueManager.recordMovedIssueKey(originalIssueObject); txn.commit(); dispatchIssueUpdateEvents(updatedIssueObject, updateLog, issueChangeHolder); }
try if (issue.getGenericValue() != null)
Map<String, Object> actionParams = EasyMap.build("issue", mIssue.getGenericValue(), "issueObject", mIssue, "remoteUser", jiraAuthenticationContext.getUser()); actionParams.put("sendMail", Boolean.FALSE);
protected void doUpdate(ApplicationUser user, MutableIssue issue, GenericValue originalIssueGV, DefaultIssueChangeHolder issueChangeHolder, UpdateIssueRequest updateRequest) { final EventDispatchOption dispatchOption = updateRequest.getEventDispatchOption(); IssueUpdateBean issueUpdateBean = new IssueUpdateBean(issue.getGenericValue(), originalIssueGV, dispatchOption.getEventTypeId(), user, updateRequest.isSendMail(), true); issueUpdateBean.setComment(issueChangeHolder.getComment()); issueUpdateBean.setChangeItems(issueChangeHolder.getChangeItems()); issueUpdateBean.setDispatchEvent(dispatchOption.isEventBeingSent()); issueUpdateBean.setHistoryMetadata(updateRequest.getHistoryMetadata()); issueUpdateBean.setParams(MapBuilder.newBuilder("eventsource", IssueEventSource.ACTION).toMutableMap()); issueUpdater.doUpdate(issueUpdateBean, false); }