@Test void resolveReferencesNoFetch() { EntityType entityType = mock(EntityType.class); Entity entity0 = new DynamicEntity(entityType); Entity entity1 = new DynamicEntity(entityType); Stream<Entity> entities = Stream.of(entity0, entity1); Fetch fetch = null; assertEquals(entityManagerImpl.resolveReferences(entityType, entities, fetch), entities); }
@Override public Entity resolveReferences(EntityType entityType, Entity entity, Fetch fetch) { if (fetch == null) { return entity; } List<Attribute> resolvableAttrs = getResolvableAttrs(entityType, fetch); if (resolvableAttrs.isEmpty()) { return entity; } return resolveReferences(resolvableAttrs, singletonList(entity), fetch).iterator().next(); }
EntityManagerImpl implements EntityManager { @Override public Entity resolveReferences(EntityType entityType, Entity entity, Fetch fetch) { if (fetch == null) { return entity; } List<Attribute> resolvableAttrs = getResolvableAttrs(entityType, fetch); if (resolvableAttrs.isEmpty()) { return entity; } return resolveReferences(resolvableAttrs, singletonList(entity), fetch).iterator().next(); } }
EntityManagerImpl implements EntityManager { @Override public Entity resolveReferences(EntityType entityType, Entity entity, Fetch fetch) { if (fetch == null) { return entity; } List<Attribute> resolvableAttrs = getResolvableAttrs(entityType, fetch); if (resolvableAttrs.isEmpty()) { return entity; } return resolveReferences(resolvableAttrs, singletonList(entity), fetch).iterator().next(); } EntityManagerImpl(
      DataService dataService,
      EntityFactoryRegistry entityFactoryRegistry,
      EntityPopulator entityPopulator,
      EntityReferenceCreator entityReferenceCreator); }
EntityManagerImpl implements EntityManager { @Override public Entity resolveReferences(EntityType entityType, Entity entity, Fetch fetch) { if (fetch == null) { return entity; } List<Attribute> resolvableAttrs = getResolvableAttrs(entityType, fetch); if (resolvableAttrs.isEmpty()) { return entity; } return resolveReferences(resolvableAttrs, singletonList(entity), fetch).iterator().next(); } EntityManagerImpl(
      DataService dataService,
      EntityFactoryRegistry entityFactoryRegistry,
      EntityPopulator entityPopulator,
      EntityReferenceCreator entityReferenceCreator); @Override Entity create(EntityType entityType, CreationMode creationMode); @Override Entity createFetch(EntityType entityType, Fetch fetch); @Override Entity getReference(EntityType entityType, Object id); @Override Iterable<Entity> getReferences(EntityType entityType, Iterable<?> ids); @Override Entity resolveReferences(EntityType entityType, Entity entity, Fetch fetch); @Override Stream<Entity> resolveReferences(
      EntityType entityType, Stream<Entity> entities, Fetch fetch); }
EntityManagerImpl implements EntityManager { @Override public Entity resolveReferences(EntityType entityType, Entity entity, Fetch fetch) { if (fetch == null) { return entity; } List<Attribute> resolvableAttrs = getResolvableAttrs(entityType, fetch); if (resolvableAttrs.isEmpty()) { return entity; } return resolveReferences(resolvableAttrs, singletonList(entity), fetch).iterator().next(); } EntityManagerImpl(
      DataService dataService,
      EntityFactoryRegistry entityFactoryRegistry,
      EntityPopulator entityPopulator,
      EntityReferenceCreator entityReferenceCreator); @Override Entity create(EntityType entityType, CreationMode creationMode); @Override Entity createFetch(EntityType entityType, Fetch fetch); @Override Entity getReference(EntityType entityType, Object id); @Override Iterable<Entity> getReferences(EntityType entityType, Iterable<?> ids); @Override Entity resolveReferences(EntityType entityType, Entity entity, Fetch fetch); @Override Stream<Entity> resolveReferences(
      EntityType entityType, Stream<Entity> entities, Fetch fetch);  }