@Test public void testMerge_AttributesAndRelationships_OverlappedPath() { AgEntity<X> entity = metadataService.getAgEntity(X.class); ResourceEntity<X> root = new RootResourceEntity<>(entity, null); includeMerger.merge(root, asList( new Include("name"), new Include("ys.name"), new Include("ys.z") ), Collections.emptyMap()); assertEquals(1, root.getAttributes().size()); assertFalse(root.isIdIncluded()); assertEquals(1, root.getChildren().size()); NestedResourceEntity<?> yChild = root.getChild("ys"); assertNotNull(yChild); assertEquals(1, yChild.getAttributes().size()); assertFalse(yChild.isIdIncluded()); assertEquals(1, yChild.getChildren().size()); NestedResourceEntity<?> zChild = yChild.getChild("z"); assertNotNull(zChild); assertEquals(metadataService.getAgEntity(Z.class).getAttributes().size(), zChild.getAttributes().size()); assertTrue(zChild.isIdIncluded()); assertEquals(0, zChild.getChildren().size()); }
@Override public void merge(ResourceEntity<?> entity, List<Include> includes, Map<Class<?>, AgEntityOverlay<?>> overlays) { PhantomTrackingResourceEntityTreeBuilder treeBuilder = new PhantomTrackingResourceEntityTreeBuilder(entity, metadataService::getAgEntity, overlays); for (Include include : includes) { mergeInclude(entity, include, treeBuilder, overlays); } for (ResourceEntity<?> e : treeBuilder.nonPhantomEntities()) { processDefaultIncludes(e); } }
IncludeMerger implements IIncludeMerger { @Override public void merge(ResourceEntity<?> entity, List<Include> includes, Map<Class<?>, AgEntityOverlay<?>> overlays) { PhantomTrackingResourceEntityTreeBuilder treeBuilder = new PhantomTrackingResourceEntityTreeBuilder(entity, metadataService::getAgEntity, overlays); for (Include include : includes) { mergeInclude(entity, include, treeBuilder, overlays); } for (ResourceEntity<?> e : treeBuilder.nonPhantomEntities()) { processDefaultIncludes(e); } } }
IncludeMerger implements IIncludeMerger { @Override public void merge(ResourceEntity<?> entity, List<Include> includes, Map<Class<?>, AgEntityOverlay<?>> overlays) { PhantomTrackingResourceEntityTreeBuilder treeBuilder = new PhantomTrackingResourceEntityTreeBuilder(entity, metadataService::getAgEntity, overlays); for (Include include : includes) { mergeInclude(entity, include, treeBuilder, overlays); } for (ResourceEntity<?> e : treeBuilder.nonPhantomEntities()) { processDefaultIncludes(e); } } IncludeMerger(
            @Inject IMetadataService metadataService,
            @Inject ICayenneExpMerger expMerger,
            @Inject ISortMerger sortMerger,
            @Inject IMapByMerger mapByMerger,
            @Inject ISizeMerger sizeMerger); }
IncludeMerger implements IIncludeMerger { @Override public void merge(ResourceEntity<?> entity, List<Include> includes, Map<Class<?>, AgEntityOverlay<?>> overlays) { PhantomTrackingResourceEntityTreeBuilder treeBuilder = new PhantomTrackingResourceEntityTreeBuilder(entity, metadataService::getAgEntity, overlays); for (Include include : includes) { mergeInclude(entity, include, treeBuilder, overlays); } for (ResourceEntity<?> e : treeBuilder.nonPhantomEntities()) { processDefaultIncludes(e); } } IncludeMerger(
            @Inject IMetadataService metadataService,
            @Inject ICayenneExpMerger expMerger,
            @Inject ISortMerger sortMerger,
            @Inject IMapByMerger mapByMerger,
            @Inject ISizeMerger sizeMerger); static void checkTooLong(String path); @Override void merge(ResourceEntity<?> entity, List<Include> includes, Map<Class<?>, AgEntityOverlay<?>> overlays); }
IncludeMerger implements IIncludeMerger { @Override public void merge(ResourceEntity<?> entity, List<Include> includes, Map<Class<?>, AgEntityOverlay<?>> overlays) { PhantomTrackingResourceEntityTreeBuilder treeBuilder = new PhantomTrackingResourceEntityTreeBuilder(entity, metadataService::getAgEntity, overlays); for (Include include : includes) { mergeInclude(entity, include, treeBuilder, overlays); } for (ResourceEntity<?> e : treeBuilder.nonPhantomEntities()) { processDefaultIncludes(e); } } IncludeMerger(
            @Inject IMetadataService metadataService,
            @Inject ICayenneExpMerger expMerger,
            @Inject ISortMerger sortMerger,
            @Inject IMapByMerger mapByMerger,
            @Inject ISizeMerger sizeMerger); static void checkTooLong(String path); @Override void merge(ResourceEntity<?> entity, List<Include> includes, Map<Class<?>, AgEntityOverlay<?>> overlays);  }