Creating a QueryFunction class

This topic describes the steps required to create a new QueryFunction class.

The steps below create a QueryFilter class, but the steps are analogous for creating a QueryConfig class.
Note: In order to create QueryFunction classes, you must install the Component SDK, which is a separate download.

To create a new QueryFilter class:

  1. In a terminal, change your directory to endeca-extensions within the Component SDK's root directory (normally called components).
  2. Run one of the following commands:
    • On Windows: .\create-queryfilter.bat your-query-filter-name
    • On Linux: ./create-queryfilter.sh your-query-filter-name
    This command creates a<your-query-filter-name>-filter directory under endeca-extensions. This directory is an Eclipse project that can be imported directly into Eclipse if that is your IDE.
The endeca-extensions directory also contains an empty sample implementation of either a QueryFilter or a QueryConfig, depending on which batch script you ran. This has no effect on QueryState in its original form. The skeleton implementation creates source files that do the following:
  • Extends either QueryFilter or QueryConfig.
  • Creates stubs for the abstract methods you need to implement: applyToENEQuery, applyToDiscoveryServiceQuery, and toString.
  • Creates default implementations for getSetters and getGetters. These use static setters and getters member properties that use reflection to extract the appropriate methods from the class.
  • Creates a no-arg, protected, empty constructor. (The protected access modifier is optional, but recommended.)
  • Creates a private member variable for logging.