Issue createIssueForExternalIssue(final ExternalIssue externalIssue) { final MutableIssue issue = issueFactory.getIssue(); issue.setProjectId(new Long(externalIssue.getProject())); issue.setIssueTypeId(externalIssue.getIssueType()); issue.setReporterId(externalIssue.getReporter()); issue.setAssigneeId(externalIssue.getAssignee()); issue.setSummary(externalIssue.getSummary()); issue.setDescription(externalIssue.getDescription()); issue.setEnvironment(externalIssue.getEnvironment()); issue.setPriorityId(externalIssue.getPriority()); issue.setResolutionId(externalIssue.getResolution()); issue.setCreated(toTimeStamp(externalIssue.getCreated())); issue.setUpdated(toTimeStamp(externalIssue.getUpdated())); issue.setDueDate(toTimeStamp(externalIssue.getDuedate())); //NOTE: This HAS to come after the setResolutionId() call, otherwise that will override this date. issue.setResolutionDate(toTimeStamp(externalIssue.getResolutionDate())); issue.setVotes(externalIssue.getVotes()); issue.setOriginalEstimate(externalIssue.getOriginalEstimate()); issue.setTimeSpent(externalIssue.getTimeSpent()); issue.setEstimate(externalIssue.getEstimate()); if (externalIssue.getSecurityLevel() != null) { issue.setSecurityLevelId(new Long(externalIssue.getSecurityLevel())); } return issue; }
private void setNotCloningFieldsToBlankByDefault() { getIssueObject().setCreated(null); getIssueObject().setUpdated(null); getIssueObject().setVotes(null); getIssueObject().setWatches(0L); getIssueObject().setStatus(null); getIssueObject().setWorkflowId(null); // Ensure that the 'time spent' and 'remaining estimated' are not cloned - JRA-7165 // We need to copy the value of 'original estimate' to the value 'remaining estimate' as they must be kept in sync // until work is logged on an issue. getIssueObject().setEstimate(getOriginalIssue().getOriginalEstimate()); getIssueObject().setTimeSpent(null); //JRA-18731: Cloning a resolved issue will result in an open issue. The resolution date should be reset. getIssueObject().setResolutionDate(null); // If the user does not have permission to modify the reporter, initialise the reporter to be the remote user if (!isCanModifyReporter()) { getIssueObject().setReporter(getLoggedInUser()); } }