Tutorials > Sales Center > Add a new search option in the IBM Sales Center

< Previous | Next >


Add the manufacturer part number data to the search result

In this step we will extend the populateSearchResult() method to contain the manufacturer's part number as part of its search result data. Using the UserData field, we will add a field called manufacturerPartNumber give it a value of the manufacturer part number in the catalog entry. The UserData field name and value is then added to the reply BOD (Business Object Document) that is sent back to the IBM Sales Center client.

To extend the populateSearchResult() method:


Procedure

  1. Add the following code to the ExtendedShowElectronicCatalog class:

    public ElectronicCatalogSearchResultBean
    populateSearchResult(CatalogEntryDataBean abnCatalogEntry, 
            boolean isHeaderOnlyRequired, boolean
    isMerchandisingAssociationRequired,    boolean isGetDetails, ElectronicCatalogSearchResultBean
    abnSearchResult) 
            throws ECException {
            
            final String METHODNAME = "populateSearchResult";
     ECTrace.entry(ECTraceIdentifiers.COMPONENT_MESSAGING, CLASSNAME, METHODNAME);
           super.populateSearchResult(abnCatalogEntry, isHeaderOnlyRequired, 
            isMerchandisingAssociationRequired, isGetDetails, abnSearchResult);
            try {
                  
    abnSearchResult.addUserDataField("manufacturerPartNumber",  
              abnCatalogEntry.getManufacturerPartNumber());
            } 
            catch (javax.naming.NamingException e) {
                    throw new ECSystemException(ECMessage._ERR_GENERIC, 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 (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);
            }
            return abnSearchResult;
            }
    

  2. Click Source > Organize Imports to add any necessary import statements.

  3. Save the file and leave it open for the next step.

< Previous | Next >


+

Search Tips   |   Advanced Search