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

com.structurizr.inspection.model.AbstractRelationshipInspection Maven / Gradle / Ivy

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

import com.structurizr.inspection.Inspection;
import com.structurizr.inspection.Inspector;
import com.structurizr.inspection.Severity;
import com.structurizr.inspection.Violation;
import com.structurizr.model.Element;
import com.structurizr.model.Relationship;

public abstract class AbstractRelationshipInspection extends Inspection {

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

    public final Violation run(Relationship relationship) {
        Severity severity = getInspector().getSeverityStrategy().getSeverity(this, relationship);
        Violation violation = inspect(relationship);

        return violation == null ? null : violation.withSeverity(severity);
    }

    protected String terminologyFor(Element element) {
        return getWorkspace().getViews().getConfiguration().getTerminology().findTerminology(element).toLowerCase();
    }

    protected String nameOf(Element element) {
        String canonicalName = element.getCanonicalName();
        return canonicalName.substring(canonicalName.indexOf("://") + 3);
    }

    protected abstract Violation inspect(Relationship relationship);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy