Class ResourceLookupDictionary

  • All Implemented Interfaces:
    ResourceLocator

    public class ResourceLookupDictionary
    extends java.lang.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 Detail

      • ResourceLookupDictionary

        public ResourceLookupDictionary()
    • Method Detail

      • parseTemplateVars

        public java.util.Map<java.lang.String,​java.lang.String> parseTemplateVars​(java.util.Map<java.lang.String,​java.lang.String> templateVars)
        Specified by:
        parseTemplateVars in interface ResourceLocator
        Returns:
      • locateRelationResource

        public ResourceWithMetadata locateRelationResource​(Api api,
                                                           java.lang.String entityResource,
                                                           java.lang.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,
                                                   java.util.Map<java.lang.String,​java.lang.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 java.util.Map<java.lang.String,​ResourceWithMetadata> locateEmbeddedResources​(Api api,
                                                                                                  java.util.Map<java.lang.String,​java.lang.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 java.util.Map<java.lang.String,​ResourceWithMetadata> locateRelationResource​(Api api,
                                                                                                 java.lang.String entityKey,
                                                                                                 java.util.Collection<java.lang.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