Search in sources :

Example 1 with ProjectGroupFindResult

use of com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectGroupFindResult in project synopsys-detect by blackducksoftware.

the class BlackDuckProjectVersionStepRunner method runAll.

ProjectVersionWrapper runAll(NameVersion projectNameVersion, BlackDuckRunData blackDuckRunData) throws DetectUserFriendlyException, OperationException {
    CloneFindResult cloneFindResult = findClone(projectNameVersion.getName(), blackDuckRunData);
    ProjectGroupFindResult projectGroupFindResult = findProjectGroup(blackDuckRunData);
    ProjectVersionLicenseFindResult projectVersionLicensesFindResult = findLicense(blackDuckRunData);
    ProjectVersionWrapper projectVersion = operationFactory.syncProjectVersion(projectNameVersion, projectGroupFindResult, cloneFindResult, projectVersionLicensesFindResult, blackDuckRunData);
    ParentProjectMapOptions mapOptions = operationFactory.calculateParentProjectMapOptions();
    if (StringUtils.isNotBlank(mapOptions.getParentProjectName()) || StringUtils.isNotBlank(mapOptions.getParentProjectVersionName())) {
        operationFactory.mapToParentProject(mapOptions.getParentProjectName(), mapOptions.getParentProjectVersionName(), projectVersion, blackDuckRunData);
    }
    String applicationId = operationFactory.calculateApplicationId();
    if (StringUtils.isBlank(applicationId)) {
        logger.debug("No 'Application ID' to set.");
    } else {
        operationFactory.setApplicationId(applicationId, projectVersion, blackDuckRunData);
    }
    CustomFieldDocument customFieldDocument = operationFactory.calculateCustomFields();
    if (customFieldDocument == null || (customFieldDocument.getProject().size() == 0 && customFieldDocument.getVersion().size() == 0)) {
        logger.debug("No custom fields to set.");
    } else {
        operationFactory.updateCustomFields(customFieldDocument, projectVersion, blackDuckRunData);
    }
    List<String> userGroups = operationFactory.calculateUserGroups();
    if (userGroups == null) {
        logger.debug("No user groups to set.");
    } else {
        operationFactory.addUserGroups(userGroups, projectVersion, blackDuckRunData);
    }
    List<String> tags = operationFactory.calculateTags();
    if (tags == null) {
        logger.debug("No tags to set.");
    } else {
        operationFactory.addTags(tags, projectVersion, blackDuckRunData);
    }
    if (operationFactory.calculateShouldUnmap()) {
        logger.debug("Unmapping code locations.");
        operationFactory.unmapCodeLocations(projectVersion, blackDuckRunData);
    } else {
        logger.debug("Will not unmap code locations: Project view was not present, or should not unmap code locations.");
    }
    return projectVersion;
}
Also used : ProjectGroupFindResult(com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectGroupFindResult) ParentProjectMapOptions(com.synopsys.integration.detect.workflow.blackduck.project.options.ParentProjectMapOptions) CustomFieldDocument(com.synopsys.integration.detect.workflow.blackduck.project.customfields.CustomFieldDocument) CloneFindResult(com.synopsys.integration.detect.workflow.blackduck.project.options.CloneFindResult) ProjectVersionLicenseFindResult(com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectVersionLicenseFindResult) ProjectVersionWrapper(com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)

Aggregations

ProjectVersionWrapper (com.synopsys.integration.blackduck.service.model.ProjectVersionWrapper)1 CustomFieldDocument (com.synopsys.integration.detect.workflow.blackduck.project.customfields.CustomFieldDocument)1 CloneFindResult (com.synopsys.integration.detect.workflow.blackduck.project.options.CloneFindResult)1 ParentProjectMapOptions (com.synopsys.integration.detect.workflow.blackduck.project.options.ParentProjectMapOptions)1 ProjectGroupFindResult (com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectGroupFindResult)1 ProjectVersionLicenseFindResult (com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectVersionLicenseFindResult)1