@Override protected RelationshipView findRelationshipView(@Nonnull RelationshipView sourceRelationshipView) { for (RelationshipView relationshipView : getRelationships()) { if (relationshipView.getRelationship().equals(sourceRelationshipView.getRelationship())) { if ((relationshipView.getDescription() != null && relationshipView.getDescription().equals(sourceRelationshipView.getDescription())) && relationshipView.getOrder().equals(sourceRelationshipView.getOrder())) { return relationshipView; } } } return null; }
private void write(DynamicView view, Writer writer) { try { writer.write("title " + view.getName() + " - " + view.getKey()); writer.write(System.lineSeparator()); writer.write(System.lineSeparator()); Set<RelationshipView> relationships = new TreeSet<>((rv1, rv2) -> rv1.getOrder().compareTo(rv2.getOrder())); relationships.addAll(view.getRelationships()); for (RelationshipView relationshipView : relationships) { Relationship r = relationshipView.getRelationship(); // Thing A->Thing B: Description writer.write(String.format("%s%s%s: %s", r.getSource().getName(), r.getInteractionStyle() == InteractionStyle.Synchronous ? SYNCHRONOUS_INTERACTION : ASYNCHRONOUS_INTERACTION, r.getDestination().getName(), relationshipView.getDescription() )); writer.write(System.lineSeparator()); } writer.write(System.lineSeparator()); } catch (IOException ioe) { ioe.printStackTrace(); } }
idOf(relationship.getRelationship().getDestination()), relationship.getOrder(), hasValue(relationship.getDescription()) ? relationship.getDescription() : hasValue(relationship.getRelationship().getDescription()) ? relationship.getRelationship().getDescription() : ""