wt.enterprise.tabularresults
Class BaseQueryService

java.lang.Object
  extended bywt.enterprise.tabularresults.BaseQueryService
All Implemented Interfaces:
Externalizable, NetFactor, Serializable
Direct Known Subclasses:
AffectingChangeActivitiesQuery, AnalysisActivitiesQuery, ChangeRequestQuery, ImplementedChangeActivitiesQuery, RelatedChangeable2s, RelevantChangeRequestsQuery, SubjectProductQuery, UsedByQuery, UsesQuery

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.

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:
QueryServiceProvider, Serialized Form

Field Summary
private static String CLASSNAME
           
static long EXTERNALIZATION_VERSION_UID
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
 
Constructor Summary
BaseQueryService()
           
 
Method Summary
 ClassInfo getClassInfo()
          Returns the ClassInfo object for this class.
abstract  String[] getColumnNames()
          Gets the value of the attribute: columnNames; The instance variable is used to hold an array of the default or initial columns that will be presented in the table of results.
abstract  String getDataFormatName()
          Gets the value of the attribute: dataFormatName; This instance variable can be used to provide a the name, full class path for example, of the subclass of

Supported API: false
abstract  Object getQuery(Object context_obj, Properties parameters, Locale locale)
          A call to getQuery should sent the object that is to be queried against to build a QueryResult.
abstract  String getTableFormatName()
          Gets the value of the attribute: tableFormatName; This instance variable can be used to provide a the name, full class path for example, of the subclass of

Supported API: false
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(BaseQueryService thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
abstract  void setColumnNames(String[] a_ColumnNames)
          Sets the value of the attribute: columnNames; The instance variable is used to hold an array of the default or initial columns that will be presented in the table of results.
abstract  void setDataFormatName(String a_DataFormatName)
          Sets the value of the attribute: dataFormatName; This instance variable can be used to provide a the name, full class path for example, of the subclass of

Supported API: false
abstract  void setTableFormatName(String a_TableFormatName)
          Sets the value of the attribute: tableFormatName; This instance variable can be used to provide a the name, full class path for example, of the subclass of

Supported API: false
 String toString()
          Returns the conceptual (modeled) name for the class.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wt.fc.NetFactor
getConceptualClassname
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values
Constructor Detail

BaseQueryService

public BaseQueryService()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(BaseQueryService thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

toString

public String toString()
Returns the conceptual (modeled) name for the class.

Supported API: false

Returns:
String

getClassInfo

public ClassInfo getClassInfo()
                       throws WTIntrospectionException
Returns the ClassInfo object for this class.

Supported API: false

Specified by:
getClassInfo in interface NetFactor
Returns:
ClassInfo
Throws:
WTIntrospectionException

getTableFormatName

public abstract String getTableFormatName()
Gets the value of the attribute: tableFormatName; This instance variable can be used to provide a the name, full class path for example, of the subclass of

Supported API: false

Returns:
String
See Also:
that the query generated by a call to, wants to use to build the table for presenting the results of the query.

setTableFormatName

public abstract void setTableFormatName(String a_TableFormatName)
                                 throws WTPropertyVetoException
Sets the value of the attribute: tableFormatName; This instance variable can be used to provide a the name, full class path for example, of the subclass of

Supported API: false

Parameters:
a_TableFormatName -
Throws:
WTPropertyVetoException
See Also:
that the query generated by a call to, wants to use to build the table for presenting the results of the query.

getDataFormatName

public abstract String getDataFormatName()
Gets the value of the attribute: dataFormatName; This instance variable can be used to provide a the name, full class path for example, of the subclass of

Supported API: false

Returns:
String
See Also:
that the query generated by a call to, wants to use to format the individual table enties for presenting the results of the query.

setDataFormatName

public abstract void setDataFormatName(String a_DataFormatName)
                                throws WTPropertyVetoException
Sets the value of the attribute: dataFormatName; This instance variable can be used to provide a the name, full class path for example, of the subclass of

Supported API: false

Parameters:
a_DataFormatName -
Throws:
WTPropertyVetoException
See Also:
that the query generated by a call to, wants to use to format the individual table enties for presenting the results of the query.

getColumnNames

public abstract String[] getColumnNames()
Gets the value of the attribute: columnNames; The instance variable is used to hold an array of the default or initial columns that will be presented in the table of results. The subclasses of

Supported API: false

Returns:
String[]
See Also:
should implement, to initialize this class.

setColumnNames

public abstract void setColumnNames(String[] a_ColumnNames)
                             throws WTPropertyVetoException
Sets the value of the attribute: columnNames; The instance variable is used to hold an array of the default or initial columns that will be presented in the table of results. The subclasses of

Supported API: false

Parameters:
a_ColumnNames -
Throws:
WTPropertyVetoException
See Also:
should implement, to initialize this class.

getQuery

public abstract Object getQuery(Object context_obj,
                                Properties parameters,
                                Locale locale)
                         throws WTException
A call to getQuery should sent the object that is to be queried against to build a QueryResult. After the query is completed, the queryresult should be enumerated against and placed into an array. One of the things that should be done at this point is any unform action on the queryresult for presentation should be done here. For example, if you get back and ChangeRecord and you need the Changeable object for presentation, you should retrieve the Changeable object and create a Changeable array with the Changeable objects. The Locale argument is passed in so that a sort may be done on the enumerated result if so desired. Here is some sample code of performing the query and sorting it.
         qr = ChangeHelper.service.getAddressingChangeOrders(change_request);
         if (qr == null)
         {
             return null;
         }
         String sorting_attribute = "number";
         QueryCollationKeyFactory key = new QueryCollationKeyFactory(locale,
 sorting_attribute);
         SortedEnumeration enum = new SortedEnumeration(qr.getEnumeration(),
 key);
         results = new Vector();
         while (enum.hasMoreElements())
           {
             ChangeOrder current_element = (ChangeOrder)enum.nextElement();
             System.out.println("ChangeOrder -> " + current_element);
             results.addElement(current_element);
           }
 


Supported API: false

Supported API: false

Parameters:
context_obj -
parameters -
locale -
Returns:
Object
Throws:
WTException