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
- Review the lzx/commerce/foundation/restricted/SearchDefinition.lzx/wcfSearchDefinition class.
- 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.
- 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
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Complete one of the following steps:
- In the Enterprise Explorer view, expand .
- In the Enterprise Explorer view, expand .
- Create a directory to store your new file.
Option Description OpenLaszlo library file Use 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. Definition file Use 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. - Create your search definition file:
Option Description OpenLaszlo search library file Use 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>
Search definition file Use 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>
- Define
a list view that displays the search results:
- The listClass attribute of the search definition uses the class name of the list view.
- The listDefinitionName attribute of the search definition uses the definition name of the list view.
What to do next
Version | Steps |
---|---|
|
|
|