use of com.yahoo.elide.jsonapi.EntityProjectionMaker in project elide by yahoo.
the class IncludedProcessor method addIncludedResources.
/**
* Adds the requested relation resources to the included block of the JsonApiDocument.
*/
private void addIncludedResources(JsonApiDocument jsonApiDocument, PersistentResource rec, List<String> requestedRelationPaths) {
EntityProjectionMaker maker = new EntityProjectionMaker(rec.getDictionary(), rec.getRequestScope());
EntityProjection projection = maker.parseInclude(rec.getResourceType());
// Process each include relation path
requestedRelationPaths.forEach(pathParam -> {
List<String> pathList = Arrays.asList(pathParam.split(RELATION_PATH_SEPARATOR));
pathList.forEach(requestedRelationPath -> {
List<String> relationPath = Lists.newArrayList(requestedRelationPath.split(RELATION_PATH_DELIMITER));
addResourcesForPath(jsonApiDocument, rec, relationPath, projection);
});
});
}
Aggregations