@RestResource(id="atg.commerce.promotion.restresources.PromotionRestResource") public class PromotionRestResource extends GenericService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
ELEMENT_PARAM |
static java.lang.String |
ERR_NO_MATCHING_ORDER_FOUND |
static java.lang.String |
ERR_REQUIRED_INPUT_MISSING |
static java.lang.String |
ERROR_PARAM |
static java.lang.String |
OUTPUT_PARAM |
static java.lang.String |
OUTPUT_PARAM_PROMOTIONS |
static java.lang.String |
PRODUCT_ID_PARAM |
static java.lang.String |
QUANTITY_PARAM |
static java.lang.String |
RESOURCE_NAME |
static java.lang.String |
SKU_ID_PARAM |
static java.util.ResourceBundle |
sResourceBundle
Resource bundle
|
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 |
---|
PromotionRestResource() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String[] |
buildMemberUris(java.util.Collection<RepositoryItem> pMembers,
<any> pQueryParams)
Build the members URIs for the given list of items of type
RepositoryItem . |
protected RepresentationModel.Builder |
getApplicableItemPromotions(java.lang.String pProductId,
java.lang.String pSkuId,
java.lang.String pQuantity)
Returns a representation model containing a collection of applicable item promotions for the given product/sku/quantity combination.
|
java.lang.String |
getGetApplicablePromotionsPath()
Gets the GetApplicablePromotions component path.
|
RepresentationModel |
getPromotion(java.lang.String pPromotionId)
Gets the representation model object of the promotion for the given promotion Id.
|
protected RepresentationModel.Builder |
getPromotions(java.lang.String pOrderId)
Returns a representation model containing a collection of promotions applied to a given order for the current user.
|
RepresentationModel |
getPromotions(java.lang.String pOrderId,
java.lang.String pProductId,
java.lang.String pSkuId,
java.lang.String pQuantity)
Returns the collection of promotions applied to a given order for the current user.
|
PromotionTools |
getPromotionTools()
Gets the promotion tools component that provides utility methods for the
promotion retrieval
|
protected RepresentationModel.Builder |
getRepresentationModelBuilder(java.util.Collection<RepositoryItem> pMembers)
Gets the RepresentationModel.Builder with the given collection of RepositoryItems
being used to build member URIs.
|
protected RepresentationModel.Builder |
getRepresentationModelBuilder(java.lang.Object pState)
Gets the RepresentationModel.Builder with the given object acting as the state.
|
protected RepositoryItem |
retrievePromotion(java.lang.String pPromotionId)
Retrieve the promotion for the given promotion Id.
|
void |
setGetApplicablePromotionsPath(java.lang.String pGetApplicablePromotionsPath)
Sets the GetApplicablePromotions component path.
|
void |
setPromotionTools(PromotionTools pPromotionTools)
Sets the the promotion tools component that provides utility methods for
the promotion retrieval
|
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 final java.lang.String CLASS_VERSION
public static final java.lang.String ERR_REQUIRED_INPUT_MISSING
public static final java.lang.String ERR_NO_MATCHING_ORDER_FOUND
public static final java.lang.String ELEMENT_PARAM
public static final java.lang.String OUTPUT_PARAM
public static final java.lang.String ERROR_PARAM
public static final java.lang.String OUTPUT_PARAM_PROMOTIONS
public static final java.lang.String PRODUCT_ID_PARAM
public static final java.lang.String SKU_ID_PARAM
public static final java.lang.String QUANTITY_PARAM
public static final java.lang.String RESOURCE_NAME
public static java.util.ResourceBundle sResourceBundle
public void setPromotionTools(PromotionTools pPromotionTools)
pPromotionTools
- the promotion tools component that provides utility methods for the promotion retrievalpublic PromotionTools getPromotionTools()
public java.lang.String getGetApplicablePromotionsPath()
public void setGetApplicablePromotionsPath(java.lang.String pGetApplicablePromotionsPath)
pGetApplicablePromotionsPath
- Nucleus path to GetApplicablePromotions component.@Endpoint(id="/promotions/{promotionId}#GET", isSingular=true, filterId="promotions.id-Default") public RepresentationModel getPromotion(java.lang.String pPromotionId) throws RestException, RepositoryException
pPromotionId
- the id of the promotion to be retrievedRestException
- If an error occurs retrieving the promotionRepositoryException
- If an error occurs retrieving the promotion@Endpoint(id="/promotions/#GET", isSingular=false, filterId="promotions-Summary") public RepresentationModel getPromotions(java.lang.String pOrderId, java.lang.String pProductId, java.lang.String pSkuId, java.lang.String pQuantity) throws RestException, CommerceException
If the request contains productId and(or) skuId, and an optional quantity value, then a collection of applicable item promotions for the given product/sku/quantity combination are returned.
pOrderId
- The id of the order for which the applied promotions has to be returned.pProductId
- The id of the product.pSkuId
- The sku id.pQuantity
- The quantity value.RestException
- if an error occurs retrieving the promotionsCommerceException
- if an error occurs retrieving the promotionsprotected RepresentationModel.Builder getPromotions(java.lang.String pOrderId) throws CommerceException
pOrderId
- The id of the order for which the applied promotions has to be returned.CommerceException
- if fails to load order.protected RepresentationModel.Builder getApplicableItemPromotions(java.lang.String pProductId, java.lang.String pSkuId, java.lang.String pQuantity)
pProductId
- The product id.pSkuId
- The sku id.pQuantity
- The quantity value.protected RepositoryItem retrievePromotion(java.lang.String pPromotionId) throws RestException, RepositoryException
pPromotionId
- the id of the promotion for which we want to retrieveRestException
- if there is a problem retrieving the promotionRepositoryException
- if there is a problem retrieving the promotionprotected RepresentationModel.Builder getRepresentationModelBuilder(java.lang.Object pState)
pState
- the state that will be added to the representation modelprotected RepresentationModel.Builder getRepresentationModelBuilder(java.util.Collection<RepositoryItem> pMembers) throws RestException
pMembers
- the members that will be added to the representation modelRestException
- if the member URIs could not be builtprotected java.lang.String[] buildMemberUris(java.util.Collection<RepositoryItem> pMembers, <any> pQueryParams) throws RestException
RepositoryItem
.pMembers
- the list of repository items from which to build the member URIspQueryParams
- optional map of query param key/value pairs to be added to any built uris, null if noneRestException
- if a problem occurred whilst building the member URIs