use of com.synopsys.integration.alert.api.channel.jira.distribution.custom.MessageValueReplacementResolver in project hub-alert by blackducksoftware.
the class JiraIssueCreationRequestCreator method createIssueRequestModel.
public IssueRequestModelFieldsBuilder createIssueRequestModel(String summary, String description, String projectId, String issueType, Collection<JiraCustomFieldConfig> customFields, MessageReplacementValues customFieldReplacementValues) {
IssueRequestModelFieldsBuilder fieldsBuilder = new IssueRequestModelFieldsBuilder().setSummary(summary).setDescription(description).setProject(projectId).setIssueType(issueType);
for (JiraCustomFieldConfig customField : customFields) {
MessageValueReplacementResolver messageValueReplacementResolver = new MessageValueReplacementResolver(customFieldReplacementValues);
String replacedFieldValue = messageValueReplacementResolver.createReplacedFieldValue(customField.getFieldOriginalValue());
customField.setFieldReplacementValue(replacedFieldValue);
JiraResolvedCustomField resolvedCustomField = jiraCustomFieldResolver.resolveCustomField(customField);
fieldsBuilder.setValue(resolvedCustomField.getFieldId(), resolvedCustomField.getFieldValue());
}
return fieldsBuilder;
}
use of com.synopsys.integration.alert.api.channel.jira.distribution.custom.MessageValueReplacementResolver in project hub-alert by blackducksoftware.
the class JiraCloudIssueCreator method createIssueCreationRequest.
@Override
protected IssueCreationRequestModel createIssueCreationRequest(IssueCreationModel alertIssueCreationModel, MessageReplacementValues replacementValues) throws AlertException {
ProjectComponent jiraProject = retrieveProjectComponent();
String issueSummary = distributionDetails.getIssueSummary();
String title = alertIssueCreationModel.getTitle();
if (StringUtils.isNotEmpty(issueSummary)) {
MessageValueReplacementResolver messageValueReplacementResolver = new MessageValueReplacementResolver(replacementValues);
title = messageValueReplacementResolver.createReplacedFieldValue(issueSummary);
}
IssueRequestModelFieldsMapBuilder fieldsBuilder = jiraIssueCreationRequestCreator.createIssueRequestModel(title, alertIssueCreationModel.getDescription(), jiraProject.getId(), distributionDetails.getIssueType(), replacementValues, distributionDetails.getCustomFields());
return new IssueCreationRequestModel(distributionDetails.getIssueCreatorEmail(), distributionDetails.getIssueType(), distributionDetails.getProjectNameOrKey(), fieldsBuilder, List.of());
}
use of com.synopsys.integration.alert.api.channel.jira.distribution.custom.MessageValueReplacementResolver in project hub-alert by blackducksoftware.
the class JiraServerIssueCreator method createIssueCreationRequest.
@Override
protected IssueCreationRequestModel createIssueCreationRequest(IssueCreationModel alertIssueCreationModel, MessageReplacementValues replacementValues) throws AlertException {
ProjectComponent jiraProject = retrieveProjectComponent();
String issueSummary = distributionDetails.getIssueSummary();
String title = alertIssueCreationModel.getTitle();
if (StringUtils.isNotEmpty(issueSummary)) {
MessageValueReplacementResolver messageValueReplacementResolver = new MessageValueReplacementResolver(replacementValues);
title = messageValueReplacementResolver.createReplacedFieldValue(issueSummary);
}
IssueRequestModelFieldsMapBuilder fieldsBuilder = jiraIssueCreationRequestCreator.createIssueRequestModel(title, alertIssueCreationModel.getDescription(), jiraProject.getId(), distributionDetails.getIssueType(), replacementValues, distributionDetails.getCustomFields());
return new IssueCreationRequestModel(distributionDetails.getIssueCreatorUsername(), distributionDetails.getIssueType(), distributionDetails.getProjectNameOrKey(), fieldsBuilder);
}
Aggregations