Class BaseQueryService

java.lang.Object
wt.enterprise.tabularresults.BaseQueryService
All Implemented Interfaces:
Externalizable, Serializable, wt.fc._NetFactor, NetFactor

public abstract class BaseQueryService extends Object implements NetFactor, Externalizable
This class will be used to define the minimally required behavior of a class that is to retrieve a queryresult and have it presented in an HTML table. It is assumed, but not required, that the HTML table will be generated via the utilities in the Package wt.enterprise.tabularquery. A call to the method printTable in TableFormatService is the specific call that is expect, but not necessary.

The classes that subclass off of this class will need to implement two methods.

  • The first method to implement will be responsible for making the query and then returning that query in an array. The array should cantain the objects that you want build each row in the table off of. This method is getQuery and the reader should look at the related javadoc.
  • The second method that you will have to implement is responsible for setting the initial/default columns that you would like to present. This method is initialize. The Strings should be used by whatever method is used to present the results to define the columns of the table. In the case of TableFormatService, the names are expected to be the names of attributes for the objects that are presented in the table.

Currently BaseQueryService implements NetFactor. The purpose of this is that all of the children of BaseQueryService can be found via introspection. Thus, when a new extension of BaseQueryService is created there is a method to locate this subclass other than hardcoding the name or the reference in the code. An example of this currently is the use of QueryServiceProvider finding the desired subclass of BaseQueryService based on the name of the class without the full path. Thus, the name of the query can be passed in as a parameter in the URL used to request the HTML page presenting the table. In ChangeViewProcessor the value of the HTTP GET parameter action is used to find the proper subclass to generate the QueryResults. Here is some sample code performing this.

         QueryServiceProvider query_service_provider = new QueryServiceProvider();
         BaseQueryService base_query_service = query_service_provider.getqueryService(query_service_name);

         queryResults = (Object[])base_query_service.getQuery( getContextObj(),
 parameters, locale);

 


Supported API: true

Extendable: false
See Also: