use of com.synopsys.integration.blackduck.api.manual.temporary.component.IssueRequest in project hub-alert by blackducksoftware.
the class BlackDuckProviderIssueHandler method createIssueRequestModel.
private IssueRequest createIssueRequestModel(BlackDuckProviderIssueModel issueModel) {
IssueRequest blackDuckIssueRequest = new IssueRequest();
blackDuckIssueRequest.setIssueId(issueModel.getKey());
blackDuckIssueRequest.setIssueLink(issueModel.getLink());
blackDuckIssueRequest.setIssueAssignee(issueModel.getAssignee());
blackDuckIssueRequest.setIssueStatus(issueModel.getStatus());
blackDuckIssueRequest.setIssueDescription(issueModel.getSummary());
return blackDuckIssueRequest;
}
use of com.synopsys.integration.blackduck.api.manual.temporary.component.IssueRequest in project hub-alert by blackducksoftware.
the class BlackDuckProviderIssueHandler method createOrUpdateBlackDuckIssue.
public void createOrUpdateBlackDuckIssue(BlackDuckProviderIssueModel issueModel, @Nullable String bomComponentVersionIssuesUrl, String projectVersionUrl) throws IntegrationException {
Optional<ProjectVersionIssuesView> optionalExistingIssue = retrieveExistingIssue(projectVersionUrl, issueModel.getKey());
Date currentDate = Date.from(Instant.now());
IssueRequest issueRequestModel = createIssueRequestModel(issueModel);
if (optionalExistingIssue.isPresent()) {
ProjectVersionIssuesView existingIssue = optionalExistingIssue.get();
issueRequestModel.setIssueDescription(existingIssue.getIssueDescription());
issueRequestModel.setIssueCreatedAt(existingIssue.getIssueCreatedAt());
issueRequestModel.setIssueUpdatedAt(currentDate);
// The request uri should point at the specific issue for PUT requests
HttpUrl requestUri = existingIssue.getHref();
performRequest(requestUri, HttpMethod.PUT, issueRequestModel);
} else if (null != bomComponentVersionIssuesUrl) {
issueRequestModel.setIssueCreatedAt(currentDate);
issueRequestModel.setIssueUpdatedAt(null);
HttpUrl requestUri = new HttpUrl(bomComponentVersionIssuesUrl);
performRequest(requestUri, HttpMethod.POST, issueRequestModel);
}
}
Aggregations