Search in sources :

Example 1 with MessageValueReplacementResolver

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;
}
Also used : JiraResolvedCustomField(com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraResolvedCustomField) JiraCustomFieldConfig(com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldConfig) MessageValueReplacementResolver(com.synopsys.integration.alert.api.channel.jira.distribution.custom.MessageValueReplacementResolver) IssueRequestModelFieldsBuilder(com.synopsys.integration.jira.common.cloud.builder.IssueRequestModelFieldsBuilder)

Example 2 with MessageValueReplacementResolver

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());
}
Also used : ProjectComponent(com.synopsys.integration.jira.common.model.components.ProjectComponent) IssueCreationRequestModel(com.synopsys.integration.jira.common.cloud.model.IssueCreationRequestModel) MessageValueReplacementResolver(com.synopsys.integration.alert.api.channel.jira.distribution.custom.MessageValueReplacementResolver) IssueRequestModelFieldsMapBuilder(com.synopsys.integration.jira.common.model.request.builder.IssueRequestModelFieldsMapBuilder)

Example 3 with MessageValueReplacementResolver

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);
}
Also used : ProjectComponent(com.synopsys.integration.jira.common.model.components.ProjectComponent) IssueCreationRequestModel(com.synopsys.integration.jira.common.server.model.IssueCreationRequestModel) MessageValueReplacementResolver(com.synopsys.integration.alert.api.channel.jira.distribution.custom.MessageValueReplacementResolver) IssueRequestModelFieldsMapBuilder(com.synopsys.integration.jira.common.model.request.builder.IssueRequestModelFieldsMapBuilder)

Aggregations

MessageValueReplacementResolver (com.synopsys.integration.alert.api.channel.jira.distribution.custom.MessageValueReplacementResolver)3 ProjectComponent (com.synopsys.integration.jira.common.model.components.ProjectComponent)2 IssueRequestModelFieldsMapBuilder (com.synopsys.integration.jira.common.model.request.builder.IssueRequestModelFieldsMapBuilder)2 JiraCustomFieldConfig (com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraCustomFieldConfig)1 JiraResolvedCustomField (com.synopsys.integration.alert.api.channel.jira.distribution.custom.JiraResolvedCustomField)1 IssueRequestModelFieldsBuilder (com.synopsys.integration.jira.common.cloud.builder.IssueRequestModelFieldsBuilder)1 IssueCreationRequestModel (com.synopsys.integration.jira.common.cloud.model.IssueCreationRequestModel)1 IssueCreationRequestModel (com.synopsys.integration.jira.common.server.model.IssueCreationRequestModel)1