MutableIssue validateAndSetIssueType(MutableIssue issue, IssueInputParameters issueInputParameters, Map<String, Object> fieldValuesHolder, ErrorCollection errorCollection, I18nHelper i18n) { issueCreationHelperBean.validateIssueType(issue, new OperationContextImpl(IssueOperations.CREATE_ISSUE_OPERATION, fieldValuesHolder), issueInputParameters.getActionParameters(), errorCollection, i18n); if (!errorCollection.hasAnyErrors()) { issue.setIssueTypeId(issueInputParameters.getIssueTypeId()); } return issue; }
private Collection<String> getProvidedFields(final User user, final Project project, final IssueInputParameters issueInputParameters) { final Collection<String> providedFields = new ArrayList<String>(); final MutableIssue contextIssue = issueFactory.getIssue(); // Most calls using the issue object will fail unless the issue object has the project and issue type are set contextIssue.setProjectObject(project); contextIssue.setIssueTypeId(issueInputParameters.getIssueTypeId()); FieldScreenRenderer renderer = issueCreationHelperBean.createFieldScreenRenderer(user, contextIssue); FieldLayout fieldLayout = renderer.getFieldLayout(); List visibleLayoutItems = fieldLayout.getVisibleLayoutItems(user, project, EasyList.build(issueInputParameters.getIssueTypeId())); for (Iterator iterator = visibleLayoutItems.iterator(); iterator.hasNext();) { FieldLayoutItem fieldLayoutItem = (FieldLayoutItem) iterator.next(); OrderableField orderableField = fieldLayoutItem.getOrderableField(); final String fieldId = orderableField.getId(); if (issueInputParameters.isFieldSet(fieldId) || fieldLayoutItem.isRequired()) { providedFields.add(fieldId); } } return providedFields; }
protected MutableIssue getIssue() { if (issue == null) { issue = issueFactory.getIssue(); } issue.setProjectId(getProject().getId()); issue.setIssueTypeId(getIssueTypeObject().getId()); return issue; }
issue.setIssueTypeId(issueType);
public MutableIssue getIssueObject() { if (getIssueObjectWithoutDatabaseRead() == null) { setIssueObject(issueFactory.getIssue()); // Most calls using the issue object will fail unless the issue object has the project and issue type are set getIssueObject().setProjectId(getPid()); getIssueObject().setIssueTypeId(getIssuetype()); } return getIssueObjectWithoutDatabaseRead(); }
public RemoteField[] getFieldsForCreate(User user, String projectKey, Long issueTypeId) throws RemoteException { //JRA-13703: Need to have the user available in the authenticationContext, such that fields // can carry out permission checks. final User oldUser = setRemoteUserInJira(user); try { if (issueTypeId == null) { throw new RemoteValidationException("The issue type must be specified"); } Project project = projectManager.getProjectObjByKey(projectKey); if (project == null || !permissionManager.hasPermission(Permissions.CREATE_ISSUE, project, user)) { throw new RemotePermissionException("You do not have create permission for this project."); } MutableIssue issue = issueFactory.getIssue(); issue.setProjectId(project.getId()); issue.setIssueTypeId(issueTypeId.toString()); return soapUtilsBean.getFieldsForCreate(user, issue); } finally { setRemoteUserInJira(oldUser); } }
/** * Get the issue with updated Issue type and status. * Subclasses can over-ride if they need to set their own fields. * E.g Issue to sub-task conversion sets the new parent issue. * Security level remains intact. * * @return Cloned issue with updated issue ype and status */ protected MutableIssue getTargetIssueObjectWithSecurityLevel() { final ConvertIssueBean bean = getBean(); MutableIssue targetIssue = issueManager.getIssueObject(getIssue().getId()); targetIssue = issueFactory.cloneIssueNoParent(targetIssue); targetIssue.setIssueTypeId(bean.getIssueType()); if (bean.getTargetStatusId() != null) { targetIssue.setStatusId(bean.getTargetStatusId()); } return targetIssue; }
protected void doValidation() { try { issueCreationHelperBean.validateProject(getIssueObject(), this, ActionContext.getParameters(), this, this); if (!invalidInput()) { getIssueObject().setProjectId(getPid()); } issueCreationHelperBean.validateIssueType(getIssueObject(), this, ActionContext.getParameters(), this, this); if (!invalidInput()) { getIssueObject().setIssueTypeId(getIssuetype()); } } catch (Exception e) { log.error(e, e); addErrorMessage("An exception occurred: " + e + "."); } }
targetSubTask.setIssueTypeId(newIssueType);
cloneIssue.setIssueTypeId(getTargetIssueTypeId());
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; }
getIssueObject().setIssueTypeId(getIssuetype());