use of org.molgenis.api.model.Selection in project molgenis by molgenis.
the class EntityMapperImpl method mapRecursive.
private EntitiesResponse.Builder mapRecursive(EntityCollection entityCollection, Selection filter, Selection expand, int depth) {
if (depth > MAX_DEPTH) {
throw new IllegalArgumentException("max_depth exceeded: " + depth);
}
EntitiesResponse.Builder builder = EntitiesResponse.builder();
if (filter.hasItems()) {
List<EntityResponse> entityResponses = entityCollection.getEntities().stream().map(entity -> mapRecursive(entity, filter, expand, depth)).collect(toList());
builder.setItems(entityResponses);
}
return builder;
}
use of org.molgenis.api.model.Selection in project molgenis by molgenis.
the class EntityMapperImpl method mapReference.
@Nullable
@CheckForNull
private EntityResponse mapReference(Entity entity, Attribute attribute, Selection filter, Selection expand, int depth) {
Entity refEntity = entity.getEntity(attribute.getName());
if (refEntity == null) {
// since the link would results in a 404 when requested.
return null;
}
Selection refFilter = getReferenceFilter(attribute, filter, expand);
Selection refExpand = getReferenceExpand(attribute, expand);
return mapRecursive(refEntity, refFilter, refExpand, depth);
}
Aggregations