wt.federation
Class IESQLQuerySpecTranslator

java.lang.Object
  extended bywt.federation.IESQLQuerySpecTranslator
All Implemented Interfaces:
QuerySpecTranslator, Serializable

public class IESQLQuerySpecTranslator
extends Object
implements QuerySpecTranslator, Serializable

This class translates Windchill QuerySpec objects to SQL-like search filter strings for Info*Engine.

See Also:
Serialized Form

Field Summary
private  Hashtable classTable
           
private static String RESOURCE
           
private  FederatedInfoEngineService service
           
private  InfoEngineTranslationTable translationTable
           
private static boolean VERBOSE
           
private static String versionID
           
private  int whereCursor
           
private  Vector whereTokens
           
 
Constructor Summary
IESQLQuerySpecTranslator()
          Constructor returning an instance initialized with a null service reference.
IESQLQuerySpecTranslator(FederatedInfoEngineService service)
          Constructor returning an instance initialized with a service reference.
 
Method Summary
static String encodeAndEscapeURLString(String s, String encoding)
          Escape the special characters and call WTURLEncode to encode the rest.
 void setService(FederatedService service)
          Associate a FederatedService with the translator instance.
private  String translateIdentifier(String identifier)
          Translate an identifier of an SQL WHERE clause to an SQL-like Info*Engine search filter.
 String translateQuerySpec(QuerySpec spec)
          Translate a Windchill QuerySpec to an SQL WHERE clause
private  String translateTerm(String encoding)
          Translate a term of an SQL WHERE clause to an SQL-like Info*Engine search filter.
private  String translateWhereClause()
          Translate an SQL WHERE clause to an SQL-like Info*Engine search filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionID

private static final String versionID
See Also:
Constant Field Values

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

classTable

private Hashtable classTable

service

private FederatedInfoEngineService service

translationTable

private InfoEngineTranslationTable translationTable

whereCursor

private int whereCursor

whereTokens

private Vector whereTokens

VERBOSE

private static boolean VERBOSE
Constructor Detail

IESQLQuerySpecTranslator

public IESQLQuerySpecTranslator(FederatedInfoEngineService service)
Constructor returning an instance initialized with a service reference.

Parameters:
service - FederatedInfoEngineService to interface with

IESQLQuerySpecTranslator

public IESQLQuerySpecTranslator()
Constructor returning an instance initialized with a null service reference.

Method Detail

encodeAndEscapeURLString

public static String encodeAndEscapeURLString(String s,
                                              String encoding)
Escape the special characters and call WTURLEncode to encode the rest.

Parameters:
s - a string to be encoded.
Returns:
String the encoded result

setService

public void setService(FederatedService service)
Associate a FederatedService with the translator instance.

Specified by:
setService in interface QuerySpecTranslator
Parameters:
service - FederatedService object to associate with this translator

translateQuerySpec

public String translateQuerySpec(QuerySpec spec)
                          throws FederationServicesException
Translate a Windchill QuerySpec to an SQL WHERE clause

Specified by:
translateQuerySpec in interface QuerySpecTranslator
Parameters:
spec - QuerySpec
Returns:
String SQL-like search filter for Info*Engine, null if QuerySpec can not be translated
Throws:
FederationServicesException

translateWhereClause

private String translateWhereClause()
                             throws FederationServicesException
Translate an SQL WHERE clause to an SQL-like Info*Engine search filter.

Returns:
String search filter, null if WHERE clause can not be translated
Throws:
FederationServicesException

translateTerm

private String translateTerm(String encoding)
                      throws FederationServicesException
Translate a term of an SQL WHERE clause to an SQL-like Info*Engine search filter.

Returns:
String search filter, null if term can not be translated
Throws:
FederationServicesException

translateIdentifier

private String translateIdentifier(String identifier)
Translate an identifier of an SQL WHERE clause to an SQL-like Info*Engine search filter.

Parameters:
identifier - the identifier to translate (e.g., A0.name)
Returns:
String search filter, null if term can not be translated