Skip to content

Commit

Permalink
#2313 Code readability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
homedirectory committed Sep 11, 2024
1 parent b4fccac commit e69fdaa
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ protected List<EntityContainer<E>> enhance(final List<EntityContainer<E>> entiti
return entities;
}

final Map<String, EntityRetrievalModel<? extends AbstractEntity<?>>> propertiesFetchModels = fetchModel.getRetrievalModels();

for (final Map.Entry<String, EntityRetrievalModel<?>> entry : propertiesFetchModels.entrySet()) {
final String propName = entry.getKey();
final EntityRetrievalModel<? extends AbstractEntity<?>> propFetchModel = entry.getValue();

fetchModel.getRetrievalModels().forEach((propName, propFetchModel) -> {
if (propFetchModel.isFetchIdOnly()) {
assignIdOnlyProxiedResultTypeToIdOnlyEntityProperty(entities, propName, propFetchModel.getEntityType());
} else {
Expand Down Expand Up @@ -88,7 +83,7 @@ else if (propMetadataUtils.isPropEntityType(pm.type(), EntityMetadata::isUnion))
enhanceProperty(entities, propName, propFetchModel, paramValues);
}
}
}
});

assignProxiedResultTypeToContainers(entities, fetchModel);
assignInstrumentationSetting(entities, fetchModel);
Expand Down Expand Up @@ -226,11 +221,9 @@ private <T extends AbstractEntity<?>> List<EntityContainer<E>> enhanceProperty(
: new EntityContainerEnhancer<T>(fetcher, domainMetadata, idOnlyProxiedEntityTypeCache).enhance(retrievedPropertyInstances, fetchModel, paramValues);

// Replacing in entities the proxies of properties with properly enhanced property instances.
for (final EntityContainer<? extends AbstractEntity<?>> enhancedPropInstance : enhancedPropInstances) {
final List<EntityContainer<E>> thisPropertyEntities = propertyValuesIds.get(enhancedPropInstance.getId());
for (final EntityContainer<E> thisPropertyEntity : thisPropertyEntities) {
thisPropertyEntity.getEntities().put(propertyName, enhancedPropInstance);
}
for (final var enhancedPropInstance : enhancedPropInstances) {
final var thisPropertyEntities = propertyValuesIds.get(enhancedPropInstance.getId());
thisPropertyEntities.forEach(thisPropertyEntity -> thisPropertyEntity.getEntities().put(propertyName, enhancedPropInstance));
}
}

Expand Down

0 comments on commit e69fdaa

Please sign in to comment.