Skip to content

Commit

Permalink
Minor: Add inheritedFields for list apis response (#14179)
Browse files Browse the repository at this point in the history
* Minor: Add inheritedFields for list apis response

* Minor: Add inheritedFields for list apis response
  • Loading branch information
harshach authored Nov 30, 2023
1 parent 25d4990 commit e11e262
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ public final List<T> listAll(Fields fields, ListFilter filter) {
List<T> entities = new ArrayList<>();
for (String json : jsons) {
T entity = setFieldsInternal(JsonUtils.readValue(json, entityClass), fields);
entity = setInheritedFields(entity, fields);
entity = clearFieldsInternal(entity, fields);
entities.add(entity);
}
Expand All @@ -578,6 +579,7 @@ public ResultList<T> listAfter(UriInfo uriInfo, Fields fields, ListFilter filter

for (String json : jsons) {
T entity = setFieldsInternal(JsonUtils.readValue(json, entityClass), fields);
entity = setInheritedFields(entity, fields);
entity = clearFieldsInternal(entity, fields);
entities.add(withHref(uriInfo, entity));
}
Expand Down Expand Up @@ -610,6 +612,7 @@ public ResultList<T> listAfterWithSkipFailure(
for (String json : jsons) {
try {
T entity = setFieldsInternal(JsonUtils.readValue(json, entityClass), fields);
entity = setInheritedFields(entity, fields);
entity = clearFieldsInternal(entity, fields);
entities.add(withHref(uriInfo, entity));
} catch (Exception e) {
Expand All @@ -633,6 +636,7 @@ public ResultList<T> listBefore(UriInfo uriInfo, Fields fields, ListFilter filte
List<T> entities = new ArrayList<>();
for (String json : jsons) {
T entity = setFieldsInternal(JsonUtils.readValue(json, entityClass), fields);
entity = setInheritedFields(entity, fields);
entity = clearFieldsInternal(entity, fields);
entities.add(withHref(uriInfo, entity));
}
Expand Down Expand Up @@ -668,6 +672,7 @@ public T getVersion(UUID id, String version) {

public EntityHistory listVersions(UUID id) {
T latest = setFieldsInternal(find(id, ALL), putFields);
latest = setInheritedFields(latest, putFields);
String extensionPrefix = EntityUtil.getVersionExtensionPrefix(entityType);
List<ExtensionRecord> records = daoCollection.entityExtensionDAO().getExtensions(id, extensionPrefix);
List<EntityVersionPair> oldVersions = new ArrayList<>();
Expand Down

0 comments on commit e11e262

Please sign in to comment.