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 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
-
-
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 ResourceDictionary
getDictionary()
java.util.Map<java.lang.String,ResourceWithMetadata>
locateEmbeddedResources(Api api, java.util.Map<java.lang.String,java.lang.String> embeddedKeys)
For a given Map finds any resources that should be embedded inside a class.ResourceWithMetadata
locateEntityResource(Api api, java.lang.String entityResource, org.springframework.http.HttpMethod httpMethod)
Finds an Entity Resource and returns it in ResourceWithMetadata wrapper.ResourceWithMetadata
locateRelationPropertyResource(Api api, java.lang.String entityResource, java.lang.String relationResource, java.lang.String property, org.springframework.http.HttpMethod httpMethod)
Finds a property or action on a Relationship Resource and returns it in ResourceWithMetadata wrapper.ResourceWithMetadata
locateRelationResource(Api api, java.lang.String entityResource, java.lang.String relationResource, org.springframework.http.HttpMethod httpMethod)
Finds an Relationship Resource and returns it in ResourceWithMetadata wrapper.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)
Finds multiple relationship Resources and returns them as a Map of ResourceWithMetadata.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.java.util.Map<java.lang.String,java.lang.String>
parseTemplateVars(java.util.Map<java.lang.String,java.lang.String> templateVars)
void
setDictionary(ResourceDictionary dictionary)
-
-
-
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 interfaceResourceLocator
- Returns:
-
locateEntityResource
public ResourceWithMetadata locateEntityResource(Api api, java.lang.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 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, java.lang.String entityResource, java.lang.String relationResource, java.lang.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 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, 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 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, 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 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 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 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 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 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()
-
-