com.ibm.commerce.giftcenter.context

Class GiftCenterContextImpl

  • All Implemented Interfaces:
    Context, ContextSPI, GiftCenterContext, java.io.Serializable


    public class GiftCenterContextImpl
    extends AbstractContextImpl
    implements GiftCenterContext
    The context contains the following information for managing gift lists:
    • A list of external identifiers for gift lists the user has accessed with a gift giver relationship
    • A list of external identifiers for gift lists the user has accessed with a co-registrant relationship
    • The unique identifier of the gift list that is being completed
    The gift lists a user owns are not stored in the context. They must be retrieved using the getGiftRegistiesOwnedByUser method (for gift registries) and the getWishListsOwnedByUser method (for wish lists).
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GiftCenterContextImpl

        public GiftCenterContextImpl()
        Default constructor to create a gift center context.
    • Method Detail

      • initializeContext

        public void initializeContext(com.ibm.commerce.component.contextservice.ActivityData initData,
                                      Context ctx)
                               throws BusinessContextException
        Initializes the context based on the context passed in as the argument by invoking the copyContext method.
        Overrides:
        initializeContext in class AbstractContextImpl
        Parameters:
        initData - The sets of attributes that are passed by the request.
        ctx - The particular context of the token being copied from.
        Throws:
        BusinessContextException - When the copy context fails.
      • copyContext

        public void copyContext(Context ctx)
        Copies the content of the specified context to this context.
        Specified by:
        copyContext in interface Context
        Parameters:
        ctx - The context to be copied from.
      • preInvokeContext

        public void preInvokeContext(com.ibm.commerce.component.contextservice.ActivityData sessionData)
                              throws BusinessContextException
        Performs context-specific tasks before request execution. If the request contains the external identifier and one of the guest access key or registry access key, the method updates the context to provide the user gift giver or co-registrant access based on the access key used. If the access keys does not match with the external identifier, the context is not updated.
        Specified by:
        preInvokeContext in class AbstractContextImpl
        Parameters:
        sessionData - The map of name-value pairs for the parameters that are passed in the request.
        Throws:
        BusinessContextException - on any error
        See Also:
        AbstractContextImpl.preInvoke(ActivityData)
      • getContextName

        public java.lang.String getContextName()
        Returns the name of the context that is stored in the CTXDATA table.
        Specified by:
        getContextName in interface Context
        Returns:
        The name of the context.
      • toString

        public java.lang.String toString()
        Returns the string representation of the object.
        Overrides:
        toString in class AbstractContextImpl
        Returns:
        The string representation of the object.
      • getGiftListExtIdsAccessed

        public java.util.Vector getGiftListExtIdsAccessed()
        Returns a list of external identifiers for gift lists that the user has accessed with either the gift giver relationship or the co-registrant relationship. For external identifiers for gift lists with which the user has a registrant relationship, use the getGiftRegistriesOwnedByUser and getWishListsOwnedByUser methods.
        Specified by:
        getGiftListExtIdsAccessed in interface GiftCenterContext
        Returns:
        A list of gift list external identifiers.
      • getGiftListExtIdsByCoRegistrantRelationship

        public java.util.Vector getGiftListExtIdsByCoRegistrantRelationship()
        Returns a list of external identifiers for gift lists that the user has a co-registrant relationship with.
        Specified by:
        getGiftListExtIdsByCoRegistrantRelationship in interface GiftCenterContext
        Returns:
        A list of gift list external identifiers.
      • getGiftListExtIdsByGiftGiverRelationship

        public java.util.Vector getGiftListExtIdsByGiftGiverRelationship()
        Returns a list of external identifiers for gift lists that the user has a gift giver relationship with.
        Specified by:
        getGiftListExtIdsByGiftGiverRelationship in interface GiftCenterContext
        Returns:
        A list of gift list external identifiers.
      • getGiftListRelationship

        public java.lang.Integer getGiftListRelationship(java.lang.String externalId)
        Returns the relationship a user has to a gift list that was accessed.
        Specified by:
        getGiftListRelationship in interface GiftCenterContext
        Parameters:
        externalId - The gift list identifier for which the relationship value must be returned.
        Returns:
        The user's relationship value with the gift list.
      • getGiftListBeingCompleted

        public java.lang.String getGiftListBeingCompleted()
        Returns the unique identifier for the gift list that the user is currently completing.
        Specified by:
        getGiftListBeingCompleted in interface GiftCenterContext
        Returns:
        The unique identifier for the gift list that the user is currently completing.
      • getGiftRegistiesOwnedByUser

        public java.util.Vector getGiftRegistiesOwnedByUser()
        Returns a vector of external identifiers for gift registries the user owns, if the user is not a guest or generic user. For guest and generic users, this method returns an empty vector.
        Specified by:
        getGiftRegistiesOwnedByUser in interface GiftCenterContext
        Returns:
        A vector of external identifiers for gift registries the user owns in the context. If the user is a guest or generic user, the vector is empty.
      • getWishListsOwnedByUser

        public java.util.Vector getWishListsOwnedByUser()
        Returns a vector of external identifiers for wish lists the user owns, if the user is not a guest or generic user. For guest and generic users, this method returns an empty vector.
        Specified by:
        getWishListsOwnedByUser in interface GiftCenterContext
        Returns:
        A vector of external identifiers for wish lists the user owns in the context. If the user is a guest or generic user, the vector is empty.
      • setGiftListBeingCompleted

        public void setGiftListBeingCompleted(java.lang.String aGiftListBeingCompleted)
        Sets the unique identifier for the gift list that the user is currently completing.
        Specified by:
        setGiftListBeingCompleted in interface GiftCenterContext
        Parameters:
        aGiftListBeingCompleted - The unique identifier for the gift list that the user is currently completing.
      • addToGiftListExtIdAccessedWithCoRegistrantRelationship

        public void addToGiftListExtIdAccessedWithCoRegistrantRelationship(java.lang.String externalId)
        Adds a gift list external identifier value to the list of identifiers for gift lists the user has accessed with a co-registrant relationship. If the user accesses a new gift list, this method is called to store this information. If the user owns the gift list, this method does not update the context.
        Specified by:
        addToGiftListExtIdAccessedWithCoRegistrantRelationship in interface GiftCenterContext
        Parameters:
        externalId - The gift list external identifier that will be added to the list.
      • addToGiftListExtIdAccessedWithGiftGiverRelationship

        public void addToGiftListExtIdAccessedWithGiftGiverRelationship(java.lang.String externalId)
        Adds a gift list external identifier value to the list of identifiers for gift lists the user has accessed with a gift giver relationship. If the user accesses a new gift list, this method is called to store this information. If the user previously accessed the gift list with a relationship higher than gift giver, for example, registrant, the method does not change the user's relationship with the gift list.
        Specified by:
        addToGiftListExtIdAccessedWithGiftGiverRelationship in interface GiftCenterContext
        Parameters:
        externalId - The gift list external identifier that will be added to the list.
      • addToGiftListExtIdAccessed

        public void addToGiftListExtIdAccessed(java.lang.String externalId,
                                               java.lang.Integer relationship)
        Adds a gift list external identifier value to the list of identifiers for gift lists the user has accessed. If the user accesses a new gift list, this method is called to store this information. The relationship parameter is the user authentication relationship the user has with the gift list.
        Specified by:
        addToGiftListExtIdAccessed in interface GiftCenterContext
        Parameters:
        externalId - The gift list external identifier that will be added to the list.
        relationship - The relationship the user has with the gift list.
      • removeAllAccessedGiftListExtIds

        public void removeAllAccessedGiftListExtIds()
        Removes all gift list external identifiers from the list of accessed gift lists for this user.
        Specified by:
        removeAllAccessedGiftListExtIds in interface GiftCenterContext
      • removeGiftListExtIdAccessed

        public void removeGiftListExtIdAccessed(java.lang.String externalId)
        Removes a gift list external identifier from the list of accessed gift lists for this user.
        Specified by:
        removeGiftListExtIdAccessed in interface GiftCenterContext
        Parameters:
        externalId - The gift list external identifier that must be removed.