com.ibm.commerce.order.commands

Class ValidateOrderAddressCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, ValidateOrderAddressCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable
    Direct Known Subclasses:
    GiftRegistryValidateOrderAddressCmdImpl


    public class ValidateOrderAddressCmdImpl
    extends TaskCommandImpl
    implements ValidateOrderAddressCmd
    This is the default implementation of the task command ValidateOrderAddressCmd.

    Behaviours:

    • if getAddressType().equals(OrderConstants.ADDRESS_TYPE_SHIPPING), call validateShippingAddress(addressAccessBean) to validate the shipping address.
    • if getAddressType().equals(OrderConstants.ADDRESS_TYPE_BILLING), call validateBillingAddress(addressAccessBean) to validate the billing address.
    • if getAddressType() is null, try to check shipping address first, if there is error occurs, try to check billing address then.
    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

      • ValidateOrderAddressCmdImpl

        public ValidateOrderAddressCmdImpl()
        The default constructor of ValidateOrderAddressCmdImpl.
    • Method Detail

      • performExecute

        public void performExecute()
                            throws ECException
        Executes the main business logic of the command.

        Behavior:
        • If the addressType: shipping is specified, the following behaviors will be performed on shipping address for an order item validation:
          If a contractId is specified, to find all ship-to TCs and AddressBook TCs for this contract(and referred account). And verify whether the specified address is included in those TCs. This is a typical validation for an order item shipping address. If there is no address defined by contract, check if the billing address belong to the given member.
        • If the addressType: billing is specified, the following behaviours will be performed on billing address validation:
          If there is a Payment terms specified by a tcId, check if the billing address is allowed by the payment terms specified.
          If there is not a tcId specified, check if the billing address is allowed by all the usable payment terms for the specified order.
          If there is no billing address specified by payment terms. Check if the billing address is allowed by the AddressBook terms of the contracts and the referred account for this order.
          If there is no address defined by the contracts, check if the billing address belong to the given member.
        • If checkPermanent flag is specified, check whether the address is permanent.

        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException -
          ECApplicationException will be raised in the following 3 cases:
          1) If the contractId is specified for a shipping address or the order is specified for a billing address. The nickname of the given address is not included in the terms of the given contract(s) or all the contracts used in the order.
          2) If the given address is not owned by a member( it could be specified, otherwise the default is the user in the session). When there is no available ShipTo TCs(for a contract) and no PaymentTC specified.
          3) If the checkPermanent flag is set as true, and the given address is not in P status.
          ECSystemException will be raised if there are EJB exceptions.

        See Also:
        ECCommand.performExecute()
      • setAddressId

        public void setAddressId(java.lang.Long anAddressId)
        Sets the identifier of the address to be validated which is a required parameter. AddressId must be set before the command execution by this method.
        Specified by:
        setAddressId in interface ValidateOrderAddressCmd
        Parameters:
        anAddressId - the identifier of the address to be validated.
      • getAddressId

        public java.lang.Long getAddressId()
        Gets the identifier of the address to be validated.
        Specified by:
        getAddressId in interface ValidateOrderAddressCmd
        Returns:
        the identifier of the address to be validated.
      • setMemberId

        public void setMemberId(java.lang.Long aMmemberId)
        Sets the identifier of the member. The validation logic will check if the address is owned by this member. If the memberId is not specified, the default value is the user identifier in the session.
        Specified by:
        setMemberId in interface ValidateOrderAddressCmd
        Parameters:
        aMmemberId - the member identifier.
      • getMemberId

        public java.lang.Long getMemberId()
        Gets the identifier of the member who is used to check if the address is owned by.
        Specified by:
        getMemberId in interface ValidateOrderAddressCmd
        Returns:
        the identifier of the member specified for validation.
      • setContractId

        public void setContractId(java.lang.Long aContractId)
        Sets the identifier of the contract which is used to check if the address is defined by the Shipping TCs of this contract.
        Specified by:
        setContractId in interface ValidateOrderAddressCmd
        Parameters:
        aContractId - the identifier of a contract.
      • getContractId

        public java.lang.Long getContractId()
        Gets the identifier of the contract which is used to check if the address is defined by the Shipping TCs of this contract.
        Specified by:
        getContractId in interface ValidateOrderAddressCmd
        Returns:
        the identifier of a contract specified for validation.
      • setTcId

        public void setTcId(java.lang.Long aTcId)
        Sets the identifier of the PaymentTC terms and conditions object which could be used to check if the address is defined by the PaymentTC.
        Specified by:
        setTcId in interface ValidateOrderAddressCmd
        Parameters:
        aTcId - the identifier of a terms and conditions object.
      • getTcId

        public java.lang.Long getTcId()
        Gets the identifier of the PaymentTC terms and conditions object which could be used to check if the address is defined by the PaymentTC.
        Specified by:
        getTcId in interface ValidateOrderAddressCmd
        Returns:
        the identifier of a terms and conditions object.
      • setCheckPermanent

        public void setCheckPermanent(boolean aCheckPermanent)
        Sets the flag which indicates whether to check the address is permanent or not. If the flag is not specified, the default value is true.
        Specified by:
        setCheckPermanent in interface ValidateOrderAddressCmd
        Parameters:
        aCheckPermanent - a flag to indicate whether to check the address is permanent or not.
      • isCheckPermanent

        public boolean isCheckPermanent()
        Gets the flag which indicates whether to check the address is permanent or not.
        Specified by:
        isCheckPermanent in interface ValidateOrderAddressCmd
        Returns:
          false indicates not to check the address is permanent or not;
          true indicates need to check the address is permanent or not
      • setAddressType

        public void setAddressType(java.lang.String anAddressType)
        Sets the type of address to validate.
        Specified by:
        setAddressType in interface ValidateOrderAddressCmd
        Parameters:
        anAddressType -
      • getAddressType

        public java.lang.String getAddressType()
        Gets the type of address to validate
        Specified by:
        getAddressType in interface ValidateOrderAddressCmd
        Returns:
        the type of address to validate. Will be either "Shipping" or "Billing".
      • setShippingModeId

        public void setShippingModeId(java.lang.Integer anShippingModeId)
        This method is used to set the shipping mode for shipping address validation.
        Parameters:
        anShippingModeId -
      • setFulfillmentCenterId

        public void setFulfillmentCenterId(java.lang.Integer anFulfillmentCenterId)
        This method is used to set the fulfillment center for shipping address validation.
        Parameters:
        anFulfillmentCenterId -