wt.query
Class WindchillSearchService

java.lang.Object
  extended bywt.query.WindchillSearchService
All Implemented Interfaces:
Externalizable, RemoteAccess, Serializable

public class WindchillSearchService
extends Object
implements RemoteAccess, Externalizable

Search service that allows the user to pass in a string representation of the where clause to perform a query. The string format of the where clause can contain both modeled and instance based search criteria. Internally SearchTask is utilized to get the resulting set of objects.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
static String DELIMITER_CHARACTER
           
private static boolean ENCODE_ATTRIBUTE_NAMES
           
static long EXTERNALIZATION_VERSION_UID
           
private static String FC_RESOURCE
           
private static String IBA_RESOURCE
           
private static String LOCAL_DOMAIN
           
private static String LOCAL_DOMAIN_INTERLOCK
           
protected static long OLD_FORMAT_VERSION_UID
           
private  ReferenceFactory referenceFactory
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
(package private) static boolean SERVER
           
private  SearchTask st
           
private static boolean VERBOSE
           
 
Fields inherited from interface wt.method.RemoteAccess
versionID
 
Constructor Summary
WindchillSearchService()
           
 
Method Summary
protected  Enumeration _getResultSet(String className, String whereClause, String[] attributes, Locale locale)
          This method will perform a search and return an Enumeration of objects matching the criteria specified in the whereClause parameter.
private  SearchExpression createInstanceSearchExpression(AttributeDefDefaultView def, OperatorType oper, AttributeValueCriteria value)
          This method will create a SearchExpression object for the given instance based AttributeDefDefaultView object, OperatorType, and AttributeValueCriteria.
private  AttributeSearchSpecification createModeledSearchSpecification(String className, String key, String searchOperator, String value, Locale locale)
          This method will create a AttributeSearchSpecification object for the given class name, attribute name, operator, and value.
private  void debug(String message)
          This method outputs debug statements.
private  String decodeAttributeName(String attributeName)
          Method used to decode an IBA name from the format used to display it to the user and represent it in the where clause to the format used to locate it in the system.
private  Vector extractInstanceSearchCriteriaFromWhereClause(String whereClause, Locale locale)
          This method will extract the instance based search criteria from the where clause and return a Vector of SearchExpression objects.
private  Vector extractModeledSearchCriteriaFromWhereClause(String whereClause, String className, Locale locale)
          This method will extract the modeled search criteria from the where clause and return a Vector of AttributeSearchSpecification objects.
private  Persistable getObject(String obid)
          Helper method used to obtain a Persitable object with the specified ObjectID.
 Enumeration getResultSet(String className, String whereClause, String[] attributes, Locale locale)
          This method will perform a search and return an Enumeration of objects matching the criteria specified in the whereClause parameter.
private  boolean isEnumType(Class type)
          This method will test to see if the Class passed to it is an EnumeratedType.
 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(WindchillSearchService thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void setSearchFilter(String searchFilter)
          This method allows the search filter on the internal SearchTask object.
 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, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

SERVER

static final boolean SERVER

FC_RESOURCE

private static final String FC_RESOURCE
See Also:
Constant Field Values

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

st

private SearchTask st

referenceFactory

private ReferenceFactory referenceFactory

VERBOSE

private static boolean VERBOSE

ENCODE_ATTRIBUTE_NAMES

private static boolean ENCODE_ATTRIBUTE_NAMES

LOCAL_DOMAIN

private static String LOCAL_DOMAIN

LOCAL_DOMAIN_INTERLOCK

private static String LOCAL_DOMAIN_INTERLOCK

IBA_RESOURCE

private static final String IBA_RESOURCE
See Also:
Constant Field Values

DELIMITER_CHARACTER

public static final String DELIMITER_CHARACTER
See Also:
Constant Field Values
Constructor Detail

WindchillSearchService

public WindchillSearchService()
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(WindchillSearchService 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

getResultSet

public Enumeration getResultSet(String className,
                                String whereClause,
                                String[] attributes,
                                Locale locale)
                         throws WTException
This method will perform a search and return an Enumeration of objects matching the criteria specified in the whereClause parameter.

Supported API: false

Parameters:
className - The search class name.
whereClause - String representation of search criteria, including both modeled and instance based attribute values.
attributes -
locale -
Returns:
Enumeration
Throws:
WTException

_getResultSet

protected Enumeration _getResultSet(String className,
                                    String whereClause,
                                    String[] attributes,
                                    Locale locale)
                             throws WTException
This method will perform a search and return an Enumeration of objects matching the criteria specified in the whereClause parameter.

Supported API: false

Parameters:
className - The search class name.
whereClause - String representation of search criteria, including both modeled and instance based attribute values.
attributes -
locale -
Returns:
Enumeration
Throws:
WTException

extractModeledSearchCriteriaFromWhereClause

private Vector extractModeledSearchCriteriaFromWhereClause(String whereClause,
                                                           String className,
                                                           Locale locale)
                                                    throws WTException
This method will extract the modeled search criteria from the where clause and return a Vector of AttributeSearchSpecification objects.

Parameters:
whereClause - String representation of search criteria, including both modeled and instance based attribute values.
className - The search class name.
locale -
Returns:
Vector
Throws:
WTException

extractInstanceSearchCriteriaFromWhereClause

private Vector extractInstanceSearchCriteriaFromWhereClause(String whereClause,
                                                            Locale locale)
                                                     throws WTException
This method will extract the instance based search criteria from the where clause and return a Vector of SearchExpression objects.

Parameters:
whereClause - String representation of search criteria, including both modeled and instance based attribute values.
locale -
Returns:
Vector
Throws:
WTException

decodeAttributeName

private String decodeAttributeName(String attributeName)
Method used to decode an IBA name from the format used to display it to the user and represent it in the where clause to the format used to locate it in the system.

Parameters:
attributeName - The string representing the attribute name to be decoded.
Returns:
String

createInstanceSearchExpression

private SearchExpression createInstanceSearchExpression(AttributeDefDefaultView def,
                                                        OperatorType oper,
                                                        AttributeValueCriteria value)
                                                 throws WTException
This method will create a SearchExpression object for the given instance based AttributeDefDefaultView object, OperatorType, and AttributeValueCriteria.

Parameters:
def - The attribute definition object used to create the SearchExpression object.
oper - The search operator used to create the SearchExpression object.
value - The value for the attribute used to create the SearchExpression object.
Returns:
SearchExpression
Throws:
WTException

createModeledSearchSpecification

private AttributeSearchSpecification createModeledSearchSpecification(String className,
                                                                      String key,
                                                                      String searchOperator,
                                                                      String value,
                                                                      Locale locale)
                                                               throws WTException
This method will create a AttributeSearchSpecification object for the given class name, attribute name, operator, and value.

Parameters:
className - The search class name used to create the AttributeSearchSpecification object.
key - The attribute name used to create the AttributeSearchSpecification object.
searchOperator - The search operator used to create the AttributeSearchSpecification object.
value - The attribute value used to create the AttributeSearchSpecification object.
locale -
Returns:
AttributeSearchSpecification
Throws:
WTException

isEnumType

private boolean isEnumType(Class type)
This method will test to see if the Class passed to it is an EnumeratedType.

Parameters:
type - The Class being tested to see if it is an EnumeratedType.
Returns:
boolean

setSearchFilter

public void setSearchFilter(String searchFilter)
                     throws WTException
This method allows the search filter on the internal SearchTask object.

Supported API: false

Parameters:
searchFilter - The search filter to be set.
Throws:
WTException

debug

private void debug(String message)
This method outputs debug statements.

Parameters:
message -

getObject

private Persistable getObject(String obid)
                       throws WTException
Helper method used to obtain a Persitable object with the specified ObjectID.

Parameters:
obid - The ObjectID of the desired Persistable object.
Returns:
Persistable
Throws:
WTException