Defining search

When you open a tool and select a store, the Management Center framework populates the search type list in the find area with the search definitions that are defined as child elements of the business object editor. When the business user searches for business objects, the selected search definition is used to invoke the correct search service and display the results in the main work area.

Before you begin

Before you define a search definition:
  1. Review the lzx/commerce/foundation/restricted/SearchDefinition.lzx/wcfSearchDefinition class.
  2. Create the Management Center service that returns business objects that match the search criteria that is specified by the business user. For more information, see Load services.
  3. Defining properties files and bundle keys for user interface text
Tip: This task file provides the generic steps for defining a search definition. For a tutorial example, refer to Tutorial: Adding search conditions for advanced search in the Catalogs tool.

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. Complete one of the following steps:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1In the Enterprise Explorer view, expand LOBTools > WebContent > WEB-INF > src > lzx.
    • Introduced in Feature Pack 2In the Enterprise Explorer view, expand LOBTools > WebContent > config.
  3. Create a directory to store your new file.
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo library file WebSphere Commerce Version 7.0.0.0Feature Pack 1Use a directory structure similar to the following example: LOBTools/WebContent/WEB-INF/src/lzx/your_company_name/Management_Center_component/searchDefinitions, where Management_Center_component is the name of your new custom tool.
    Introduced in Feature Pack 2Definition file Introduced in Feature Pack 2Use a directory structure similar to the following example: LOBTools/WebContent/config/your_company_name/Management_Center_component/searchDefinitions, where Management_Center_component is the name of your new custom tool.
  4. Create your search definition file:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo search library file WebSphere Commerce Version 7.0.0.0Feature Pack 1Use the following syntax to create this file: Management_Center_componentname in camel caseSearchDefinition.lzx. For example, FindProductsSearchDefinition.lzx. Within this file, the class name must follow this syntax: three-character Management Center component code in lower caseFindManagement_Center_componentobject type. For example, catFindProducts.
    <class name="extFindMyPrimaryObjectsSearchDefinition" 
        extends="wcfSearchDefinition" 
        searchType="FindMyPrimaryObjects" 
        displayName="${myResources.findMyPrimaryObjectsSearchDefinition_DisplayName.string}" 
        listClass="extMyPrimaryObjectSearchGrid" 
        listTitle="${myResources.myPrimaryObjectChildListTitle.string}" 
        
        <wcfSearchService name="findMyPrimaryObjects" url="/cmc/FindMyPrimaryObjects"> 
    
            <wcfServiceParam name="storeId"/> 
            <wcfServiceParam name="masterCatalogId"/> 
    
        </wcfSearchService> 
    
    </class> 
    Introduced in Feature Pack 2Search definition file Introduced in Feature Pack 2Use the following syntax to create this file: Management_Center_componentname in camel caseSearchDefinition.def. For example, FindProductsSearchDefinition.def. Within this file, the definition name must follow this syntax: three-character Management Center component code in lower caseFindManagement_Center_componentobject type. For example, catFindProducts.
    <SearchDefinition definitionName="extFindMyPrimaryObjectsSearchDefinition" 
        searchType="FindMyPrimaryObjects" 
        displayName="${myResources.findMyPrimaryObjectsSearchDefinition_DisplayName}" 
        listDefinitionName="extMyPrimaryObjectSearchGrid" 
        listTitle="${myResources.myPrimaryObjectChildListTitle}"> 
        
        <SearchService name="findMyPrimaryObjects" url="/cmc/FindMyPrimaryObjects"> 
    
            <ServiceParam name="storeId"/> 
            <ServiceParam name="masterCatalogId"/> 
    
        </SearchService> 
    
    </SearchDefinition>
  5. Define a list view that displays the search results:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1The listClass attribute of the search definition uses the class name of the list view.
    • Introduced in Feature Pack 2The listDefinitionName attribute of the search definition uses the definition name of the list view.

What to do next

After you complete your customization:
Version Steps
  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This setting is the default environment setting.
  2. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  3. Deploy your changes to your production environment.
Introduced in Feature Pack 2
  1. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  2. Deploy your changes to your production environment.