cloneIssue.setProjectId(getTargetPid()); cloneIssue.setIssueTypeId(getTargetIssueTypeId()); cloneIssue.setParentObject(getParentIssueObject()); else if ((parentBulkEditBean != null) && cloneIssue.isSubTask()) final Issue parent = getParentTargetIssue(cloneIssue.getParentId()); if (parent == null) "Could not find parent [" + cloneIssue.getParentId() + "] for subtask [" + cloneIssue.getId() + "] in the parent BulkEditBean."); cloneIssue.setParentObject(parent); cloneIssue.setSecurityLevelId(getParentIssueObject().getSecurityLevelId()); if (issueSecurityHelper.securityLevelNeedsMove(selectedIssue, cloneIssue)) cloneIssue.setSecurityLevel(null);
public void put(@Nonnull final Long id, @Nonnull Optional<MutableIssue> issue) { byId.put(id, issue); issue.ifPresent(i -> byKey.put(i.getKey(), Optional.of(i))); }
if (issue.getCreated() == null) issue.setCreated(now); if (issue.getUpdated() == null) issue.setUpdated(now); long incCount = ComponentAccessor.getProjectManager().getNextId(issue.getProjectObject()); issue.setKey(issue.getProjectObject().getKey() + "-" + incCount); if (issue.getVotes() == null) issue.setVotes(0L); if (issue.getWatches() == null) issue.setWatches(0L); issue.setWorkflowId(entry.getId()); WorkflowDescriptor descriptor = (WorkflowDescriptor) transientVars.get("descriptor"); StepDescriptor stepDescriptor = descriptor.getStep(step.getStepId()); issue.setStatusId((String) stepDescriptor.getMetaAttributes().get("jira.status.id")); issue.store(); Map<String, ModifiedValue> modifiedFields = issue.getModifiedFields(); for (final String fieldId : modifiedFields.keySet())
private void removeLinkFromParent(final MutableIssue issue, final ApplicationUser applicationUser) { if (issue.getParentId() != null) { List<IssueLink> parentLinks = issueLinkManager.getOutwardLinks(issue.getParentId()); parentLinks.stream().filter(link -> link.getIssueLinkType().isSubTaskLinkType() && link.getDestinationId().equals(issue.getId())).forEach( link -> issueLinkManager.removeIssueLink(link, applicationUser) ); } }
protected MutableIssue getTargetIssueObjectWithSecurityLevel() { MutableIssue issue = super.getTargetIssueObjectWithSecurityLevel(); issue.setParentId(issueManager.getIssueObject(((ConvertIssueToSubTaskBean) getBean()).getParentIssueKey()).getId()); return issue; }
private MutableIssue getDummyIssue() { MutableIssue dummyIssue = issueFactory.getIssue(); FieldConfigScheme fieldConfigScheme = fieldConfigSchemeManager.getFieldConfigScheme(getFieldConfigSchemeId()); if (fieldConfigScheme != null) { Collection<Project> associatedProjects = fieldConfigScheme.getAssociatedProjectObjects(); if (associatedProjects != null && associatedProjects.size() == 1) { dummyIssue.setProjectObject(associatedProjects.iterator().next()); } Collection<IssueType> associatedIssueTypes = fieldConfigScheme.getAssociatedIssueTypeObjects(); if (associatedIssueTypes != null && associatedIssueTypes.size() == 1) { dummyIssue.setIssueTypeObject(associatedIssueTypes.iterator().next()); } } return dummyIssue; } }
copyIssueBean.setOriginalKey(issueToCopy.getKey()); copyIssueBean.setBaseUrl(applicationProperties.getString(APKeys.JIRA_BASEURL)); copyIssueBean.setTargetIssueType(targetIssueType); if (issueToCopy.getPriorityObject() != null) { copyIssueBean.setPriority(issueToCopy.getPriorityObject().getName()); .isNotBlank(issueToCopy.getReporterId())) { copyIssueBean.setReporter(userMappingManager.createUserBean(issueToCopy.getReporterId())); } else if (orderableField instanceof EnvironmentSystemField) { copyIssueBean.setEnvironment(issueToCopy.getEnvironment()); } else if (orderableField instanceof AssigneeSystemField && StringUtils .isNotBlank(issueToCopy.getAssigneeId())) { copyIssueBean.setAssignee(userMappingManager.createUserBean(issueToCopy.getAssigneeId())); } else if (orderableField instanceof DescriptionSystemField) { copyIssueBean.setDescription(issueToCopy.getDescription()); } else if (orderableField instanceof DueDateSystemField) { copyIssueBean.setIssueDueDate(issueToCopy.getDueDate()); } else if (orderableField instanceof TimeTrackingSystemField && isTimeTrackingEnabled()) { if (issueToCopy.getOriginalEstimate() != null) { TimeTrackingBean timeTrackingBean = new TimeTrackingBean(issueToCopy.getOriginalEstimate(), issueToCopy.getTimeSpent(), issueToCopy.getEstimate()); copyIssueBean.setTimeTracking(timeTrackingBean); GenericValue securityLevel = issueToCopy.getSecurityLevel(); if (securityLevel != null) { String issueSecurityLevel = securityLevel.getString("name"); Set<Label> labels = issueToCopy.getLabels();
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; }
if (!issue.isSubTask()) regularIssues.put(issue.getId(), issue); if (BulkMigrateOperation.OPERATION_NAME.equals(operationName) && issue.isSubTask() && regularIssues.containsKey(issue.getParentId())) "Sub issue: " + issue.getKey() + " : discarded since parent was also present in the bulk move"); subTasksDiscarded++; issuesInContext.put(new IssueContextImpl(issue.getProjectObject(), issue.getIssueTypeObject()), issue);
getIssueManager().getIssueObject(getMoveIssueBean().getUpdatedIssue().getId()); final String sourceIssueKey = getMoveIssueBean().getSourceIssueKey(); if (!originalIssueObject.getKey().equals(sourceIssueKey)) addErrorMessage(getText("moveissue.error.already.moved", sourceIssueKey, originalIssueObject.getKey())); return ERROR; if (updatedIssueObject.getWorkflowId() != null) originalWfId = updatedIssueObject.getWorkflowId().toString(); workflowMigrationMapping.put(updatedIssueObject.getStatusObject().getId(), getTargetStatusId()); if (!updatedIssueObject.isSubTask() && !updatedIssueObject.getSubTaskObjects().isEmpty()) Collection<Issue> subTasks = updatedIssueObject.getSubTaskObjects(); for (final Issue subtask : subTasks) updatedIssueObject.setProjectObject(project); final long incCount = getProjectManager().getNextId(project); updatedIssueObject.setNumber(incCount); attachmentManager.moveAttachments(originalIssueObject, updatedIssueObject.getKey()); if (!updatedIssueObject.isSubTask() && !updatedIssueObject.getSubTaskObjects().isEmpty())
final Project currentProject = oldIssue.getProjectObject(); final Project targetProject = bulkEditBean.getTargetProject(); currentProject.getName(), targetProject.getId().toString(), targetProject.getName())); issueChangeHolder.addChangeItem( new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Key", null, oldIssue.getKey(), null, newIssue.getKey())); new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Workflow", oldIssue.getWorkflowId().toString(), originalWorkflow.getName(), newIssue.getWorkflowId().toString(), bulkEditBean.getTargetWorkflow().getName())); final Status originalStatus = oldIssue.getStatusObject(); final Status newStatus = newIssue.getStatusObject(); if (originalStatus != null && !originalStatus.equals(newStatus)) final Map<String, ModifiedValue> modifiedFields = newIssue.getModifiedFields(); for (final String fieldId : modifiedFields.keySet()) .getFieldLayout(newIssue.getProjectObject(), newIssue.getIssueTypeId()) .getFieldLayoutItem(field); field.updateValue(fieldLayoutItem, newIssue, (ModifiedValue) modifiedFields.get(fieldId), if (oldIssue.getIssueType().isSubTask() && !newIssue.getIssueType().isSubTask()) final Issue parentIssue = oldIssue.getParentObject(); if( parentIssue!=null ) else if (!oldIssue.getIssueType().isSubTask() && newIssue.getIssueType().isSubTask())
newIssue.getParentObject().getId(), newIssue.getParentObject().getKey(), issue.getId(), issue.getKey()); log.warn(errorMsg); throw new IllegalStateException(errorMsg); final boolean issueProjectMoved = !issue.getProjectId().equals(bulkEditBean.getTargetPid()); if (issueProjectMoved) newIssue.setNumber(incCount); attachmentManager.moveAttachments(issue, newIssue.getKey()); if (newStatus == null) newStatus = issue.getStatusObject(); newIssue.setUpdated(new Timestamp(System.currentTimeMillis())); newIssue.store();
@Override public Issue updateIssue(ApplicationUser user, MutableIssue issue, UpdateIssueRequest updateIssueRequest) { issues.put(issue.getId(), issue); return issue; }
targetSubTask.setIssueTypeId(newIssueType); targetSubTask.setProjectObject(project); final long incCount = getProjectManager().getNextId(project); targetSubTask.setNumber(incCount); attachmentManager.moveAttachments(originalSubTask, targetSubTask.getKey()); if (!isWorkflowMatch(originalSubTask.getIssueTypeId(), targetSubTask.getIssueTypeId())) targetSubTask.setUpdated(UtilDateTime.nowTimestamp()); targetSubTask.store();
IssueCreationResultBean resultBean = new IssueCreationResultBean(createIssueResult.getIssue().getKey(), createIssueResult.getIssue().getProjectObject().getKey(), createIssueResult.getIssue().getId()); errors.addErrorMessage(authenticationContext.getI18nHelper().getText("cpji.errors.issue.created.with.errors", createIssueResult.getIssue().getKey())); throw new IssueCreatedWithErrorsException(resultBean, errors);
public Response createIssue(IssueUpdateBean createRequest, @Context UriInfo uriInfo) { IssueInputParametersAssembler.Result result = issueInputParametersAssembler.makeCreateAssembler(createRequest); if (result.getErrors().hasAnyErrors()) { throw error(ErrorCollection.of(result.getErrors())); } IssueInputParameters parameters = result.getParameters(); MutableIssue issue; if (result.getParentIdorKey() == null) { issue = createIssue(parameters); } else { issue = createSubtask(parameters, result.getParentIdorKey()); } IssueCreateResponse response = new IssueCreateResponse() .id(issue.getId().toString()) .key(issue.getKey()) .self(resourceUriBuilder.build(uriInfo, IssueResource.class, String.valueOf(issue.getId())).toString()); return status(CREATED).entity(response).build(); }
@RequiresXsrfCheck protected String doExecute() throws Exception { MutableIssue issue = getMutableIssue(); // update the assignee system field OrderableField field = (OrderableField) fieldManager.getField(IssueFieldConstants.ASSIGNEE); FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue).getFieldLayoutItem(field); field.updateIssue(fieldLayoutItem, issue, getFieldValuesHolder()); // This hack is here until the comment field becomes placeable on screens by the users OrderableField commentField = (OrderableField) fieldManager.getField(IssueFieldConstants.COMMENT); FieldLayoutItem fieldLayoutItem2 = fieldLayoutManager.getFieldLayout(issue.getProjectObject(), issue.getIssueTypeId()).getFieldLayoutItem(commentField); commentField.updateIssue(fieldLayoutItem2, issue, getFieldValuesHolder()); issueManager.updateIssue(getLoggedInUser(), issue, ISSUE_ASSIGNED, true); if (isInlineDialogMode()) { return returnComplete(); } return getRedirect("/browse/" + issue.getKey()); }
protected MutableIssue getIssue() { if (issue == null) { issue = issueFactory.getIssue(); } issue.setProjectId(getProject().getId()); issue.setIssueTypeId(getIssueTypeObject().getId()); return issue; }
IssueType targetIssueType = getConstantsManager().getIssueType(getTargetIssueType()); String newKey = newIssue.getKey(); newIssue.setIssueTypeObject(getTargetIssueTypeObject()); changeHolder.addChangeItem(new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Workflow", originalWfId, getWorkflowManager().getWorkflow(getIssue()).getName(), newIssue.getWorkflowId().toString(), getWorkflowForType(getTargetPid(), getTargetIssueType()).getName())); newIssue.store(); Map<String, ModifiedValue> modifiedFields = newIssue.getModifiedFields(); for (final String fieldId : modifiedFields.keySet()) newIssue.resetModifiedFields();
String leadKey = null; ApplicationUser lead; if (issue.getComponentObjects() != null) lead = issue.getProjectObject().getProjectLead(); leadKey = lead == null ? null : lead.getKey(); issue.getProjectObject().getName() + " does not exist"); return; issue.setAssignee(lead); if (issue.isCreated()) issue.store();