Search in sources :

Example 1 with EntityResource

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);
}
Also used : EntityResource(org.alfresco.rest.framework.resource.EntityResource) EmbeddedEntityResource(org.alfresco.rest.framework.resource.EmbeddedEntityResource)

Example 2 with EntityResource

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());
}
Also used : RelationshipResource(org.alfresco.rest.framework.resource.RelationshipResource) EntityResource(org.alfresco.rest.framework.resource.EntityResource) EmbeddedEntityResource(org.alfresco.rest.framework.resource.EmbeddedEntityResource)

Aggregations

EmbeddedEntityResource (org.alfresco.rest.framework.resource.EmbeddedEntityResource)2 EntityResource (org.alfresco.rest.framework.resource.EntityResource)2 RelationshipResource (org.alfresco.rest.framework.resource.RelationshipResource)1