View extends ElementDefinitions<ViewElementDefinition, ViewElementDefinition> implements Cloneable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (null == obj || getClass() != obj.getClass()) { return false; } final View view = (View) obj; return new EqualsBuilder() .appendSuper(super.equals(view)) .append(globalElements, view.getGlobalElements()) .append(globalEntities, view.getGlobalEntities()) .append(globalEdges, view.getGlobalEdges()) .append(allEntities, view.isAllEntities()) .append(allEdges, view.isAllEdges()) .isEquals(); } View(); static View fromJson(final InputStream inputStream); static View fromJson(final Path filePath); static View fromJson(final byte[] jsonBytes); byte[] toCompactJson(); @Override String toString(); @Override ViewElementDefinition getElement(final String group); Set<String> getElementGroupBy(final String group); boolean isAllEntities(); void setAllEntities(final boolean allEntities); boolean isAllEdges(); void setAllEdges(final boolean allEdges); List<GlobalViewElementDefinition> getGlobalElements(); List<GlobalViewElementDefinition> getGlobalEntities(); List<GlobalViewElementDefinition> getGlobalEdges(); boolean hasPreAggregationFilters(); boolean hasPostAggregationFilters(); boolean hasPostTransformFilters(); boolean hasEntityFilters(); boolean hasEdgeFilters(); @SuppressWarnings("CloneDoesntCallSuperClone") @SuppressFBWarnings(value = "CN_IDIOM_NO_SUPER_CALL", justification = "Only inherits from Object") @Override View clone(); void expandGlobalDefinitions(); @JsonInclude(Include.NON_EMPTY) Map<String, String> getConfig(); void addConfig(final String key, final String value); String getConfig(final String key); boolean canMerge(final View addingView, final View srcView); @Override boolean equals(final Object obj); @Override int hashCode(); @JsonInclude(Include.NON_NULL) @JsonGetter("class") String getClassName();  }
@Test public void shouldFilterEntitiesInBuilder() { final View view = new View.Builder() .entity(TestGroups.ENTITY) .entity(TestGroups.ENTITY_2) .removeEntities(e -> e.getKey().equals(TestGroups.ENTITY)) .build(); assertEquals(Sets.newHashSet(TestGroups.ENTITY_2), view.getEntityGroups()); }
@Test public void shouldFilterEdgesInBuilder() { final View view = new View.Builder() .edge(TestGroups.EDGE) .edge(TestGroups.EDGE_2) .removeEdges(e -> e.getKey().equals(TestGroups.EDGE)) .build(); assertEquals(Sets.newHashSet(TestGroups.EDGE_2), view.getEdgeGroups()); }