Class ResourceLookupDictionary

java.lang.Object
org.alfresco.rest.framework.core.ResourceLookupDictionary
All Implemented Interfaces:
ResourceLocator

public class ResourceLookupDictionary extends Object implements ResourceLocator
Used for locating resources, implements ResourceLocator Contains a ResourceDictionary (which is a reference to all the resources available)
Author:
Gethin James
  • Constructor Details

    • ResourceLookupDictionary

      public ResourceLookupDictionary()
  • Method Details

    • parseTemplateVars

      public Map<String,String> parseTemplateVars(Map<String,String> templateVars)
      Specified by:
      parseTemplateVars in interface ResourceLocator
      Returns:
    • locateEntityResource

      public ResourceWithMetadata locateEntityResource(Api api, String entityResource, org.springframework.http.HttpMethod httpMethod) throws NotFoundException, UnsupportedResourceOperationException
      Description copied from interface: ResourceLocator
      Finds an Entity Resource and returns it in ResourceWithMetadata wrapper.
      Specified by:
      locateEntityResource in interface ResourceLocator
      Parameters:
      api - - The API being used.
      entityResource - - The entity resource name - this is the "name" property on the @EntityResource annotation.
      httpMethod - - A permitted HttpMethod
      Returns:
      ResourceWithMetadata - The resource and its metadata.
      Throws:
      UnsupportedResourceOperationException - - throw if the resource does not support the specified HttpMethod.
      NotFoundException
    • locateRelationPropertyResource

      public ResourceWithMetadata locateRelationPropertyResource(Api api, String entityResource, String relationResource, String property, org.springframework.http.HttpMethod httpMethod) throws NotFoundException, UnsupportedResourceOperationException
      Description copied from interface: ResourceLocator
      Finds a property or action on a Relationship Resource and returns it in ResourceWithMetadata wrapper.
      Specified by:
      locateRelationPropertyResource in interface ResourceLocator
      Parameters:
      api - - The API being used.
      property - - The property resource name - can be either an action or a @BinaryProperty
      httpMethod - - A permitted HttpMethod
      Returns:
      ResourceWithMetadata - The resource and its metadata.
      Throws:
      UnsupportedResourceOperationException - - throw if the resource does not support the specified HttpMethod.
      NotFoundException
    • locateRelationResource

      public ResourceWithMetadata locateRelationResource(Api api, String entityResource, String relationResource, org.springframework.http.HttpMethod httpMethod) throws NotFoundException, UnsupportedResourceOperationException
      Description copied from interface: ResourceLocator
      Finds an Relationship Resource and returns it in ResourceWithMetadata wrapper.
      Specified by:
      locateRelationResource in interface ResourceLocator
      Parameters:
      api - - The API being used.
      entityResource - - The entity resource name - this is the "entityResourceName" property on the @RelationshipResource annotation.
      relationResource - - The relationship resource name - this is the "name" property on the @RelationshipResource annotation.
      httpMethod - - A permitted HttpMethod
      Returns:
      ResourceWithMetadata - The resource and its metadata.
      Throws:
      UnsupportedResourceOperationException - - throw if the resource does not support the specified HttpMethod.
      NotFoundException
    • locateResource

      public ResourceWithMetadata locateResource(Api api, Map<String,String> templateVars, org.springframework.http.HttpMethod httpMethod)
      Locates a resource by URI path and wraps it in an invoker This will probably get refactored later when we work out what we are doing with the discoverability model. It shouldn't create a new instance every time.
      Specified by:
      locateResource in interface ResourceLocator
      Parameters:
      api - - The API being used.
      templateVars - A map of variables representing the request
      httpMethod - - A permitted HttpMethod
      Returns:
      ResourceWithMetadata - The resource and its metadata.
    • locateEmbeddedResources

      public Map<String,ResourceWithMetadata> locateEmbeddedResources(Api api, Map<String,String> embeddedKeys)
      Description copied from interface: ResourceLocator
      For a given Map finds any resources that should be embedded inside a class.
      Specified by:
      locateEmbeddedResources in interface ResourceLocator
      Parameters:
      api - - The API being used.
      embeddedKeys - - Likely to be the result of a call to ResourceInspector.findEmbeddedResources()
      Returns:
      ResourceWithMetadata - The resources with metadata.
    • locateRelationResource

      public Map<String,ResourceWithMetadata> locateRelationResource(Api api, String entityKey, Collection<String> relationshipKeys, org.springframework.http.HttpMethod httpMethod)
      Description copied from interface: ResourceLocator
      Finds multiple relationship Resources and returns them as a Map of ResourceWithMetadata.
      Specified by:
      locateRelationResource in interface ResourceLocator
      Parameters:
      api - - The API being used.
      entityKey - - this is the "entityResourceName" property on the @RelationshipResource annotation.
      relationshipKeys - - The relationship resource names - this is the "name" property on the @RelationshipResource annotation.
      httpMethod - - A permitted HttpMethod
      Returns:
      ResourceWithMetadata - The resource and its metadata.
    • setDictionary

      public void setDictionary(ResourceDictionary dictionary)
      Parameters:
      dictionary - the dictionary to set
    • getDictionary

      public ResourceDictionary getDictionary()