com.ibm.commerce.order.commands

Class RecordOrderHistoryTaskCmdImpl

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


    public class RecordOrderHistoryTaskCmdImpl
    extends TaskCommandImpl
    implements RecordOrderHistoryTaskCmd
    This is the default implementation of the RecordOrderHistoryTaskCmd task command.

    Behaviour:

      It records an order as an XML tree and save the change comments for this order as well.
    • Convert the order and the related order item, shipping info, calculation adjustment and payment info to an XML string.
    • Create the order history.
    • Save the comments for this order.

    Task commands called:

    None
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

      • RecordOrderHistoryTaskCmdImpl

        public RecordOrderHistoryTaskCmdImpl()
    • Method Detail

      • performExecute

        public void performExecute()
                            throws ECException
        This method executes the business logic of this command implementation. This method converts the current order object to be XML recordable object and then persists the XML representation object.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException
      • reset

        public void reset()
        This method reset all the fields to reuse this command.
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AbstractECTargetableCommand
        See Also:
        Command.reset()
      • setOrder

        public void setOrder(OrderAccessBean abOrder)
        This method sets an order as a history Order.
        Specified by:
        setOrder in interface RecordOrderHistoryTaskCmd
        Parameters:
        abOrder - An OrderAccessBean to be recorded as a history Order.
      • setLastupdate

        public void setLastupdate(java.sql.Timestamp argLastUpdate)
        This method sets the LastUpdate to the order history.
        Specified by:
        setLastupdate in interface RecordOrderHistoryTaskCmd
        Parameters:
        argLastUpdate - A Timestamp that represents the last update time.
      • setCustomizableXMLRecordableObject

        public void setCustomizableXMLRecordableObject(XMLRecordable recordable)
        This method is used for customizable fields and customized element.
         Sample:
          
          Assuming there two fields to customize: field1 = "aa", field2 = "bb" and the XML tag to record these fields are field1Element and field2Element respectively.
           
           
              
                   aa
                                 bb
              
           
         wherein the  '' and '' are defined already in our schema and has been taken care by our code HistoryOrder. Therefore the customize class should 
         only processs the customized element which are of child of '. Here are '' and ''.
         
         Steps for refrence only.
          Step1. Defined a class that implements the specified interface XMLRecordable
          clase OtherOrderFieldNeedToReacord implements XMLRecordable{
              String field1 = "";
              String field2 = "";
              //See XMLRecordable - toObject(Node xmlNode)
                public XMLRecordable toObject(Node xmlNode){
                                toFields(xmlNode);
                  //anything else to do here...         
              }
                        //See XMLRecordable - toFields(Node xmlNode)
              public XMLRecordable toFields(Node xmlNode){
                Node element;
                                element = OrderXMLUtil.getChildElementByName(xmlNode, "field1Element");
                                if (element != null) {
                                        this.field1 = OrderXMLUtil.getElementValue(element);
                                }
                                element = OrderXMLUtil.getChildElementByName(xmlNode, "field2Element");
                                if (element != null) {
                                        this.field2 = OrderXMLUtil.getElementValue(element);
                                }
              }
             //See XMLRecordable - toXML()
              public String toXML(){
                return fieldsToXML();
              }
                        //See XMLRecordable - fieldsToXML()
              public String fieldsToXML(){
                 return ""+getField1()+"" + ""+getField2()+"";
              }
                        private String getField1(){return "aa";}
              private String getField2(){return "bb";}
          }
          Step2.Instantiate an instance of above customized class 
               OtherOrderFieldNeedToReacord otherOrderFields= new OtherOrderFieldNeedToReacord();
          Step3. Call setCustomizableXMLRecordableObject(otherOrderFields) when invoking this cmd - RecordOrderHistoryTaskCmdImpl
          
         Note: The ojbect this method set may be overridden one set by processExtendableObject in case you extends this cmd and override that method.
           
         
        Specified by:
        setCustomizableXMLRecordableObject in interface RecordOrderHistoryTaskCmd
        Parameters:
        recordable - The recordable object that must be a concrete sub class that implements XMLRecordable interface.
        See Also:
        processExtendableObject
      • getOrderVersion

        public java.lang.Short getOrderVersion()
        This method returns the order version.
        Specified by:
        getOrderVersion in interface RecordOrderHistoryTaskCmd
        Returns:
        A Short that specifies the order version number.
      • setOrderVersion

        public void setOrderVersion(java.lang.Short argOrderVersion)
        This method sets the order version.
        Parameters:
        argOrderVersion - A Short that specifies the order version number.