Search in sources :

Example 1 with ProjectCloneCategoriesType

use of com.synopsys.integration.blackduck.api.generated.enumeration.ProjectCloneCategoriesType in project synopsys-detect by blackducksoftware.

the class DetectConfigurationFactory method createDetectProjectServiceOptions.

public ProjectSyncOptions createDetectProjectServiceOptions() {
    ProjectVersionPhaseType projectVersionPhase = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_VERSION_PHASE);
    ProjectVersionDistributionType projectVersionDistribution = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_VERSION_DISTRIBUTION);
    Integer projectTier = detectConfiguration.getNullableValue(DetectProperties.DETECT_PROJECT_TIER);
    String projectDescription = detectConfiguration.getNullableValue(DetectProperties.DETECT_PROJECT_DESCRIPTION);
    String projectVersionNotes = detectConfiguration.getNullableValue(DetectProperties.DETECT_PROJECT_VERSION_NOTES);
    List<ProjectCloneCategoriesType> cloneCategories = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_CLONE_CATEGORIES).representedValues();
    Boolean projectLevelAdjustments = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_LEVEL_ADJUSTMENTS);
    Boolean forceProjectVersionUpdate = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_VERSION_UPDATE);
    String projectVersionNickname = detectConfiguration.getNullableValue(DetectProperties.DETECT_PROJECT_VERSION_NICKNAME);
    return new ProjectSyncOptions(projectVersionPhase, projectVersionDistribution, projectTier, projectDescription, projectVersionNotes, cloneCategories, forceProjectVersionUpdate, projectVersionNickname, projectLevelAdjustments);
}
Also used : ProjectVersionDistributionType(com.synopsys.integration.blackduck.api.generated.enumeration.ProjectVersionDistributionType) ProjectVersionPhaseType(com.synopsys.integration.blackduck.api.manual.temporary.enumeration.ProjectVersionPhaseType) ProjectCloneCategoriesType(com.synopsys.integration.blackduck.api.generated.enumeration.ProjectCloneCategoriesType) ProjectSyncOptions(com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectSyncOptions)

Example 2 with ProjectCloneCategoriesType

use of com.synopsys.integration.blackduck.api.generated.enumeration.ProjectCloneCategoriesType in project synopsys-detect by blackducksoftware.

the class SyncProjectOperation method createProjectSyncModel.

public ProjectSyncModel createProjectSyncModel(NameVersion projectNameVersion, ProjectGroupFindResult projectGroupFindResult, CloneFindResult cloneFindResult, ProjectVersionLicenseFindResult projectVersionLicensesFindResult, ProjectSyncOptions projectSyncOptions) {
    ProjectSyncModel projectSyncModel = ProjectSyncModel.createWithDefaults(projectNameVersion.getName(), projectNameVersion.getVersion());
    // TODO: Handle a boolean property not being set in detect configuration - ie need to determine if this property actually exists in the ConfigurableEnvironment - just omit this one?
    projectSyncModel.setProjectLevelAdjustments(projectSyncOptions.getProjectLevelAdjustments());
    Optional.ofNullable(projectSyncOptions.getProjectVersionPhase()).ifPresent(projectSyncModel::setPhase);
    Optional.ofNullable(projectSyncOptions.getProjectVersionDistribution()).ifPresent(projectSyncModel::setDistribution);
    Integer projectTier = projectSyncOptions.getProjectTier();
    if (null != projectTier && projectTier >= 1 && projectTier <= 5) {
        projectSyncModel.setProjectTier(projectTier);
    }
    String description = projectSyncOptions.getProjectDescription();
    if (StringUtils.isNotBlank(description)) {
        projectSyncModel.setDescription(description);
    }
    String releaseComments = projectSyncOptions.getProjectVersionNotes();
    if (StringUtils.isNotBlank(releaseComments)) {
        projectSyncModel.setReleaseComments(releaseComments);
    }
    List<ProjectCloneCategoriesType> cloneCategories = projectSyncOptions.getCloneCategories();
    projectSyncModel.setCloneCategories(cloneCategories);
    String nickname = projectSyncOptions.getProjectVersionNickname();
    if (StringUtils.isNotBlank(nickname)) {
        projectSyncModel.setNickname(nickname);
    }
    if (cloneFindResult.getCloneUrl().isPresent()) {
        logger.debug("Cloning project version from release url: {}", cloneFindResult.getCloneUrl().get());
        projectSyncModel.setCloneFromReleaseUrl(cloneFindResult.getCloneUrl().get().string());
    }
    projectGroupFindResult.getProjectGroup().ifPresent(projectGroupUrl -> {
        logger.debug("Setting project group to url: {}", projectGroupUrl);
        projectSyncModel.setProjectGroup(projectGroupUrl.string());
    });
    projectVersionLicensesFindResult.getLicenseUrl().ifPresent(projectSyncModel::setVersionLicenseUrl);
    return projectSyncModel;
}
Also used : ProjectSyncModel(com.synopsys.integration.blackduck.service.model.ProjectSyncModel) ProjectCloneCategoriesType(com.synopsys.integration.blackduck.api.generated.enumeration.ProjectCloneCategoriesType)

Aggregations

ProjectCloneCategoriesType (com.synopsys.integration.blackduck.api.generated.enumeration.ProjectCloneCategoriesType)2 ProjectVersionDistributionType (com.synopsys.integration.blackduck.api.generated.enumeration.ProjectVersionDistributionType)1 ProjectVersionPhaseType (com.synopsys.integration.blackduck.api.manual.temporary.enumeration.ProjectVersionPhaseType)1 ProjectSyncModel (com.synopsys.integration.blackduck.service.model.ProjectSyncModel)1 ProjectSyncOptions (com.synopsys.integration.detect.workflow.blackduck.project.options.ProjectSyncOptions)1