Search in sources :

Example 1 with DetectProperty

use of com.blackducksoftware.integration.hub.detect.configuration.DetectProperty in project hub-detect by blackducksoftware.

the class DetectOptionManager method init.

private void init() {
    final Map<DetectProperty, DetectOption> detectOptionsMap = new HashMap<>();
    final Map<DetectProperty, Object> propertyMap = detectConfiguration.getCurrentProperties();
    if (null != propertyMap && !propertyMap.isEmpty()) {
        for (final DetectProperty detectProperty : propertyMap.keySet()) {
            final DetectOption option = processField(detectProperty, detectConfiguration.getPropertyValueAsString(detectProperty, PropertyAuthority.None));
            if (option != null) {
                if (!detectOptionsMap.containsKey(detectProperty)) {
                    detectOptionsMap.put(detectProperty, option);
                }
            }
        }
    }
    detectOptions = detectOptionsMap.values().stream().sorted((o1, o2) -> o1.getDetectOptionHelp().primaryGroup.compareTo(o2.getDetectOptionHelp().primaryGroup)).collect(Collectors.toList());
    detectGroups = detectOptions.stream().map(it -> it.getDetectOptionHelp().primaryGroup).distinct().sorted().collect(Collectors.toList());
    checkForRemovedProperties();
}
Also used : HashMap(java.util.HashMap) DetectProperty(com.blackducksoftware.integration.hub.detect.configuration.DetectProperty)

Example 2 with DetectProperty

use of com.blackducksoftware.integration.hub.detect.configuration.DetectProperty in project hub-detect by blackducksoftware.

the class HelpJsonWriter method convertOption.

public HelpJsonOption convertOption(DetectOption detectOption) {
    HelpJsonOption helpJsonOption = new HelpJsonOption();
    DetectProperty property = detectOption.getDetectProperty();
    helpJsonOption.propertyName = property.getPropertyName();
    helpJsonOption.propertyKey = property.getPropertyKey();
    helpJsonOption.propertyType = property.getPropertyType().getDisplayName();
    helpJsonOption.addedInVersion = property.getAddedInVersion();
    helpJsonOption.defaultValue = property.getDefaultValue();
    DetectOptionHelp optionHelp = detectOption.getDetectOptionHelp();
    helpJsonOption.group = optionHelp.primaryGroup;
    helpJsonOption.additionalGroups = optionHelp.groups;
    helpJsonOption.description = optionHelp.description;
    helpJsonOption.detailedDescription = optionHelp.detailedHelp;
    helpJsonOption.deprecated = optionHelp.isDeprecated;
    if (optionHelp.isDeprecated) {
        helpJsonOption.deprecatedDescription = optionHelp.deprecation;
        helpJsonOption.deprecatedFailInVersion = optionHelp.deprecationFailInVersion.getDisplayValue();
        helpJsonOption.deprecatedRemoveInVersion = optionHelp.deprecationRemoveInVersion.getDisplayValue();
    }
    helpJsonOption.strictValues = detectOption.hasStrictValidation();
    helpJsonOption.caseSensitiveValues = detectOption.hasCaseSensitiveValidation();
    helpJsonOption.acceptableValues = detectOption.getValidValues();
    helpJsonOption.hasAcceptableValues = detectOption.getValidValues().size() > 0;
    helpJsonOption.isCommaSeparatedList = detectOption.isCommaSeperatedList();
    return helpJsonOption;
}
Also used : DetectOptionHelp(com.blackducksoftware.integration.hub.detect.help.DetectOptionHelp) DetectProperty(com.blackducksoftware.integration.hub.detect.configuration.DetectProperty)

Aggregations

DetectProperty (com.blackducksoftware.integration.hub.detect.configuration.DetectProperty)2 DetectOptionHelp (com.blackducksoftware.integration.hub.detect.help.DetectOptionHelp)1 HashMap (java.util.HashMap)1