Tutorials > Program model > Web services > Customize Web services and WebSphere Portal to support a new search

< Previous | Next >


Changing the code to allow additional search parameters

Add new search parameters to the fetch command.

In order to attain the correct results from the database, it is required to create a new fetch command that will set the appropriate values in the data bean. In this section, the maximum and minimum price as well as the name keyword must be set in the databean to return the correct results.

The new fetch command will be called FetchCatalogEntryByPriceRangeTaskCmdImpl2. Since the goal of this fetch command is to retrieve a list of catalog entries based on specified search criteria it will be necessary to use the CatEntrySearchListDataBean. This data bean will search the database to find catalog entries of any type specified, with the attributes as passed in by the fetch command. All of the catalog fetch commands extend the class AbstractFetchCatalogEntrySOICmdImpl, which provides logic to connect the fetch command to the appropriate compose command based on the access profile and XPath used.

Execute the following steps to copy the code into the FetchCatalogEntryByPriceRangeTaskCmdImpl2 fetch command:


Procedure

  1. Click the com.mycompany.commerce.catalog package.

  2. Create a new Java class in the new package.

    1. Right-click the package. Select New > Class.

    2. Enter the following information:

      Name:

      FetchCatalogEntryByPriceRangeTaskCmdImpl2

      Superclass:

      Click Browse, then type AbstractFetchCatalogEntrySOICmdImpl

    3. Select the class which appears and click OK.

  3. The FetchCatalogEntryByPriceRangeTaskCmdImpl2.java file is automatically opened in the editor. Replace the contents of this file with the following:


Related concepts

Design patterns

< Previous | Next >


+

Search Tips   |   Advanced Search