com.ibm.commerce.contract.util

Class ContractCmdUtil

  • java.lang.Object
    • com.ibm.commerce.contract.util.ContractCmdUtil


  • public class ContractCmdUtil
    extends java.lang.Object
    This is a contract-oriented utility class. The following AccessBeans are used in this class: ContractAccessBean, StoreDefaultAccessBean, ContractAccessBean, StoreDefaultAccessBean, ParticipantAccessBean, UserAccessBean, OrganizationAccessBean, MemberGroupAccessBean, MemberAccessBean, ContractJDBCHelperAccessBean.getTCDeployCmdBySubType(tcSubType), AttachmentAccessBean, TradingAttachmentRelationAccessBean, TradingDescriptionAccessBean, ContractJDBCHelperAccessBean.addEntryToContractName(name, owner, origin), ContractJDBCHelperAccessBean().findAllTCSubType(), AccountAccessBean, StoreContractAccessBean, LanguageAccessBean, TermConditionDescriptionAccessBean
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CLASSNAME
      The name of this class.
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ContractCmdUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void activeContract(java.lang.Long argContractId, java.lang.Integer argStoreId)
      Actives the specified contract in the given store.
      static void activeContract(java.lang.Long argContractId, java.lang.Integer argStoreId, com.ibm.commerce.command.CommandContext context, boolean refreshRegistry)
      Actives the specified contract in the given store.
      static void activeContract(java.lang.Long argContractId, java.lang.Integer argStoreId, java.lang.Integer argDefaultShippingMode)
      Actives the specified contract in the given store.
      static void activeContract(java.lang.Long argContractId, java.lang.Integer argStoreId, java.lang.Integer argDefaultShippingMode, com.ibm.commerce.command.CommandContext context, boolean refreshRegistry)
      Actives the specified contract in the given store.
      static void addParticipants(org.w3c.dom.NodeList argParticipants, java.lang.Long argTradingId, java.lang.Long argTCId, java.sql.Timestamp currentTime)
      Adds a participant to either a trading agreement or terms and conditions.
      static void addParticipants(java.util.Vector participants, java.lang.Long tradingId, java.lang.Long tcId, java.sql.Timestamp currentTime)
      Adds a participant to either a trading agreement or terms and conditions.
      static java.lang.String addZeroStringInFront(java.lang.String str)
      Adds a zero "0" to the beginning of the given string.
      static boolean anythingNeedsToDeployed(java.lang.Long argContractId)
      Checks whether there are terms and conditions in the specified contract which require deployment using the deployment commands provided in the database.
      static void checkBuyerParticipant(java.lang.Long accountId, java.util.Enumeration buyers, java.lang.String returnView, com.ibm.commerce.datatype.TypedProperty resp)
      Checks the Buyer Participants in a contract when the contract refers to a business account.
      static void checkContractLastUpdated(com.ibm.commerce.contract.objects.ContractAccessBean abContract, java.lang.String lastUpdatedTime, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools)
      Checks whether someone has made a more recent update to the contract, which will be overwritten, based on the last updated time string.
      static void checkContractLastUpdated(org.w3c.dom.Element contractElement, java.lang.String lastUpdatedTime, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools)
      Checks whether someone has made a more recent update to the contract, which will be overwritten, based on the last updated time string.
      static void checkLastUpdatedTime(java.lang.String utime, java.lang.String lastUpdatedTime, java.lang.String tradingId, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools)
      Checks the timestamp of the last update.
      static boolean containsIgnoreCase(java.lang.String[] strArray, java.lang.String str)
      Checks if the given string array contains the specified string.
      static void contractAttachmentSet(java.lang.Long argTradingId, org.w3c.dom.Element argAttachmentElement, java.lang.Long argOwnerId, java.lang.String argUsageId)
      Adds an attachment to the attachment table if the attachment does not exist yet, and creates a relationship between the specified trading agreement and the attachment.
      static void contractAttachmentSet(java.lang.Long argTradingId, java.lang.Long argOwnerId, java.lang.String usageId, java.lang.String uri, java.lang.String mimeType, java.lang.String mimeTypeEncoding)
      Adds an attachment to the attachment table if the attachment does not exist yet, and creates a relationship between the specified trading agreement and the attachment.
      static void contractDescriptionSet(org.w3c.dom.Element argContractDescElement, java.lang.Long argContractId, java.sql.Timestamp currentTime)
      Adds or updates the contract description.
      static java.lang.Object copyOrgAddress(java.lang.Long sourceOrgMemberId, java.lang.Long targetOrgMemberId, int count, java.lang.String addressType, java.lang.String url)
      Copies the source organization's address to the target organization's address.
      static java.lang.Long createNewContract(org.w3c.dom.Element argContract, java.sql.Timestamp currentTime)
      Creates a new contract based on the provided Element object.
      static java.lang.Long createNewXSDContract(org.w3c.dom.Element argContract, java.sql.Timestamp currentTime)
      Creates a new contract based on the given contract Element object.
      static boolean doesTradingAgreementHaveTCs(java.lang.String tradingId, java.lang.String tcType)
      Checks if a trading agreement has term and conditions of a particular type.
      static java.lang.String encode(java.lang.String infile)
      Converts a system dependant file path to an encoded URI string.
      static java.lang.Integer findStringIndex(java.lang.String[] strArray, java.lang.String str)
      Gets the index of the specified string in the given string array.
      static java.lang.String formatEntityPath(java.lang.String[] pathList)
      Returns the formatted entity path.
      static java.lang.Integer getContractOriginType(java.lang.String str)
      Gets the origin of the contract based on the given string.
      static java.lang.String getContractOriginTypeInString(java.lang.Integer index)
      Gets the origin of the contract in string format from the given integer contract origin.
      static java.lang.Integer getContractParticipantRole(java.lang.String prty)
      Gets the participant role of a participant based on the given participant role string.
      static java.lang.String getContractParticipantRoleInString(java.lang.Integer index)
      Gets the participant role of a participant based on the given participant role.
      static java.lang.Integer getContractState(com.ibm.commerce.contract.objects.ContractAccessBean abContract)
      Gets the state of the contract.
      static java.lang.Integer getContractState(java.lang.Long contractId)
      Gets the state of the specified contract.
      static java.lang.Integer getContractState(java.lang.String state)
      Gets the state of the contract based on the given contract state string.
      static java.lang.String getContractStateInString(java.lang.Integer index)
      Gets the state of the contract based on the given contract state integer.
      static java.lang.Integer getContractUsageType(java.lang.String str)
      Gets the usage of the contract based on the given contract usage string.
      static java.lang.String getContractUsageTypeInString(java.lang.Integer index)
      Gets the usage of the contract based on the given contract usage.
      static java.lang.String getCurrentContract(java.lang.String familyId)
      Returns the current version of a contract based on the contract family id.
      static java.lang.String[] getCurrentTradingAgreementIds(com.ibm.commerce.command.CommandContext context)
      Gets the ids of the current set of trading agreements.
      static com.ibm.commerce.contract.objects.TradingAgreementAccessBean[] getCurrentTradingAgreements(com.ibm.commerce.command.CommandContext context)
      Gets the current set of trading agreements.
      static org.w3c.dom.Element getElementFromElementByTag(org.w3c.dom.Element element, java.lang.String tag)
      Gets an element which has the name of the specified tag from the given element object.
      static java.util.Vector getElementsFromElementByTag(org.w3c.dom.Element element, java.lang.String tag)
      Get the all of the children elements which have the tag name as the specified tag from the given element.
      static java.lang.String[] getEligibleDelegationGrids(java.lang.Long participantId, java.lang.Integer storeId)
      Gets the eligible price override limits (Contract) for the specified participant, who has the CSR participant role in the trading agreements, in the given store.
      static java.lang.String[] getEligibleTradingAgreementIds(com.ibm.commerce.command.CommandContext context)
      Gets the eligible trading agreement IDs as an array for type contract only.
      static java.lang.String[] getEligibleTradingAgreements(java.util.Enumeration trading, java.lang.Integer storeId)
      Gets the eligible trading agreements.
      static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId, java.lang.Integer storeId)
      Gets the eligible trading agreements (Contract) for the specified participant, who has the Buyer participant role in the trading agreemnts, in the given store.
      static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId, java.lang.Integer storeId, com.ibm.commerce.command.CommandContext cc)
      Gets the eligiable trading agreements (Contract) for the specified participant, who has the Buyer participant role in the trading agreemnts, in the given store.
      static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId, java.lang.Integer storeId, java.lang.Integer tradingType)
      Gets the eligible trading agreements for the specified participant, who has the Buyer participant role in the trading agreements, in the store.
      static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId, java.lang.Integer storeId, java.lang.Integer tradingType, com.ibm.commerce.command.CommandContext cc)
      Gets the eligible trading agreements for the specified participant, who has the Buyer participant role in the trading agreements, in the store.
      static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId, java.lang.Integer storeId, java.lang.Integer tradingType, java.lang.Long orgId)
      Gets the eligible trading agreements for the specified participant, who has the Buyer participant role in the trading agreements, in the store.
      static java.lang.String getFullContractXMLFileName(java.lang.String file)
      Gets the absolute name of the XML file.
      static java.lang.Integer getIntegerFromTrueOrFalse(java.lang.String str)
      Gets the Integer value for "true" or "false" string.
      static java.lang.String[] getMasterCatalogIdAndNameAndOwnerMemberId(java.lang.Integer storeId)
      Gets the master catalog ID, name and the owner member ID of the store.
      static java.lang.String getParticipantMemberGroups(java.lang.Long participantId, java.lang.Integer storeId)
      Gets the member groups for the specified participant, who has the Buyer participant role in the trading agreemnts, in the given store.
      static java.util.Vector getPricePoliciesByStoreIdAndTPCIdAndTPCName(java.lang.String sStoreId, java.lang.String sTPCId, java.lang.String sTPCName)
      Gets the price policies asssociated with the store (in most cases, this is the catalog profile store).
      static com.ibm.commerce.contract.objects.ContractAccessBean getReferredContract(org.w3c.dom.Element cntrRefElement)
      Gets the referred contract bases on the contract reference element.
      static java.lang.Long[] getSameFamilyContractIds(java.lang.Long contractId)
      Gets contracts belonging to the same family as the specified contract.
      static java.lang.Integer[] getStoreIdsContractDeloyedTo(java.lang.Long contractId)
      Gets the IDs of the stores to which the specified contract belongs.
      static java.lang.Integer[] getStoreIdsCreatedByContract(java.lang.Long contractId)
      Gets the IDs of the stores created by the specified contract.
      static java.lang.String getStoreRelationshipType(java.lang.Integer contractUsage)
      Gets the type of store relationship based on the contract usage.
      static java.util.Vector getTermConditionElements(org.w3c.dom.Element tradingElement)
      Gets all of the elements of the terms and conditions in the given trading agreement element.
      static java.sql.Timestamp getTimeFromElement(org.w3c.dom.Element timeElement)
      Gets the time from the specified time element object.
      static java.sql.Timestamp getTimeFromElement(org.w3c.dom.Element anElement, java.lang.String tag, java.sql.Timestamp time)
      Gets the time from the specified time element object.
      static java.sql.Timestamp getTimeFromString(java.lang.String timeStr, java.sql.Timestamp defaultTime)
      Gets the time from the specified time string.
      static java.sql.Timestamp getTimeFromXSDElement(org.w3c.dom.Element anElement, java.lang.String tag, java.sql.Timestamp time)
      Gets the time from the given element.
      static java.lang.String[] getTPCIdAndTPCNameAndCatlogProfileStoreIdByHostingStoreIdOrCatalogProfileStoreId(java.lang.Integer hostedStoreId, java.lang.Integer catalogProfileStoreId)
      Gets the trading position container ID and the catalog profile store ID of the hosting store.
      If a catalogProfileStoreId is specified, this method gets the trading position container ID of that catalog profile store, and simply returns the trading position container ID and the catalog profile store ID.
      If a catalogProfileStoreId is not specified, this method finds the catalog profile store associated with specified hosting store ID (hostedStoreId), then gets the trading position container ID of the catalog profile store.
      static com.ibm.commerce.contract.objects.TradingAgreementAccessBean getTradingAgreement(java.lang.Long id)
      Gets the trading agreement given an ID.
      static com.ibm.commerce.contract.objects.TradingAgreementAccessBean getTradingAgreement(java.lang.String id)
      Gets the trading agreement given a string ID.
      static com.ibm.commerce.user.objects.AddressAccessBean[] getTradingAgreementAddressIDsFromAddressBooks(com.ibm.commerce.contract.objects.TradingAgreementAccessBean tradingAB, java.lang.String type, java.lang.Long userId, java.lang.Integer storeId)
      Gets the addresses that can be used for shipping and billing addresses for a contract as allowed by the AddressBook Terms and Conditions
      static boolean getTradingAgreementAllowPersonalAddressBook(com.ibm.commerce.contract.objects.TradingAgreementAccessBean tradingAB, java.lang.String type, java.lang.Long userId)
      Returns whether the user can use their personal address book.
      static com.ibm.commerce.contract.objects.ParticipantAccessBean[] getTradingLevelParticipants(java.lang.Long tradingId, java.lang.Integer role)
      Gets trading agreement level participants in the specified trading agreement with the specified role.
      static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName)
      Gets the XML Document object based on the specified XML instance file name.
      static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName, boolean validation)
      Gets the XML Doucment object from the specified xml instance file.
      static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName, boolean validation, boolean xsd)
      Gets the XML Document object from a file.
      static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName, boolean validation, boolean xsd, java.lang.String entityPath)
      Gets the XML Document object from a file.
      static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName, boolean validation, java.lang.String entityPath)
      Gets the XML Document object from the specified XML instance file.
      static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName, java.lang.String entityPath)
      Gets the XML Document object based on the specified XML instance file name.
      static org.w3c.dom.Document getXMLDocumentObjectFromInputStream(java.io.InputStream xmlInput, boolean validation, boolean xsd)
      Gets the XML Document object from an InputStream object which contains the XML instance.
      static org.w3c.dom.Document getXMLDocumentObjectFromInputStream(java.io.InputStream xmlInput, boolean validation, boolean xsd, java.lang.String entityPath)
      Gets the XML Document object from an InputStream object which contains the XML instance.
      static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader)
      Gets the XML Document object based on the specified Reader object.
      static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader, boolean validation)
      Gets the XML Document object from a Reader object which contains the XML instance.
      static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader, boolean validation, boolean xsd)
      Gets the XML Document object from a Reader object which contains the XML instance.
      static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader, boolean validation, boolean xsd, java.lang.String entityPath)
      Gets the XML Document object from a Reader object which contains the XML instance.
      static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader, boolean validation, java.lang.String entityPath)
      Gets the XML Document object from a Reader object which contains the XML instance.
      static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader, java.lang.String dtdPath)
      Gets the XML Document object based on the specified Reader object.
      static boolean hasPaymentTCWithCreditLine(com.ibm.commerce.contract.objects.TermConditionAccessBean[] tcList)
      Checks whether the specified terms and conditions have a "Credit" type of business policy.
      static boolean hasThisTypeOfTermCondition(java.lang.Long tradingId, java.lang.String tcType)
      Checks whether the specified trading agreement has the given type of terms and conditions.
      static void invalidateTradingAgreement(java.lang.Long id, com.ibm.commerce.command.CommandContext context)
      Removes a trading agreement from the cache.
      static void invalidateTradingAgreement(java.lang.String id, com.ibm.commerce.command.CommandContext context)
      Removes a trading agreement from the cache given a string ID.
      static boolean isBuyerContract(java.lang.Integer contractUsage)
      Checks if the contract is a buyer contract.
      static boolean isBuyerContract(java.lang.Long contractId)
      Checks whether the contract is a buyer contract.
      static boolean isDelegationGridContract(java.lang.Integer contractUsage)
      Checks whether the contract is a delegation grid contract.
      static boolean isDelegationGridContract(java.lang.Long contractId)
      Checks whether the contract is a delegation grid contract.
      static boolean isHostingContract(java.lang.Integer contractUsage)
      Checks whether the contract is a hosting contract.
      static boolean isHostingContract(java.lang.Long contractId)
      Checks whether the contract is a hosting contract.
      static boolean isMasterPriceListPolicy(java.lang.String sPolicyName)
      Check whether the price policy is a master price list policy.
      static boolean isReferralContract(java.lang.Integer contractUsage)
      Checks whether the contract is a referral contract.
      static boolean isReferralContract(java.lang.Long contractId)
      Checks whether the contract is a referral contract.
      static void manageStore(java.lang.Integer[] stores, java.lang.Integer status, boolean markForDelete, boolean storeCancelOrDelete, com.ibm.commerce.command.CommandContext cmdContext, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools)
      This method calls the ManageStoreCmd to update the status of the specified stores.
      static void manageStoreAndUpdateStoreRelationshipState(java.lang.Long contractId, java.lang.Integer contractUsage, java.lang.Integer storeStatus, java.lang.Integer relationshipState, boolean storeMarkforDelete, boolean storeCancelOrDelete, com.ibm.commerce.command.CommandContext cmdContext, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools)
      Manages the stores and updates the state of a Store Relationship when the state of a store's contract was changed.
      static void removeContractFromStore(java.lang.Long contractId, java.lang.Integer storeId)
      Removes the contract-store relationship from the STORECNTR table for the specified contract and store.
      static java.lang.String replace(java.lang.String text, java.lang.String find, java.lang.String replace)
      Returns a new string resulting from replacing the first occurrence of find in the specified string text with replace.
      static java.lang.String replaceAll(java.lang.String text, java.lang.String find, java.lang.String replace)
      Returns a new string resulting from replacing all occurrences of find in the specified string text with replace.
      static java.lang.String reverseFromHtml(java.lang.String result) 
      static void setAccountInfoToTrading(java.lang.Long contractId, org.w3c.dom.Element contractElement)
      Sets the account-related information provided in the contract element object into TRADING table for the specified contract.
      static void setContractState(com.ibm.commerce.contract.objects.ContractAccessBean abContract, java.lang.Integer state)
      Sets the state of the specified contract to the given state.
      static void setContractState(java.lang.Long contractId, java.lang.Integer state)
      Sets the state of the specified contract to the given state.
      static void setCurrentTradingAgreements(com.ibm.commerce.contract.objects.TradingAgreementAccessBean[] newValue, com.ibm.commerce.command.CommandContext context)
      Reserved for IBM internal use.
      static boolean setDescription(org.w3c.dom.Element argDescElement, java.lang.Long id, java.sql.Timestamp currentTime, boolean tradingLevel)
      Adds or updates the trading agreement description, or the term and condition description.
      static void setXSDAccountInfoToTrading(java.lang.Long contractId, org.w3c.dom.Element contractElement)
      Sets the account related information provided in the contract element object into TRADING table for the specified contract.
      static com.ibm.commerce.contract.objects.TermConditionAccessBean[] sortTermConditionArrayByWithOrWithOutParticipant(com.ibm.commerce.contract.objects.TermConditionAccessBean[] inArray)
      Sorts the input terms and conditions array, and puts the terms and conditions with participants before the terms and conditions without participants.
      static void tcDescriptionSet(org.w3c.dom.Element argTCElement, java.lang.Long argTCId)
      Sets the term and condition description.
      static void tcDescriptionSetFromDescElement(org.w3c.dom.Element tcDescElement, java.lang.Long argTCId)
      Sets the term and condition description.
      static void TermConditionDescriptionSet(org.w3c.dom.Element argTcDescElement, java.lang.Long tcId, java.sql.Timestamp currentTime)
      Adds or updates a term and condition description.
      static java.lang.String toGMTElementStringFromTimestamp(java.sql.Timestamp time)
      Converts a Timestamp object to a string in the format of time defined in the XSD file (yyyy-mm-ddThh:mm:ss).
      static void TradingAgreementDescriptionSet(org.w3c.dom.Element argTradingDescElement, java.lang.Long tradingId, java.sql.Timestamp currentTime)
      Adds or updates the trading agreement description.
      static java.lang.Long updateContract(org.w3c.dom.Element argContract, java.sql.Timestamp currentTime)
      Updates the contract based on the information provided in the contract element object.
      static void updateStoreRelationshipState(java.lang.Integer storeId, java.lang.Integer relatedStoreId, java.lang.String relationshipType, java.lang.Integer state, com.ibm.commerce.command.CommandContext cmdContext, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools)
      Updates the state of the store relationship for the given stores.
      static java.lang.Long updateXSDContract(org.w3c.dom.Element argContract, java.sql.Timestamp currentTime)
      Updates the contract based on the information provided in the contract element object.
      static java.lang.Integer validateContractAttributes(org.w3c.dom.Element contractElement, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools, java.lang.String actionFlag)
      Validates the contract attributes in the provided contract element object.
      static java.lang.Integer validateXSDContractAttributes(org.w3c.dom.Element contractElement, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools, java.lang.String actionFlag)
      Validates the contract attributes in the provided contract element object.
      • Methods inherited from class java.lang.Object

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

      • CLASSNAME

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

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

      • ContractCmdUtil

        public ContractCmdUtil()
    • Method Detail

      • activeContract

        public static void activeContract(java.lang.Long argContractId,
                                          java.lang.Integer argStoreId)
                                   throws java.sql.SQLException,
                                          javax.ejb.RemoveException
        Actives the specified contract in the given store.
        Parameters:
        argContractId - The ID of the contract.
        argStoreId - The ID of the store.
        Throws:
        javax.ejb.RemoveException
        java.sql.SQLException
      • activeContract

        public static void activeContract(java.lang.Long argContractId,
                                          java.lang.Integer argStoreId,
                                          com.ibm.commerce.command.CommandContext context,
                                          boolean refreshRegistry)
                                   throws java.sql.SQLException,
                                          javax.ejb.RemoveException
        Actives the specified contract in the given store.
        Parameters:
        argContractId - the ID of the contract
        argStoreId - the ID of the store
        context - the command context
        refreshRegistry - true if the store registry should be refreshed, false otherwise
        Throws:
        javax.ejb.RemoveException
        java.sql.SQLException
      • activeContract

        public static void activeContract(java.lang.Long argContractId,
                                          java.lang.Integer argStoreId,
                                          java.lang.Integer argDefaultShippingMode)
                                   throws java.sql.SQLException,
                                          javax.ejb.RemoveException
        Actives the specified contract in the given store.
        Parameters:
        argContractId - the ID of the contract
        argStoreId - the ID of the store
        argDefaultShippingMode - the default shipping mode for the store
        Throws:
        javax.ejb.RemoveException
        java.sql.SQLException
      • activeContract

        public static void activeContract(java.lang.Long argContractId,
                                          java.lang.Integer argStoreId,
                                          java.lang.Integer argDefaultShippingMode,
                                          com.ibm.commerce.command.CommandContext context,
                                          boolean refreshRegistry)
                                   throws java.sql.SQLException,
                                          javax.ejb.RemoveException
        Actives the specified contract in the given store.
        Parameters:
        argContractId - The ID of the contract.
        argStoreId - The ID of the store.
        argDefaultShippingMode - The default shipping mode for the store.
        context - the command context
        refreshRegistry - true if the store registry should be refreshed, false otherwise
        Throws:
        javax.ejb.RemoveException
        java.sql.SQLException
      • addParticipants

        public static void addParticipants(org.w3c.dom.NodeList argParticipants,
                                           java.lang.Long argTradingId,
                                           java.lang.Long argTCId,
                                           java.sql.Timestamp currentTime)
                                    throws javax.ejb.RemoveException,
                                           com.ibm.commerce.exception.ECApplicationException
        Adds a participant to either a trading agreement or terms and conditions.
        Parameters:
        argParticipants - The list of the participant object.
        argTradingId - The trading agreement ID.
        argTCId - The term and condition ID.
        currentTime - The Timestamp object of the current time.
        Throws:
        javax.ejb.RemoveException
        com.ibm.commerce.exception.ECApplicationException - Raised with message _ERR_WRONG_MEMBER_INFO_IN_PARTICIPANT if the member ID of the participant cannot be resolved.
      • addParticipants

        public static void addParticipants(java.util.Vector participants,
                                           java.lang.Long tradingId,
                                           java.lang.Long tcId,
                                           java.sql.Timestamp currentTime)
                                    throws javax.ejb.RemoveException,
                                           com.ibm.commerce.exception.ECApplicationException
        Adds a participant to either a trading agreement or terms and conditions.
        Parameters:
        participants - The vector of participant Element objects.
        argTradingId - The trading agreement ID.
        argTCId - The term and condition ID.
        currentTime - A Timestamp of object represents the current time.
        Throws:
        javax.ejb.RemoveException
        com.ibm.commerce.exception.ECApplicationException - Raised with message _ERR_WRONG_MEMBER_INFO_IN_PARTICIPANT if the member ID of the participant cannot be resolved.
      • addZeroStringInFront

        public static java.lang.String addZeroStringInFront(java.lang.String str)
        Adds a zero "0" to the beginning of the given string.
        Parameters:
        str - A string object.
        Returns:
        The new string with a zero character added at the beginning.
      • anythingNeedsToDeployed

        public static boolean anythingNeedsToDeployed(java.lang.Long argContractId)
                                               throws javax.naming.NamingException,
                                                      java.sql.SQLException
        Checks whether there are terms and conditions in the specified contract which require deployment using the deployment commands provided in the database.
        Parameters:
        argContractId - The ID of the contract.
        Returns:
        True if there are terms and conditions which require deployment, false otherwise.
        Throws:
        javax.naming.NamingException
        java.sql.SQLException
      • checkBuyerParticipant

        public static void checkBuyerParticipant(java.lang.Long accountId,
                                                 java.util.Enumeration buyers,
                                                 java.lang.String returnView,
                                                 com.ibm.commerce.datatype.TypedProperty resp)
                                          throws com.ibm.commerce.exception.ECApplicationException
        Checks the Buyer Participants in a contract when the contract refers to a business account.
        Parameters:
        accountId - The ID of the business acccount to which the contract refers.
        buyers - An Enumeration of ParticipantAccessBean objects representing the Buyer participants.
        returnView - The return view of the tools user interface.
        resp - The response properties.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_MBRGRP_BUYER_CANNOT_REFER_ACCOUNT message if one of the Buyer participants in the contract is a member group when the contract refers to a business account. Raised with _ERR_BUYER_IN_CNTR_DOES_NOT_MATCH_WITH_BUYER_IN_ACNT message if one of the Buyer participants in the contract does not match the Buyer participants in the referenced business account. Raised with _ERR_MISSING_ACCOUNT_HOLDER_IN_ACCOUNT message if there is no AccountHolder in the referenced business account when there are no Buyer participants. Raised with _ERR_BUYER_IN_CNTR_DOES_NOT_MATCH_WITH_ACCOUNTHOLDER_IN_ACNT message if one of the Buyer participants in the contract does not match the AccountHolder participant in the referenced business account.
      • checkContractLastUpdated

        public static void checkContractLastUpdated(com.ibm.commerce.contract.objects.ContractAccessBean abContract,
                                                    java.lang.String lastUpdatedTime,
                                                    com.ibm.commerce.datatype.TypedProperty responseProperties,
                                                    java.lang.String returnViewForTools)
                                             throws com.ibm.commerce.exception.ECApplicationException
        Checks whether someone has made a more recent update to the contract, which will be overwritten, based on the last updated time string.
        Parameters:
        abContract - The ContractAccessBean object of the specified contract.
        lastUpdateTime - A string representing the last updated time of the contract. This must be in the same format as the TIMEUPDATED column of the CONTRACT table in the database.
        responseProperties - The response property object.
        returnViewForTools - The return view name for tools user interface.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_FINDER_EXCEPTION message if a FinderException occurred. Raised with _ERR_NAMING_EXCEPTION message if a NamingException occurred. Raised with _ERR_REMOTE_EXCEPTION message if a RemoteException occurred. Raised with _ERR_CREATE_EXCEPTION message if a CreateException occurred.
        See Also:
        checkLastUpdatedTime(String utime, String lastUpdatedTime, String tradingId, TypedProperty responseProperties, String returnViewForTools)
      • checkContractLastUpdated

        public static void checkContractLastUpdated(org.w3c.dom.Element contractElement,
                                                    java.lang.String lastUpdatedTime,
                                                    com.ibm.commerce.datatype.TypedProperty responseProperties,
                                                    java.lang.String returnViewForTools)
                                             throws com.ibm.commerce.exception.ECApplicationException
        Checks whether someone has made a more recent update to the contract, which will be overwritten, based on the last updated time string.
        Parameters:
        contractElement - The contract Element object.
        lastUpdateTime - A string representing the last updated time of the contract. This must be in the same format as the TIMEUPDATED column of the CONTRACT table in the database.
        responseProperties - The response property object.
        returnViewForTools - The return view name for tools user interface.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_FINDER_EXCEPTION message if a FinderException occurred. Raised with _ERR_NAMING_EXCEPTION message if a NamingException occurred. Raised with _ERR_REMOTE_EXCEPTION message if a RemoteException occurred. Raised with _ERR_CREATE_EXCEPTION message if a CreateException occurred.
        See Also:
        checkLastUpdatedTime(String utime, String lastUpdatedTime, String tradingId, TypedProperty responseProperties, String returnViewForTools)
      • checkLastUpdatedTime

        public static void checkLastUpdatedTime(java.lang.String utime,
                                                java.lang.String lastUpdatedTime,
                                                java.lang.String tradingId,
                                                com.ibm.commerce.datatype.TypedProperty responseProperties,
                                                java.lang.String returnViewForTools)
                                         throws com.ibm.commerce.exception.ECApplicationException
        Checks the timestamp of the last update.
        Parameters:
        utime - The timestamp of the last update in the database.
        lastUpdatedTime - The user who performed the last update of a trading agreement.
        tradingId - The trading agreement ID.
        responseProperties - The response property object.
        returnViewForTools - The return view name for tools user interface.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_TRADING_HAS_BEEN_CHANGED message if the utime and the lastUpdatedTime parameters are different.
      • containsIgnoreCase

        public static boolean containsIgnoreCase(java.lang.String[] strArray,
                                                 java.lang.String str)
        Checks if the given string array contains the specified string.
        Parameters:
        strArray - The array of strings to be checked.
        str - The specified string
        Returns:
        True if the string array contains the specified string, false otherwise.
      • contractAttachmentSet

        public static void contractAttachmentSet(java.lang.Long argTradingId,
                                                 org.w3c.dom.Element argAttachmentElement,
                                                 java.lang.Long argOwnerId,
                                                 java.lang.String argUsageId)
                                          throws javax.ejb.RemoveException
        Adds an attachment to the attachment table if the attachment does not exist yet, and creates a relationship between the specified trading agreement and the attachment.
        Parameters:
        argAttachmentElement - The attachment Element object.
        argTradingId - The ID of the trading agreement.
        argOwnerId - The ID of the owner of the attachment.
        argUsageId - The ID of the usage of the attachment.
        Throws:
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.ejb.DuplicateKeyException.
        javax.ejb.RemoveException.
        javax.naming.NamingException.
        javax.ejb.RemoveException
      • contractAttachmentSet

        public static void contractAttachmentSet(java.lang.Long argTradingId,
                                                 java.lang.Long argOwnerId,
                                                 java.lang.String usageId,
                                                 java.lang.String uri,
                                                 java.lang.String mimeType,
                                                 java.lang.String mimeTypeEncoding)
        Adds an attachment to the attachment table if the attachment does not exist yet, and creates a relationship between the specified trading agreement and the attachment.
        Parameters:
        argTradingId - The ID of the trading agreement.
        argOwnerId - The ID of the attachment's owner
        argUsageId - The ID of the attachment usage.
        uri - The attachment URI.
        mimeType - The mime type of the attachment.
        mimeTypeEncoding - The mime type encoding of the attachment.
        Throws:
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.ejb.DuplicateKeyException.
        javax.naming.NamingException.
      • contractDescriptionSet

        public static void contractDescriptionSet(org.w3c.dom.Element argContractDescElement,
                                                  java.lang.Long argContractId,
                                                  java.sql.Timestamp currentTime)
                                           throws com.ibm.commerce.exception.ECApplicationException
        Adds or updates the contract description.
        Parameters:
        argContractDescElement - The contract description Element object.
        argContractId - The ID of the contract.
        currentTime - The Timestamp object representing the current time.
        Throws:
        java.rmi.RemoteException.
        javax.ejb.CreateException.
        javax.ejb.FinderException.
        javax.naming.NamingException.
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_NUMBER_FORMAT_EXCEPTION message if the language ID provided in the description Element cannot be converted to the language ID as an Integer.
      • copyOrgAddress

        public static java.lang.Object copyOrgAddress(java.lang.Long sourceOrgMemberId,
                                                      java.lang.Long targetOrgMemberId,
                                                      int count,
                                                      java.lang.String addressType,
                                                      java.lang.String url)
        Copies the source organization's address to the target organization's address.
        Parameters:
        sourceOrgMemberID - The source organization's member ID.
        sourceOrgMemberID - The target organization's member ID. If the target organization's member ID is null, then copy the address from the source address to the source organization's STADDRESS table. Otherwise, copy to the target organization's address table.
        address - The nickname suffix
        addressType - The type of address that will be copied.
        url - The remote URL of the store.
        Returns:
        The store address ID.
      • createNewContract

        public static java.lang.Long createNewContract(org.w3c.dom.Element argContract,
                                                       java.sql.Timestamp currentTime)
                                                throws com.ibm.commerce.contract.helper.TermCondCreateException,
                                                       javax.naming.NamingException,
                                                       com.ibm.commerce.exception.ECApplicationException,
                                                       java.sql.SQLException
        Creates a new contract based on the provided Element object.
        Parameters:
        argContract - The contract Element object.
        currentTime - The Timestamp object represents the current time.
        Returns:
        The ID of the new contract.
        Throws:
        javax.naming.NamingException
        java.sql.SQLException
        com.ibm.commerce.exception.ECApplicationException
        com.ibm.commerce.contract.helper.TermCondCreateException
        See Also:
        com.ibm.commerce.contract.helper.ContractUtil#getMemberId(member), getTimeFromElement(Element anElement, String tag, Timestamp time)
      • createNewXSDContract

        public static java.lang.Long createNewXSDContract(org.w3c.dom.Element argContract,
                                                          java.sql.Timestamp currentTime)
                                                   throws com.ibm.commerce.contract.helper.TermCondCreateException,
                                                          javax.naming.NamingException,
                                                          com.ibm.commerce.exception.ECApplicationException,
                                                          java.sql.SQLException
        Creates a new contract based on the given contract Element object. This method is for XSD-based contract elements.
        Parameters:
        argContract - The contract Element object.
        currentTime - The Timestamp object represents the current time.
        Returns:
        The ID of the new contract.
        Throws:
        javax.naming.NamingException
        java.sql.SQLException
        com.ibm.commerce.exception.ECApplicationException.
        com.ibm.commerce.contract.helper.TermCondCreateException
        com.ibm.commerce.exception.ECApplicationException
        See Also:
        com.ibm.commerce.contract.helper.ContractUtil#getXSDMemberId(member), getTimeFromXSDElement(Element anElement, String tag, Timestamp time)
      • doesTradingAgreementHaveTCs

        public static boolean doesTradingAgreementHaveTCs(java.lang.String tradingId,
                                                          java.lang.String tcType)
        Checks if a trading agreement has term and conditions of a particular type.
        Parameters:
        tradingId - the trading id to check. all base trading agreements are checked as well.
        tcType - the type of term and condition to check for.
        Returns:
        true if the trading agreement has a tc of the given type, false otherwise
      • encode

        public static java.lang.String encode(java.lang.String infile)
        Converts a system dependant file path to an encoded URI string.
        Parameters:
        infile - the filename
        Returns:
        the encoded filename
      • findStringIndex

        public static java.lang.Integer findStringIndex(java.lang.String[] strArray,
                                                        java.lang.String str)
        Gets the index of the specified string in the given string array.
        Parameters:
        strArray - The string array
        str - The specified string
        Returns:
        The index of the specified string in the given string array if found, otherwise return null.
      • formatEntityPath

        public static java.lang.String formatEntityPath(java.lang.String[] pathList)
        Returns the formatted entity path.
        Parameters:
        pathList - The list of the entity paths.
        Returns:
        The combined entity paths.
      • getContractOriginType

        public static java.lang.Integer getContractOriginType(java.lang.String str)
        Gets the origin of the contract based on the given string.
        Parameters:
        str - The string object represents the origin type of a contract.
        Returns:
        The origin of the contract.
      • getContractOriginTypeInString

        public static java.lang.String getContractOriginTypeInString(java.lang.Integer index)
        Gets the origin of the contract in string format from the given integer contract origin.
        Parameters:
        index - The origin of the contract.
        Returns:
        The origin of the contract.
      • getContractParticipantRole

        public static java.lang.Integer getContractParticipantRole(java.lang.String prty)
        Gets the participant role of a participant based on the given participant role string.
        Parameters:
        prty - The participant role type in String object.
        Returns:
        The participant role type in Integer object.
      • getContractParticipantRoleInString

        public static java.lang.String getContractParticipantRoleInString(java.lang.Integer index)
        Gets the participant role of a participant based on the given participant role.
        Parameters:
        index - The participant role type in Integer object.
        Returns:
        The participant role type in String object.
      • getContractState

        public static java.lang.Integer getContractState(com.ibm.commerce.contract.objects.ContractAccessBean abContract)
        Gets the state of the contract.
        Parameters:
        abContract - The ContractAccessBean of the contract.
        Returns:
        The state of the contract.
      • getContractState

        public static java.lang.Integer getContractState(java.lang.Long contractId)
        Gets the state of the specified contract.
        Parameters:
        contractId - The ID of the contract
        Returns:
        The state of the contract
      • getContractState

        public static java.lang.Integer getContractState(java.lang.String state)
        Gets the state of the contract based on the given contract state string.
        Parameters:
        state - The contract state string.
        Returns:
        The state of the contract in Integer object.
      • getContractStateInString

        public static java.lang.String getContractStateInString(java.lang.Integer index)
        Gets the state of the contract based on the given contract state integer.
        Parameters:
        index - The state of the contract.
        Returns:
        The state of the contract in String object.
      • getContractUsageType

        public static java.lang.Integer getContractUsageType(java.lang.String str)
        Gets the usage of the contract based on the given contract usage string.
        Parameters:
        str - The contract usage string.
        Returns:
        The usage of the contract in Integer object.
      • getContractUsageTypeInString

        public static java.lang.String getContractUsageTypeInString(java.lang.Integer index)
        Gets the usage of the contract based on the given contract usage.
        Parameters:
        index - The usage of the contract.
        Returns:
        The contract usage string.
      • getCurrentContract

        public static java.lang.String getCurrentContract(java.lang.String familyId)
        Returns the current version of a contract based on the contract family id. This is the contract with the lastest creation date. Usually this will be the latest Active or Draft contract.
        Parameters:
        familyId - the contract family id to check.
        Returns:
        the current version of the contract family
      • getCurrentTradingAgreementIds

        public static java.lang.String[] getCurrentTradingAgreementIds(com.ibm.commerce.command.CommandContext context)
                                                                throws com.ibm.commerce.exception.ECException
        Gets the ids of the current set of trading agreements.
        Parameters:
        context - CommandContext - the command context.
        Returns:
        the current trading agreement ids, or null.
        Throws:
        com.ibm.commerce.exception.ECException
      • getCurrentTradingAgreements

        public static com.ibm.commerce.contract.objects.TradingAgreementAccessBean[] getCurrentTradingAgreements(com.ibm.commerce.command.CommandContext context)
                                                                                                          throws com.ibm.commerce.exception.ECException
        Gets the current set of trading agreements.
        Parameters:
        context - CommandContext - the command context.
        Returns:
        TradingAgreementAccessBean[]
        Throws:
        com.ibm.commerce.exception.ECException
      • getElementFromElementByTag

        public static org.w3c.dom.Element getElementFromElementByTag(org.w3c.dom.Element element,
                                                                     java.lang.String tag)
        Gets an element which has the name of the specified tag from the given element object.
        Parameters:
        element - The source element object.
        tag - The tag name.
        Returns:
        The element with tag name as the specified tag.
      • getElementsFromElementByTag

        public static java.util.Vector getElementsFromElementByTag(org.w3c.dom.Element element,
                                                                   java.lang.String tag)
        Get the all of the children elements which have the tag name as the specified tag from the given element.
        Parameters:
        element - The source element.
        tag - The tag name.
        Returns:
        The vector of the children elements.
      • getEligibleDelegationGrids

        public static java.lang.String[] getEligibleDelegationGrids(java.lang.Long participantId,
                                                                    java.lang.Integer storeId)
        Gets the eligible price override limits (Contract) for the specified participant, who has the CSR participant role in the trading agreements, in the given store.
        Parameters:
        participantId - The ID of the participant.
        storeId - The ID of the store.
        Returns:
        All of the eligible trading agreements.
        See Also:
        getEligibleTradingAgreements(Enumeration trading, Integer storeId)
      • getEligibleTradingAgreementIds

        public static java.lang.String[] getEligibleTradingAgreementIds(com.ibm.commerce.command.CommandContext context)
                                                                 throws com.ibm.commerce.exception.ECException
        Gets the eligible trading agreement IDs as an array for type contract only.
        Parameters:
        context - CommandContext - the command context.
        Returns:
        String[] - trading agreement Ids
        Throws:
        com.ibm.commerce.exception.ECException
      • getEligibleTradingAgreements

        public static java.lang.String[] getEligibleTradingAgreements(java.util.Enumeration trading,
                                                                      java.lang.Integer storeId)
        Gets the eligible trading agreements. This method will remove the store default contract if one of the eligible contracts does not allow the store's default contract be used.
        Parameters:
        trading - An enumeration of TradingAgreementAccessBeans represent the eligible trading agreements.
        storeId - The ID of the store.
        Returns:
        The eligible trading agreement.
      • getEligibleTradingAgreements

        public static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId,
                                                                      java.lang.Integer storeId)
        Gets the eligible trading agreements (Contract) for the specified participant, who has the Buyer participant role in the trading agreemnts, in the given store.
        Parameters:
        participantId - The ID of the participant.
        storeId - The ID of the store.
        Returns:
        all The eligible trading agreements.
        See Also:
        getEligibleTradingAgreements(Enumeration trading, Integer storeId)
      • getEligibleTradingAgreements

        public static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId,
                                                                      java.lang.Integer storeId,
                                                                      com.ibm.commerce.command.CommandContext cc)
                                                               throws javax.naming.NamingException
        Gets the eligiable trading agreements (Contract) for the specified participant, who has the Buyer participant role in the trading agreemnts, in the given store.
        Parameters:
        participantId - the ID of the participant
        storeId - the ID of the store
        cc - the command context
        Returns:
        all the eligiable trading agreements
        Throws:
        javax.naming.NamingException
        See Also:
        getEligibleTradingAgreements(Enumeration trading, Integer storeId)
      • getEligibleTradingAgreements

        public static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId,
                                                                      java.lang.Integer storeId,
                                                                      java.lang.Integer tradingType)
        Gets the eligible trading agreements for the specified participant, who has the Buyer participant role in the trading agreements, in the store.
        Parameters:
        participantId - The ID of the participant.
        storeId - The ID of the store.
        tradingType - The type of the trading agreement.
        Returns:
        The eligible trading agreement.
        See Also:
        getEligibleTradingAgreements(Enumeration trading, Integer storeId)
      • getEligibleTradingAgreements

        public static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId,
                                                                      java.lang.Integer storeId,
                                                                      java.lang.Integer tradingType,
                                                                      com.ibm.commerce.command.CommandContext cc)
                                                               throws javax.naming.NamingException
        Gets the eligible trading agreements for the specified participant, who has the Buyer participant role in the trading agreements, in the store.
        Parameters:
        participantId - the ID of the participant
        storeId - the ID of the store
        tradingType - the type of the trading agreement
        cc - the command context
        Returns:
        the eligible trading agreement
        Throws:
        javax.naming.NamingException
        See Also:
        getEligibleTradingAgreements(Enumeration trading, Integer storeId)
      • getEligibleTradingAgreements

        public static java.lang.String[] getEligibleTradingAgreements(java.lang.Long participantId,
                                                                      java.lang.Integer storeId,
                                                                      java.lang.Integer tradingType,
                                                                      java.lang.Long orgId)
                                                               throws javax.naming.NamingException
        Gets the eligible trading agreements for the specified participant, who has the Buyer participant role in the trading agreements, in the store.
        Parameters:
        participantId - the ID of the participant
        storeId - the ID of the store
        tradingType - the type of the trading agreement
        orgId - the ID of the active organization
        Returns:
        the eligible trading agreements
        Throws:
        javax.naming.NamingException
        See Also:
        getEligibleTradingAgreements(Enumeration trading, Integer storeId)
      • getFullContractXMLFileName

        public static java.lang.String getFullContractXMLFileName(java.lang.String file)
        Gets the absolute name of the XML file.
        Parameters:
        file - The name of the XML file
        Returns:
        The absolute name of the XML file
      • getIntegerFromTrueOrFalse

        public static java.lang.Integer getIntegerFromTrueOrFalse(java.lang.String str)
        Gets the Integer value for "true" or "false" string. The method ignores the case of the input string.
        Parameters:
        str - The true or false string
        Returns:
        The Integer value of the string. 1 for true, 0 for false.
      • getMasterCatalogIdAndNameAndOwnerMemberId

        public static java.lang.String[] getMasterCatalogIdAndNameAndOwnerMemberId(java.lang.Integer storeId)
                                                                            throws java.sql.SQLException
        Gets the master catalog ID, name and the owner member ID of the store.
        Parameters:
        storeId - The ID of the store.
        Returns:
        The master catalog ID(first element), name(second element) and owner's member ID(third element).
        Throws:
        java.sql.SQLException
      • getParticipantMemberGroups

        public static java.lang.String getParticipantMemberGroups(java.lang.Long participantId,
                                                                  java.lang.Integer storeId)
        Gets the member groups for the specified participant, who has the Buyer participant role in the trading agreemnts, in the given store.
        Parameters:
        participantId - The ID of the participant.
        Returns:
        all The participant's member groups.
      • getPricePoliciesByStoreIdAndTPCIdAndTPCName

        public static java.util.Vector getPricePoliciesByStoreIdAndTPCIdAndTPCName(java.lang.String sStoreId,
                                                                                   java.lang.String sTPCId,
                                                                                   java.lang.String sTPCName)
                                                                            throws java.sql.SQLException
        Gets the price policies asssociated with the store (in most cases, this is the catalog profile store). This method returns the policy Vectors if their properties' name is equal to the specified trading position container's name.
        Each element inside the returned vector is another vector which contains a policy ID, policy name, and a store ID.
        Parameters:
        sStoreId - The store ID (in most cases, this is the catalog profile store ID).
        sTPCId - The ID of the trading position container.
        sTPCName - The name of the trading position container.
        Returns:
        The price policy list.
        Throws:
        java.sql.SQLException
      • getReferredContract

        public static com.ibm.commerce.contract.objects.ContractAccessBean getReferredContract(org.w3c.dom.Element cntrRefElement)
                                                                                        throws com.ibm.commerce.contract.helper.TermCondCreateException,
                                                                                               com.ibm.commerce.exception.ECApplicationException
        Gets the referred contract bases on the contract reference element.
        Parameters:
        cntrRefElement - The contract reference Element object.
        Returns:
        The ContractAccessBean object which includes the referenced contract information.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_WRONG_CONTRACT_OWNER_MEMBER_INFO message if the information provided in the contract owner element is incorrect, and prevents the contract owner ID from being retrived. Raised with _ERR_CONTRACT_NOT_FOUND message if the contract object cannot be found based on the provided contract name, major version, minor version, origin, and owner. Raised with _ERR_VERSION_NUMBER_FORMAT message if either the major verion or minor version of the contract is not an Integer.
        com.ibm.commerce.contract.helper.TermCondCreateException
      • getSameFamilyContractIds

        public static java.lang.Long[] getSameFamilyContractIds(java.lang.Long contractId)
                                                         throws javax.naming.NamingException,
                                                                java.sql.SQLException
        Gets contracts belonging to the same family as the specified contract.
        Parameters:
        contractId - The ID of the contract.
        Returns:
        An array of Long objects containing the same family contract IDs (excluding current contract ID).
        Throws:
        CreateException.
        FinderException.
        NamingException.
        SQLException.
        RemoteException.
        javax.naming.NamingException
        java.sql.SQLException
      • getStoreIdsContractDeloyedTo

        public static java.lang.Integer[] getStoreIdsContractDeloyedTo(java.lang.Long contractId)
                                                                throws java.sql.SQLException,
                                                                       javax.naming.NamingException
        Gets the IDs of the stores to which the specified contract belongs.
        Parameters:
        contractId - The ID of the contract.
        Returns:
        The list of store IDs to which the specified contract is deployed.
        Throws:
        javax.naming.NamingException
        java.sql.SQLException
      • getStoreIdsCreatedByContract

        public static java.lang.Integer[] getStoreIdsCreatedByContract(java.lang.Long contractId)
                                                                throws javax.naming.NamingException,
                                                                       java.sql.SQLException
        Gets the IDs of the stores created by the specified contract.
        Parameters:
        contractId - The ID of the contract.
        Returns:
        The list of store IDs which created by the specified contract
        Throws:
        javax.naming.NamingException
        java.sql.SQLException
      • getStoreRelationshipType

        public static java.lang.String getStoreRelationshipType(java.lang.Integer contractUsage)
        Gets the type of store relationship based on the contract usage.
        Parameters:
        contractUsage - The usage of the contract.
        Returns:
        The type of the store relationship.
      • getTermConditionElements

        public static java.util.Vector getTermConditionElements(org.w3c.dom.Element tradingElement)
                                                         throws java.sql.SQLException,
                                                                javax.naming.NamingException
        Gets all of the elements of the terms and conditions in the given trading agreement element.
        Parameters:
        tradingElement - The trading agreement element object.
        Returns:
        The vector of all of the elements of the terms and conditions in the trading agreement.
        Throws:
        javax.naming.NamingException
        java.sql.SQLException
      • getTimeFromElement

        public static java.sql.Timestamp getTimeFromElement(org.w3c.dom.Element timeElement)
        Gets the time from the specified time element object.
        Parameters:
        timeElement - The element includes the information specifying the time.
        Returns:
        The Timestamp for the time specified in the time element.
      • getTimeFromElement

        public static java.sql.Timestamp getTimeFromElement(org.w3c.dom.Element anElement,
                                                            java.lang.String tag,
                                                            java.sql.Timestamp time)
                                                     throws com.ibm.commerce.exception.ECApplicationException
        Gets the time from the specified time element object.
        Parameters:
        anElement - The parent object of a time element.
        tag - The tag name of the time element.
        time - The time will return if the time element does not exist in the parent element.
        Returns:
        The Timestamp for the time specified in the time element. If the time element cannot be found, the input time will be returned.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_WRONG_GMT_TIMESTAMP_FORMAT message if the time cannot be converted to a Timestamp object.
      • getTimeFromString

        public static java.sql.Timestamp getTimeFromString(java.lang.String timeStr,
                                                           java.sql.Timestamp defaultTime)
        Gets the time from the specified time string. If the time string is null or empty, the default time is returned.
        Parameters:
        timeStr - The string represents the time in the JDBC timestamp escape format.
        defaultTime - The default time.
        Returns:
        The Timestamp object of the time string.
      • getTimeFromXSDElement

        public static java.sql.Timestamp getTimeFromXSDElement(org.w3c.dom.Element anElement,
                                                               java.lang.String tag,
                                                               java.sql.Timestamp time)
                                                        throws com.ibm.commerce.exception.ECApplicationException
        Gets the time from the given element. If the time attribute specified by the tag is null or empty, the default time will be returned.
        Parameters:
        anElement - The element includes the time information.
        tag - The name of the time attribute.
        time - The default time.
        Returns:
        The time in the given element.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_WRONG_GMT_TIMESTAMP_FORMAT message if the time information provided in the element cannot be converted to a Timestamp object.
      • getTPCIdAndTPCNameAndCatlogProfileStoreIdByHostingStoreIdOrCatalogProfileStoreId

        public static java.lang.String[] getTPCIdAndTPCNameAndCatlogProfileStoreIdByHostingStoreIdOrCatalogProfileStoreId(java.lang.Integer hostedStoreId,
                                                                                                                          java.lang.Integer catalogProfileStoreId)
                                                                                                                   throws javax.naming.NamingException,
                                                                                                                          java.sql.SQLException
        Gets the trading position container ID and the catalog profile store ID of the hosting store.
        If a catalogProfileStoreId is specified, this method gets the trading position container ID of that catalog profile store, and simply returns the trading position container ID and the catalog profile store ID.
        If a catalogProfileStoreId is not specified, this method finds the catalog profile store associated with specified hosting store ID (hostedStoreId), then gets the trading position container ID of the catalog profile store. If multiple trading position container IDs are associated with the catalog profile store, this method returns the one with the highest precedence. If they have same precedence, this method picks the first one.
        Either hostedStoreId or catalogProfileStoreId can be null, however they cannot be both null.

        Parameters:
        hostedStoreId - The hosting store ID.
        catalogProfileStoreId - Catalog profile store ID.
        Returns:
        An array contains the trading position container ID (first element) and the catalog profile store ID (second element).
        Throws:
        javax.naming.NamingException
        java.sql.SQLException
        See Also:
        getTPCIdAndNameByCatalogProfileStoreId
      • getTradingAgreement

        public static com.ibm.commerce.contract.objects.TradingAgreementAccessBean getTradingAgreement(java.lang.Long id)
                                                                                                throws com.ibm.commerce.exception.ECException
        Gets the trading agreement given an ID.
        Parameters:
        Long - id - trading agreement id
        Returns:
        TradingAgreementAccessBean
        Throws:
        com.ibm.commerce.exception.ECException
      • getTradingAgreement

        public static com.ibm.commerce.contract.objects.TradingAgreementAccessBean getTradingAgreement(java.lang.String id)
                                                                                                throws com.ibm.commerce.exception.ECException
        Gets the trading agreement given a string ID.
        Parameters:
        String - id - trading agreement id
        Returns:
        TradingAgreementAccessBean
        Throws:
        com.ibm.commerce.exception.ECException
      • getTradingAgreementAddressIDsFromAddressBooks

        public static com.ibm.commerce.user.objects.AddressAccessBean[] getTradingAgreementAddressIDsFromAddressBooks(com.ibm.commerce.contract.objects.TradingAgreementAccessBean tradingAB,
                                                                                                                      java.lang.String type,
                                                                                                                      java.lang.Long userId,
                                                                                                                      java.lang.Integer storeId)
        Gets the addresses that can be used for shipping and billing addresses for a contract as allowed by the AddressBook Terms and Conditions
        Parameters:
        tradingId - The trading agreement ID.
        type - Find shipping or billing address book tcs
        userId - The user's ID.
        storeId - The store ID.
        Returns:
        An array of the address access beans.
      • getTradingAgreementAllowPersonalAddressBook

        public static boolean getTradingAgreementAllowPersonalAddressBook(com.ibm.commerce.contract.objects.TradingAgreementAccessBean tradingAB,
                                                                          java.lang.String type,
                                                                          java.lang.Long userId)
        Returns whether the user can use their personal address book.
        Parameters:
        tradingId - The trading agreement ID.
        type - Finds the shipping or billing address book terms and conditions.
        userId - The user's id.
        Returns:
        An array of the address access beans
      • getTradingLevelParticipants

        public static com.ibm.commerce.contract.objects.ParticipantAccessBean[] getTradingLevelParticipants(java.lang.Long tradingId,
                                                                                                            java.lang.Integer role)
        Gets trading agreement level participants in the specified trading agreement with the specified role.
        Parameters:
        tradingId - The ID of the trading agreement.
        role - The type of the participant role.
        Returns:
        An array of ParticipantAccessBean objects representing the trading agreement level participants.
      • getXMLDocumentObjectFromFile

        public static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName)
                                                                 throws org.xml.sax.SAXParseException,
                                                                        java.io.FileNotFoundException,
                                                                        org.xml.sax.SAXException,
                                                                        java.io.IOException
        Gets the XML Document object based on the specified XML instance file name. This method is for a DTD-based XML instance. The DTD file should be placed under the default DTD path which is defined in the Websphere Commerce instance XML file.
        Parameters:
        xmlFileName - The name of the XML instance file.
        Returns:
        The XML Document of the XML instance.
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
        org.xml.sax.SAXParseException
        org.xml.sax.SAXException
      • getXMLDocumentObjectFromFile

        public static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName,
                                                                        boolean validation)
                                                                 throws org.xml.sax.SAXParseException,
                                                                        java.io.FileNotFoundException,
                                                                        org.xml.sax.SAXException,
                                                                        java.io.IOException
        Gets the XML Doucment object from the specified xml instance file. This method is for an XML Schema-based XML instance. The XML Schema files should be placed under the default XSD path which is defined in the Websphere Commerce instance XML file.
        Parameters:
        xmlFileName - The name of the XML file.
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        Returns:
        The Document object of the XML file.
        Throws:
        org.xml.sax.SAXParseException
        java.io.FileNotFoundException
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromFile

        public static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName,
                                                                        boolean validation,
                                                                        boolean xsd)
                                                                 throws org.xml.sax.SAXParseException,
                                                                        java.io.FileNotFoundException,
                                                                        org.xml.sax.SAXException,
                                                                        java.io.IOException
        Gets the XML Document object from a file. The XML Schema files should be placed under the default XSD path which is defined in the WebSphere Commerce instance XML file. The DTD files should be placed under the default DTD path which is defined in the WebSphere Commerce instance XML file.
        Parameters:
        xmlFileName - The name of the XML file.
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        xsd - Specifies whether the file is based on an XSD file. If the value is true, it is XSD-based. If the value is false, the file is DTD-based.
        Returns:
        The Document object of the XML file.
        Throws:
        org.xml.sax.SAXParseException
        java.io.FileNotFoundException
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromFile

        public static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName,
                                                                        boolean validation,
                                                                        boolean xsd,
                                                                        java.lang.String entityPath)
                                                                 throws org.xml.sax.SAXParseException,
                                                                        java.io.FileNotFoundException,
                                                                        org.xml.sax.SAXException,
                                                                        java.io.IOException
        Gets the XML Document object from a file.
        Parameters:
        xmlFileName - The name of the XML file.
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        xsd - Specifies whether the file is based on an XSD file. If the value is true, it is XSD-based. If the value is false, the file is DTD-based.
        entityPath - The specified paths where DTD or XML schema files are located.
        Returns:
        The Document object of the XML file.
        Throws:
        org.xml.sax.SAXParseException
        java.io.FileNotFoundException
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromFile

        public static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName,
                                                                        boolean validation,
                                                                        java.lang.String entityPath)
                                                                 throws org.xml.sax.SAXParseException,
                                                                        java.io.FileNotFoundException,
                                                                        org.xml.sax.SAXException,
                                                                        java.io.IOException
        Gets the XML Document object from the specified XML instance file. This method is for an XSD-based XML instance.
        Parameters:
        xmlFileName - The name of the XML file.
        validation - If XML file should be validatated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        entityPath - The specified paths where XML schema files are located.
        Returns:
        The Document object of the XML file.
        Throws:
        org.xml.sax.SAXParseException
        java.io.FileNotFoundException
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromFile

        public static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName,
                                                                        java.lang.String entityPath)
                                                                 throws org.xml.sax.SAXParseException,
                                                                        java.io.FileNotFoundException,
                                                                        org.xml.sax.SAXException,
                                                                        java.io.IOException
        Gets the XML Document object based on the specified XML instance file name. This method is for a DTD-based XML instance.
        Parameters:
        xmlFileName - The name of the XML instance file.
        entityPath - The specified paths where DTD files are located.
        Returns:
        The XML Document of the XML instance.
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
        org.xml.sax.SAXParseException
        org.xml.sax.SAXException
      • getXMLDocumentObjectFromInputStream

        public static org.w3c.dom.Document getXMLDocumentObjectFromInputStream(java.io.InputStream xmlInput,
                                                                               boolean validation,
                                                                               boolean xsd)
                                                                        throws org.xml.sax.SAXException,
                                                                               java.io.IOException
        Gets the XML Document object from an InputStream object which contains the XML instance. The XML Schema files should be placed under the default XSD path which is defined in the WebSphere Commerce instance XML file. The DTD files should be placed under the default DTD path which is defined in the Websphere Commerce instance XML file.
        Parameters:
        xmlInput - The InputStream object contains the XML instance.
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        xsd - Specifies whether the file is based on an XSD file. If the value is true, it is XSD-based. If the value is false, the file is DTD-based.
        Returns:
        The Document object of the XML instance.
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromInputStream

        public static org.w3c.dom.Document getXMLDocumentObjectFromInputStream(java.io.InputStream xmlInput,
                                                                               boolean validation,
                                                                               boolean xsd,
                                                                               java.lang.String entityPath)
                                                                        throws org.xml.sax.SAXException,
                                                                               java.io.IOException
        Gets the XML Document object from an InputStream object which contains the XML instance.
        Parameters:
        xmlInput - The InputStream object contains the XML instance.
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        xsd - Specifies whether the file is based on an XSD file. If the value is true, it is XSD-based. If the value is false, the file is DTD-based.
        entityPath - The specified paths where DTD or XML schema files are located.
        Returns:
        The Document object of the XML instance.
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromReader

        public static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader)
                                                                   throws org.xml.sax.SAXException,
                                                                          java.io.IOException
        Gets the XML Document object based on the specified Reader object. This method is for a DTD-based XML instance. The DTD files should be placed under the default DTD path which is defined in the Websphere Commerce instance XML file.
        Parameters:
        reader - The Reader object includes the XML instance.
        Returns:
        The XML Document of the XML instance.
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
      • getXMLDocumentObjectFromReader

        public static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader,
                                                                          boolean validation)
                                                                   throws org.xml.sax.SAXException,
                                                                          java.io.IOException
        Gets the XML Document object from a Reader object which contains the XML instance. This method is for an XSD-based XML instance. The XML Schema files should be placed under the default XSD path which is defined in the Websphere Commerce instance XML file.
        Parameters:
        reader - The Reader object contains the XML instance.
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        Returns:
        The Document object of the XML instance.
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromReader

        public static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader,
                                                                          boolean validation,
                                                                          boolean xsd)
                                                                   throws org.xml.sax.SAXException,
                                                                          java.io.IOException
        Gets the XML Document object from a Reader object which contains the XML instance. The XML Schema files should be placed under the default XSD path which is defined in the Websphere Commerce instance XML file. The DTD files should be placed under the default DTD path which is defined in the Websphere Commerce instance XML file.
        Parameters:
        reader - The Reader object contains the XML instance
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        xsd - Specifies whether the file is based on an XSD file. If the value is true, it is XSD-based. If the value is false, the file is DTD-based.
        Returns:
        The Document object of the XML instance.
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromReader

        public static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader,
                                                                          boolean validation,
                                                                          boolean xsd,
                                                                          java.lang.String entityPath)
                                                                   throws org.xml.sax.SAXException,
                                                                          java.io.IOException
        Gets the XML Document object from a Reader object which contains the XML instance.
        Parameters:
        reader - The Reader object contains the XML instance.
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        xsd - Specifies whether the file is based on an XSD file. If the value is true, it is XSD-based. If the value is false, the file is DTD-based.
        entityPath - The specified paths where DTD or XML schema files are located.
        Returns:
        The Document object of the XML instance.
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromReader

        public static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader,
                                                                          boolean validation,
                                                                          java.lang.String entityPath)
                                                                   throws org.xml.sax.SAXException,
                                                                          java.io.IOException
        Gets the XML Document object from a Reader object which contains the XML instance. This is for an XSD-based XML instance.
        Parameters:
        reader - The Reader object contains the XML instance.
        validation - If XML file should be validated based on a specified XSD. A value true means that it should be validated, a value of false means it should not be validated.
        entityPath - The specified paths where XML schema files are located.
        Returns:
        The Document object of the XML instance.
        Throws:
        org.xml.sax.SAXException
        java.io.IOException
      • getXMLDocumentObjectFromReader

        public static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader,
                                                                          java.lang.String dtdPath)
                                                                   throws org.xml.sax.SAXException,
                                                                          java.io.IOException
        Gets the XML Document object based on the specified Reader object. This method is for a DTD-based XML instance.
        Parameters:
        reader - The Reader object includes the XML instance.
        entityPath - The specified paths where dtd files are located.
        Returns:
        The xml Document of the xml instance.
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
      • hasPaymentTCWithCreditLine

        public static boolean hasPaymentTCWithCreditLine(com.ibm.commerce.contract.objects.TermConditionAccessBean[] tcList)
        Checks whether the specified terms and conditions have a "Credit" type of business policy.
        Parameters:
        tcList - The list of terms and conditions to be checked.
        Returns:
        True if the specified terms and conditions have a "Credit" type of business policy, false otherwise.
      • hasThisTypeOfTermCondition

        public static boolean hasThisTypeOfTermCondition(java.lang.Long tradingId,
                                                         java.lang.String tcType)
        Checks whether the specified trading agreement has the given type of terms and conditions.
        Parameters:
        tradingId - The ID of the trading agreement.
        tcType - The type of the term and condition.
        Returns:
        True if the trading agreement has the given type of the term and condition; false otherwise.
      • invalidateTradingAgreement

        public static void invalidateTradingAgreement(java.lang.Long id,
                                                      com.ibm.commerce.command.CommandContext context)
                                               throws com.ibm.commerce.exception.ECException
        Removes a trading agreement from the cache.
        Parameters:
        id - Long - trading agreement id.
        context - CommandContext - the command context.
        Throws:
        com.ibm.commerce.exception.ECException
      • invalidateTradingAgreement

        public static void invalidateTradingAgreement(java.lang.String id,
                                                      com.ibm.commerce.command.CommandContext context)
                                               throws com.ibm.commerce.exception.ECException
        Removes a trading agreement from the cache given a string ID.
        Parameters:
        id - String - trading agreement id.
        context - CommandContext - the command context.
        Throws:
        com.ibm.commerce.exception.ECException
      • isBuyerContract

        public static boolean isBuyerContract(java.lang.Integer contractUsage)
        Checks if the contract is a buyer contract.
        Parameters:
        contractUsage - The usage of the contract.
        Returns:
        True if the contract is a buyer contract; false otherwise.
      • isBuyerContract

        public static boolean isBuyerContract(java.lang.Long contractId)
        Checks whether the contract is a buyer contract.
        Parameters:
        contractId - The ID of the contract.
        Returns:
        True if the contract is a buyer contract; false otherwise.
      • isDelegationGridContract

        public static boolean isDelegationGridContract(java.lang.Integer contractUsage)
        Checks whether the contract is a delegation grid contract.
        Parameters:
        contractUsage - The usage of the contract.
        Returns:
        True if the contract is a delegation grid contract; false otherwise.
      • isDelegationGridContract

        public static boolean isDelegationGridContract(java.lang.Long contractId)
        Checks whether the contract is a delegation grid contract.
        Parameters:
        contractId - The ID of the contract.
        Returns:
        True if the contract is a delegation grid contract; false otherwise.
      • isHostingContract

        public static boolean isHostingContract(java.lang.Integer contractUsage)
        Checks whether the contract is a hosting contract.
        Parameters:
        contractUsage - The usage of the contract
        Returns:
        True if the contract is a hosting contract; false otherwise.
      • isHostingContract

        public static boolean isHostingContract(java.lang.Long contractId)
        Checks whether the contract is a hosting contract.
        Parameters:
        contractId - The ID of the contract.
        Returns:
        True if the contract is a hosting contract; false otherwise.
      • isMasterPriceListPolicy

        public static boolean isMasterPriceListPolicy(java.lang.String sPolicyName)
        Check whether the price policy is a master price list policy.
        Parameters:
        sPolicyName - The name of the price policy.
        Returns:
        True if the price policy is a master price list policy, false otherwise.
      • isReferralContract

        public static boolean isReferralContract(java.lang.Integer contractUsage)
        Checks whether the contract is a referral contract.
        Parameters:
        contractUsage - The usage of the contract.
        Returns:
        True if the contract is a referral contract; false otherwise.
      • isReferralContract

        public static boolean isReferralContract(java.lang.Long contractId)
        Checks whether the contract is a referral contract.
        Parameters:
        contractId - The ID of the contract.
        Returns:
        True if the contract is a referral contract; false otherwise.
      • manageStore

        public static void manageStore(java.lang.Integer[] stores,
                                       java.lang.Integer status,
                                       boolean markForDelete,
                                       boolean storeCancelOrDelete,
                                       com.ibm.commerce.command.CommandContext cmdContext,
                                       com.ibm.commerce.datatype.TypedProperty responseProperties,
                                       java.lang.String returnViewForTools)
                                throws com.ibm.commerce.exception.ECApplicationException
        This method calls the ManageStoreCmd to update the status of the specified stores.
        Parameters:
        stores - An Integer array of the store IDs.
        status - The status of the store which will be updated.
        markForDelete - The markForDelete flag of the store.
        storeCancelOrDelete - The flag indicating if the store will be cancelled or deleted.
        cmdContext - The CommandContext object of the calling command.
        responseProperties - The response properties of the calling command.
        returnViewForTools - The return view name for the tools.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_UPDATE_STORE_STATUS message whenever an error occurs in ManageStoreCmd. See additional details in that command.
        See Also:
        ManageStoreCmdImpl.performExecute()
      • manageStoreAndUpdateStoreRelationshipState

        public static void manageStoreAndUpdateStoreRelationshipState(java.lang.Long contractId,
                                                                      java.lang.Integer contractUsage,
                                                                      java.lang.Integer storeStatus,
                                                                      java.lang.Integer relationshipState,
                                                                      boolean storeMarkforDelete,
                                                                      boolean storeCancelOrDelete,
                                                                      com.ibm.commerce.command.CommandContext cmdContext,
                                                                      com.ibm.commerce.datatype.TypedProperty responseProperties,
                                                                      java.lang.String returnViewForTools)
                                                               throws com.ibm.commerce.exception.ECException
        Manages the stores and updates the state of a Store Relationship when the state of a store's contract was changed.
        Parameters:
        contractId - The ID of the contract.
        contractUsage - The usage of the specified contract.
        storeStatus - The status of the store after this update process.
        relationshipState - The state of the store relationship after this update process.
        storeMarkforDelete - The flag indicating whether the store will be MarkForDelete.
        storeCancelOrDelete - The flag indicating whether the store will be cancelled or deleted.
        cmdContext - The CommandContext object of the calling command.
        responseProperties - The response properties of the calling command.
        returnViewForTools - The return view name for the tools user interface.
        Throws:
        com.ibm.commerce.exception.ECException - Raised with _ERR_UPDATE_STORE_OR_STORE_RELATIONSHIP_STATE message if the EJB throws one of CreateException, FinderException, NameException, RemoteException, or SQLException.
        See Also:
        #manageStore(Integer stores[], Integer status, boolean markForDelete, CommandContext cmdContext, TypedProperty responseProperties, String returnViewForTools), updateStoreRelationshipState(Integer storeId, Integer relatedStoreId, String relationshipType, Integer state, CommandContext cmdContext, TypedProperty responseProperties, String returnViewForTools), ECCommand.performExecute()
      • removeContractFromStore

        public static void removeContractFromStore(java.lang.Long contractId,
                                                   java.lang.Integer storeId)
                                            throws javax.ejb.RemoveException
        Removes the contract-store relationship from the STORECNTR table for the specified contract and store.
        Parameters:
        contractId - The ID of the contract.
        storeId - The ID of the store.
        Throws:
        javax.ejb.RemoveException
      • replace

        public static java.lang.String replace(java.lang.String text,
                                               java.lang.String find,
                                               java.lang.String replace)
        Returns a new string resulting from replacing the first occurrence of find in the specified string text with replace.
        Parameters:
        text - The string to be processed.
        find - The string pattern to locate in the specified string.
        replace - The replacement string.
        Returns:
        A string derived from the specified string text by replacing the first occurrence of find with replace.
      • replaceAll

        public static java.lang.String replaceAll(java.lang.String text,
                                                  java.lang.String find,
                                                  java.lang.String replace)
        Returns a new string resulting from replacing all occurrences of find in the specified string text with replace.
        Parameters:
        text - The string to be processed.
        find - The string pattern to locate in the specified string.
        replace - The replacement string.
        Returns:
        A string derived from the specified string text by replacing every occurrence of find with replace.
      • reverseFromHtml

        public static java.lang.String reverseFromHtml(java.lang.String result)
      • setAccountInfoToTrading

        public static void setAccountInfoToTrading(java.lang.Long contractId,
                                                   org.w3c.dom.Element contractElement)
                                            throws com.ibm.commerce.contract.helper.TermCondCreateException
        Sets the account-related information provided in the contract element object into TRADING table for the specified contract. This method is for a DTD-based XML instance.
        Parameters:
        contractId - The ID of the contract.
        contractElement - The contract Element object.
        Throws:
        com.ibm.commerce.contract.helper.TermCondCreateException
      • setContractState

        public static void setContractState(com.ibm.commerce.contract.objects.ContractAccessBean abContract,
                                            java.lang.Integer state)
        Sets the state of the specified contract to the given state.
        Parameters:
        abContract - The ContractAccessBean object of the specified contract.
        state - The target state of the contract.
      • setContractState

        public static void setContractState(java.lang.Long contractId,
                                            java.lang.Integer state)
        Sets the state of the specified contract to the given state.
        Parameters:
        contractId - The ID of the contract.
        state - The target state of the contract.
      • setCurrentTradingAgreements

        public static void setCurrentTradingAgreements(com.ibm.commerce.contract.objects.TradingAgreementAccessBean[] newValue,
                                                       com.ibm.commerce.command.CommandContext context)
        Reserved for IBM internal use. Sets the current trading agreements.
        Parameters:
        value - TradingAgreementAccessBean[] - trading agreements
        context - CommandContext - the command context.
      • setDescription

        public static boolean setDescription(org.w3c.dom.Element argDescElement,
                                             java.lang.Long id,
                                             java.sql.Timestamp currentTime,
                                             boolean tradingLevel)
                                      throws com.ibm.commerce.exception.ECApplicationException
        Adds or updates the trading agreement description, or the term and condition description.
        Parameters:
        argDescElement - The description element object.
        id - The ID of the trading agreement or a term and condition.
        currentTime - The Timestamp object represents the current time.
        tradingLevel - The flag to indicate if it is trading agreement description. True if it is a trading agreement description; false it is term and condition description.
        Returns:
        True if the description was added or updated successfully, false if the language ID of the description cannot be resolved.
        Throws:
        com.ibm.commerce.exception.ECApplicationException
        See Also:
        getTimeFromXSDElement(Element anElement, String tag, Timestamp time)
      • setXSDAccountInfoToTrading

        public static void setXSDAccountInfoToTrading(java.lang.Long contractId,
                                                      org.w3c.dom.Element contractElement)
                                               throws com.ibm.commerce.contract.helper.TermCondCreateException
        Sets the account related information provided in the contract element object into TRADING table for the specified contract. This method is for XSD-based XML instace.
        Parameters:
        contractId - The ID of the contract.
        contractElement - The contract Element object.
        Throws:
        com.ibm.commerce.contract.helper.TermCondCreateException
      • sortTermConditionArrayByWithOrWithOutParticipant

        public static com.ibm.commerce.contract.objects.TermConditionAccessBean[] sortTermConditionArrayByWithOrWithOutParticipant(com.ibm.commerce.contract.objects.TermConditionAccessBean[] inArray)
                                                                                                                            throws com.ibm.commerce.exception.ECException
        Sorts the input terms and conditions array, and puts the terms and conditions with participants before the terms and conditions without participants.
        Parameters:
        inArray - The terms and conditions array to be sorted.
        Returns:
        The sorted array of terms and conditions.
        Throws:
        com.ibm.commerce.exception.ECException - Raised with _ERR_CREATE_EXCEPTION message if a CreateException occurred. Raised with _ERR_FINDER_EXCEPTION message if a FinderException occurred. Raised with _ERR_NAMING_EXCEPTION message if a NamingException occurred. Raised with _ERR_REMOVE_EXCEPTION message if a RemoveException occurred.
      • tcDescriptionSet

        public static void tcDescriptionSet(org.w3c.dom.Element argTCElement,
                                            java.lang.Long argTCId)
                                     throws com.ibm.commerce.exception.ECApplicationException
        Sets the term and condition description.
        Parameters:
        tcDescElement - The term and condition description Element object.
        argTCId - The term and condition ID.
        Throws:
        com.ibm.commerce.exception.ECApplicationException
        See Also:
        tcDescriptionSetFromDescElement(Element tcDescElement, Long argTCId)
      • tcDescriptionSetFromDescElement

        public static void tcDescriptionSetFromDescElement(org.w3c.dom.Element tcDescElement,
                                                           java.lang.Long argTCId)
                                                    throws com.ibm.commerce.exception.ECApplicationException
        Sets the term and condition description.
        Parameters:
        tcDescElement - The term and condition description Element object.
        argTCId - The term and condition ID.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_NUMBER_FORMAT_EXCEPTION message if the provided language ID in the description element cannot be converted to an Integer object.
      • TermConditionDescriptionSet

        public static void TermConditionDescriptionSet(org.w3c.dom.Element argTcDescElement,
                                                       java.lang.Long tcId,
                                                       java.sql.Timestamp currentTime)
                                                throws com.ibm.commerce.exception.ECApplicationException
        Adds or updates a term and condition description.
        Parameters:
        argTcDescElement - The term and condition description element object.
        tcId - The ID of the term and condition to which the description will be added or updated.
        currentTime - The Timestamp object representing the current time.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_TC_DESC_LOCALE message if the language ID of the description cannot be resolved using the locale provided in the description element.
      • toGMTElementStringFromTimestamp

        public static java.lang.String toGMTElementStringFromTimestamp(java.sql.Timestamp time)
        Converts a Timestamp object to a string in the format of time defined in the XSD file (yyyy-mm-ddThh:mm:ss).
        Parameters:
        time - The time to be converted.
        Returns:
        A string representing the time in the following format: yyyy-mm-ddThh:mm:ss. For example: 2000-01-01T00:00:00.
      • TradingAgreementDescriptionSet

        public static void TradingAgreementDescriptionSet(org.w3c.dom.Element argTradingDescElement,
                                                          java.lang.Long tradingId,
                                                          java.sql.Timestamp currentTime)
                                                   throws com.ibm.commerce.exception.ECApplicationException
        Adds or updates the trading agreement description.
        Parameters:
        argTradingDescElement - The trading agreement description element object.
        tradingId - The ID of the trading agreement to which the description will be added or updated.
        currentTime - The Timestamp object representing the current time.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_TRADING_DESC_LOCALE message if the language ID of the description cannot be resolved by using the locale provided in the description element.
      • updateContract

        public static java.lang.Long updateContract(org.w3c.dom.Element argContract,
                                                    java.sql.Timestamp currentTime)
                                             throws com.ibm.commerce.exception.ECApplicationException,
                                                    com.ibm.commerce.contract.helper.TermCondCreateException
        Updates the contract based on the information provided in the contract element object. This method is for DTD-based XML instances.
        Parameters:
        argContract - The contract element object.
        currentTime - The Timestamp object representing the current time.
        Returns:
        The ID of the contract.
        Throws:
        com.ibm.commerce.exception.ECApplicationException
        com.ibm.commerce.contract.helper.TermCondCreateException
        See Also:
        com.ibm.commerce.contract.helper.ContractUtil#getMemberId(member), getTimeFromElement(Element anElement, String tag, Timestamp time)
      • updateStoreRelationshipState

        public static void updateStoreRelationshipState(java.lang.Integer storeId,
                                                        java.lang.Integer relatedStoreId,
                                                        java.lang.String relationshipType,
                                                        java.lang.Integer state,
                                                        com.ibm.commerce.command.CommandContext cmdContext,
                                                        com.ibm.commerce.datatype.TypedProperty responseProperties,
                                                        java.lang.String returnViewForTools)
                                                 throws com.ibm.commerce.exception.ECApplicationException
        Updates the state of the store relationship for the given stores.
        Parameters:
        storeId - The ID of the store.
        relatedStoreId - The ID of the related store.
        relationshipType - The relationship type.
        state - The target state of the relationship.
        cmdContext - The CommandContext object of the calling command.
        responseProperties - The response properties of the calling command.
        returnViewForTools - The return view name for the tools user interface.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_UPDATE_STORE_RELATIONSHIP_STATE message whenever an error occurs in UpdateStoreRelationshipStateCmd. See additional details in the documentation for that command.
        See Also:
        UpdateStoreRelationshipStateCmdImpl.performExecute()
      • updateXSDContract

        public static java.lang.Long updateXSDContract(org.w3c.dom.Element argContract,
                                                       java.sql.Timestamp currentTime)
                                                throws com.ibm.commerce.exception.ECApplicationException,
                                                       com.ibm.commerce.contract.helper.TermCondCreateException
        Updates the contract based on the information provided in the contract element object. This method is for an XSD-based XML instance.
        Parameters:
        argContract - The contract element object.
        currentTime - The Timestamp object representing the current time.
        Returns:
        The ID of the contract.
        Throws:
        com.ibm.commerce.exception.ECApplicationException
        com.ibm.commerce.contract.helper.TermCondCreateException
        See Also:
        com.ibm.commerce.contract.helper.ContractUtil#getMemberId(member), getTimeFromElement(Element anElement, String tag, Timestamp time)
      • validateContractAttributes

        public static java.lang.Integer validateContractAttributes(org.w3c.dom.Element contractElement,
                                                                   com.ibm.commerce.datatype.TypedProperty responseProperties,
                                                                   java.lang.String returnViewForTools,
                                                                   java.lang.String actionFlag)
                                                            throws com.ibm.commerce.exception.ECApplicationException
        Validates the contract attributes in the provided contract element object. This method is for a DTD-based XML instance.
        Parameters:
        contractElement - The contract element object.
        responseProperties - The response properties for a controller command.
        returnViewForTools - The return view name for tools user interface.
        actionFlag - The action flag indicating the action of the process.
        Returns:
        The contract action. The possible values include: 0 - updating; -1 - creating.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_WRONG_CONTRACT_STATE message if the state of the contract is not Draft when creating , updating, or saving a contract; or importing a draft contract. This is also raised when the state of the contract is not in either Active or Approved when importing an approved version of a contract. Raised with _ERR_VERSION_NUMBER_FORMAT message if the provided major version or minor version of the contract attribute cannot be converted to an Integer object. Raised with _ERR_MISSING_CONTRACT_NAME message if the contract name attribute is empty. Raised with _ERR_MISSING_ACCOUNT_OWNER_ELEMENT message if the name of the referenced business account is provided but the account owner element is missing from the contract element object. Raised with _ERR_MISSING_ACCOUNT_NAME message if the business account owner element is provided but the name of business account is missing from the contract element object. Raised with _ERR_WRONG_ACCOUNT_OWNER_INFO message if the ID of the business account owner cannot be resolved based on the information provided in the account owner element object. Raised with _ERR_ACCOUNT_DOES_NOT_EXIST message if the ID of the business account cannot be resolved based on the business account name and the business account owner ID. Raised with _ERR_WRONG_CONTRACT_OWNER_MEMBER_INFO message if the ID of the contract owner cannot be resolved based on the information provided in the contract owner element. Raised with _ERR_MISSING_CONTRACT_REFERENCE_NUMBER_FOR_UPDATE message if the referenceNumber attribute is missing or empty from the contract element for updating contract action. Raised with _ERR_DUPLICATED_CONTRACT_NAME message if a contract with the same name, origin, and owner already existed. Raised with _ERR_CONTRACT_REFERENCE_NUMBER_NOT_REQUIRED message if the referenceNumber attribute of the contract element is provided, but the target action is not an update. Raised with _ERR_CONTRACT_UPDATE message if the provided contract ID by the referenceNumber attribute in the contract element does not match with the ID of the contract with the same name, major version, minor version, origin, and owner in the database.
      • validateXSDContractAttributes

        public static java.lang.Integer validateXSDContractAttributes(org.w3c.dom.Element contractElement,
                                                                      com.ibm.commerce.datatype.TypedProperty responseProperties,
                                                                      java.lang.String returnViewForTools,
                                                                      java.lang.String actionFlag)
                                                               throws com.ibm.commerce.exception.ECApplicationException
        Validates the contract attributes in the provided contract element object. This method is for an XSD-based XML instance.
        Parameters:
        contractElement - The contract element object.
        responseProperties - The response properties for a controller command.
        returnViewForTools - The return view name for tools user interface.
        actionFlag - The action flag indicating the action of the process
        Returns:
        The contract action. The possible values include: 0 - creating; -1 - updating.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with _ERR_WRONG_CONTRACT_STATE message if the state of the contract is not Draft when creating , updating, or saving a contract; or importing a draft contract. This is also raised when the state of the contract is not in either Active or Approved when importing an approved version of a contract. Raised with _ERR_VERSION_NUMBER_FORMAT message if the provided major version or minor version of the contract attribute cannot be converted to an Integer object. Raised with _ERR_MISSING_CONTRACT_NAME message if the contract name attribute is empty. Raised with _ERR_MISSING_ACCOUNT_OWNER_ELEMENT message if the name of the referenced business account is provided but the account owner element is missing from the contract element object. Raised with _ERR_MISSING_ACCOUNT_NAME message if the business account owner element is provided but the name of business account is missing from the contract element object. Raised with _ERR_WRONG_ACCOUNT_OWNER_INFO message if the ID of the business account owner cannot be resolved based on the information provided in the account owner element object. Raised with _ERR_ACCOUNT_DOES_NOT_EXIST message if the ID of the business account cannot be resolved based on the business account name and the business account owner ID. Raised with _ERR_WRONG_CONTRACT_OWNER_MEMBER_INFO message if the ID of the contract owner cannot be resolved based on the information provided in the contract owner element. Raised with _ERR_MISSING_CONTRACT_REFERENCE_NUMBER_FOR_UPDATE message if the referenceNumber attribute is missing or empty from the contract element for updating contract action. Raised with _ERR_DUPLICATED_CONTRACT_NAME message if a contract with the same name, origin, and owner already existed. Raised with _ERR_CONTRACT_REFERENCE_NUMBER_NOT_REQUIRED message if the referenceNumber attribute of the contract element is provided, but the target action is not an update. Raised with _ERR_CONTRACT_UPDATE message if the provided contract ID by the referenceNumber attribute in the contract element does not match with the ID of the contract with the same name, major version, minor version, origin, and owner in the database.