/** * provide the edge style depending on the type of the relationship. * * @param rel the {@link Dependency} to style * @return the edge {@link LineStyle} */ public static LineStyle getEdgeStyle(Dependency rel) { return EDGE_STYLES.getOrDefault(rel.getDependencyType(), DEFAULT_LINE_STYLE); }
/** * provide the edge style depending on the type of the relationship. * * @param rel the {@link Dependency} to style * @return the edge {@link LineStyle} */ public static LineStyle getEdgeStyle(Dependency rel) { return EDGE_STYLES.getOrDefault(rel.getDependencyType(), DEFAULT_LINE_STYLE); }
private void check() { dependencyGraph.getAllEdges().stream() .filter(edge -> edge.getDependencyType() != DependencyType.CONTAINS) .filter(edge -> !hasMatchingRule(edge)) .forEach(violatingDependencies::add); logViolatingDependencies(); }
/** * writes all edges except CONTAINS, as the contains-relation is visualized by nested clusters. */ private void writeEdges() { dependencyGraph.getAllEdges().stream() .filter(dependency -> !dependency.getDependencyType().equals(DependencyType.CONTAINS)) .forEach(dependency -> outGraphST.setAttribute(EDGES_ATT, createEdgeST(dependency))); }
/** * Maps all dependencies given in the Base Graph onto the level of architecture components: For each Edge from V1 to * V2, it creates the dependency parent(V1) to parent(V2) in the Target Graph, where the parent nodes are defined by * the given tag. They should be set beforehand, see {@link ArchitectureNodeCreator}. * We assume that both parent(V1) and parent(V2) exist in the Target Graph. * * @param dependencyGraph the {@link DependencyGraph} * @param tag the name of the architecture */ public static void mapDependencies(DependencyGraph dependencyGraph, String tag) { dependencyGraph.getAllEdges() .stream() .filter(dep -> dep.getDependencyType() != DependencyType.CONTAINS) .forEach(edge -> createArchitectureDependency(dependencyGraph.getBaseGraph(), tag, edge)); }
private void mapEdge(Dependency dependency) { if (dependency.getDependencyType() == DependencyType.CONTAINS) { mapHierarchy(dependency); } else { mapReference(dependency); } }
/** * writes all edges except CONTAINS, as the contains-relation is visualized by nested nodes. */ private void writeEdges() { dependencyGraph.getAllEdges().stream() .filter(dependency -> !dependency.getDependencyType().equals(DependencyType.CONTAINS)) .forEach(dependency -> outGraphST.setAttribute(EDGES_ATT, createEdgeST(dependency))); }
/** * writes all edges except CONTAINS, as the contains-relation is visualized by nested clusters. */ private void writeEdges() { dependencyGraph.getAllEdges().stream() .filter(dependency -> !dependency.getDependencyType().equals(DependencyType.CONTAINS)) .forEach(dependency -> outGraphST.setAttribute(EDGES_ATT, createEdgeST(dependency))); }
/** * writes all edges except CONTAINS, as the contains-relation is visualized by nested nodes. */ private void writeEdges() { dependencyGraph.getAllEdges().stream() .filter(dependency -> !dependency.getDependencyType().equals(DependencyType.CONTAINS)) .forEach(dependency -> outGraphST.setAttribute(EDGES_ATT, createEdgeST(dependency))); }
private void mapReference(Dependency dependency) { ReferencesRelation referencesRelation = new ReferencesRelation(); referencesRelation.setReferenceType(dependency.getDependencyType().name()); referencesRelation.setFrom(nodeMap.get(dependency.getSource().getName())); referencesRelation.setTo(nodeMap.get(dependency.getTarget().getName())); referencesRelation.setLineNo(dependency.getProperty("lineNo", new ArrayList<>())); mapProperties(referencesRelation.getProperties(), dependency.getProperties()); referencesRelation.getProperties().remove("lineNo"); referencesRelation.getFrom().getReferencesRelations().add(referencesRelation); referencesRelations.add(referencesRelation); }
private static void createArchitectureDependency(DependencyGraph dependencyGraph, String tag, Dependency dep) { Node baseFrom = dep.getSource(); Node baseTo = dep.getTarget(); // if the tag is not set on either of these two, the Node will be null, too, and no dependency will be mapped: Node parentFrom = dependencyGraph.getNode((String) baseFrom.getProperty(tag + Constants.PARENT_SUFFIX)); Node parentTo = dependencyGraph.getNode((String) baseTo.getProperty(tag + Constants.PARENT_SUFFIX)); if (parentFrom != null && parentTo != null && !parentFrom.equals(parentTo)) { Dependency architectureDependency = dependencyGraph.addDependency(parentFrom, parentTo, dep.getDependencyType()); architectureDependency.addBaseDependency(dep); // if there is at least one base dependency which depends on an Impl class, it's marked as DEPENDS_ON_IMPL boolean isImpl = architectureDependency.getProperty(DEPENDS_ON_IMPL, false) || baseTo.getProperty(tag + Constants.IMPL_SUFFIX, false); architectureDependency.setProperty(DEPENDS_ON_IMPL, isImpl); architectureDependency.addListProperty(Constants.TARGET_API, baseTo.getProperty(tag + Constants.PARENT_API_SUFFIX)); } } }