Package org.alfresco.rest.framework.core
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
-
-
Field Summary
-
Fields inherited from interface org.alfresco.rest.framework.core.ResourceLocator
COLLECTION_RESOURCE, ENTITY_ID, LEFTOVER, PROPERTY, PROPERTY2, RELATIONSHIP_ID, RELATIONSHIP_RESOURCE, RELATIONSHIP2_ID
-
-
Constructor Summary
Constructors Constructor Description ResourceLookupDictionary()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceDictionarygetDictionary()Map<String,ResourceWithMetadata>locateEmbeddedResources(Api api, Map<String,String> embeddedKeys)For a given Map finds any resources that should be embedded inside a class.ResourceWithMetadatalocateEntityResource(Api api, String entityResource, org.springframework.http.HttpMethod httpMethod)Finds an Entity Resource and returns it in ResourceWithMetadata wrapper.ResourceWithMetadatalocateRelationPropertyResource(Api api, String entityResource, String relationResource, String property, org.springframework.http.HttpMethod httpMethod)Finds a property or action on a Relationship Resource and returns it in ResourceWithMetadata wrapper.ResourceWithMetadatalocateRelationResource(Api api, String entityResource, String relationResource, org.springframework.http.HttpMethod httpMethod)Finds an Relationship Resource and returns it in ResourceWithMetadata wrapper.Map<String,ResourceWithMetadata>locateRelationResource(Api api, String entityKey, Collection<String> relationshipKeys, org.springframework.http.HttpMethod httpMethod)Finds multiple relationship Resources and returns them as a Map of ResourceWithMetadata.ResourceWithMetadatalocateResource(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.Map<String,String>parseTemplateVars(Map<String,String> templateVars)voidsetDictionary(ResourceDictionary dictionary)
-
-
-
Method Detail
-
parseTemplateVars
public Map<String,String> parseTemplateVars(Map<String,String> templateVars)
- Specified by:
parseTemplateVarsin interfaceResourceLocator- Returns:
-
locateEntityResource
public ResourceWithMetadata locateEntityResource(Api api, String entityResource, org.springframework.http.HttpMethod httpMethod) throws NotFoundException, UnsupportedResourceOperationException
Description copied from interface:ResourceLocatorFinds an Entity Resource and returns it in ResourceWithMetadata wrapper.- Specified by:
locateEntityResourcein interfaceResourceLocator- 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:ResourceLocatorFinds a property or action on a Relationship Resource and returns it in ResourceWithMetadata wrapper.- Specified by:
locateRelationPropertyResourcein interfaceResourceLocator- Parameters:
api- - The API being used.property- - The property resource name - can be either an action or a @BinaryPropertyhttpMethod- - 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:ResourceLocatorFinds an Relationship Resource and returns it in ResourceWithMetadata wrapper.- Specified by:
locateRelationResourcein interfaceResourceLocator- 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:
locateResourcein interfaceResourceLocator- Parameters:
api- - The API being used.templateVars- A map of variables representing the requesthttpMethod- - 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:ResourceLocatorFor a given Map finds any resources that should be embedded inside a class.- Specified by:
locateEmbeddedResourcesin interfaceResourceLocator- 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:ResourceLocatorFinds multiple relationship Resources and returns them as a Map of ResourceWithMetadata.- Specified by:
locateRelationResourcein interfaceResourceLocator- 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()
-
-