@Override protected void finaliseOperation(String finalValue, IssueInputParameters parameters, ErrorCollection errors) { parameters.addCustomFieldValue(field.getId(), (finalValue != null) ? finalValue.toString() : null); }
private IssueInputParameters getIssueInputParameters(String projectId, String issueTypeId, String summary, ApplicationUser reporter) { final IssueInputParameters issueInputParameters = new IssueInputParametersImpl(); issueInputParameters.setProjectId(new Long(projectId)); issueInputParameters.setIssueTypeId(issueTypeId); issueInputParameters.setSummary(summary); issueInputParameters.setReporterId(reporter.getName()); issueInputParameters.setAssigneeId("-1"); issueInputParameters.setPriorityId(constantsManager.getDefaultPriorityObject().getId()); return issueInputParameters; }
private void performAddOperation(CommentJsonBean commentJson, IssueInputParameters parameters, ErrorCollection errors) { parameters.getActionParameters().put(CommentSystemField.CREATE_COMMENT, new String[] { "true" }); final List<String> commentParams = new ArrayList<String>(); commentParams.add(commentJson.getBody()); parameters.getActionParameters().put(IssueFieldConstants.COMMENT, commentParams.toArray(new String[commentParams.size()])); }
@Override public void validateCreateIssueFields(final JiraServiceContext jiraServiceContext, final Collection<String> providedFields, final Issue issueObject, final FieldScreenRenderer fieldScreenRenderer, final OperationContext operationContext, final IssueInputParameters issueInputParameters, final I18nHelper i18n) { validateCreateIssueFields(jiraServiceContext, providedFields, issueObject, fieldScreenRenderer, operationContext, issueInputParameters.getActionParameters(), issueInputParameters.applyDefaultValuesWhenParameterNotProvided(), issueInputParameters.skipScreenCheck(), i18n); }
private void initProjectAndIssueType(Map<String, Object> fields) { for (Map.Entry<String, Object> e : fields.entrySet()) { String fieldId = e.getKey(); Object value = e.getValue(); JsonData data = new JsonData(value); if ("project".equals(fieldId)) { parameters.setProjectId(parseProject(fieldId, data, errors)); } if ("issuetype".equals(fieldId)) { parameters.setIssueTypeId(parseIssueType(fieldId, data, errors)); } } }
issueInputParameters.setProjectId(projectId); issueInputParameters.setIssueTypeId(rIssue.getType()); issueInputParameters.setSummary(rIssue.getSummary()); if (StringUtils.isNotEmpty(rIssue.getReporter())) issueInputParameters.setReporterId(rIssue.getReporter()); issueInputParameters.setReporterId(user.getName()); issueInputParameters.setAssigneeId(rIssue.getAssignee()); issueInputParameters.setDescription(rIssue.getDescription()); issueInputParameters.setEnvironment(rIssue.getEnvironment()); issueInputParameters.setStatusId(rIssue.getStatus()); issueInputParameters.setPriorityId(rIssue.getPriority()); issueInputParameters.setResolutionId(rIssue.getResolution()); issueInputParameters.setSecurityLevelId(securityLevelId); issueInputParameters.setFixVersionIds(SoapUtils.getRemoteEntityIdsAsLong(rIssue.getFixVersions())); issueInputParameters.setAffectedVersionIds(SoapUtils.getRemoteEntityIdsAsLong(rIssue.getAffectsVersions())); issueInputParameters.setComponentIds(SoapUtils.getRemoteEntityIdsAsLong(rIssue.getComponents())); issueInputParameters.setDueDate(dateTimeFormatter.format(rIssue.getDuedate())); issueInputParameters.addCustomFieldValue(fullCfKey, sanitisedValues); issueInputParameters.addCustomFieldValue(fullCfKey, values); issueInputParameters.setProvidedFields(getProvidedFields(user, project, issueInputParameters));
final String[] values = issueInputParameters.getCustomFieldValue(customFieldId); issueInputParameters.addCustomFieldValue(customFieldId, sanitisedValues); if (issueInputParameters.isFieldPresent(orderableField.getId())) orderableField.populateFromParams(workflowTransitionParams, issueInputParameters.getActionParameters());
private void validateAndPopulateParamsWithScreenCheck(MutableIssue issue, IssueInputParameters issueInputParameters, Map<String, Object> fieldValuesHolder, OperationContext operationContext, ErrorCollection errorCollection, I18nHelper i18n, FieldScreenRenderer fieldScreenRenderer) final boolean retainIssueValues = issueInputParameters.retainExistingValuesWhenParameterNotProvided(); final boolean onlyValidatePresentFields = issueInputParameters.onlyValidatePresentFieldsWhenRetainingExistingValues(); if (retainIssueValues && !issueInputParameters.isFieldPresent(orderableField.getId())) orderableField.populateFromParams(fieldValuesHolder, issueInputParameters.getActionParameters());
@Override public void populateInputParams(CachingUserMapper userMapper, IssueInputParameters inputParameters, CopyIssueBean copyIssueBean, FieldLayoutItem fieldLayoutItem, Project project, IssueType issueType) { MappingResult mappingResult = getMappingResult(userMapper, copyIssueBean, project); if (!mappingResult.hasOneValidValue() && fieldLayoutItem.isRequired()) { String[] defaultFieldValue = defaultFieldValuesManager.getDefaultFieldValue(project.getKey(), getFieldId(), issueType.getName()); if (defaultFieldValue != null) { inputParameters.getActionParameters().put(getFieldId(), defaultFieldValue); } } else { inputParameters.setSummary(copyIssueBean.getSummary()); } }
@Override public void populateInputParams(CachingUserMapper userMapper, IssueInputParameters inputParameters, CopyIssueBean copyIssueBean, FieldLayoutItem fieldLayoutItem, Project project, IssueType issueType) { MappingResult mappingResult = getMappingResult(userMapper, copyIssueBean, project); if (!mappingResult.hasOneValidValue() && fieldLayoutItem.isRequired()) { String[] defaultFieldValue = defaultFieldValuesManager.getDefaultFieldValue(project.getKey(), getFieldId(), issueType.getName()); if (defaultFieldValue != null) { inputParameters.getActionParameters().put(getFieldId(), defaultFieldValue); } } else { inputParameters.setProjectId(project.getId()); } }
@Override public void populateInputParams(CachingUserMapper userMapper, IssueInputParameters inputParameters, CopyIssueBean copyIssueBean, FieldLayoutItem fieldLayoutItem, Project project, IssueType issueType) { MappingResult mappingResult = getMappingResult(userMapper, copyIssueBean, project); if (!mappingResult.hasOneValidValue() && fieldLayoutItem.isRequired()) { String[] defaultFieldValue = defaultFieldValuesManager.getDefaultFieldValue(project.getKey(), getFieldId(), issueType.getName()); if (defaultFieldValue != null) { inputParameters.getActionParameters().put(getFieldId(), defaultFieldValue); } } else { final IssueType mappedIssueType = findIssueType(copyIssueBean, project); inputParameters.setIssueTypeId(mappedIssueType.getId()); } }
@Override public void populateInputParams(CachingUserMapper userMapper, IssueInputParameters inputParameters, CopyIssueBean copyIssueBean, FieldLayoutItem fieldLayoutItem, Project project, IssueType issueType) { MappingResult mappingResult = getMappingResult(userMapper, copyIssueBean, project); if (!mappingResult.hasOneValidValue() && fieldLayoutItem.isRequired()) { String[] defaultFieldValue = defaultFieldValuesManager.getDefaultFieldValue(project.getKey(), getFieldId(), issueType.getName()); if (defaultFieldValue != null) { inputParameters.getActionParameters().put(getFieldId(), defaultFieldValue); } } else { Priority priority = findPriority(copyIssueBean.getPriority()); inputParameters.setPriorityId(priority.getId()); } }
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; }
@Override public void populateInputParams(CachingUserMapper userMapper, IssueInputParameters inputParameters, CopyIssueBean copyIssueBean, FieldLayoutItem fieldLayoutItem, Project project, IssueType issueType) { final Date date = copyIssueBean.getIssueDueDate(); if (date != null) { inputParameters.setDueDate(dateFieldFormat.formatDatePicker(date)); } else if (fieldLayoutItem.isRequired()) { String[] defaultFieldValue = defaultFieldValuesManager.getDefaultFieldValue(project.getKey(), getFieldId(), issueType.getName()); if (defaultFieldValue != null) { inputParameters.getActionParameters().put(getFieldId(), defaultFieldValue); } } }
@Override public void populateInputParams(CachingUserMapper userMapper, IssueInputParameters inputParameters, CopyIssueBean copyIssueBean, FieldLayoutItem fieldLayoutItem, Project project, IssueType issueType) { MappingResult mappingResult = getMappingResult(userMapper, copyIssueBean, project); if (!mappingResult.hasOneValidValue() && fieldLayoutItem.isRequired()) { String[] defaultFieldValue = defaultFieldValuesManager.getDefaultFieldValue(project.getKey(), getFieldId(), issueType.getName()); if (defaultFieldValue != null) { inputParameters.getActionParameters().put(getFieldId(), defaultFieldValue); } } else { inputParameters.setEnvironment(copyIssueBean.getEnvironment()); } }
@Override public void populateInputParams(CachingUserMapper userMapper, IssueInputParameters inputParameters, CopyIssueBean copyIssueBean, FieldLayoutItem fieldLayoutItem, Project project, IssueType issueType) { MappingResult mappingResult = getMappingResult(userMapper, copyIssueBean, project); if (!mappingResult.hasOneValidValue() && fieldLayoutItem.isRequired()) { String[] defaultFieldValue = defaultFieldValuesManager.getDefaultFieldValue(project.getKey(), getFieldId(), issueType.getName()); if (defaultFieldValue != null) { inputParameters.getActionParameters().put(getFieldId(), defaultFieldValue); } } else { inputParameters.setDescription(copyIssueBean.getDescription()); } }
Long projectId = parameters.getProjectId(); if (projectId == null) return; String issueTypeId = parameters.getIssueTypeId(); if (issueTypeId == null) parameters.setApplyDefaultValuesWhenParameterNotProvided(true); build(request, getValidFieldsForCreate(issueCtx), true); if (!errors.hasAnyErrors())
MutableIssue validateAndSetProject(MutableIssue issue, IssueInputParameters issueInputParameters, Map<String, Object> fieldValuesHolder, ErrorCollection errorCollection, I18nHelper i18n) { issueCreationHelperBean.validateProject(issue, new OperationContextImpl(IssueOperations.CREATE_ISSUE_OPERATION, fieldValuesHolder), issueInputParameters.getActionParameters(), errorCollection, i18n); if (!errorCollection.hasAnyErrors()) { issue.setProjectId(issueInputParameters.getProjectId()); } return issue; }
@Override protected void finaliseOperation(String finalValue, IssueInputParameters parameters, ErrorCollection errors) { parameters.setReporterId(finalValue); }
@Override protected void finaliseOperation(String finalValue, IssueInputParameters parameters, ErrorCollection errors) { parameters.setAssigneeId(finalValue); }