com.ibm.commerce.contract.commands

Class ValidateContractCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
      • com.ibm.commerce.command.MeasuredCacheableCommandImpl
        • com.ibm.commerce.command.AbstractECTargetableCommand
          • com.ibm.commerce.command.TaskCommandImpl
            • com.ibm.commerce.contract.commands.ValidateContractCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, ValidateContractCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class ValidateContractCmdImpl
    extends com.ibm.commerce.command.TaskCommandImpl
    implements ValidateContractCmd
    This is the default implementation of the ValidateContractCmd task command. Validate the contract (WebSphere Commerce Enterprise only).

    Behaviour:

    • If usage is a referral contract, calls validateTCOccurrenceForReferralContract() to validate the occurrence of the Terms and Conditions in the distributor contract.
    • If usage is a hosting contract, calls validateTCOccurrenceForHostingContract() to validate the occurrence of the Terms and Conditions in the distributor contract.
    • If usage is a buyer contract:
      • If origin is not EC_CONTRACT_ORIGIN_DEPLOYMENT, calls validateTCType() to validate the type of the Terms and Conditions in the contract.
      • else if there are Buyer participants, calls validateTCType() to validate check participant.
    Calling commands: ContractImportApprovedVersion, ContractSubmitPreApproval, ContractDeploy

    AccessBeans called:

    • BusinessPolicyAccessBean
    • ParticipantAccessBean
    • TradingAgreementAccessBean
    • TermConditionAccessBean
    • MemberAccessBean
    • ContractAccessBean
    • Constructor Summary

      Constructors 
      Constructor and Description
      ValidateContractCmdImpl()
      Constructor for ValidateContractCmdImpl
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void checkContractReference()
      In this default implementation, we validate the contract you refer to is an active contract
      void checkIsContractExpired()
      In this default implementation, we validate if the contract is expired.
      java.lang.Long getContractId()
      Returns the ID of the contract to validate.
      com.ibm.commerce.datatype.TypedProperty getResponseProperties()
      Returns the response properties.
      void otherValidateCheck()
      Overrides this method to add additional contract validation.
      void performExecute()
      Executes the business logic of this command implementation to validate the specified contract.
      void setContractId(java.lang.Long newContractId)
      Sets the id of the contract to validate
      void setResponseProperties(com.ibm.commerce.datatype.TypedProperty resp)
      sets the ResponseProperties
      void setReturnViewForTools(java.lang.String returnView)
      Sets the return view for the tools GUI
      void setStoreId(java.lang.Integer storeId)
      Sets the target store ID.
      void validateAccountRelatedInfo()
      Validates business account related Information in the contract.
      void validateBuyerParticipant()
      Validates Buyer participant in contract.
      void validatePriceRuleTC()
      Validates the price rule TC in the contract.
      void validateSellerParticipant()
      Validates Seller participant in contract In this default implementation, this method checks: 1.
      void validateTCOccurrence()
      Validates the occurrence of the Terms and Conditions in the contract.
      void validateTCType()
      Validates the type of the Terms and Conditions in the contract.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand

        accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
      • Methods inherited from interface com.ibm.commerce.command.CacheableECCommand

        execute
      • Methods inherited from interface com.ibm.commerce.command.ECCommand

        checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
    • Field Detail

      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The full name of this command.
        See Also:
        Constant Field Values
      • COPYRIGHT

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

      • ValidateContractCmdImpl

        public ValidateContractCmdImpl()
        Constructor for ValidateContractCmdImpl
    • Method Detail

      • checkContractReference

        public void checkContractReference()
                                    throws com.ibm.commerce.exception.ECException
        In this default implementation, we validate the contract you refer to is an active contract
        Throws:
        com.ibm.commerce.exception.ECException. - Raised with message _ERR_NO_SUBMIT_WITH_NON_ACTIVE_CONTRACT_REFERRAL if contract we refer to is not active
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECException
      • checkIsContractExpired

        public void checkIsContractExpired()
                                    throws com.ibm.commerce.exception.ECException
        In this default implementation, we validate if the contract is expired. The expired date of the contract should later than its referenced business policies' expired date.
        Specified by:
        checkIsContractExpired in interface ValidateContractCmd
        Throws:
        com.ibm.commerce.exception.ECException. - Raised with message _ERR_CONTRACT_EXPIRED if the end date of the contract is earlier than current date. Raised with message _ERR_INVALID_CONTRACT_EXPIRED_DATE if the end date is earlier than the end date of the contract. The end date is the date of the business policies which the contract referred to.
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECException
      • getContractId

        public java.lang.Long getContractId()
        Returns the ID of the contract to validate.
        Specified by:
        getContractId in interface ValidateContractCmd
        Returns:
        the contract ID
      • getResponseProperties

        public com.ibm.commerce.datatype.TypedProperty getResponseProperties()
        Returns the response properties.
        Specified by:
        getResponseProperties in interface ValidateContractCmd
        Returns:
        responseProperties the response properties
      • otherValidateCheck

        public void otherValidateCheck()
                                throws com.ibm.commerce.exception.ECException
        Overrides this method to add additional contract validation.
        Specified by:
        otherValidateCheck in interface ValidateContractCmd
        Throws:
        com.ibm.commerce.exception.ECException.
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECException
      • setContractId

        public void setContractId(java.lang.Long newContractId)
        Sets the id of the contract to validate
        Specified by:
        setContractId in interface ValidateContractCmd
        Parameters:
        newContractId - java.lang.Long
      • setResponseProperties

        public void setResponseProperties(com.ibm.commerce.datatype.TypedProperty resp)
        sets the ResponseProperties
        Specified by:
        setResponseProperties in interface ValidateContractCmd
        Parameters:
        resp - com.ibm.commerce.datatype.TypedProperty
      • setReturnViewForTools

        public void setReturnViewForTools(java.lang.String returnView)
        Sets the return view for the tools GUI
        Specified by:
        setReturnViewForTools in interface ValidateContractCmd
        Parameters:
        returnView - the return view name
      • setStoreId

        public void setStoreId(java.lang.Integer storeId)
        Sets the target store ID.
        Specified by:
        setStoreId in interface ValidateContractCmd
        Parameters:
        storeId - The store id which the contract belongs to.
      • validateAccountRelatedInfo

        public void validateAccountRelatedInfo()
                                        throws com.ibm.commerce.exception.ECApplicationException
        Validates business account related Information in the contract. In the default implementation, this method checks if the contract refers to a business account when creditAllowed be set to true. and if there is a PaymentTC with credit in the referred business account.
        Specified by:
        validateAccountRelatedInfo in interface ValidateContractCmd
        Throws:
        com.ibm.commerce.exception.ECApplicationException. - Raised with message _ERR_DO_NOT_REFERRED_TO_ACCOUNT_WHEN_CREDIT_ALLOWED if the creditAllowed attribute is set to true in the contract but the contract did not refer to a business account. Raised with message _ERR_NEED_PAYMENT_TC_WITH_CREDIT_IN_ACCOUNT if the creditAllowed attribute is set to true in the contract. But there is not payment with credit term and condition in the referred business account.
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECApplicationException
      • validateBuyerParticipant

        public void validateBuyerParticipant()
                                      throws com.ibm.commerce.exception.ECApplicationException
        Validates Buyer participant in contract. In this default implementation, this method checks: if the contract has at least one buyer participant. if the Terms and Conditions level participants are Buyer only. when there is account referenced. if the account has Buyer participant(s), it should be the same as or super-organization of the Buyer participant(s) in the contract. otherwise, the AccountHolder in the referenced account should be the same as or super-organization of the Buyer participant(s) in the contract.
        Specified by:
        validateBuyerParticipant in interface ValidateContractCmd
        Throws:
        com.ibm.commerce.exception.ECApplicationException. - Raised with message EC_ERR_MISSING_BUYER_PARTICIPANT if there is no Buyer participants in the contract. Raised with message EC_ERR_TERM_CONDITION_PARTICIPANT_ROLE if one of the terms and conditions participants is not a Buyer participant. Raised with message _ERR_MBRGRP_BUYER_CANNOT_REFER_ACCOUNT if one of the Buyer participants in the contract is a member group when the contract referred to a business account. Raised with message _ERR_BUYER_IN_CNTR_DOES_NOT_MATCH_WITH_BUYER_IN_ACNT if one of the Buyer participants in the contract does not match the Buyer participants in the referred business account. Raised with message _ERR_MISSING_ACCOUNT_HOLDER_IN_ACCOUNT if there is not AccountHolder in the referred business account when there are no Buyer participants neither. Raised with message _ERR_BUYER_IN_CNTR_DOES_NOT_MATCH_WITH_ACCOUNTHOLDER_IN_ACNT if one of the Buyer participants in the contract does not match the AccountHolder participant in the referred business account.
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECApplicationException
      • validatePriceRuleTC

        public void validatePriceRuleTC()
                                 throws com.ibm.commerce.exception.ECApplicationException,
                                        javax.naming.NamingException,
                                        java.sql.SQLException
        Validates the price rule TC in the contract.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - If the price rule TC(s) is/are invalid, raised with message _ERR_NULL_EXCEPTION.
        javax.naming.NamingException
        java.sql.SQLException
      • validateSellerParticipant

        public void validateSellerParticipant()
                                       throws com.ibm.commerce.exception.ECApplicationException
        Validates Seller participant in contract In this default implementation, this method checks: 1. When there is an account referenced, Seller participant is optional in the contract. If there, it must be the same Seller participant in the account. 2. A contract cannot have more than one Seller participant.
        Specified by:
        validateSellerParticipant in interface ValidateContractCmd
        Throws:
        com.ibm.commerce.exception.ECApplicationException. - Raised with message _ERR_CANNOT_HAVE_MORE_THAN_ONE_SELLER if there are more than one Seller participants in the contract. Raised with message _ERR_MISSING_SELLER_PARTICIPANT if the Seller participant is missing from the contract. Raised with message _ERR_SELLER_DO_NOT_MATCH_TO_SELLER_IN_ACCOUNT if the Seller participant in the contract does not match the Seller participant in the business account which it referred to.
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECApplicationException
      • validateTCOccurrence

        public void validateTCOccurrence()
                                  throws com.ibm.commerce.exception.ECApplicationException
        Validates the occurrence of the Terms and Conditions in the contract. In this default implementation, this method checks: 1. at least one Price Rule Ts & Cs or Price Ts & Cs 2. one and only one Shipping Charge Ts & Cs (2 allowed if one in base and one in customer contract) 3. cannot have more than one RightToBuyByAmount Ts & Cs 4. cannot have more than one ObligationToBuyByAmount Ts & Cs 5. cannot have more than one OrderApproval Ts & Cs 6. cannot have more than one Return Charge Ts & Cs 7. When setting returns terms and conditions for your contract, you must specify both return charge and refund methods. 8. cannot have more than one PriceTCMasterCatalogWithOptionalAdjustment all these checks are done in the terms and conditions which do not specified Ts and Cs participant.
        Specified by:
        validateTCOccurrence in interface ValidateContractCmd
        Throws:
        com.ibm.commerce.exception.ECApplicationException. - Raised with message _ERR_MISSING_PRICE_TC if there is no Price terms and conditions in the contract. Raised with message _ERR_MISSING_SHIPPING_CHARGE_TC if the ShippingCharge term and condition are missing or there is more than one ShippingCharge terms and conditions in the contract. Raised with message _ERR_CANNOT_HAVE_MORE_THAN_ONE_RIGHT_TO_BUY_BY_AMOUNT_TC if there are more than one RightToBuyByAmount terms and conditions in the contract. Raised with message _ERR_CANNOT_HAVE_MORE_THAN_ONE_OBLIGATION_TO_BUY_BY_AMOUNT_TC if there are more than one ObligationToBuyByAmount terms and conditions in the contract. Raised with message _ERR_CANNOT_HAVE_MORE_THAN_ONE_ORDER_APPROVAL_TC if there are more than one OrderApproval terms and conditions in the contract. Raised with message _ERR_CANNOT_HAVE_MORE_THAN_ONE_RETURN_CHARGE_TC if there are more than one ReturnTCReturnCharge terms and conditions in the contract. Raised with message _ERR_RETURN_TC_CHARGE_AND_REFUND_METHOD_DO_NOT_MATCH if only one of the ReturnTCReturnCharge and ReturnTCRefundPaymentMethod terms and conditions are in the contract. Raised with message _ERR_CANNOT_HAVE_MORE_THAN_ONE_PRICE_TC_MC_OPTIONAL_ADJUSTMENT if there are more than one PriceTCMasterCatalogWithOptionalAdjustment terms and conditions in the contract.
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECApplicationException
      • validateTCType

        public void validateTCType()
                            throws com.ibm.commerce.exception.ECApplicationException
        Validates the type of the Terms and Conditions in the contract. In this default implementation, this method checks A contract cannot have following Ts & Cs 1. PaymentTC with credit line 2. PurchaseOrder 3. Invoice 4. DisplayCustomization
        Specified by:
        validateTCType in interface ValidateContractCmd
        Throws:
        com.ibm.commerce.exception.ECApplicationException. - Raised with message _ERR_CANNOT_HAVE_PAYMENT_TC_WITH_CREDIT_LINE_IN_CONTRACT if there are PaymentTC with credit line terms and conditions in the contract. Raised with message _ERR_CANNOT_HAVE_DISPLAY_CUSTOMIZATION_TC_IN_CONTRACT if there are DisplayCustomizationTC terms and conditions in the contract. Raised with message _ERR_CANNOT_HAVE_INVOICE_TC_IN_CONTRACT if there are InvoiceTC terms and conditions in the contract. Raised with message _ERR_CANNOT_HAVE_PURCHASE_ORDER_TC_IN_CONTRACT if there are purchase order terms and conditions in the contract.
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECApplicationException