All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.structurizr.inspection.view.SystemContextViewsForMultipleSoftwareSystemsInspection Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.structurizr.inspection.view;

import com.structurizr.Workspace;
import com.structurizr.inspection.Inspector;
import com.structurizr.inspection.Violation;
import com.structurizr.view.SystemContextView;

import java.util.HashSet;
import java.util.Set;

public class SystemContextViewsForMultipleSoftwareSystemsInspection extends AbstractViewsInspection {

    public SystemContextViewsForMultipleSoftwareSystemsInspection(Inspector inspector) {
        super(inspector);
    }

    @Override
    protected Violation inspect(Workspace workspace) {
        Set softwareSystemsWithSystemContextViews = new HashSet<>();
        for (SystemContextView view : workspace.getViews().getSystemContextViews()) {
            softwareSystemsWithSystemContextViews.add(view.getSoftwareSystemId());
        }
        if (softwareSystemsWithSystemContextViews.size() > 1) {
            return violation("System context views exist for " + softwareSystemsWithSystemContextViews.size() + " software systems. It is recommended that a workspace includes system context views for a single software system only.");
        }

        return noViolation();
    }

    @Override
    protected String getType() {
        return "workspace.scope";
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy