Tutorial: Customizing Web services and WebSphere Portal to support a new search > < Previous | Next >
Change the code to allow additional search parameters
Adding 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. Perform the following steps to copy the code into the FetchCatalogEntryByPriceRangeTaskCmdImpl2 fetch command:
- Click the com.mycompany.commerce.customization.catalog package.
- Create a new Java class in the new package.
- Right-click the package. Select New > Class.
- Enter the following information:
- Name:
- FetchCatalogEntryByPriceRangeTaskCmdImpl2
- Superclass:
- Click Browse, then type AbstractFetchCatalogEntrySOICmdImpl
- Select the class which appears and click OK.
- Copy the contents of FetchCatalogEntryByPriceRangeTaskCmdImpl2.java to the clipboard.
- In the Java perspective, open the FetchCatalogEntryByPriceRangeTaskCmdImpl2 fetch command you created in step 2.
- Replace the contents of this file with the code on your clipboard.