Tutorials > Sales Center > Add an editable column to the Order Items table by creating a new widget manager

< Previous | Next >


Add the code to the new ExtendedShowSalesOrder class

In this section you add the code to the new ExtendedShowSalesOrder class.

In this step, you add code to the class you created in the previous step

to perform the customization that is needed from the WebSphere Commerce Server.

  1. Copy and paste the following code within the brackets:

    /**     Variable names declarations
             */
            final String CLASSNAME = ExtendedShowSalesOrder.CLASS_NAME;
            final String METHODNAME = "createUserdataInLineElement";
            final String COLUMN_FIELD_NAME="field1"; //Variable name of
    the field in the database
            
            
            /**
             * createUserdataInLineElement is an empty method to create
    the UserData element for Line Element in the SalesOrder BOD. 
             * In this method custom UserData tag element will be added
    with the information that is already passed into from the 
             * Order Item Data Bean.
             * @param abnOrderItem - OrderItemDataBean
             * @param abnOrderBaseSearchResult -
    OrderBaseSearchResultBean
             * @param lineElement - org.w3c.dom.Element
             * @return org.w3c.dom.Element
             * @throws ECException
             */
            
            protected org.w3c.dom.Element
    createUserdataInLineElement(OrderItemDataBean abnOrderItem, 
                            OrderBaseSearchResultBean
    abnOrderBaseSearchResult,                         org.w3c.dom.Element lineElement) throws
    ECException {
    
                    // Writes a trace entry in the trace file to record
    the entrance to a method for debugging purposes
                   
    ECTrace.entry(ECTraceIdentifiers.COMPONENT_MESSAGING, CLASSNAME,                                 METHODNAME);
                    
                    
                    //Creates a WC standard userdata tag
                    Element userDataElement =
    createWCDocumentElement(lineElement, BodConstants.TAG_WC_USER_DATA);
    
                    
                    try {
                            //Creates the User Data field in the Line
    element
                            createUserDataFieldElement(userDataElement, COLUMN_FIELD_NAME, abnOrderItem.getField1());               
                            
                    } catch (CreateException e) {
                                    
                            throw new
    ECSystemException(ECMessage._ERR_CREATE_EXCEPTION, CLASSNAME, 
                                                      METHODNAME, ECMessageHelper.generateMsgParms(e.toString()), e);
                            
                                    
                            
                    } catch (RemoteException e) {
                                    
                            throw new
    ECSystemException(ECMessage._ERR_REMOTE_EXCEPTION, CLASSNAME, 
                                                                     
    METHODNAME, ECMessageHelper.generateMsgParms(e.toString()), e);
                                                    
                            
                            
                    } catch (FinderException e) {
                                                    
                            throw new
    ECSystemException(ECMessage._ERR_FINDER_EXCEPTION, CLASSNAME, 
                                                                     
    METHODNAME, ECMessageHelper.generateMsgParms(e.toString()), e);
                                                    
                            
                    } catch (NamingException e) {
                                                    
                            throw new
    ECSystemException(ECMessage._ERR_NAMING_EXCEPTION, CLASSNAME, METHODNAME, 
                                                                     
    ECMessageHelper.generateMsgParms(e.toString()), e);
                            }       
                     
                    //              Writes a trace entry in the trace
    file to record the exit to a method for debugging purposes
                   
    ECTrace.exit(ECTraceIdentifiers.COMPONENT_MESSAGING, CLASSNAME,                                 METHODNAME);
                    
                    // returns the customized element
                    return userDataElement;
    
            }
    

< Previous | Next >


+

Search Tips   |   Advanced Search