|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.projects.store.profile.recentlyviewed.RecentlyViewedTools
public class RecentlyViewedTools
This class provides the low level functionality for recently viewed item creation/manipulation. It performs the calls required to read and write information to and from the userProfile repository.
There are also some convenience methods for general recently viewed functionality.
Field Summary | |
---|---|
static java.lang.String |
ALL_SITE_SCOPE
|
static java.lang.String |
CLASS_VERSION
Class version string |
static java.lang.String |
CURRENT_SITE_SCOPE
|
protected atg.multisite.SiteGroupManager |
mSiteGroupManager
|
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 | |
---|---|
RecentlyViewedTools()
|
Method Summary | |
---|---|
void |
addProduct(atg.repository.RepositoryItem pItem,
atg.repository.RepositoryItem pProfile,
java.lang.String pSiteId)
Puts product into the list of recently viewed products for the current profile. |
void |
addProductsToList(java.util.List<atg.repository.RepositoryItem> pProducts,
atg.repository.RepositoryItem pProfile)
This method takes a List of recentlyViewedProduct items and adds them a user's recentlyViewedProducts list. |
void |
addRecentlyViewedProduct(atg.repository.MutableRepositoryItem pRecentlyViewedProduct)
This method adds a transient recentlyViewedProduct item to the repository. |
atg.repository.MutableRepositoryItem |
createRecentlyViewedProduct(atg.repository.RepositoryItem pProduct,
atg.repository.RepositoryItem pProfile,
java.lang.String pSiteId)
Create a new 'recentlyViewedProduct' item and add it to the repository if the user is logged in. |
atg.service.util.CurrentDate |
getCurrentDate()
|
atg.repository.RepositoryItem |
getDuplicateRecentlyViewedProduct(atg.repository.RepositoryItem pProduct,
java.util.List<atg.repository.RepositoryItem> pRecentlyViewed,
java.lang.String pSiteId)
Check a recentlyViewed list for a duplicate product. |
int |
getExpiryPeriod()
|
StartEndDateValidator |
getItemDateValidator()
|
java.util.List<atg.repository.RepositoryItem> |
getProducts(atg.repository.RepositoryItem pProfile)
Get the specified user's (immutable) recentlyViewedProduct list. |
java.util.List<atg.repository.RepositoryItem> |
getProductsForUpdate(atg.repository.RepositoryItem pProfile)
Gets a user's recentlyViewedProducts property list that can be written to. |
StoreProfileTools |
getProfileTools()
|
int |
getRecentlyViewedSize()
|
protected atg.multisite.SiteGroupManager |
getSiteGroupManager()
|
java.lang.String |
getSiteScope()
|
boolean |
isListSizeInfinite()
|
boolean |
isProductExpired(atg.repository.RepositoryItem pProduct)
This method checks if an recentlyViewedProduct item's timestamp property exceeds the expiryPeriod. |
boolean |
isSiteInScope(java.lang.String pRecentlyViewedProductSiteId,
java.lang.String pSiteId)
This method checks if a site is valid for a particular siteScope and the current site context. |
boolean |
removeExpiredProducts(java.util.List<atg.repository.RepositoryItem> pRecentlyViewed,
atg.repository.RepositoryItem pProfile)
This method removes any products from a user's recently viewed products repository list that exceed this components expiryPeriod. |
boolean |
removeNonExistentProducts(java.util.List<atg.repository.RepositoryItem> pRecentlyViewed,
atg.repository.RepositoryItem pProfile)
This method removes any recentlyViewedProduct items from the recentlyViewedProducts list if a product item doesn't exist any more in the productCatalog repository. |
void |
setCurrentDate(atg.service.util.CurrentDate pCurrentDate)
|
void |
setExpiryPeriod(int pExpiryPeriod)
|
void |
setItemDateValidator(StartEndDateValidator pItemDateValidator)
|
void |
setListSizeInfinite(boolean pListSizeInfinite)
|
void |
setProfileTools(StoreProfileTools pProfileTools)
|
void |
setRecentlyViewedSize(int pRecentlyViewedSize)
|
void |
setSiteGroupManager(atg.multisite.SiteGroupManager pSiteGroupManager)
|
void |
setSiteScope(java.lang.String pSiteScope)
|
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 |
---|
public static final java.lang.String CLASS_VERSION
public static final java.lang.String CURRENT_SITE_SCOPE
public static final java.lang.String ALL_SITE_SCOPE
protected atg.multisite.SiteGroupManager mSiteGroupManager
Constructor Detail |
---|
public RecentlyViewedTools()
Method Detail |
---|
protected atg.multisite.SiteGroupManager getSiteGroupManager()
public void setSiteGroupManager(atg.multisite.SiteGroupManager pSiteGroupManager)
pSiteGroupManager
- A SiteGroupManager instance.public StoreProfileTools getProfileTools()
public void setProfileTools(StoreProfileTools pProfileTools)
pProfileTools
- A StoreProfileTools instance.public int getRecentlyViewedSize()
public void setRecentlyViewedSize(int pRecentlyViewedSize)
pRecentlyViewedSize
- The maximum size of a user's recently viewed list.public void setListSizeInfinite(boolean pListSizeInfinite)
pListSizeInfinite
- A flag determining whether the recently viewed list size should be infinite or not.public boolean isListSizeInfinite()
public void setExpiryPeriod(int pExpiryPeriod)
pExpiryPeriod
- The expiry period for a recentlyViewedItem. '0' means that there is no
expiry period.public int getExpiryPeriod()
public void setSiteScope(java.lang.String pSiteScope)
pSiteScope
- The site scope (all/current/shareableId).public java.lang.String getSiteScope()
public void setItemDateValidator(StartEndDateValidator pItemDateValidator)
pItemDateValidator
- The ItemDateValidator component.public StartEndDateValidator getItemDateValidator()
public void setCurrentDate(atg.service.util.CurrentDate pCurrentDate)
pCurrentDate
- The CurrentDate component.public atg.service.util.CurrentDate getCurrentDate()
public void addProduct(atg.repository.RepositoryItem pItem, atg.repository.RepositoryItem pProfile, java.lang.String pSiteId) throws atg.repository.RepositoryException
The term 'virtual' list is used because each user's recently viewed list will contain every product browsed no matter what site it was viewed on. The siteScope property is then taken into account and a conceptual list is maintained for products in that particular siteScope and currently viewed site. This is needed to determine how many products from each site should be held in the list.
So for example, if the maximum number of products that can be held in a list is 10. If storeA and storeB both share a ShoppingCart shareableType and storeC doesn't share anything; storeA and storeB will share a conceptual list of 10 products and storeC will hold a conceptual list of 10 products. This means that the recently viewed user profile list for a a user can hold a total of 20 products.
pItem
- A repository item to add to the list of recently viewed items.pProfile
- A user profile repository item.pSiteId
- The site id associated with the product to be added.
atg.repository.RepositoryException
public boolean removeNonExistentProducts(java.util.List<atg.repository.RepositoryItem> pRecentlyViewed, atg.repository.RepositoryItem pProfile) throws atg.repository.RepositoryException
pRecentlyViewed
- The recentlyViewedProducts list that will be examined for
expired products.pProfile
- The user who owns the recently viewed list.
atg.repository.RepositoryException
- If there was a problem removing a product from the repository.public boolean isSiteInScope(java.lang.String pRecentlyViewedProductSiteId, java.lang.String pSiteId)
pRecentlyViewedProductSiteId
- The site id of a recentlyViewedProduct.pSiteId
- The id of the site currently in context.
public atg.repository.MutableRepositoryItem createRecentlyViewedProduct(atg.repository.RepositoryItem pProduct, atg.repository.RepositoryItem pProfile, java.lang.String pSiteId) throws atg.repository.RepositoryException
pProduct
- The product that will be set in the recentlyViewedItem 'product' property.pProfile
- The profile item of the user that the recentlyViewedProduct is being created for.pSiteId
- The site id of the site that is currently in context.
atg.repository.RepositoryException
- If there's a problem creating/adding the item.public void addRecentlyViewedProduct(atg.repository.MutableRepositoryItem pRecentlyViewedProduct) throws atg.repository.RepositoryException
pRecentlyViewedProduct
- The transient recentlyViewedProduct to be added.
atg.repository.RepositoryException
- If there's a problem adding the recentlyViewedProduct to the repository.public void addProductsToList(java.util.List<atg.repository.RepositoryItem> pProducts, atg.repository.RepositoryItem pProfile) throws atg.repository.RepositoryException
pProducts
- The list of recentlyViewedProducts that are to be added to the list.pProfile
- The profile of the user whose recently viewed list is to be updated.
atg.repository.RepositoryException
public java.util.List<atg.repository.RepositoryItem> getProductsForUpdate(atg.repository.RepositoryItem pProfile) throws atg.repository.RepositoryException
pProfile
- The user's profile whose recentlyViewedProducts property is to be modified.
atg.repository.RepositoryException
- If there's a problem retrieving the recently viewed list.public java.util.List<atg.repository.RepositoryItem> getProducts(atg.repository.RepositoryItem pProfile)
pProfile
- The user whose recentlyViewedProduct list will be retrieved.
public atg.repository.RepositoryItem getDuplicateRecentlyViewedProduct(atg.repository.RepositoryItem pProduct, java.util.List<atg.repository.RepositoryItem> pRecentlyViewed, java.lang.String pSiteId)
pProduct
- The actual 'product' item to be added to the list.pRecentlyViewed
- The current list of recentlyViewedProduct items.pSiteId
- The site id of the site that is currently in context.
public boolean removeExpiredProducts(java.util.List<atg.repository.RepositoryItem> pRecentlyViewed, atg.repository.RepositoryItem pProfile) throws atg.repository.RepositoryException
pRecentlyViewed
- The recentlyViewedProducts list that will be examined for
expired products.
atg.repository.RepositoryException
- If there was a problem removing a product from the repository.public boolean isProductExpired(atg.repository.RepositoryItem pProduct)
pProduct
- The recentlyViewedProduct item we want to run the expiry check against.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |