com.ibm.commerce.contract.commands
Class ValidateContractCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.contract.commands.ValidateContractCmdImpl
All Implemented Interfaces:
ECCommand, ECTargetableCommand, TaskCommand, ValidateContractCmd

public class ValidateContractCmdImpl
extends TaskCommandImpl
implements ValidateContractCmd

Validate the contract (WebSphere Commerce Business Edition only). This is the default implementation of the ValidateContractCmd. Calling commands: ContractImportApprovedVersion, ContractSubmitPreApproval, ContractDeploy The following AccessBeans are used in this default implementation: BusinessPolicyAccessBean, ParticipantAccessBean, TradingAgreementAccessBean, TermConditionAccessBean, MemberAccessBean, ContractAccessBean

See Also:
Serialized Form

Field Summary
static java.lang.String CLASSNAME
          The name of this command.
static java.lang.String COPYRIGHT
          IBM copyright notice field.
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.contract.commands. ValidateContractCmd
defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
ValidateContractCmdImpl()
          Constructor for ValidateContractCmdImpl
 
Method Summary
 void checkIsContractExpired()
          In this default implementation, we validate if the contract is expired and the expired date of the contract should later than its referenced business policies' expired date.
 java.lang.Long getContractId()
          Returns the ID of the contract to validate.
  TypedProperty getResponseProperties()
          Returns the response properties.
 void otherValidateCheck()
          Override this method to add additional contract validation.
 void performExecute()
          Validates the specified contract.
 void setContractId(java.lang.Long newContractId)
          Set the id of the contract to validate
 void setResponseProperties( TypedProperty resp)
          set the ResponseProperties
 void setReturnViewForTools(java.lang.String returnView)
          Sets the return view for the tools GUI
 void validateAccountRelatedInfo()
          Validates business account related Information in the contract.
 void validateBuyerParticipant()
          Validates Buyer participant in contract.
protected  void validateParticipantsForHostingContract()
          Validates participants in reseller contract.
protected  void validateParticipantsForReferralContract()
          Validates participants in disributor contract.
 void validateSellerParticipant()
          Validate Seller participant in contract In this default implementation, this method checks: 1.
 void validateTCOccurrence()
          Validate the occurrence of the Terms and Conditions in the contract.
protected  void validateTCOccurrenceForHostingContract()
          Validates the occurrence of the Terms and Conditions in the reseller contract.
protected  void validateTCOccurrenceForReferralContract()
          Validates the occurrence of the Terms and Conditions in the distributor contract.
 void validateTCType()
          Validates the type of the Terms and Conditions in the contract.
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

CLASSNAME

public static final java.lang.String CLASSNAME
The name of this command.
See Also:
Constant Field Values
Constructor Detail

ValidateContractCmdImpl

public ValidateContractCmdImpl()
Constructor for ValidateContractCmdImpl
Method Detail

checkIsContractExpired

public void checkIsContractExpired()
                            throws ECException,
                                   CreateException,
                                   java.rmi.RemoteException,
                                   FinderException,
                                   javax.naming.NamingException
In this default implementation, we validate if the contract is expired and 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 of the business policies which the contract referred to is earlier than the end date of the contract.
java.rmi.RemoteException.
javax.ejb.CreateException.
javax.ejb.FinderException.
javax.naming.NamingException.
ECException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

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 TypedProperty getResponseProperties()
Returns the response properties.
Specified by:
getResponseProperties in interface ValidateContractCmd
Returns:
responseProperties the response properties

otherValidateCheck

public void otherValidateCheck()
                        throws ECException,
                               CreateException,
                               java.rmi.RemoteException,
                               FinderException,
                               javax.naming.NamingException
Override 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.
ECException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

setContractId

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

setResponseProperties

public void setResponseProperties(TypedProperty resp)
set 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

validateAccountRelatedInfo

public void validateAccountRelatedInfo()
                                throws ECApplicationException,
                                       CreateException,
                                       java.rmi.RemoteException,
                                       FinderException,
                                       javax.naming.NamingException
Validates business account related Information in the contract. In the default implementation, this method check if the contract refers to a business account when creditAllowed be set to true. and if there is a PaymentTC with credit in the referrd 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.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

validateBuyerParticipant

public void validateBuyerParticipant()
                              throws ECApplicationException,
                                     CreateException,
                                     java.rmi.RemoteException,
                                     FinderException,
                                     javax.naming.NamingException
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 pariticipants 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.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

validateSellerParticipant

public void validateSellerParticipant()
                               throws ECApplicationException,
                                      CreateException,
                                      java.rmi.RemoteException,
                                      FinderException,
                                      javax.naming.NamingException
Validate 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 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.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

validateTCOccurrence

public void validateTCOccurrence()
                          throws ECApplicationException,
                                 CreateException,
                                 java.rmi.RemoteException,
                                 FinderException,
                                 javax.naming.NamingException
Validate the occurrence of the Terms and Conditions in the contract. In this default implementation, this method checks: 1. at least one Price Ts & Cs 2. one and only one Shipping Charge Ts & Cs 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 is missing or there are 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 ther 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 is 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.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

validateTCType

public void validateTCType()
                    throws ECApplicationException,
                           CreateException,
                           java.rmi.RemoteException,
                           FinderException,
                           javax.naming.NamingException
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.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

performExecute

public void performExecute()
                    throws ECException
Validates the specified contract.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException
See Also:
checkIsContractExpired(), validateParticipantsForDistributorContract(), validateTCOccurrenceForDistributorContract(), validateParticipantsForResellerContract(), validateTCOccurrenceForResellerContract(), validateAccountRelatedInfo(), validateBuyerParticipant(), validateSellerParticipant(), validateTCOccurrence(), validateTCType(), otherValidateCheck(), AbstractECTargetableCommand.performExecute()

validateParticipantsForReferralContract

protected void validateParticipantsForReferralContract()
                                                throws ECApplicationException,
                                                       CreateException,
                                                       java.rmi.RemoteException,
                                                       FinderException,
                                                       javax.naming.NamingException
Validates participants in disributor contract. In this default implementation, this method checks: if the contract has one and only one Distributor participant. if the contract has one and only one ServiceProvider participant.
Throws:
com.ibm.commerce.exception.ECApplicationException. - Raised with message _ERR_DISTRIBUTOR_PARTICIPANT if the contract has no Distributor particicpants or has more than one Distributor participants. Raised with message _ERR_CHANNEL_PARTICIPANT if the contract has no ServiveProvider particicpants or has more than one ServiveProvider participants.
java.rmi.RemoteException.
javax.ejb.CreateException.
javax.ejb.FinderException.
javax.naming.NamingException.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

validateParticipantsForHostingContract

protected void validateParticipantsForHostingContract()
                                               throws ECApplicationException,
                                                      CreateException,
                                                      java.rmi.RemoteException,
                                                      FinderException,
                                                      javax.naming.NamingException
Validates participants in reseller contract. In this default implementation, this method checks: if the contract has one and only one Reseller participant. if the contract has one and only one ServiceProvider participant.
Throws:
com.ibm.commerce.exception.ECApplicationException. - Raised with message _ERR_RESELLER_PARTICIPANT if one of the following cases happened: 1. both Reseller and Supplier participants are missing from the hosting contract 2. both Reseller and Supplier participants are provided in the hosting contract 3. there are more than one Reseller or Supplier partcipants in the hosting contract Raised with message _ERR_CHANNEL_PARTICIPANT if the contract has no ServiveProvider particicpants or has more than one ServiveProvider participants.
java.rmi.RemoteException.
javax.ejb.CreateException.
javax.ejb.FinderException.
javax.naming.NamingException.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

validateTCOccurrenceForReferralContract

protected void validateTCOccurrenceForReferralContract()
                                                throws ECApplicationException,
                                                       CreateException,
                                                       java.rmi.RemoteException,
                                                       FinderException,
                                                       javax.naming.NamingException
Validates the occurrence of the Terms and Conditions in the distributor contract. In this default implementation, this method checks: 1. one and only one ReferralInterfaceTC
Throws:
com.ibm.commerce.exception.ECApplicationException. - Raised with message _ERR_REFERRAL_INTERFACE_TC if there is no ReferralInterface terms and conditions or more than one in the contract.
java.rmi.RemoteException.
javax.ejb.CreateException.
javax.ejb.FinderException.
javax.naming.NamingException.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException

validateTCOccurrenceForHostingContract

protected void validateTCOccurrenceForHostingContract()
                                               throws ECApplicationException,
                                                      CreateException,
                                                      java.rmi.RemoteException,
                                                      FinderException,
                                                      javax.naming.NamingException
Validates the occurrence of the Terms and Conditions in the reseller contract. In this default implementation, this method checks: we check nothing for HostingContract in this default implementation now.
Throws:
com.ibm.commerce.exception.ECApplicationException.
java.rmi.RemoteException.
javax.ejb.CreateException.
javax.ejb.FinderException.
javax.naming.NamingException.
ECApplicationException
CreateException
java.rmi.RemoteException
FinderException
javax.naming.NamingException