use of com.synopsys.integration.blackduck.api.generated.view.ProjectGroupsView in project synopsys-detect by blackducksoftware.
the class FindProjectGroupOperation method findProjectGroup.
public HttpUrl findProjectGroup(String projectGroupName) throws IntegrationException, DetectUserFriendlyException {
BlackDuckRequestBuilder blackDuckRequestBuilder = new BlackDuckRequestBuilder().commonGet().addBlackDuckQuery(new BlackDuckQuery("name", projectGroupName)).addBlackDuckFilter(BlackDuckRequestFilter.createFilterWithSingleValue("exactName", "true"));
BlackDuckMultipleRequest<ProjectGroupsView> requestMultiple = blackDuckRequestBuilder.buildBlackDuckRequest(projectGroupsResponses);
List<ProjectGroupsView> response = blackDuckApiClient.getAllResponses(requestMultiple);
if (response.size() != 1) {
throw new DetectUserFriendlyException("Project Group Name must have exactly 1 match on Black Duck, instead '" + projectGroupName + "' had " + response.size() + " matches.", ExitCodeType.FAILURE_BLACKDUCK_FEATURE_ERROR);
}
ProjectGroupsView result = response.get(0);
return result.getHref();
}
Aggregations