wt.epm.structure
Class LinkProxy

java.lang.Object
  extended bywt.epm.structure.LinkProxy
Direct Known Subclasses:
DependencyGraph.Dependency, EPMFamily.LocalLinkProxy

public class LinkProxy
extends Object

The LinkProxy is a proxy object for a Binary Link. In addition to holding the identity of the Binary Link that it represents, it also holds the identities of the link's role A and role B objects. It is return by the PLSQLNavigator methods, which query link classes using PL/SQL stored procedures. LinkProxy also supports the notion of a "missing link". You may navigate from one object to another using a config spec or other filtering rules. A "missing link" signifies that you can navigate from the object to other iterations of the same master but not to the one selected by the config spec or other filtering rules.

Supported API: false

Extendable: false


Nested Class Summary
static class LinkProxy.Role
          Represents the Role for a LinkProxy.
 
Field Summary
private  BinaryLink link
           
private  ObjectIdentifier linkId
           
private  QueryKey roleA
           
static LinkProxy.Role RoleA
           
private  Persistable roleAObject
           
private  QueryKey roleB
           
static LinkProxy.Role RoleB
           
private  Persistable roleBObject
           
 
Constructor Summary
protected LinkProxy(QueryKey roleA, QueryKey roleB, ObjectIdentifier objectId)
          Constructs a LinkProxy object.
 
Method Summary
static void cacheObjects(Collection linkProxies)
          Given a collection of LinkProxy objects, query the Binary Links that they represent from the database as efficiently as possible.
static void cacheRoleObjects(Collection linkProxies, LinkProxy.Role role, Collection objects)
          Given a collection of LinkProxy objects, query the role A or B objects from the database as efficiently as possible.
 boolean equals(Object object)
          Indicates whether given object is a LinkProxy object that represents the "same link" as this LinkProxy.
 BinaryLink getObject()
          Finds the Binary Link object that this is a proxy for.
 ObjectIdentifier getObjectId()
          Gets the object identifier of the Binary Link object that this is a proxy for.
static Set getRole(Collection linkProxies, LinkProxy.Role role)
          Given a collection of LinkProxy objects, return the query keys for the given role.
 QueryKey getRole(LinkProxy.Role role)
          Gets the query key (object identifier or version key) for the given role.
 QueryKey getRoleA()
          Gets the query key (object identifier or version key) for the role A object.
 Persistable getRoleAObject()
          Gets the role A object.
 QueryKey getRoleB()
          Gets the query key (object identifier or version key) for the role B object.
 Persistable getRoleBObject()
          Gets the role B object.
 Persistable getRoleObject(LinkProxy.Role role)
          Gets the role object for the given role.
static List getRoleObjects(Collection linkProxies, LinkProxy.Role role)
          Given a collection of LinkProxy objects, return the objects for the given role.
static LinkProxy.Role[] getRoles(Class linkClass, Class objectClass)
          For the given Link class, determine which roles (if any) that objects of the given class may participate as.
 int hashCode()
          Returns a hash code value for this LinkProxy object.
 boolean isMissingLink()
          Returns true if this LinkProxy represents a "missing link".
private  void setRoleObject(LinkProxy.Role role, Persistable object)
           
static Map sortByRole(Collection linkProxies, LinkProxy.Role role)
          Given a collection of LinkProxy objects, sort the LinkProxy objects by the query keys for the given role.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RoleA

public static LinkProxy.Role RoleA

RoleB

public static LinkProxy.Role RoleB

roleA

private QueryKey roleA

roleAObject

private Persistable roleAObject

roleB

private QueryKey roleB

roleBObject

private Persistable roleBObject

linkId

private ObjectIdentifier linkId

link

private BinaryLink link
Constructor Detail

LinkProxy

protected LinkProxy(QueryKey roleA,
                    QueryKey roleB,
                    ObjectIdentifier objectId)
             throws WTException
Constructs a LinkProxy object.

Supported API: false

Method Detail

getRoleA

public QueryKey getRoleA()
Gets the query key (object identifier or version key) for the role A object.


getRoleAObject

public Persistable getRoleAObject()
Gets the role A object.


getRoleB

public QueryKey getRoleB()
Gets the query key (object identifier or version key) for the role B object.


getRoleBObject

public Persistable getRoleBObject()
Gets the role B object.


getRole

public QueryKey getRole(LinkProxy.Role role)
Gets the query key (object identifier or version key) for the given role.


getRoleObject

public Persistable getRoleObject(LinkProxy.Role role)
Gets the role object for the given role.


getObjectId

public ObjectIdentifier getObjectId()
Gets the object identifier of the Binary Link object that this is a proxy for. This method will return null if this LinkProxy represents a missing link.


getObject

public BinaryLink getObject()
                     throws WTException
Finds the Binary Link object that this is a proxy for. This method will return null if this LinkProxy represents a missing link.

Throws:
WTException

equals

public boolean equals(Object object)
Indicates whether given object is a LinkProxy object that represents the "same link" as this LinkProxy.


hashCode

public int hashCode()
Returns a hash code value for this LinkProxy object.


isMissingLink

public boolean isMissingLink()
Returns true if this LinkProxy represents a "missing link". Typically, a LinkProxy is a proxy object for a Binary Link. However, you may navigate from one object to another using a config spec or other filtering rules. A "missing link" signifies that you can navigate from an object to other iterations of the same master but not to the one selected by the config spec or other filtering rules. Hence, the Binary Link between the object and the selected other-side iteration is "missing".


getRole

public static Set getRole(Collection linkProxies,
                          LinkProxy.Role role)
Given a collection of LinkProxy objects, return the query keys for the given role. Duplicate keys are removed.

Supported API: false

Returns:
Set of query keys for the given role (duplicate keys removed)

getRoleObjects

public static List getRoleObjects(Collection linkProxies,
                                  LinkProxy.Role role)
Given a collection of LinkProxy objects, return the objects for the given role. Duplicate objects are removed.

Supported API: false

Returns:
List of objects for the given role (duplicate objects removed)

sortByRole

public static Map sortByRole(Collection linkProxies,
                             LinkProxy.Role role)
Given a collection of LinkProxy objects, sort the LinkProxy objects by the query keys for the given role.

Supported API: false

Returns:
Map that holds lists of LinkProxy objects indexed by the query key of the given role

getRoles

public static LinkProxy.Role[] getRoles(Class linkClass,
                                        Class objectClass)
                                 throws WTException
For the given Link class, determine which roles (if any) that objects of the given class may participate as.

Supported API: false

Returns:
Role[] that holds roles (if any) that objects of the given class may participate as.
Throws:
WTException

cacheObjects

public static void cacheObjects(Collection linkProxies)
                         throws WTException
Given a collection of LinkProxy objects, query the Binary Links that they represent from the database as efficiently as possible. Cache each Binary Link in the appropriate LinkProxy object.

Supported API: false

Throws:
WTException

cacheRoleObjects

public static void cacheRoleObjects(Collection linkProxies,
                                    LinkProxy.Role role,
                                    Collection objects)
                             throws WTException
Given a collection of LinkProxy objects, query the role A or B objects from the database as efficiently as possible. Cache each role object in its appropriate LinkProxy object. This method will search the given collection of objects before it queries the database.

Supported API: false

Throws:
WTException

setRoleObject

private void setRoleObject(LinkProxy.Role role,
                           Persistable object)