wt.fc.requireddata
Class StandardRequiredDataService

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.fc.requireddata.StandardRequiredDataService
All Implemented Interfaces:
Manager, NetFactor, RequiredDataServiceSvr, Serializable

public final class StandardRequiredDataService
extends StandardManager
implements RequiredDataServiceSvr, Serializable

Use the newStandardRequiredDataService static factory method(s), not the StandardRequiredDataService constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
private static String RESOURCE
           
private static boolean VERBOSE
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Constructor Summary
StandardRequiredDataService()
           
 
Method Summary
private  void appendConstantExpression(LinkQueryData data, boolean useRoleA, QuerySpec querySpec)
          Append a ConstantExpression based on whether the role object is Versioned or not.
private  void appendIdSearchCondition(LinkQueryData data, QuerySpec querySpec, boolean appendRoleA)
          Determine if the specified role represents a Versioned object for the link class being queries and append either the branchIds or ida2a2s.
private  void appendOidSearchCondition(LinkQueryData data, String role, QuerySpec querySpec, int[] fromIndices)
          Append a SearchCondition where all ida2a2s for the specified role.
private  void appendVersionIdSearchCondition(LinkQueryData data, String role, QuerySpec querySpec, int[] fromIndices)
          Append a SearchCondition where all branchIds for the specified role and where latest iteration = true.
private  CompoundQuerySpec buildCompoundQuerySpec(SetOperator operator, QuerySpec[] querySpecs)
          Build a CompoundQuerySpec given a SetOperator and an array of QuerySpec objects.
private  QuerySpec[] buildQuerySpecs(LinkQueryData[] linkQueryData, boolean singleRoleOnly, boolean useRoleA)
          Returns a List of QuerySpecs.
 String getConceptualClassname()
          Deprecated.  
private  QuerySpec getForeignKeyQuerySpec(AdHocForeignKeyLinkQueryData data)
           
private  QuerySpec getLinkQueryDataQuerySpec(LinkQueryData data, boolean useRoleA)
           
private  QuerySpec getLinkQuerySpec(LinkQueryData data)
          Get QuerySpec for a link class.
private  QuerySpec getLinkQuerySpec(LinkQueryData data, boolean useRoleA)
          Get a QuerySpec based on the type of LinkQueryData input.
private  String getRoleAttribute(LinkQueryData data, boolean useRoleA)
          Return the correct attribute to query against based on whether the role specified is Iterated.
private  long[] getRoleIds(LinkQueryData data, String role)
          Return true if the linkClass for the LinkQueryData instance is a type of either ObjectToVersionLink or VersionToVersionLink.
private  boolean hasIds(LinkQueryData data)
          Return true if the LinkQueryData has either roleA or roleB ids.
private  boolean hasRoleAIds(LinkQueryData data)
          Return true if the LinkQueryData has either roleA ids.
private  boolean hasRoleBIds(LinkQueryData data)
          Return true if the LinkQueryData has either roleB ids.
private  QuerySpec initializeQuerySpec(Class linkClass, boolean isSelectable)
          Setup a QuerySpec that will return the id and classname attributes for the linkClass argument.
private  boolean isLinkQueryDataValid(LinkQueryData[] linkQueryData)
           
static StandardRequiredDataService newStandardRequiredDataService()
          Default factory for the class.
private  WTKeyedMap processResults(QueryResult qr)
          Construct a WTKeyedMap containing keys = link QueryKeys and values = role object QueryKeys.
 WTKeyedMap queryAdHocForeignKey(AdHocForeignKeyLinkQueryData[] adHocFKLinkQueryData)
          Supports bulk queries for relationships that are not modeled as BinaryLink or ForeignKeyLink.
 WTCollection queryLinks(LinkQueryData[] linkQueryData)
          Builds a query based on the information in an array of LinkQueryData objects and returns a WTCollection for the linkClasses defined in the LinkQueryData[].
 WTKeyedMap queryLinks(LinkQueryData[] linkQueryData, boolean useRoleA)
          Queries a single link class role specified by the useRoleA boolean and the information defined in the LinkQueryData[].
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, performShutdownProcess, performStartupProcess, registerEvents, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

VERBOSE

private static boolean VERBOSE
Constructor Detail

StandardRequiredDataService

public StandardRequiredDataService()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

newStandardRequiredDataService

public static StandardRequiredDataService newStandardRequiredDataService()
                                                                  throws WTException
Default factory for the class.

Supported API: false

Returns:
StandardRequiredDataService
Throws:
WTException

queryLinks

public WTCollection queryLinks(LinkQueryData[] linkQueryData)
                        throws WTException
Builds a query based on the information in an array of LinkQueryData objects and returns a WTCollection for the linkClasses defined in the LinkQueryData[]. Each element in the WTCollection is an Object array containing two elements: the link classname and the link id.

Supported API: false

Specified by:
queryLinks in interface RequiredDataServiceSvr
Parameters:
linkQueryData -
Returns:
WTCollection
Throws:
WTException

queryLinks

public WTKeyedMap queryLinks(LinkQueryData[] linkQueryData,
                             boolean useRoleA)
                      throws WTException
Queries a single link class role specified by the useRoleA boolean and the information defined in the LinkQueryData[]. Returns a WTKeyedMap with key/value pairs of link reference/role object reference.

Supported API: false

Specified by:
queryLinks in interface RequiredDataServiceSvr
Parameters:
linkQueryData -
useRoleA -
Returns:
WTKeyedMap
Throws:
WTException

queryAdHocForeignKey

public WTKeyedMap queryAdHocForeignKey(AdHocForeignKeyLinkQueryData[] adHocFKLinkQueryData)
                                throws WTException
Supports bulk queries for relationships that are not modeled as BinaryLink or ForeignKeyLink. Returns a WTKeyedMap with key/value pairs of foreign key object reference/parent object reference. This api assumes that only ObjectIdentifier QueryKeys are passed.

Supported API: false

Specified by:
queryAdHocForeignKey in interface RequiredDataServiceSvr
Parameters:
adHocFKLinkQueryData -
Returns:
WTKeyedMap
Throws:
WTException

processResults

private WTKeyedMap processResults(QueryResult qr)
                           throws WTException
Construct a WTKeyedMap containing keys = link QueryKeys and values = role object QueryKeys.

Parameters:
qr -
Returns:
WTKeyedMap
Throws:
WTException

buildCompoundQuerySpec

private CompoundQuerySpec buildCompoundQuerySpec(SetOperator operator,
                                                 QuerySpec[] querySpecs)
                                          throws WTException
Build a CompoundQuerySpec given a SetOperator and an array of QuerySpec objects.

Parameters:
operator -
querySpecs -
Returns:
CompoundQuerySpec
Throws:
WTException

getForeignKeyQuerySpec

private QuerySpec getForeignKeyQuerySpec(AdHocForeignKeyLinkQueryData data)
                                  throws WTException
Throws:
WTException

getLinkQueryDataQuerySpec

private QuerySpec getLinkQueryDataQuerySpec(LinkQueryData data,
                                            boolean useRoleA)
                                     throws WTException
Throws:
WTException

getRoleAttribute

private String getRoleAttribute(LinkQueryData data,
                                boolean useRoleA)
                         throws WTException
Return the correct attribute to query against based on whether the role specified is Iterated.

Parameters:
data -
useRoleA -
Returns:
String
Throws:
WTException

appendConstantExpression

private void appendConstantExpression(LinkQueryData data,
                                      boolean useRoleA,
                                      QuerySpec querySpec)
                               throws WTException
Append a ConstantExpression based on whether the role object is Versioned or not.

Parameters:
data -
useRoleA -
querySpec -
Returns:
void
Throws:
WTException

getLinkQuerySpec

private QuerySpec getLinkQuerySpec(LinkQueryData data,
                                   boolean useRoleA)
                            throws WTException
Get a QuerySpec based on the type of LinkQueryData input.

Parameters:
data -
useRoleA -
Returns:
QuerySpec
Throws:
WTException

appendIdSearchCondition

private void appendIdSearchCondition(LinkQueryData data,
                                     QuerySpec querySpec,
                                     boolean appendRoleA)
                              throws WTException
Determine if the specified role represents a Versioned object for the link class being queries and append either the branchIds or ida2a2s.

Parameters:
data -
querySpec -
appendRoleA -
Returns:
void
Throws:
WTException

getLinkQuerySpec

private QuerySpec getLinkQuerySpec(LinkQueryData data)
                            throws WTException
Get QuerySpec for a link class. Different criteria are added based on whether or not the link class's role objects are Versioned or not.

Parameters:
data -
Returns:
QuerySpec
Throws:
WTException

getRoleIds

private long[] getRoleIds(LinkQueryData data,
                          String role)
Return true if the linkClass for the LinkQueryData instance is a type of either ObjectToVersionLink or VersionToVersionLink.

Parameters:
data -
role -
Returns:
long[]

appendVersionIdSearchCondition

private void appendVersionIdSearchCondition(LinkQueryData data,
                                            String role,
                                            QuerySpec querySpec,
                                            int[] fromIndices)
                                     throws WTException
Append a SearchCondition where all branchIds for the specified role and where latest iteration = true.

Parameters:
data -
role -
querySpec -
fromIndices - - The from index for the linkClass value in the LinkQueryData argument.
Returns:
void
Throws:
WTException

appendOidSearchCondition

private void appendOidSearchCondition(LinkQueryData data,
                                      String role,
                                      QuerySpec querySpec,
                                      int[] fromIndices)
                               throws WTException
Append a SearchCondition where all ida2a2s for the specified role. The role determines if the LinkQueryData's value for roleAIds or roleBIds should be used.

Parameters:
data -
role -
querySpec -
fromIndices - - The from index for the linkClass value in the LinkQueryData argument.
Returns:
void
Throws:
WTException

initializeQuerySpec

private QuerySpec initializeQuerySpec(Class linkClass,
                                      boolean isSelectable)
                               throws WTException
Setup a QuerySpec that will return the id and classname attributes for the linkClass argument.

Parameters:
linkClass -
isSelectable -
Returns:
QuerySpec
Throws:
WTException

hasIds

private boolean hasIds(LinkQueryData data)
Return true if the LinkQueryData has either roleA or roleB ids.

Parameters:
data -
Returns:
boolean

hasRoleAIds

private boolean hasRoleAIds(LinkQueryData data)
Return true if the LinkQueryData has either roleA ids.

Parameters:
data -
Returns:
boolean

hasRoleBIds

private boolean hasRoleBIds(LinkQueryData data)
Return true if the LinkQueryData has either roleB ids.

Parameters:
data -
Returns:
boolean

buildQuerySpecs

private QuerySpec[] buildQuerySpecs(LinkQueryData[] linkQueryData,
                                    boolean singleRoleOnly,
                                    boolean useRoleA)
                             throws WTException
Returns a List of QuerySpecs. Each QuerySpec is a representation of the information in one element of the linkQueryData array. If an element in linkQueryData does not have any roleAIds or roleBIds defined then no QuerySpec is added for that element.

Parameters:
linkQueryData -
singleRoleOnly -
useRoleA -
Returns:
QuerySpec[]
Throws:
WTException

isLinkQueryDataValid

private boolean isLinkQueryDataValid(LinkQueryData[] linkQueryData)