use of org.alfresco.rest.framework.resource.EntityResource in project alfresco-remote-api by Alfresco.
the class ResourceInspector method findEntityNameByAnnotationAttributes.
/**
* Finds the name of the entity using its annotation.
* @return the entity name/path
*/
protected static String findEntityNameByAnnotationAttributes(Map<String, Object> annotAttribs) {
Class<?> entityResourceRef = (Class<?>) annotAttribs.get("entityResource");
EntityResource entityAnnot = AnnotationUtils.findAnnotation(entityResourceRef, EntityResource.class);
return findEntityName(entityAnnot);
}
use of org.alfresco.rest.framework.resource.EntityResource in project alfresco-remote-api by Alfresco.
the class ResourceInspector method inspect.
/**
* Inspects the annotated resource to understand its capabilities
*
* @param resource Class
*/
@SuppressWarnings("rawtypes")
public static List<ResourceMetadata> inspect(Class resource) {
EntityResource annot = AnnotationUtils.findAnnotation(resource, EntityResource.class);
if (annot != null) {
return inspectEntity(annot, resource);
}
RelationshipResource relAnnot = AnnotationUtils.findAnnotation(resource, RelationshipResource.class);
if (relAnnot != null) {
return inspectRelationship(relAnnot, resource);
}
throw new UnsupportedOperationException("Unable to inspect " + resource.getName());
}
Aggregations