com.ibm.commerce.utf.commands

Class RFQModifyCmdImpl

    • Field Detail

      • COPYRIGHT

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

        public java.util.Vector originalProducts
        Original Product List Vector.
      • emptyProductList

        public boolean emptyProductList
        Empty Product List Flag.
      • emptyTCList

        public boolean emptyTCList
        Empty Product T&C Flag.
    • Constructor Detail

      • RFQModifyCmdImpl

        public RFQModifyCmdImpl()
    • Method Detail

      • createItem

        public java.lang.Long createItem(java.lang.String itemname,
                                         java.lang.String shortdesc,
                                         java.lang.Long productid)
                                  throws ECException
        Calls the CreateRFQItemCmd task command to create a new item in the catalog.
        Parameters:
        itemname - The name of the item.
        shortdesc - A brief description of the item.
        productid - The identifier of the product which will be the parent catalog entry for this new item.
        Returns:
        the Long Item Id.
        Throws:
        ECException
      • createRFQCatentryRel

        public void createRFQCatentryRel(java.lang.Long catentryId,
                                         java.math.BigDecimal price,
                                         java.lang.Double quantity,
                                         java.lang.String currency,
                                         java.lang.String quantityUnit,
                                         java.lang.Double priceAdjust,
                                         java.lang.Integer negotiationType,
                                         java.lang.Long customfield1,
                                         java.lang.Integer customfield2,
                                         java.lang.String customfield3,
                                         java.lang.String customfield4)
                                  throws ECException
        Creates the association between an item and the RFQ .

        Behaviour:

        • Determines if the incoming item is already associated with the RFQ that is being modified.
        • If the association exists, updates it with the new values of price, quantity, currency and quantityunit.
        • If the association does not exist, creates a new association.
        Parameters:
        catentryId - The identifier of the item.
        price - The price of the item as specified by the buyer who created the RFQ.
        quantity - The quantity of the item requested by the buyer.
        currency - The currency specified by the buyer.
        quantityUnit - An optional unit of measure for the quantity.
        Throws:
        ECException
      • deleteRFQCatentryRel

        public void deleteRFQCatentryRel()
                                  throws ECException
        Calls the DeleteRFQCatentryRelCmd to delete the associations between the RFQ and one or more items.

        Behaviour:

        • Determines if the list of items for this RFQ is empty. If yes, sets the deleteAll flag to delete all the existing associations between the RFQ and items.
        • If there is a list of items for this RFQ, compares these items with the existing items for the RFQ. And it composes a vector of items that have been removed from the RFQ.
        • Calls the task command to delete all or some associations.
        Throws:
        ECException
      • determineCatentryType

        public java.lang.String determineCatentryType(java.lang.Long catentryId)
                                               throws ECException
        Determines the type of a given catalog entry.
        Parameters:
        catentryId - The catalog entry identifier.
        Returns:
        the String Catentry Type
        Throws:
        ECException
      • doAcknowledgment

        public void doAcknowledgment()
                              throws ECException
        Composes and sends out the response to the browser
        Throws:
        ECException
      • getOriginalProducts

        public java.util.Vector getOriginalProducts()
        Returns a vector of identifiers of catalog entries that the RFQ buyer had picked.
        Returns:
        A vector of catalog entry identifiers.
      • isEmptyProductList

        public boolean isEmptyProductList()
        Returns true if the product list is empty, else returns false.
        Returns:
        A boolean indicating whether the product list is empty or not.
      • isEmptyTCList

        public boolean isEmptyTCList()
        Returns true if the term-condition list is empty, else returns false.
        Returns:
        A boolean indicating whether the term-condition list is empty or not.
      • modifyBasicOffering

        public void modifyBasicOffering()
                                 throws ECException
        Calls the ModifyRFQBasicInfoCmd task command to update RFQ information.
        Throws:
        ECException
      • performExecute

        public void performExecute()
                            throws ECException
        Modifies the RFQ.
        This method does the following:
        1. Updates basic RFQ information by calling the modifyBasicOffering method.
        2. Keeps a backup of the list of products/items selected by the buyer in a vector.
        3. For every "product" chosen by the buyer, create an "item" in the catalog by calling the createItem method.
        4. Creates associations between the RFQ and its items.
        5. Calls the deleteRFQCatentryRel method to delete any RFQ-item associations that are no longer valid.
        6. Creates/updates product attributes by calling the processProductAttributes method.
        7. Creates/updates product comments by calling the processProductComments method.
        8. Creates/updates RFQ level freeform comments by calling the processTCs method.
        9. Calls the doAcknowledgment method to send back the response.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException
        See Also:
        ECCommand#performExecute()
      • processProductAttributes

        public void processProductAttributes()
                                      throws ECException
        Processes standard and personalized attributes for each item in the RFQ.
        This method does the following:
        1. Determines if the list of items for this RFQ is empty. If yes, sets the deleteAll flag to true.
        2. If there is a list of items for this RFQ, retrieves all the OrderItemPAttribute TCs corresponding to personalization attributes that are not of type "FREEFORM". Loops through these TCs to determine if the buyer has deleted any of them. Composes a vector of TC identifiers for the TCs that have been deleted.
        3. Calls the DeleteOrderItemPAttributeTCCmd task command to delete some or all of the TCs depending on the outcome of the previous steps.
        4. Loops through the list of incoming attributes. For each attribute does one of the following:
          • If the attribute corresponds to a product for which a new item has been created, and if the attribute was defined for the product in the catalog, creates a standard attribute for the new item in the catalog.
          • If the attribute is user defined and no TC ID is specified, adds the attribute information to a "createVector"
          • If the attribute is user defined and a TC ID is specified, adds the attribute information to an "updateVector"
        5. If the "createVector" is not empty, call CreateOrderItemPAttributeTCCmd task command to create one OrderItemPAttribute TC for each vector element
        6. If the "updateVector" is not empty, call ModifyOrderItemPAttributeTCCmd task command to update existing OrderItemPAttribute TCs with information from the "updateVector".

        Throws:
        ECException
      • processProductComments

        public void processProductComments()
                                    throws ECException
        Processes freeform comments for each item in the RFQ.
        This method does the following:
        1. Determines if the list of items for this RFQ is empty. If yes, sets the deleteAll flag to true.
        2. If there is a list of items for this RFQ, retrieves all the OrderItemPAttribute TCs corresponding to personalization attributes that are of type "FREEFORM". Loops through these TCs to determine if the buyer has deleted any of them. Composes a vector of TC identifiers for the TCs that have been deleted.
        3. Calls the DeleteOrderItemPAttributeTCCmd task command to delete some or all of the TCs depending on the outcome of the previous steps.
        4. Loops through the list of incoming comments. For each comment does one of the following:
          • If no TC ID is specified for the comment, adds the comment information to a "createVector"
          • If a TC ID is specified, adds the comment information to an "updateVector"
        5. If the "createVector" is not empty, call CreateOrderItemPAttributeTCCmd task command to create one OrderItemPAttribute TC for each vector element
        6. If the "updateVector" is not empty, call ModifyOrderItemPAttributeTCCmd task command to update existing OrderItemPAttribute TCs with information from the "updateVector".

        Throws:
        ECException
      • processTCs

        public void processTCs()
                        throws ECException
        Processes freeform comments for the RFQ.
        This method does the following:
        1. Determines if the list of term-conditions for this RFQ is empty. If yes, sets the deleteAll flag to true.
        2. If there is a list of term-conditions for this RFQ, retrieves all the OrderComment TCs for this RFQ. Loops through these TCs to determine if the buyer has deleted any of them. Composes a vector of TC identifiers for the TCs that have been deleted.
        3. Calls the DeleteOrderCommentsTCCmd task command to delete some or all of the TCs depending on the outcome of the previous steps.
        4. Loops through the list of incoming term-conditions. For each term-condition does one of the following:
          • If no TC ID is specified for the term-condition, adds the term-condition information to a "createVector"
          • If a TC ID is specified, adds the term-condition information to an "updateVector"
        5. If the "createVector" is not empty, call CreateOrderCommentsTCCmd task command to create one OrderComment TC for each vector element
        6. If the "updateVector" is not empty, call ModifyOrderCommentsTCCmd task command to update existing OrderComment TCs with information from the "updateVector".

        Throws:
        ECException
      • setEmptyProductList

        public void setEmptyProductList(boolean newEmptyProductList)
        Sets a member variable to the incoming boolean value.
        Parameters:
        newEmptyProductList - True if the list of products is empty for this RFQ. False otherwise.
      • setEmptyProductListFromUrl

        public void setEmptyProductListFromUrl(java.lang.String s,
                                               boolean isReq)
        Sets a member variable to the incoming boolean value from the request. The incoming boolean value indicates whether the list of products for this RFQ is empty or not.
        Parameters:
        s - The name of the parameter to look for in the tools XML objects.
        isReq - If true, implies that the parameter is mandatory. If the parameter is not found, causes an exception.
        If false, the parameter is optional. If parameter is not found, sets the member variable to a default value of false.
      • setEmptyTCList

        public void setEmptyTCList(boolean newEmptyTCList)
        Sets a member variable to the incoming boolean value.
        Parameters:
        newEmptyProductList - True if the list of TCs is empty for this RFQ. False otherwise.
      • setEmptyTCListFromUrl

        public void setEmptyTCListFromUrl(java.lang.String s,
                                          boolean isReq)
        Sets a member variable to the incoming boolean value from the request. The incoming boolean value indicates whether the list of TCs for this RFQ is empty or not.
        Parameters:
        s - The name of the parameter to look for in the tools XML objects.
        isReq - If true, implies that the parameter is mandatory. If the parameter is not found, causes an exception.
        If false, the parameter is optional. If parameter is not found, sets the member variable to a default value of false.
      • setOriginalProducts

        public void setOriginalProducts(java.util.Vector OriginalProducts)
        Sets a member variable to the incoming vector of catalog entry IDs. The catalog entry IDs correspond to the products or item selected by the RFQ buyer for this RFQ.
        Parameters:
        newNewItems - A vector of catalog entries.
      • updateCatentryIdInAllVectors

        public void updateCatentryIdInAllVectors(java.lang.Long originalProductId,
                                                 java.lang.Long itemId)
                                          throws ECException
        Replaces the occurrence of the first parameter originalProductId with the second parameter itemId in three lists : the product list, the product comments list and the product attributes list.
        When the buyer selects a product and associates it with the RFQ, it causes an item to be created under the covers. Every occurrence of the original product has to now be replaced by this new item. This method goes through all the incoming information that reference the product ID selected by the buyer and replaces them with the new item ID.
        Parameters:
        originalProductId - The ID of the product selected by the buyer.
        itemId - The ID of the new item that was created under the covers.
        Throws:
        ECException
      • validateParameters

        public void validateParameters()
                                throws ECException
        Checks for validity of incoming parameters.
        This method does the following:
        1. Calls the initParameters method to store the incoming request parameters in member variables .
        2. Checks to see that the RFQ is in the draft state .
        3. Checks if the specified RFQ start date & time are not in the past.
        4. Checks if the specified RFQ end date & time are not in the past.
        5. Checks if the specified RFQ end date & time are later than the specified RFQ start date and time.
        Specified by:
        validateParameters in interface ECCommand
        Overrides:
        validateParameters in class AbstractECTargetableCommand
        Throws:
        ECException
        See Also:
        ECCommand#validateParameters()