public abstract class AbstractItemLookupRestResource extends GenericService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
COLLECTION_MISSING_INPUT_PARAMS |
static java.lang.String |
COLLECTION_PARENT_ITEM_NOT_FOUND |
static java.lang.String |
COLLECTION_PARENT_REPOSITORY_NOT_FOUND |
static java.lang.String |
COLLECTION_PROPERTY_INVALID |
static java.lang.String |
COLLECTION_PROPERTY_NOT_FOUND |
static int |
COLLECTION_SORT_SIZE |
static java.lang.String |
COMMA |
static int |
DEFAULT_PAGE_SIZE |
static java.lang.String |
ID |
static java.lang.String |
INVALID_QUERY_PARAMS |
static java.lang.String |
ITEM |
static java.lang.String |
ITEM_DESCRIPTOR_NOT_SUPPLIED |
static java.lang.String |
ITEM_NOT_FOUND |
protected java.util.Map<java.lang.String,java.lang.String> |
mEmbeddedRelationshipToResourceId |
protected Repository |
mRepository
The repository.
|
static java.lang.String |
PARENT_ITEM_ID |
static java.lang.String |
PARENT_ITEM_TYPE |
static java.lang.String |
PARENT_PROPERTY_NAME |
static java.lang.String |
REQUEST_DATA_KEY_PREFIX |
protected static java.lang.String |
RESOURCE_NAME |
static java.lang.String |
SEPARATOR |
protected static java.util.ResourceBundle |
sResourceBundle
The resource bundle.
|
static java.lang.String |
UNEXPECTED_ERROR |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
AbstractItemLookupRestResource() |
Modifier and Type | Method and Description |
---|---|
void |
addEmbeddedCollectionResource(RepresentationModel.Builder pBuilder,
java.lang.String pParentItemId,
java.lang.String pParentItemType,
java.lang.String pParentPropertyName,
java.lang.String pEmbeddedResourceId,
java.lang.String pEmbeddedRelationshipName)
Embed the collection link to the resource passed in using the relationship name passed in.
|
void |
addEmbeddedCollectionResources(RepresentationModel.Builder pBuilder,
java.lang.String pParentItemId,
java.lang.String pParentItemType)
Builds embedded collection relationship links using the embeddedRelationshipToResourceId property.
|
java.util.Map<java.lang.String,java.lang.Object> |
buildInputs(java.lang.String pItemId,
java.lang.Boolean pFilterBySiteFlag,
java.lang.String pSiteId)
Helps method to build the inputs.
|
protected java.lang.String |
generateRequestDataKey(java.lang.String pParentItemId,
java.lang.String pParentItemType)
Generate the key to use for the request data map for input and retrieval.
|
int |
getCollectionSortLimit()
Returns the collection sort limit value.
|
int |
getDefaultLimit()
Returns the default limit to use for paging if no 'limit' param set
|
javax.servlet.Servlet |
getDroplet()
Gets the droplet.
|
java.util.Map<java.lang.String,java.lang.String> |
getEmbeddedRelationshipToResourceId()
Returns property EmbeddedRelationshipToResourceId.
|
RepositoryItem |
getItem(java.util.Map<java.lang.String,java.lang.Object> pParams)
This is a generic method that can get an item.
|
java.lang.String |
getItemDescriptor()
Returns property ItemDescriptor
|
protected RepositoryItem |
getParentRepositoryItem(java.lang.String pParentItemId,
java.lang.String pParentItemType)
Retrieves the repository item for the specified type/id, either from the
repository or the request data map via the key.
|
Repository |
getRepository()
Returns property Repository
|
protected RepresentationModel.Builder |
getRepresentationModelBuilder(java.lang.Object pState)
Gets the RepresentationModel.Builder with the given object acting as the state.
|
ListingResponse<RepositoryItem> |
listItems(ListingRequest pListingRequest)
Return a ListingResponse list of items based on listing request.
|
RepresentationModel.Builder |
listItems(java.lang.String pParentItemId,
java.lang.String pParentItemType,
java.lang.String pParentPropertyName)
Generic resource collection GET that retrieves the collection via the specified
item's property.
|
RepresentationModel.Builder |
listItems(java.lang.String pParentItemId,
java.lang.String pParentItemType,
java.lang.String pParentPropertyName,
java.lang.String pCollectionSortQuery)
Generic resource collection GET that retrieves the collection via the specified
item's property.
|
protected DropletInvoker |
postInvoker(DropletInvoker pInvoker,
java.util.Map<java.lang.String,java.lang.Object> pParams)
It does post processing required after the droplet is invoked.
|
protected DropletInvoker |
preInvoker(DropletInvoker pInvoker,
java.util.Map<java.lang.String,java.lang.Object> pParams)
It sets the inputs parameters before invoking an ItemLookupDroplet.
|
protected RepositoryItem |
retrieveItem(DropletInvoker pInvoker)
Retrieve item returned by the droplet.
|
protected RepositoryItem |
retrieveRequestData(java.lang.String pParentItemId,
java.lang.String pParentItemType)
When embedding collections, the collection's parent item can be passed via
the request data map.
|
void |
setCollectionSortLimit(int pCollectionSortLimit)
Sets the collection sort limit value.
|
void |
setDefaultLimit(int pDefaultLimit)
Sets the default limit to use for paging if no 'limit' param set
|
void |
setDroplet(javax.servlet.Servlet pDroplet)
Sets the droplet.
|
void |
setEmbeddedRelationshipToResourceId(java.util.Map<java.lang.String,java.lang.String> pEmbeddedRelationshipToResourceId)
Sets property EmbeddedRelationshipToResourceId.
|
void |
setItemDescriptor(java.lang.String pItemDescriptor)
Sets property ItemDescriptor
|
void |
setRepository(Repository pRepository)
Sets property Repository
|
protected void |
validateProperty(RepositoryItem pItem,
java.lang.String pPropertyName)
Verify the property passed in references a collection of the expected item type.
|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService, toString
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static java.lang.String CLASS_VERSION
protected static final java.lang.String RESOURCE_NAME
public static final java.lang.String ID
public static final java.lang.String ITEM
public static final java.lang.String ITEM_DESCRIPTOR_NOT_SUPPLIED
public static final java.lang.String ITEM_NOT_FOUND
public static final java.lang.String UNEXPECTED_ERROR
public static final java.lang.String COLLECTION_MISSING_INPUT_PARAMS
public static final java.lang.String COLLECTION_PARENT_REPOSITORY_NOT_FOUND
public static final java.lang.String COLLECTION_PARENT_ITEM_NOT_FOUND
public static final java.lang.String COLLECTION_PROPERTY_NOT_FOUND
public static final java.lang.String COLLECTION_PROPERTY_INVALID
public static final java.lang.String INVALID_QUERY_PARAMS
public static final java.lang.String REQUEST_DATA_KEY_PREFIX
public static final java.lang.String PARENT_ITEM_ID
public static final java.lang.String PARENT_ITEM_TYPE
public static final java.lang.String PARENT_PROPERTY_NAME
public static final java.lang.String SEPARATOR
public static final java.lang.String COMMA
public static final int COLLECTION_SORT_SIZE
public static final int DEFAULT_PAGE_SIZE
protected static java.util.ResourceBundle sResourceBundle
protected Repository mRepository
protected java.util.Map<java.lang.String,java.lang.String> mEmbeddedRelationshipToResourceId
public javax.servlet.Servlet getDroplet()
public void setDroplet(javax.servlet.Servlet pDroplet)
pDroplet
- the new dropletpublic void setRepository(Repository pRepository)
public Repository getRepository()
public void setItemDescriptor(java.lang.String pItemDescriptor)
public java.lang.String getItemDescriptor()
public int getCollectionSortLimit()
public void setCollectionSortLimit(int pCollectionSortLimit)
pCollectionSortLimit
- the limit to setpublic int getDefaultLimit()
public void setDefaultLimit(int pDefaultLimit)
pDefaultLimit
- the limit to setpublic void setEmbeddedRelationshipToResourceId(java.util.Map<java.lang.String,java.lang.String> pEmbeddedRelationshipToResourceId)
pEmbeddedRelationshipToResourceId
- the EmbeddedRelationshipToResourceId property.public java.util.Map<java.lang.String,java.lang.String> getEmbeddedRelationshipToResourceId()
public ListingResponse<RepositoryItem> listItems(ListingRequest pListingRequest) throws RestException, RepositoryException, javax.servlet.ServletException
pListingRequest
- the listing requestRestException
- the rest exceptionRepositoryException
- the repository exceptionjavax.servlet.ServletException
- the servlet exceptionpublic RepresentationModel.Builder listItems(java.lang.String pParentItemId, java.lang.String pParentItemType, java.lang.String pParentPropertyName) throws RestException, RepositoryException, javax.servlet.ServletException
pParentItemId
- the id of the item that contains the collection.pParentItemType
- the repository type of the item that contains the
collection, supports a qualifying repository e.g. repositoryPath:type.pParentPropertyName
- the property name containing the item collection,
supports dot notation for the collection to be displayed.RestException
- the rest exceptionRepositoryException
- the repository exceptionjavax.servlet.ServletException
- the servlet exceptionpublic RepresentationModel.Builder listItems(java.lang.String pParentItemId, java.lang.String pParentItemType, java.lang.String pParentPropertyName, java.lang.String pCollectionSortQuery) throws RestException, RepositoryException, javax.servlet.ServletException
pParentItemId
- the id of the item that contains the collection.pParentItemType
- the repository type of the item that contains the
collection, supports a qualifying repository e.g. repositoryPath:typepParentPropertyName
- the property name containing the item collection,
supports dot notation for the collection to be displayed.pCollectionSortQuery
- the RQL query used to retrieve a sorted collection.RestException
- the rest exceptionRepositoryException
- the repository exceptionjavax.servlet.ServletException
- the servlet exceptiongetParentRepositoryItem(java.lang.String, java.lang.String)
,
ListingRequest
,
ListingRequestUtils
protected RepositoryItem getParentRepositoryItem(java.lang.String pParentItemId, java.lang.String pParentItemType) throws RestException
pParentItemId
- the id of the item to retrieve.pParentItemType
- the repository type of the item to retrieve, supports
a qualifying repository e.g. /atg/multisite/SiteRepository:touchpointRestException
- the rest exceptionRepositoryException
- the repository exceptionretrieveRequestData(java.lang.String, java.lang.String)
protected RepositoryItem retrieveRequestData(java.lang.String pParentItemId, java.lang.String pParentItemType)
generateRequestDataKey(String pParentItemId, String pParentItemType)
that can be used to place and retrieve it from the map.
Retrieving the item from the request data map can be overridden via this method.pParentItemId
- the id of the item that contains the child collection.pParentItemType
- the parent item type.RestException
- the rest exceptiongenerateRequestDataKey(java.lang.String, java.lang.String)
protected java.lang.String generateRequestDataKey(java.lang.String pParentItemId, java.lang.String pParentItemType)
To generate the key append the parent item's type to a const value.
This will be used to ensure the right key is used per resource. Using a commerce example to illustrate, if embedding category's child products the collection will be product but parent will be category, so it's the category item that's in the request data map alternatively if embedding product's related products it will be the product item in the map
If the parent item is the same type as the collection there may be a recursive issue retrieving the item adding on the id solves this issue - if this is this case we need to add the id to the key.
pParentItemId
- the id of the item that contains the child collection.pParentItemType
- the parent item type.RestException
- the rest exceptionprotected void validateProperty(RepositoryItem pItem, java.lang.String pPropertyName) throws RestException, RepositoryException
pItem
- the parent item containing the collectionpPropertyName
- the name of the property referencing the collectionRestException
- the rest exceptionRepositoryException
protected RepresentationModel.Builder getRepresentationModelBuilder(java.lang.Object pState)
pState
- the state that will be added to the representation modelpublic void addEmbeddedCollectionResource(RepresentationModel.Builder pBuilder, java.lang.String pParentItemId, java.lang.String pParentItemType, java.lang.String pParentPropertyName, java.lang.String pEmbeddedResourceId, java.lang.String pEmbeddedRelationshipName)
pBuilder
- the model builder used to embed the link.pParentItemId
- the id of the parent item that contains the child collection.pParentItemType
- the parent item type.pParentPropertyName
- the property name.pEmbeddedResourceId
- the id of the rest resource to be embedded.pEmbeddedRelationshipName
- the name of the embedded relationship.public void addEmbeddedCollectionResources(RepresentationModel.Builder pBuilder, java.lang.String pParentItemId, java.lang.String pParentItemType)
pBuilder
- the representation model builder.pParentItemId
- the parent item repository id.pParentItemType
- the parent item type.public RepositoryItem getItem(java.util.Map<java.lang.String,java.lang.Object> pParams) throws RestException
pParams
- the paramsRestException
- the rest exceptionprotected DropletInvoker preInvoker(DropletInvoker pInvoker, java.util.Map<java.lang.String,java.lang.Object> pParams)
pInvoker
- the invokerpParams
- the paramsprotected DropletInvoker postInvoker(DropletInvoker pInvoker, java.util.Map<java.lang.String,java.lang.Object> pParams) throws RestException
pInvoker
- the invokerpParams
- the paramsRestException
- the rest exceptionprotected RepositoryItem retrieveItem(DropletInvoker pInvoker)
pInvoker
- the invokerRestException
- the rest exceptionpublic java.util.Map<java.lang.String,java.lang.Object> buildInputs(java.lang.String pItemId, java.lang.Boolean pFilterBySiteFlag, java.lang.String pSiteId)
pItemId
- the item idpFilterBySiteFlag
- the filter by site flagpSiteId
- the site id