Package org.alfresco.rest.framework.core
Interface ResourceLocator
-
- All Known Implementing Classes:
ResourceLookupDictionary
public interface ResourceLocatorLocates rest resources in the system. It can locate Entity,Relationship and Action resources. It can also find embedded resources on a value object. Additionally, it supports locating multiple relationship resources at the same time.- Author:
- Gethin James
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOLLECTION_RESOURCEstatic java.lang.StringENTITY_IDstatic java.lang.StringLEFTOVERstatic java.lang.StringPROPERTYstatic java.lang.StringPROPERTY2static java.lang.StringRELATIONSHIP_IDstatic java.lang.StringRELATIONSHIP_RESOURCEstatic java.lang.StringRELATIONSHIP2_ID
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.ResourceWithMetadatalocateEntityResource(Api api, java.lang.String resourceName, org.springframework.http.HttpMethod httpMethod)Finds an Entity Resource and returns it in ResourceWithMetadata wrapper.ResourceWithMetadatalocateRelationPropertyResource(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.ResourceWithMetadatalocateRelationResource(Api api, java.lang.String resourceName, java.lang.String relationName, 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.ResourceWithMetadatalocateResource(Api api, java.util.Map<java.lang.String,java.lang.String> templateVars, org.springframework.http.HttpMethod httpMethod)Used by webscripts to locate a resource based on the URL template variables.java.util.Map<java.lang.String,java.lang.String>parseTemplateVars(java.util.Map<java.lang.String,java.lang.String> templateVars)
-
-
-
Field Detail
-
COLLECTION_RESOURCE
static final java.lang.String COLLECTION_RESOURCE
- See Also:
- Constant Field Values
-
ENTITY_ID
static final java.lang.String ENTITY_ID
- See Also:
- Constant Field Values
-
RELATIONSHIP_RESOURCE
static final java.lang.String RELATIONSHIP_RESOURCE
- See Also:
- Constant Field Values
-
RELATIONSHIP_ID
static final java.lang.String RELATIONSHIP_ID
- See Also:
- Constant Field Values
-
PROPERTY
static final java.lang.String PROPERTY
- See Also:
- Constant Field Values
-
LEFTOVER
static final java.lang.String LEFTOVER
- See Also:
- Constant Field Values
-
RELATIONSHIP2_ID
static final java.lang.String RELATIONSHIP2_ID
- See Also:
- Constant Field Values
-
PROPERTY2
static final java.lang.String PROPERTY2
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseTemplateVars
java.util.Map<java.lang.String,java.lang.String> parseTemplateVars(java.util.Map<java.lang.String,java.lang.String> templateVars)
- Parameters:
templateVars-- Returns:
-
locateEntityResource
ResourceWithMetadata locateEntityResource(Api api, java.lang.String resourceName, org.springframework.http.HttpMethod httpMethod) throws InvalidArgumentException, UnsupportedResourceOperationException
Finds an Entity Resource and returns it in ResourceWithMetadata wrapper.- Parameters:
api- - The API being used.resourceName- - 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:
InvalidArgumentException- - thrown if either the api or resourceName's are invalid. ie. A resource doesn't exist.UnsupportedResourceOperationException- - throw if the resource does not support the specified HttpMethod.
-
locateRelationPropertyResource
ResourceWithMetadata locateRelationPropertyResource(Api api, java.lang.String entityResource, java.lang.String relationResource, java.lang.String property, org.springframework.http.HttpMethod httpMethod) throws InvalidArgumentException, UnsupportedResourceOperationException
Finds a property or action on a Relationship Resource and returns it in ResourceWithMetadata wrapper.- Parameters:
api- - The API being used.resourceName- - The entity resource name - this is the "entityResourceName" property on the @RelationshipResource annotation.relationName- - The relationship resource name - this is the "name" property on the @RelationshipResource annotation.property- - The property resource name - can be either an action or a @BinaryPropertyhttpMethod- - A permitted HttpMethod- Returns:
- ResourceWithMetadata - The resource and its metadata.
- Throws:
InvalidArgumentException- - thrown if either the api or resourceName's are invalid. ie. A resource doesn't exist.UnsupportedResourceOperationException- - throw if the resource does not support the specified HttpMethod.
-
locateRelationResource
ResourceWithMetadata locateRelationResource(Api api, java.lang.String resourceName, java.lang.String relationName, org.springframework.http.HttpMethod httpMethod) throws InvalidArgumentException, UnsupportedResourceOperationException
Finds an Relationship Resource and returns it in ResourceWithMetadata wrapper.- Parameters:
api- - The API being used.resourceName- - The entity resource name - this is the "entityResourceName" property on the @RelationshipResource annotation.relationName- - 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:
InvalidArgumentException- - thrown if either the api or resourceName's are invalid. ie. A resource doesn't exist.UnsupportedResourceOperationException- - throw if the resource does not support the specified HttpMethod.
-
locateResource
ResourceWithMetadata locateResource(Api api, java.util.Map<java.lang.String,java.lang.String> templateVars, org.springframework.http.HttpMethod httpMethod)
Used by webscripts to locate a resource based on the URL template variables.- 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
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.- 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
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) throws InvalidArgumentException, UnsupportedResourceOperationException
Finds multiple relationship Resources and returns them as a Map of ResourceWithMetadata.- 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.
- Throws:
InvalidArgumentException- - thrown if either the api or resourceName's are invalid. ie. A resource doesn't exist.UnsupportedResourceOperationException- - throw if the resource does not support the specified HttpMethod.
-
-