public class GiftRegistryContextImpl extends AbstractContextImpl implements GiftRegistryContext, ContextSPI
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
SER_ELEMENT_SEP
The delimiter used in Vector and HashMap string representation
|
static java.lang.String |
SER_KEY_SEP
The delimiter used in the key-value of the HashMap string representation
|
SER_VALUE_SEP
CONTEXT_NAME
Constructor and Description |
---|
GiftRegistryContextImpl()
Creates the preview context.
|
Modifier and Type | Method and Description |
---|---|
void |
clearContext()
Resets the attributes specific to this context.
|
void |
copyContext(Context ctx)
Copy the content of the specified context to this context.
|
java.lang.Object[] |
getContextAttributes()
This method returns an array of context attributes to be persisted.
|
java.lang.String |
getContextName()
Returns the name of this context
|
java.lang.String |
getCurrentExternalId()
Returns the current gift registry externalId that this shopper has accessed or managed
|
java.util.Vector |
getExternalIdsAccessed()
Returns a vector of all the gift registry externalId's this user accessed this session
|
java.util.Vector |
getExternalIdsAccessedByRelationship(java.lang.Integer relationship)
Returns a list of gift registry externalId's that this user has accessed or managed recently
for which they have a particular relationship with.
|
java.util.Vector |
getExternalIdsByRegistrantRelationship()
Returns a list of gift registry externalId's that this user has the Registrant or
Co-Registrant relationship with.
|
java.lang.String |
getGiftRegistryBeingManaged()
If
isUserManagingARegistry() is true, it means that a gift registry is being
managed by a shopper. |
java.lang.String |
getLastExternalIdAccessed()
Returns the last gift registry externalId that this shopper has accessed or managed
|
java.lang.Integer |
getRegistryRelationship(java.lang.String externalId)
Returns the relationship of a registrant with regards to a known registry they
accessed.
|
void |
initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData)
Initializes the context with the initialization data.
|
void |
initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData,
Context ctx)
Initializes the context based on the context passed in as the argument and updates it using the initData.
|
boolean |
isUserManagingARegistry()
Returns true if the user is currently managing a registry.
|
void |
preInvokeContext(com.ibm.commerce.component.contextservice.ActivityData sessionData)
Operation to perform at the beginning of each request.
|
void |
removeAllAccessedExternalIds()
Removes all externalId's from the list of accessed registries for this user
|
java.lang.String |
removeExternalIdAccessed(java.lang.String externalId)
Removes an externalId from the list of accessed registries for this user
|
void |
setContextAttributes(java.lang.String[] ctxAttrs)
This method initializes the context from the specified list of attributes.
|
void |
setExternalIdAccessed(java.lang.String externalId)
Adds to a list of gift registry externalId's this user has accessed.
|
void |
setExternalIdAccessed(java.lang.String externalId,
java.lang.Integer relationship)
Adds to a list of gift registry externalId's this user has accessed.
|
void |
setUserManagingARegistry(boolean managing,
java.lang.String externalId)
Sets if the user is currently managing a particular registry.
|
boolean |
validate()
Validates whether the attributes of this context are valid.
|
clear, getActivityToken, getContextSerializedString, initialize, initialize, isDirty, postInvoke, postInvokeContext, preInvoke, recalibrate, recalibrateContext, reset, resetContext, setContextSerializedString, setDirty, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getActivityToken
clear, getContextSerializedString, initialize, initialize, isDirty, postInvoke, preInvoke, recalibrate, reset, setContextSerializedString
public static final java.lang.String COPYRIGHT
public static final java.lang.String SER_ELEMENT_SEP
public static final java.lang.String SER_KEY_SEP
public GiftRegistryContextImpl()
public void clearContext()
clearContext
in class AbstractContextImpl
AbstractContextImpl.clear()
public void copyContext(Context ctx)
copyContext
in interface Context
ctx
- - The context to be copied from.public java.lang.Object[] getContextAttributes() throws BusinessContextException
getContextAttributes
in class AbstractContextImpl
BusinessContextException
AbstractContextImpl.getContextSerializedString()
public void setContextAttributes(java.lang.String[] ctxAttrs)
setContextAttributes
in class AbstractContextImpl
ctxAttrs
- An array of attributes of the contextpublic void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData) throws BusinessContextException
initializeContext
in class AbstractContextImpl
initData
- The sets of attributes that are passed in from the request.java.lang.Exception
BusinessContextException
- on any error encounteredAbstractContextImpl.initializeContext(ActivityData)
public void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData, Context ctx) throws BusinessContextException
initializeContext
in class AbstractContextImpl
initData
- The sets of attributes that are passed by the requestctx
- The particular context of the token being copied from.java.lang.Exception
BusinessContextException
- on any error encounteredpublic java.lang.String getContextName()
getContextName
in interface Context
public boolean validate() throws BusinessContextException
validate
in interface Context
BusinessContextException
- Throws exception if any of the attribute is not valid.public void preInvokeContext(com.ibm.commerce.component.contextservice.ActivityData sessionData) throws BusinessContextException
preInvokeContext
in class AbstractContextImpl
sessionData
- The session data of the request.java.lang.Exception
- should never happen since no operation is performed.BusinessContextException
- on any error encounteredContextSPI.preInvoke(com.ibm.commerce.component.contextservice.ActivityData)
public java.lang.Integer getRegistryRelationship(java.lang.String externalId)
getExternalIdsAccessed()
Vector.getRegistryRelationship
in interface GiftRegistryContext
ExternalId
- public java.lang.String getLastExternalIdAccessed()
getLastExternalIdAccessed
in interface GiftRegistryContext
public java.lang.String getCurrentExternalId()
getCurrentExternalId
in interface GiftRegistryContext
public java.util.Vector getExternalIdsAccessed()
getExternalIdsAccessed
in interface GiftRegistryContext
public void setExternalIdAccessed(java.lang.String externalId, java.lang.Integer relationship)
setExternalIdAccessed
in interface GiftRegistryContext
ExternalId
- relationship
- public void setExternalIdAccessed(java.lang.String externalId)
setExternalIdAccessed
in interface GiftRegistryContext
ExternalId
- public java.util.Vector getExternalIdsByRegistrantRelationship()
getExternalIdsByRegistrantRelationship
in interface GiftRegistryContext
public java.util.Vector getExternalIdsAccessedByRelationship(java.lang.Integer relationship)
getExternalIdsAccessedByRelationship
in interface GiftRegistryContext
relationship
- public boolean isUserManagingARegistry()
getGiftRegistryBeingManaged()
.isUserManagingARegistry
in interface GiftRegistryContext
public void setUserManagingARegistry(boolean managing, java.lang.String externalId)
setUserManagingARegistry
in interface GiftRegistryContext
managing
- ExternalId
- public java.lang.String getGiftRegistryBeingManaged()
isUserManagingARegistry()
is true, it means that a gift registry is being
managed by a shopper. This method can then be called to retrieve the gift registry
ExternalId that the user is managing.getGiftRegistryBeingManaged
in interface GiftRegistryContext
public java.lang.String removeExternalIdAccessed(java.lang.String externalId)
removeExternalIdAccessed
in interface GiftRegistryContext
ExternalId
- public void removeAllAccessedExternalIds()
removeAllAccessedExternalIds
in interface GiftRegistryContext