Search in sources :

Example 1 with NameValuePairView

use of com.synopsys.integration.blackduck.api.manual.temporary.component.NameValuePairView in project blackduck-common by blackducksoftware.

the class PolicyStatusDescription method populatePolicySeverityMap.

private void populatePolicySeverityMap() {
    ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView policyViolationDetails = policyStatusItem.getComponentVersionPolicyViolationDetails();
    if (policyViolationDetails != null && ProjectVersionComponentPolicyStatusType.IN_VIOLATION.equals(policyStatusItem.getOverallStatus())) {
        List<NameValuePairView> nameValuePairs = policyViolationDetails.getSeverityLevels();
        if (nameValuePairs != null) {
            for (NameValuePairView nameValuePairView : nameValuePairs) {
                if (nameValuePairView.getName() != null) {
                    ComponentVersionPolicyViolationCount componentVersionPolicyViolationCount = new ComponentVersionPolicyViolationCount(nameValuePairView);
                    policySeverityCount.put(componentVersionPolicyViolationCount.name, componentVersionPolicyViolationCount);
                }
            }
        }
    }
}
Also used : ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView(com.synopsys.integration.blackduck.api.generated.component.ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView) NameValuePairView(com.synopsys.integration.blackduck.api.manual.temporary.component.NameValuePairView)

Example 2 with NameValuePairView

use of com.synopsys.integration.blackduck.api.manual.temporary.component.NameValuePairView in project blackduck-common by blackducksoftware.

the class PolicyStatusDescription method populatePolicyStatusMap.

private void populatePolicyStatusMap() {
    List<NameValuePairView> nameValuePairs = policyStatusItem.getComponentVersionStatusCounts();
    if (nameValuePairs != null) {
        for (NameValuePairView nameValuePairView : nameValuePairs) {
            if (nameValuePairView.getName() != null) {
                ComponentVersionStatusCount componentVersionStatusCount = new ComponentVersionStatusCount(nameValuePairView);
                policyStatusCount.put(componentVersionStatusCount.name, componentVersionStatusCount);
            }
        }
    }
}
Also used : NameValuePairView(com.synopsys.integration.blackduck.api.manual.temporary.component.NameValuePairView)

Example 3 with NameValuePairView

use of com.synopsys.integration.blackduck.api.manual.temporary.component.NameValuePairView in project blackduck-common by blackducksoftware.

the class PolicyStatusDescriptionTest method createProjectVersionPolicyStatusView.

private ProjectVersionPolicyStatusView createProjectVersionPolicyStatusView() {
    NameValuePairView blockerViolation = new NameValuePairView();
    blockerViolation.setName(PolicyRuleSeverityType.BLOCKER.name());
    blockerViolation.setValue(3);
    NameValuePairView trivialViolation = new NameValuePairView();
    trivialViolation.setName(PolicyRuleSeverityType.TRIVIAL.name());
    trivialViolation.setValue(1);
    List<NameValuePairView> violations = new ArrayList<>();
    violations.add(blockerViolation);
    violations.add(trivialViolation);
    ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView projectVersionPolicyStatusComponentVersionPolicyViolationDetailsView = new ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView();
    projectVersionPolicyStatusComponentVersionPolicyViolationDetailsView.setSeverityLevels(violations);
    NameValuePairView inViolation = new NameValuePairView();
    inViolation.setName(ProjectVersionComponentPolicyStatusType.IN_VIOLATION.name());
    inViolation.setValue(4);
    NameValuePairView notInViolation = new NameValuePairView();
    notInViolation.setName(ProjectVersionComponentPolicyStatusType.NOT_IN_VIOLATION.name());
    notInViolation.setValue(1);
    List<NameValuePairView> statuses = new ArrayList<>();
    statuses.add(inViolation);
    statuses.add(notInViolation);
    ProjectVersionPolicyStatusView policyStatusItem = new ProjectVersionPolicyStatusView();
    policyStatusItem.setComponentVersionPolicyViolationDetails(projectVersionPolicyStatusComponentVersionPolicyViolationDetailsView);
    policyStatusItem.setComponentVersionStatusCounts(statuses);
    policyStatusItem.setOverallStatus(ProjectVersionComponentPolicyStatusType.IN_VIOLATION);
    return policyStatusItem;
}
Also used : ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView(com.synopsys.integration.blackduck.api.generated.component.ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView) ArrayList(java.util.ArrayList) NameValuePairView(com.synopsys.integration.blackduck.api.manual.temporary.component.NameValuePairView) ProjectVersionPolicyStatusView(com.synopsys.integration.blackduck.api.generated.view.ProjectVersionPolicyStatusView)

Aggregations

NameValuePairView (com.synopsys.integration.blackduck.api.manual.temporary.component.NameValuePairView)3 ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView (com.synopsys.integration.blackduck.api.generated.component.ProjectVersionPolicyStatusComponentVersionPolicyViolationDetailsView)2 ProjectVersionPolicyStatusView (com.synopsys.integration.blackduck.api.generated.view.ProjectVersionPolicyStatusView)1 ArrayList (java.util.ArrayList)1