wt.fc
Class PersistenceServerHelper

java.lang.Object
  extended bywt.fc.PersistenceServerHelper

public class PersistenceServerHelper
extends Object

This class implements helper methods for server side PersistenceManagerSvr operations.

Supported API: true

Extendable: false

See Also:
PersistenceManagerSvr

Field Summary
private static String CLASSNAME
           
static PersistenceManagerSvr manager
          

Supported API: true
static String REFERENTIAL_INTEGRITY_DIRECTIVE_KEY
          This attribute is used as a common key for all Referential Integrity directives stored in a Manifest.
private static String RESOURCE
           
 
Constructor Summary
PersistenceServerHelper()
           
 
Method Summary
static WTValuedMap appendCopyLinkMap(WTValuedMap copyLinkMap, Map sourceObjectsToLinksMap, String roleObjectRole, WTKeyedMap sourceObjectToRoleObjectMap)
          Build an aggregate copyLinkMap.
static WTValuedHashMap buildCopyLinkMap(WTList linksToCopy, WTList roleObjects, List roleObjectRole, WTList otherRoleObjects)
          Builds a copy-link map that can be passed as an argument to PersistenceManagerSvr.copyLink() method.
static QuerySpec buildLinkRoleQuerySpec(Object a_source, String a_role, Class a_linkClass)
          Builds a QuerySpec for retrieving objects related to the specified source object(s), role, and link class.
static void copyLinks(Map sourceObjectsToLinksMap, String roleObjectRole, WTKeyedMap sourceObjectToRoleObjectMap)
          Copies forward RoleObject values in sourceObjectToRoleObjectMap to copies of links in sourceObjectsToLinksMap.
static QueryResult expand(Object source, String role, Class linkClass, boolean onlyOtherSide)
          Retrieves objects related to the specified source object(s) role and link class.
static Map expand(WTCollection source, String role, Class linkClass)
          Expand a collection of objects and return a java.util.Map with keys = source QueryKeys, values = WTArrayLists of associated link ObjectIdentifiers.
static Map expand(WTCollection source, String role, Class linkClass, boolean addLatestCriteria)
          Expand a collection of objects and optionally specify a latest criteria.
static WTList expandToOtherSideObjectList(Object a_source, String a_role, Class a_linkClass)
          Retrieves objects related to the specified source object(s), role, and link class.
static Manifest getGlobalTransactionManifest(Object a_key)
          Returns a Manifest from the current global Transaction associated with the specified key.
static void insert(WTCollection objects, Map createStampMap, Map modifyStampMap)
          Stores the WTCollection of Persistable objects into the datastore.
static BinaryLink newCopyLink(BinaryLink linkToCopy, Persistable roleObject, String roleObjectRole, Persistable otherRoleObject)
          Creates a new copy of a link by duplicating it and replacing the role members.
static void store(WTCollection objects, Map createStampMap, Map modifyStampMap)
          Stores the WTCollection of Persistable objects into the datastore.
private static void store(WTCollection objects, Map createStampMap, Map modifyStampMap, boolean a_insert)
           
 
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

REFERENTIAL_INTEGRITY_DIRECTIVE_KEY

public static final String REFERENTIAL_INTEGRITY_DIRECTIVE_KEY
This attribute is used as a common key for all Referential Integrity directives stored in a Manifest.

Supported API: false

See Also:
Constant Field Values

manager

public static final PersistenceManagerSvr manager


Supported API: true

Constructor Detail

PersistenceServerHelper

public PersistenceServerHelper()
Method Detail

newCopyLink

public static BinaryLink newCopyLink(BinaryLink linkToCopy,
                                     Persistable roleObject,
                                     String roleObjectRole,
                                     Persistable otherRoleObject)
                              throws WTException
Creates a new copy of a link by duplicating it and replacing the role members.

Supported API: false

Parameters:
linkToCopy - The original link to copy.
roleObject - The object on the "roleObjectRole" side to assign. If left null, the "linkToCopy"'s role object is not replaced.
roleObjectRole - The role the "roleObject" plays in the association.
otherRoleObject - The object on the other side of the "roleObjectRole" side to assign. If left null, the "linkToCopy"'s other side role object is not replaced.
Returns:
BinaryLink
Throws:
WTException

buildCopyLinkMap

public static WTValuedHashMap buildCopyLinkMap(WTList linksToCopy,
                                               WTList roleObjects,
                                               List roleObjectRole,
                                               WTList otherRoleObjects)
                                        throws WTException
Builds a copy-link map that can be passed as an argument to PersistenceManagerSvr.copyLink() method. This method takes several Lists as arguments. The elements at each index in the list are assumed to correspond to a single entry in the copy-link map.

Supported API: false

Parameters:
linksToCopy - The original links to copy.
roleObjects - The objects on the "roleObjectRole" side to assign. If the list is null or an element is null, the "linkToCopy"'s role object is not replaced.
roleObjectRole - The role the "roleObject" plays in the association.
otherRoleObjects - The objects on the other side of the "roleObjectRole" side to assign. If the list is null or an element is null, the "linkToCopy"'s other side role object is not replaced.
Returns:
WTValuedHashMap
Throws:
WTException
See Also:
PersistenceManagerSvr.copyLink(WTValuedHashMap)

expand

public static QueryResult expand(Object source,
                                 String role,
                                 Class linkClass,
                                 boolean onlyOtherSide)
                          throws WTException
Retrieves objects related to the specified source object(s) role and link class. This method provides low level access to the database and bypasses access control operations.

Supported API: false

Parameters:
source - The persistable object to navigate. This object can be a single Peristable object or a WTCollection.
role - The role to navigate to.
linkClass - The association's link class to navigate.
onlyOtherSide - Indicates that only the other side objects of the association should be returned. If false, then the link objects are returned (the other side object can be obtained via the link object's getter method).
Returns:
QueryResult
Throws:
WTException

expand

public static Map expand(WTCollection source,
                         String role,
                         Class linkClass)
                  throws WTException
Expand a collection of objects and return a java.util.Map with keys = source QueryKeys, values = WTArrayLists of associated link ObjectIdentifiers.

Supported API: false

Parameters:
source -
role -
linkClass -
Returns:
Map
Throws:
WTException

expand

public static Map expand(WTCollection source,
                         String role,
                         Class linkClass,
                         boolean addLatestCriteria)
                  throws WTException
Expand a collection of objects and optionally specify a latest criteria. Returns a java.util.Map with keys = source QueryKeys, values = WTArrayLists of associated link ObjectIdentifiers.

Supported API: false

Parameters:
source -
role -
linkClass -
addLatestCriteria -
Returns:
Map
Throws:
WTException

getGlobalTransactionManifest

public static Manifest getGlobalTransactionManifest(Object a_key)
                                             throws WTException
Returns a Manifest from the current global Transaction associated with the specified key. If a Transaction or associated Manifest does not yet exist, then a new one will be created.

Supported API: true

Parameters:
a_key - The key to use to look up the Manifest.
Returns:
Manifest
Throws:
WTException

insert

public static void insert(WTCollection objects,
                          Map createStampMap,
                          Map modifyStampMap)
                   throws WTException
Stores the WTCollection of Persistable objects into the datastore. A transaction is started if one does not already exist. This method provides low level access to the database and bypasses access control operations. The object's initial creation and modification timestamps are explicitly set to the values retrieved from the specified map arguments. If the map is null or a value does not exist for a Persistable object, then the current time is used.

Supported API: false

Parameters:
objects - The WTCollection of objects to be inserted into the datastore
createStampMap - Map to use to retrieve associated create Timestamp. The keys for this map are Persistables and the values are Timestamps.
modifyStampMap - Map to use to retrieve associated modify Timestamp. The keys for this map are Persistables and the values are Timestamps.
Throws:
WTException

store

public static void store(WTCollection objects,
                         Map createStampMap,
                         Map modifyStampMap)
                  throws WTException
Stores the WTCollection of Persistable objects into the datastore. A transaction is started if one does not already exist. The object's initial creation and modification timestamps are explicitly set to the values retrieved from the specified map arguments. If the map is null or a value does not exist for a Persistable object, then the current time is used.

Supported API: false

Parameters:
objects - The WTCollection of objects to be inserted into the datastore
createStampMap - Map to use to retrieve associated create Timestamp. The keys for this map are Persistables and the values are Timestamps.
modifyStampMap - Map to use to retrieve associated modify Timestamp. The keys for this map are Persistables and the values are Timestamps.
Throws:
WTException

copyLinks

public static void copyLinks(Map sourceObjectsToLinksMap,
                             String roleObjectRole,
                             WTKeyedMap sourceObjectToRoleObjectMap)
                      throws WTException
Copies forward RoleObject values in sourceObjectToRoleObjectMap to copies of links in sourceObjectsToLinksMap.

Supported API: false

Parameters:
sourceObjectsToLinksMap - keys = source objects, values = links
roleObjectRole -
sourceObjectToRoleObjectMap - keys = source objects, values = new role objects
Throws:
WTException

appendCopyLinkMap

public static WTValuedMap appendCopyLinkMap(WTValuedMap copyLinkMap,
                                            Map sourceObjectsToLinksMap,
                                            String roleObjectRole,
                                            WTKeyedMap sourceObjectToRoleObjectMap)
                                     throws WTException
Build an aggregate copyLinkMap.

Supported API: false

Parameters:
copyLinkMap -
sourceObjectsToLinksMap -
roleObjectRole -
sourceObjectToRoleObjectMap -
Returns:
WTValuedMap
Throws:
WTException

expandToOtherSideObjectList

public static WTList expandToOtherSideObjectList(Object a_source,
                                                 String a_role,
                                                 Class a_linkClass)
                                          throws WTException
Retrieves objects related to the specified source object(s), role, and link class. The other side objects are returned directly in a WTList. This method provides low level access to the database and bypasses access control operations.

Supported API: false

Returns:
WTList of other side objects
Throws:
WTException

buildLinkRoleQuerySpec

public static QuerySpec buildLinkRoleQuerySpec(Object a_source,
                                               String a_role,
                                               Class a_linkClass)
                                        throws WTException
Builds a QuerySpec for retrieving objects related to the specified source object(s), role, and link class.

Supported API: false

Returns:
QuerySpec to query for other side objects QueryKeys
Throws:
WTException

store

private static void store(WTCollection objects,
                          Map createStampMap,
                          Map modifyStampMap,
                          boolean a_insert)
                   throws WTException
Throws:
WTException