use of com.structurizr.model.Element in project java by structurizr.
the class DefaultLayoutMergeStrategy method findRelationshipView.
private RelationshipView findRelationshipView(View view, RelationshipView relationshipWithoutLayoutInformation, Map<Element, Element> elementMap) {
if (!elementMap.containsKey(relationshipWithoutLayoutInformation.getRelationship().getSource()) || !elementMap.containsKey(relationshipWithoutLayoutInformation.getRelationship().getDestination())) {
return null;
}
Element sourceElementWithLayoutInformation = elementMap.get(relationshipWithoutLayoutInformation.getRelationship().getSource());
Element destinationElementWithLayoutInformation = elementMap.get(relationshipWithoutLayoutInformation.getRelationship().getDestination());
for (RelationshipView rv : view.getRelationships()) {
if (rv.getRelationship().getSource().equals(sourceElementWithLayoutInformation) && rv.getRelationship().getDestination().equals(destinationElementWithLayoutInformation) && rv.getDescription().equals(relationshipWithoutLayoutInformation.getDescription()) && rv.getOrder().equals(relationshipWithoutLayoutInformation.getOrder())) {
return rv;
}
}
return null;
}
use of com.structurizr.model.Element in project moduliths by moduliths.
the class Documenter method addComponentsToView.
private void addComponentsToView(Supplier<Stream<Module>> modules, ComponentView view, Options options, Consumer<ComponentView> afterCleanup) {
Styles styles = view.getViewSet().getConfiguration().getStyles();
Map<Module, Component> components = getComponents(options);
//
modules.get().distinct().filter(//
options.getExclusions().negate()).map(//
it -> applyBackgroundColor(it, components, options, styles)).filter(//
options.getComponentFilter()).forEach(view::add);
// view.getViewSet().getConfiguration().getStyles().findElementStyle(element).getBackground()
// Remove filtered dependency types
//
DependencyType.allBut(options.getDependencyTypes()).map(//
Object::toString).forEach(it -> view.removeRelationshipsWithTag(it));
afterCleanup.accept(view);
// Filter outgoing relationships of target-only modules
//
modules.get().filter(options.getTargetOnly()).forEach(module -> {
Component component = components.get(module);
//
view.getRelationships().stream().map(//
RelationshipView::getRelationship).filter(//
it -> it.getSource().equals(component)).forEach(it -> view.remove(it));
});
// … as well as all elements left without a relationship
if (options.hideElementsWithoutRelationships()) {
view.removeElementsWithNoRelationships();
}
afterCleanup.accept(view);
// Remove default relationships if more qualified ones exist
//
view.getRelationships().stream().map(//
RelationshipView::getRelationship).collect(//
Collectors.groupingBy(Connection::of)).values().stream().forEach(it -> potentiallyRemoveDefaultRelationship(view, it));
}
Aggregations