com.ibm.commerce.rest.bod.helpers

Class PersonHelper

  • java.lang.Object
    • com.ibm.commerce.rest.bod.helpers.PersonHelper


  • public class PersonHelper
    extends java.lang.Object
    This class provides helper methods to get and update data for Person noun using MemberFacadeClient.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String BILLING
      Billing type
      static java.lang.String CHECKOUT_ACCESS_PROFILE
      The checkout access profile.
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
      static java.lang.String DEFAULT_ACCESS_PROFILE
      The default access profile.
      static java.lang.String FIND_BY_SELF_XPATH
      The default expression, used when a noun identifier is not provided.
      static java.lang.String NOUN
      The OAGIS noun that this helper performs BOD action on.
      static java.lang.String SHIPPING
      Shipping type
      static java.lang.String SHIPPING_ADD_BILLING
      ShippingAndBilling type
    • Constructor Summary

      Constructors 
      Constructor and Description
      PersonHelper() 
      PersonHelper(com.ibm.commerce.rest.utils.Instrumentor instrumentor)
      Instantiates a new person helper.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.util.Map<java.lang.String,java.lang.Object> deleteAddressForPerson(BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh, java.lang.String nickName)
      This method is used to delete contact
      java.util.Map deleteContextAttributeForPerson(java.lang.String jobName, java.lang.String storeId, java.lang.String attrVal, BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh)
      Deletes one or more context attributes of an existing person.
      java.lang.String getAddressIdByNickName(java.lang.String nickName, BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh, java.lang.String accessProfile)
      Get address Id by a person's nick name.
      com.ibm.commerce.rest.utils.Instrumentor getInstrumentor()
      Get the instrumentor associated with this request instance.
      commonj.sdo.DataObject getPerson(BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh, java.lang.String expression, java.lang.String accessProfile)
      This method performs a GetPerson service request.
      commonj.sdo.DataObject getPersonContact(PersonType person, java.lang.String nickName, BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh, java.lang.String accessProfile)
      This method get PersonContact from a PersonType object.
      commonj.sdo.DataObject getPersonContact(java.lang.String nickName, BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh, java.lang.String accessProfile)
      This method performs a GetPersonContact service request.
      commonj.sdo.DataObject getPersonContactByAddressType(java.lang.String addressType, BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh, java.lang.String accessProfile)
      Get person contact by address type.
      commonj.sdo.DataObject getPersonContactById(java.lang.String addressId, BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh, java.lang.String accessProfile)
      Get person contact by address Id.
      java.lang.String getPersonIdForSelf(BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh)
      Get person id for the user who is logged on.
      PersonType getPersonType(BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh, java.lang.String expression, java.lang.String accessProfile)
      This method get DataObject for the first and then extract PersonType.
      java.util.Map<java.lang.String,java.lang.Object> processOrChangePerson(java.lang.String resourceName, java.lang.String urlParamGrpName, java.lang.String verb, java.lang.String actionCode, java.util.Map requestMap, BusinessContextType businessContext, javax.security.auth.callback.CallbackHandler callbackHandler)
      Create BOD object and execute it.
      java.util.Map<java.lang.String,java.lang.Object> resetPassword(java.util.Map<java.lang.String,java.lang.Object> requestMap, java.lang.String resourceName, BusinessContextType bContext, javax.security.auth.callback.CallbackHandler cbh)
      This method is used to reset password for registered shopper.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
      • DEFAULT_ACCESS_PROFILE

        public static final java.lang.String DEFAULT_ACCESS_PROFILE
        The default access profile.
        See Also:
        Constant Field Values
      • CHECKOUT_ACCESS_PROFILE

        public static final java.lang.String CHECKOUT_ACCESS_PROFILE
        The checkout access profile.
        See Also:
        Constant Field Values
      • FIND_BY_SELF_XPATH

        public static final java.lang.String FIND_BY_SELF_XPATH
        The default expression, used when a noun identifier is not provided.
        See Also:
        Constant Field Values
      • NOUN

        public static final java.lang.String NOUN
        The OAGIS noun that this helper performs BOD action on.
        See Also:
        Constant Field Values
      • SHIPPING_ADD_BILLING

        public static final java.lang.String SHIPPING_ADD_BILLING
        ShippingAndBilling type
        See Also:
        Constant Field Values
    • Constructor Detail

      • PersonHelper

        public PersonHelper()
      • PersonHelper

        public PersonHelper(com.ibm.commerce.rest.utils.Instrumentor instrumentor)
        Instantiates a new person helper.
        Parameters:
        instrumentor - the instrumentor
    • Method Detail

      • getInstrumentor

        public com.ibm.commerce.rest.utils.Instrumentor getInstrumentor()
        Get the instrumentor associated with this request instance.
        Returns:
        the instrumentor
      • getPerson

        public commonj.sdo.DataObject getPerson(BusinessContextType bContext,
                                                javax.security.auth.callback.CallbackHandler cbh,
                                                java.lang.String expression,
                                                java.lang.String accessProfile)
                                         throws PersonException
        This method performs a GetPerson service request.
        Parameters:
        bContext - the b context
        cbh - the cbh
        expression - the XPath expression.
        accessProfile - the access profile of the get expression.
        Returns:
        the Person noun.
        Throws:
        PersonException - the exception representing the error of the GetPerson request.
      • getPersonType

        public PersonType getPersonType(BusinessContextType bContext,
                                        javax.security.auth.callback.CallbackHandler cbh,
                                        java.lang.String expression,
                                        java.lang.String accessProfile)
                                 throws PersonException
        This method get DataObject for the first and then extract PersonType.
        Parameters:
        bContext - the business context
        cbh - the cbh
        expression - the expression
        accessProfile - the access profile
        Returns:
        the person type
        Throws:
        PersonException - the person exception
      • getPersonIdForSelf

        public java.lang.String getPersonIdForSelf(BusinessContextType bContext,
                                                   javax.security.auth.callback.CallbackHandler cbh)
                                            throws PersonException
        Get person id for the user who is logged on. It will use CallbackHandler parameter to identify the person.
        Parameters:
        bContext - the b context
        cbh - the cbh
        Returns:
        the person id for self
        Throws:
        PersonException - the person exception
      • getPersonContact

        public commonj.sdo.DataObject getPersonContact(java.lang.String nickName,
                                                       BusinessContextType bContext,
                                                       javax.security.auth.callback.CallbackHandler cbh,
                                                       java.lang.String accessProfile)
                                                throws PersonException
        This method performs a GetPersonContact service request.
        Parameters:
        nickName - Nick name of the contact
        bContext - Business context
        cbh - Callback handler
        accessProfile - access profile
        Returns:
        Person contact.
        Throws:
        PersonException - the exception representing the error of the getPersonContact request.
      • getPersonContactByAddressType

        public commonj.sdo.DataObject getPersonContactByAddressType(java.lang.String addressType,
                                                                    BusinessContextType bContext,
                                                                    javax.security.auth.callback.CallbackHandler cbh,
                                                                    java.lang.String accessProfile)
                                                             throws PersonException
        Get person contact by address type.
        Parameters:
        addressType - address type
        bContext - business context
        cbh - callback handler
        accessProfile - access profile
        Returns:
        return a DataObject
        Throws:
        PersonException
      • getPersonContactById

        public commonj.sdo.DataObject getPersonContactById(java.lang.String addressId,
                                                           BusinessContextType bContext,
                                                           javax.security.auth.callback.CallbackHandler cbh,
                                                           java.lang.String accessProfile)
                                                    throws PersonException
        Get person contact by address Id.
        Parameters:
        addressId -
        bContext -
        cbh -
        accessProfile -
        Returns:
        Person contact DataObject
        Throws:
        PersonException
      • getAddressIdByNickName

        public java.lang.String getAddressIdByNickName(java.lang.String nickName,
                                                       BusinessContextType bContext,
                                                       javax.security.auth.callback.CallbackHandler cbh,
                                                       java.lang.String accessProfile)
                                                throws PersonException
        Get address Id by a person's nick name.
        Parameters:
        nickName - Nick name.
        bContext - Business context.
        cbh - Callback handler.
        accessProfile - Access profile.
        Returns:
        Address Id.
        Throws:
        PersonException - May throw PersonException.
      • getPersonContact

        public commonj.sdo.DataObject getPersonContact(PersonType person,
                                                       java.lang.String nickName,
                                                       BusinessContextType bContext,
                                                       javax.security.auth.callback.CallbackHandler cbh,
                                                       java.lang.String accessProfile)
                                                throws PersonException
        This method get PersonContact from a PersonType object.
        Parameters:
        person - the current shopper.
        nickName - of the contact to get.
        bContext - Business context.
        cbh - Callback handler.
        accessProfile - Access profile.
        Returns:
        Person contact.
        Throws:
        PersonException
      • processOrChangePerson

        public java.util.Map<java.lang.String,java.lang.Object> processOrChangePerson(java.lang.String resourceName,
                                                                                      java.lang.String urlParamGrpName,
                                                                                      java.lang.String verb,
                                                                                      java.lang.String actionCode,
                                                                                      java.util.Map requestMap,
                                                                                      BusinessContextType businessContext,
                                                                                      javax.security.auth.callback.CallbackHandler callbackHandler)
                                                                               throws java.lang.Exception
        Create BOD object and execute it.
        Parameters:
        resourceName - resource name
        urlParamGrpName - URL parameter group name defined in XML configuration file
        verb - verb
        actionCode - action code
        requestMap - request data
        businessContext - business context
        callbackHandler - callback handler
        Returns:
        response map
        Throws:
        java.lang.Exception - throw exception when error happens
      • deleteAddressForPerson

        public java.util.Map<java.lang.String,java.lang.Object> deleteAddressForPerson(BusinessContextType bContext,
                                                                                       javax.security.auth.callback.CallbackHandler cbh,
                                                                                       java.lang.String nickName)
                                                                                throws PersonException
        This method is used to delete contact
        Parameters:
        bContext -
        cbh -
        nickName -
        Returns:
        Map
        Throws:
        PersonException
      • resetPassword

        public java.util.Map<java.lang.String,java.lang.Object> resetPassword(java.util.Map<java.lang.String,java.lang.Object> requestMap,
                                                                              java.lang.String resourceName,
                                                                              BusinessContextType bContext,
                                                                              javax.security.auth.callback.CallbackHandler cbh)
                                                                       throws java.lang.Exception
        This method is used to reset password for registered shopper. Scenario 1: A registered user has forgotten his/her password, so they cannot login. a: They would need to provide the logonId and challengeAnswer (while unauthenticated), and then a new password is generated and email to the user. b: 2-step process: They would need to provide the logonId and challengeAnswer (while unauthenticated but with a guest identity), and then a validation code is generated and emailed to the user. The user (with the same guest identity) will then provide the validation code, a new password and verification of the new password to complete the password reset process. Scenario 2: A registered user while authenticated decides to have his/her password reset. In this scenario, they would need to provide current logon password, a new password and verification of the new password.
        Parameters:
        requestMap -
        resourceName -
        bContext -
        cbh -
        Returns:
        Map
        Throws:
        java.lang.Exception
      • deleteContextAttributeForPerson

        public java.util.Map deleteContextAttributeForPerson(java.lang.String jobName,
                                                             java.lang.String storeId,
                                                             java.lang.String attrVal,
                                                             BusinessContextType bContext,
                                                             javax.security.auth.callback.CallbackHandler cbh)
                                                      throws PersonException
        Deletes one or more context attributes of an existing person.
        Parameters:
        jobName -
        storeId -
        attrVal -
        bContext -
        cbh -
        Returns:
        Map
        Throws:
        PersonException