atg.commerce.catalog
Class CatalogServices

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.catalog.CatalogServices
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class CatalogServices
extends GenericService

Contains API to access Product Catalog which supports either custom catalog or normal catalog. All these methods returns the Product & SKU repository items in XML format.

Properties that are returned in the XML data can be controlled via mapping files used to generate the XML data from the items. getProductMappingFileName() determines the Product XML data. getSKUMappingFileName() determines the SKU XML data.


Field Summary
static java.lang.String CATALOG_NOT_FOUND_IN_USER
           
static java.lang.String CATALOGID_FOR_NON_CUSTOM_CATALOGS
           
static java.lang.String CATALOGID_NOT_EXIST
           
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String DESCRIPTION_SEARCH_STRING_IS_NULL
           
static java.lang.String INVALID_PRODUCTID
           
static java.lang.String INVALID_PRODUCTID_OR_CATALOGID
           
static java.lang.String NULL_PRODUCTID
           
static java.lang.String NULL_RQL
           
static java.lang.String SEARCH_PROPERTY_NAMES_NOT_CONFIGURED
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
CatalogServices()
           
 
Method Summary
 void catalogItemViewed(java.lang.String pProfileId, java.lang.String pItemId, java.lang.String pItemType)
          This method can be used to announce that a particular item was viewed by the current user.
protected  void filterProducts(RepositoryItem[] pProducts, java.lang.String pCatalogId, java.lang.String pCatalogKey)
          Verifies the pProducts repository items checking whether they belong to the catalog specified by pCatalogId.
protected  Query generateQuery(java.lang.String[] pSearchPropertyNames, java.lang.String pSearchString, java.lang.String pCatalogKey, QueryBuilder pProductQueryBuilder)
          Generates Query to execute.
protected  RepositoryItem getCatalogItemFromProfile()
          Retrieves the catalog item from the user repository item in the current session.
 CatalogTools getCatalogTools()
          Returns Catalog Tools to access Product Catalog
 atg.userprofiling.dms.DPSMessageSource getDPSMessageSource()
          This component is used to send ViewItem events
 GetService getGetService()
          Returns GetService component to render XML data from Repository Items.
 java.lang.String getProductMappingFileName()
          Returns Name of the mapping file to be used to generate Product XML
 java.lang.String getProductSKUPropertyName()
          Returns property name of the SKU items in product item-descriptor
 java.lang.String[] getProductSkusXML(java.lang.String pProductId, java.lang.String pCatalogId)
          Retrieves product repository item as specified by pProductId and returns the SKU items in the product in XML format.
 java.lang.String[] getProductSkusXML(java.lang.String pProductId, java.lang.String pCatalogId, java.lang.String pCatalogKey)
          Retrieves product repository item as specified by pProductId and returns the SKU items in the product in XML format.
 java.lang.String[] getProductXMLByDescription(java.lang.String pSearchString, java.lang.String[] pSearchPropertyNames, java.lang.String pCatalogId)
          Retrieves the product whose properties as specified by pSearchPropertyNames or getSearchPropertyNames() contains pSearchString.
 java.lang.String[] getProductXMLByDescription(java.lang.String pSearchString, java.lang.String[] pSearchPropertyNames, java.lang.String pCatalogId, java.lang.String pCatalogKey)
          Retrieves the product whose properties as specified by pSearchPropertyNames or getSearchPropertyNames() contains pSearchString.
 java.lang.String getProductXMLById(java.lang.String pProductId, java.lang.String pCatalogId)
          Retrieves the Product item in XML form as speicfied by the pProductId.
 java.lang.String getProductXMLById(java.lang.String pProductId, java.lang.String pCatalogId, java.lang.String pCatalogKey)
          Retrieves the Product item in XML form as speicfied by the pProductId.
 java.lang.String[] getProductXMLByRQL(java.lang.String pRQLQuery, java.lang.String pCatalogId)
          Parses the pRQLQuery and executes the RqlStatement to retrieve the product items.
 java.lang.String[] getProductXMLByRQL(java.lang.String pRQLQuery, java.lang.String pCatalogId, java.lang.String pCatalogKey)
          Parses the pRQLQuery and executes the RqlStatement to retrieve the product items.
 CommerceProfileTools getProfileTools()
          Convenience methods for managing profiles
 java.lang.String[] getSearchPropertyNames()
          Returns Names of the properties to search for getProductXMLByDescription
 java.lang.String getSKUMappingFileName()
          Returns Name of the mapping file to be used to generate SKU XML
 java.lang.String getUserCatalogPropertyName()
          Returns Name of catalog property name in Profile repository item
 void setCatalogTools(CatalogTools pCatalogTools)
          Sets Catalog Tools to access Product Catalog
 void setDPSMessageSource(atg.userprofiling.dms.DPSMessageSource pDPSMessageSource)
           
 void setGetService(GetService pGetService)
          Sets GetService component to render XML data from Repository Items.
 void setProductMappingFileName(java.lang.String pProductMappingFileName)
          Sets Name of the mapping file to be used to generate Product XML
 void setProductSKUPropertyName(java.lang.String pProductSKUPropertyName)
          Sets property name of the SKU items in product item-descriptor
 void setProfileTools(CommerceProfileTools pProfileTools)
           
 void setSearchPropertyNames(java.lang.String[] pSearchPropertyNames)
          Sets Names of the properties to search for getProductXMLByDescription
 void setSKUMappingFileName(java.lang.String pSKUMappingFileName)
          Sets Name of the mapping file to be used to generate SKU XML
 void setUserCatalogPropertyName(java.lang.String pUserCatalogPropertyName)
          Sets Name of catalog property name in Profile repository item
 
Methods inherited from class atg.nucleus.GenericService
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
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


NULL_PRODUCTID

public static java.lang.String NULL_PRODUCTID

NULL_RQL

public static java.lang.String NULL_RQL

SEARCH_PROPERTY_NAMES_NOT_CONFIGURED

public static java.lang.String SEARCH_PROPERTY_NAMES_NOT_CONFIGURED

CATALOGID_FOR_NON_CUSTOM_CATALOGS

public static java.lang.String CATALOGID_FOR_NON_CUSTOM_CATALOGS

CATALOGID_NOT_EXIST

public static java.lang.String CATALOGID_NOT_EXIST

CATALOG_NOT_FOUND_IN_USER

public static java.lang.String CATALOG_NOT_FOUND_IN_USER

INVALID_PRODUCTID

public static java.lang.String INVALID_PRODUCTID

INVALID_PRODUCTID_OR_CATALOGID

public static java.lang.String INVALID_PRODUCTID_OR_CATALOGID

DESCRIPTION_SEARCH_STRING_IS_NULL

public static java.lang.String DESCRIPTION_SEARCH_STRING_IS_NULL
Constructor Detail

CatalogServices

public CatalogServices()
Method Detail

getCatalogTools

public CatalogTools getCatalogTools()
Returns Catalog Tools to access Product Catalog

Returns:
the CatalogTools

setCatalogTools

public void setCatalogTools(CatalogTools pCatalogTools)
Sets Catalog Tools to access Product Catalog

Parameters:
CatalogTools -

getProductMappingFileName

public java.lang.String getProductMappingFileName()
Returns Name of the mapping file to be used to generate Product XML

Returns:
the ProductMappingFileName

setProductMappingFileName

public void setProductMappingFileName(java.lang.String pProductMappingFileName)
Sets Name of the mapping file to be used to generate Product XML

Parameters:
ProductMappingFileName -

getSKUMappingFileName

public java.lang.String getSKUMappingFileName()
Returns Name of the mapping file to be used to generate SKU XML

Returns:
the SKUMappingFileName

setSKUMappingFileName

public void setSKUMappingFileName(java.lang.String pSKUMappingFileName)
Sets Name of the mapping file to be used to generate SKU XML

Parameters:
SKUMappingFileName -

getGetService

public GetService getGetService()
Returns GetService component to render XML data from Repository Items.

Returns:
the GetService

setGetService

public void setGetService(GetService pGetService)
Sets GetService component to render XML data from Repository Items.

Parameters:
GetService -

setDPSMessageSource

public void setDPSMessageSource(atg.userprofiling.dms.DPSMessageSource pDPSMessageSource)

getDPSMessageSource

public atg.userprofiling.dms.DPSMessageSource getDPSMessageSource()
This component is used to send ViewItem events


setProfileTools

public void setProfileTools(CommerceProfileTools pProfileTools)

getProfileTools

public CommerceProfileTools getProfileTools()
Convenience methods for managing profiles


getSearchPropertyNames

public java.lang.String[] getSearchPropertyNames()
Returns Names of the properties to search for getProductXMLByDescription

Returns:
the SearchPropertyNames

setSearchPropertyNames

public void setSearchPropertyNames(java.lang.String[] pSearchPropertyNames)
Sets Names of the properties to search for getProductXMLByDescription

Parameters:
SearchPropertyNames -

getProductSKUPropertyName

public java.lang.String getProductSKUPropertyName()
Returns property name of the SKU items in product item-descriptor

Returns:
the ProductSKUPropertyName

setProductSKUPropertyName

public void setProductSKUPropertyName(java.lang.String pProductSKUPropertyName)
Sets property name of the SKU items in product item-descriptor

Parameters:
ProductSKUPropertyName -

getUserCatalogPropertyName

public java.lang.String getUserCatalogPropertyName()
Returns Name of catalog property name in Profile repository item

Returns:
the UserCatalogPropertyName

setUserCatalogPropertyName

public void setUserCatalogPropertyName(java.lang.String pUserCatalogPropertyName)
Sets Name of catalog property name in Profile repository item

Parameters:
UserCatalogPropertyName -

getProductXMLById

public java.lang.String getProductXMLById(java.lang.String pProductId,
                                          java.lang.String pCatalogId,
                                          java.lang.String pCatalogKey)
                                   throws RepositoryException,
                                          GetException
Retrieves the Product item in XML form as speicfied by the pProductId. if custom catalogs are used then catalog item is retrieved as specified by pCatalogId. If no catalog item is found then the user in the current session is accessed and catalog item is retrieved from the user.

Parameters:
pProductId - specifies the product to retrieve
pCatalogId - specifies the catalogItem to check for the product
pCatalogKey - specifies the catalog to use
Returns:
Product item in XML form.
Throws:
RepositoryException - if an error occurs
GetException - if an error occurs

getProductSkusXML

public java.lang.String[] getProductSkusXML(java.lang.String pProductId,
                                            java.lang.String pCatalogId,
                                            java.lang.String pCatalogKey)
                                     throws RepositoryException,
                                            GetException
Retrieves product repository item as specified by pProductId and returns the SKU items in the product in XML format. getProductSKUPropertyName() specifies the propery name of SKU repository items in product repository item.

Parameters:
pProductId - Id of the product to retreive SKU items from
pCatalogId - catalog Item to use.
pCatalogKey - specifies the catalog to use
Returns:
SKU items present in the specified product in XML format.
Throws:
RepositoryException - if an error occurs
GetException - if an error occurs

getProductXMLByDescription

public java.lang.String[] getProductXMLByDescription(java.lang.String pSearchString,
                                                     java.lang.String[] pSearchPropertyNames,
                                                     java.lang.String pCatalogId,
                                                     java.lang.String pCatalogKey)
                                              throws RepositoryException,
                                                     GetException
Retrieves the product whose properties as specified by pSearchPropertyNames or getSearchPropertyNames() contains pSearchString.

Parameters:
pSearchString - search string to search for in the properties of Product
pSearchPropertyNames - array of property names to search for
pCatalogId - catalog item to verify the product
pCatalogKey - catalog to use
Returns:
product items in XML format
Throws:
RepositoryException - if an error occurs
GetException - if an error occurs

getProductXMLByRQL

public java.lang.String[] getProductXMLByRQL(java.lang.String pRQLQuery,
                                             java.lang.String pCatalogId,
                                             java.lang.String pCatalogKey)
                                      throws RepositoryException,
                                             GetException
Parses the pRQLQuery and executes the RqlStatement to retrieve the product items. product repository items are checked against specified catalog to include only items present in catalog.

Parameters:
pRQLQuery - RQL query string to execute against product RepositoryView
pCatalogId - Id of the catalog to retrieve
pCatalogKey - key to the catalog to use
Returns:
array of strings containing product repository items in XML format
Throws:
RepositoryException - if an error occurs
GetException - if an error occurs

filterProducts

protected void filterProducts(RepositoryItem[] pProducts,
                              java.lang.String pCatalogId,
                              java.lang.String pCatalogKey)
                       throws RepositoryException
Verifies the pProducts repository items checking whether they belong to the catalog specified by pCatalogId. Returns only the items that belong to the specified catalog

Parameters:
pProducts - product repository items to verify
pCatalogId - Id of the catalog item to verify in
pCatalogKey - key to the catalog to use
Throws:
RepositoryException - if an error occurs

generateQuery

protected Query generateQuery(java.lang.String[] pSearchPropertyNames,
                              java.lang.String pSearchString,
                              java.lang.String pCatalogKey,
                              QueryBuilder pProductQueryBuilder)
                       throws RepositoryException
Generates Query to execute. Iterates through the pSearchPropertyNames array constructing the query

Parameters:
pSearchPropertyNames - a String[] value
pSearchString - a String value
pCatalogKey - a String value
pProductQueryBuilder - a QueryBuilder value
Returns:
a Query value
Throws:
RepositoryException - if an error occurs

getCatalogItemFromProfile

protected RepositoryItem getCatalogItemFromProfile()
Retrieves the catalog item from the user repository item in the current session.

Returns:
catalog item

getProductXMLById

public java.lang.String getProductXMLById(java.lang.String pProductId,
                                          java.lang.String pCatalogId)
                                   throws RepositoryException,
                                          GetException
Retrieves the Product item in XML form as speicfied by the pProductId. if custom catalogs are used then catalog item is retrieved as specified by pCatalogId. If no catalog item is found then the user in the current session is accessed and catalog item is retrieved from the user.

Parameters:
pProductId - specifies the product to retrieve
pCatalogId - specifies the catalogItem to check for the product
Returns:
Product item in XML form.
Throws:
RepositoryException - if an error occurs
GetException - if an error occurs

getProductSkusXML

public java.lang.String[] getProductSkusXML(java.lang.String pProductId,
                                            java.lang.String pCatalogId)
                                     throws RepositoryException,
                                            GetException
Retrieves product repository item as specified by pProductId and returns the SKU items in the product in XML format. getProductSKUPropertyName() specifies the propery name of SKU repository items in product repository item.

Parameters:
pProductId - Id of the product to retreive SKU items from
pCatalogId - catalog Item to use.
Returns:
SKU items present in the specified product in XML format.
Throws:
RepositoryException - if an error occurs
GetException - if an error occurs

getProductXMLByDescription

public java.lang.String[] getProductXMLByDescription(java.lang.String pSearchString,
                                                     java.lang.String[] pSearchPropertyNames,
                                                     java.lang.String pCatalogId)
                                              throws RepositoryException,
                                                     GetException
Retrieves the product whose properties as specified by pSearchPropertyNames or getSearchPropertyNames() contains pSearchString.

Parameters:
pSearchString - search string to search for in the properties of Product
pSearchPropertyNames - array of property names to search for
pCatalogId - catalog item to verify the product
Returns:
product items in XML format
Throws:
RepositoryException - if an error occurs
GetException - if an error occurs

getProductXMLByRQL

public java.lang.String[] getProductXMLByRQL(java.lang.String pRQLQuery,
                                             java.lang.String pCatalogId)
                                      throws RepositoryException,
                                             GetException
Parses the pRQLQuery and executes the RqlStatement to retrieve the product items. product repository items are checked against specified catalog to include only items present in catalog.

Parameters:
pRQLQuery - RQL query string to execute against product RepositoryView
pCatalogId - Id of the catalog to retrieve
Returns:
array of strings containing product repository items in XML format
Throws:
RepositoryException - if an error occurs
GetException - if an error occurs

catalogItemViewed

public void catalogItemViewed(java.lang.String pProfileId,
                              java.lang.String pItemId,
                              java.lang.String pItemType)
                       throws RepositoryException
This method can be used to announce that a particular item was viewed by the current user. A new ViewItemMessage will be created and sent.

Parameters:
pProfileId - The id of the user who viewed the item. If null, current user is assumed
pItemId - The item of the item
pItemType - The type of the item viewed: (eg category, product)
Throws:
RepositoryException - Thrown if the item is not valid
See Also:
ViewItemMessage