use of org.structr.core.ViewTransformation in project structr by structr.
the class ResourceHelper method applyViewTransformation.
/**
* Apply view transformation on final resource, if any
*
* @param request
* @param securityContext
* @param finalResource
* @param propertyView
* @return transformedResource
* @throws FrameworkException
*/
public static Resource applyViewTransformation(final HttpServletRequest request, final SecurityContext securityContext, final Resource finalResource, final Value<String> propertyView) throws FrameworkException {
Resource transformedResource = finalResource;
// add view transformation
Class type = finalResource.getEntityClass();
if (type != null) {
ViewTransformation transformation = StructrApp.getConfiguration().getViewTransformation(type, propertyView.get(securityContext));
if (transformation != null) {
transformedResource = transformedResource.tryCombineWith(new TransformationResource(securityContext, transformation));
}
}
return transformedResource;
}
Aggregations