@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RelationshipView that = (RelationshipView) o; if (description != null ? !description.equals(that.description) : that.description != null) return false; if (!getId().equals(that.getId())) return false; if (order != null ? !order.equals(that.order) : that.order != null) return false; return true; }
@Override public int hashCode() { int result = getId().hashCode(); result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (order != null ? order.hashCode() : 0); return result; }
/** * Gets the relationship view for the given relationship. * * @param relationship the Relationship to find the RelationshipView for * @return an RelationshipView object, or null if the relationship doesn't exist in the view */ public RelationshipView getRelationshipView(@Nonnull Relationship relationship) { Optional<RelationshipView> relationshipView = this.relationshipViews.stream().filter(rv -> rv.getId().equals(relationship.getId())).findFirst(); return relationshipView.orElse(null); }
private void hydrateView(View view) { view.setViewSet(this); for (ElementView elementView : view.getElements()) { elementView.setElement(model.getElement(elementView.getId())); } for (RelationshipView relationshipView : view.getRelationships()) { relationshipView.setRelationship(model.getRelationship(relationshipView.getId())); } }