Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…napi into SimonCardaire-main
  • Loading branch information
bnasslahsen committed Feb 26, 2024
2 parents 0c61d75 + e50758c commit 641a0a9
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.springframework.data.mapping.SimpleAssociationHandler;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.core.mapping.ResourceMapping;
import org.springframework.data.rest.core.mapping.ResourceMappings;
import org.springframework.data.rest.core.mapping.ResourceMetadata;
import org.springframework.data.rest.webmvc.RestMediaTypes;
Expand Down Expand Up @@ -417,8 +418,11 @@ private List<String> getAssociationsFields(ResourceMetadata
List<String> associationsFields = new ArrayList<>();
entity.doWithAssociations((SimpleAssociationHandler) association -> {
PersistentProperty<?> property = association.getInverse();
String filedName = resourceMetadata.getMappingFor(property).getRel().value();
associationsFields.add(filedName);
ResourceMapping mapping = resourceMetadata.getMappingFor(property);
if (mapping.isExported()) {
String filedName = mapping.getRel().value();
associationsFields.add(filedName);
}
});
return associationsFields;
}
Expand All @@ -438,8 +442,11 @@ private List<String> getIgnoredFields(ResourceMetadata
ignoredFields.add(idField);
entity.doWithAssociations((SimpleAssociationHandler) association -> {
PersistentProperty<?> property = association.getInverse();
String filedName = resourceMetadata.getMappingFor(property).getRel().value();
ignoredFields.add(filedName);
ResourceMapping mapping = resourceMetadata.getMappingFor(property);
if (mapping.isExported()) {
String filedName = mapping.getRel().value();
ignoredFields.add(filedName);
}
});
}
return ignoredFields;
Expand Down

0 comments on commit 641a0a9

Please sign in to comment.