wt.epm
Class EPMFamily

java.lang.Object
  extended bywt.epm.EPMFamily
All Implemented Interfaces:
Serializable

public class EPMFamily
extends Object
implements Serializable

EPMFamily holds a set of instances that belong to a given family table. The set of instances that this EPMFamily holds may not be complete or compatible with the top-level generic. The EPMFamily may hold some but not all of the instances that belong to this family table. Some of the instances may not be compatible with EPMFamily's top-level generic.



Supported API: false

Extendable: false

See Also:
Serialized Form

Nested Class Summary
static class EPMFamily.FamilyTableQueryByFamilyTable
           
static class EPMFamily.FamilyTableQueryByMember
           
static class EPMFamily.FamilyTableSnapshot
           
private static class EPMFamily.LocalLinkProxy
           
 
Field Summary
private  List compatibleLinks
           
private  boolean complete
           
private  EPMFamilyTable familyTable
           
private  List incompatibles
           
private  List instances
           
private  EPMDocument topLevelGeneric
           
 
Constructor Summary
private EPMFamily(Collection links, boolean isComplete)
           
  EPMFamily(EPMFamily.FamilyTableSnapshot familyTableSnapshot, boolean checkCompleteness)
          Constructs an EPMFamily.
  EPMFamily(EPMFamilyTable familyTable)
          Constructs an complete and compatible EPMFamily.
  EPMFamily(EPMFamilyTable familyTable, Collection members)
          Constructs an EPMFamily.
  EPMFamily(EPMFamilyTable familyTable, Collection members, boolean checkCompleteness)
          Constructs an EPMFamily.
  EPMFamily(EPMFamilyTable familyTable, EPMDocument topGeneric, Collection instances, boolean checkCompleteness)
          Constructs an EPMFamily.
 
Method Summary
private static List buildFamilies(Collection linksToInstances, boolean isComplete)
           
static long buildId(Object databaseId)
           
static ObjectIdentifier buildObjectId(Class clazz, Object databaseId)
           
private  boolean cleanId(long[] array, long value)
           
private  boolean containsId(long[] array, long value)
           
static EPMFamily.FamilyTableQueryByFamilyTable createQueryByFamilyTable(EPMFamilyTable familyTable)
           
static EPMFamily.FamilyTableQueryByFamilyTable createQueryByFamilyTables(Collection familyTables, Map familyTableMap, boolean returnSourceId)
           
static EPMFamily.FamilyTableQueryByMember createQueryByMember(EPMDocument member)
           
static EPMFamily.FamilyTableQueryByMember createQueryByMembers(Collection members, Map memberMap, boolean returnSourceId)
           
private static List filterByMaster(Collection objects, Collection masterIds)
           
 EPMDocument findCompatibleGeneric()
          Returns an iteration of the top-level generic that is compatible with all instances in this family.
private static EPMDocument findCompatibleGeneric(Collection instances)
           
static List findFamilies(Collection documents, ConfigSpec configSpec)
          Finds all families in the given collection of documents.
static QueryResult findFamilies(QueryResult documents)
          Finds all families in the given list of documents.
static QueryResult findFamilies(QueryResult documents, boolean checkCompleteness)
          Finds all families in the given list of documents and checks their completeness.
static Map findFamilyTableInstances(Collection familyTables)
           
static EPMFamily.FamilyTableSnapshot findFamilyTableInstances(EPMFamilyTable familyTable)
           
static Map findFamilyTableMembers(Collection familyTables)
           
static EPMFamily.FamilyTableSnapshot findFamilyTableMembers(EPMFamilyTable familyTable)
           
static EPMDocument findFamilyTableTopGeneric(EPMFamilyTable familyTable)
           
static WTKeyedMap findFamilyTableTopGenerics(Collection familyTables)
           
private static List findGenerics(Collection documents, ConfigSpec configSpec)
           
private static List findInstances(Collection documents, ConfigSpec configSpec)
           
static List getAllInstances(Collection families)
          Return the instances that belong to each family in the collection.
static List getAllMembers(Collection families)
          Return the instances and the generic for each family in the collection.
 List getCompatibleLinks()
          getCompatibleLinks: Get compatible ContainedIn links between family table and its members If EPMFamily is not complete, it returns empty List
 List getContainedInLinks()
           
static EPMFamily getEPMFamily(EPMDocument doc)
          static method to get the EPMFamily for a given Document If document is a top-level generic, all the latest-compatible instances are added in EPMFamily If document is a normal EPMDocument (not participating in any Family) null is returned If document is instance, latest-compatible generic is used to fetch all the instances.
 List getFamilyMembers()
          Return the instances and the generic of the family.
 EPMFamilyTable getFamilyTable()
          Returns the family table (container) associated with this family.
static List getFamilyTableMembersList(Collection familyTables)
           
 EPMDocument getGeneric()
          Returns the top-level generic.
static EPMDocument getGeneric(EPMDocument instance, WTContainerRef sandboxContainerRef)
           
 List getIncompatibles()
          Returns all instances that are not compatible with the top-level generic.
 List getInstances()
          Returns a list of instances that belong to this family table.
static EPMFamilyTable getLatestFamilyTable(Collection familyTables)
          Returns "latest" family table object for a given family table collection
private static String getName(EPMDocument doc)
           
private  long getObjectIdAsLong(Persistable object)
           
private  long getObjectMasterIdAsLong(Iterated object)
           
private static Map groupByFamily(QueryResult idPairs, QueryResult documents)
           
private static Persistable id2Persistable(long id, Map persistables)
           
private static Persistable id2Persistable(Object id, Map persistables)
           
 boolean isCompatible()
          Returns whether or not all of the instances that this EPMFamily holds are compatible with the EPMFamily's top-level generic.
 boolean isComplete()
          Returns whether or not this EPMFamily holds all of the instances that belong to this family table.
static boolean isGeneric(int memberStatus)
           
static boolean isGeneric(Object memberStatus)
           
static boolean isInstance(int memberStatus)
           
static boolean isInstance(Object memberStatus)
           
private  boolean isOldFamilyTable()
           
static boolean isTopGeneric(int memberStatus)
           
static boolean isTopGeneric(Object memberStatus)
           
static List navigateIterationToMaster(Collection documents)
           
static void splitFamilyTables(Collection familyTables, Collection oldFamilyTables, Collection newFamilyTables)
           
static void splitFamilyTables(QueryResult familyTables, Collection oldFamilyTables, Collection newFamilyTables)
           
 String toString()
           
private  void updateIncompatiblesAndCompleteness(boolean checkCompleteness)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

topLevelGeneric

private EPMDocument topLevelGeneric

familyTable

private EPMFamilyTable familyTable

instances

private List instances

incompatibles

private List incompatibles

complete

private boolean complete

compatibleLinks

private List compatibleLinks
Constructor Detail

EPMFamily

public EPMFamily(EPMFamilyTable familyTable)
          throws WTException
Constructs an complete and compatible EPMFamily.

Supported API: false

Parameters:
familyTable - family table object

EPMFamily

public EPMFamily(EPMFamilyTable familyTable,
                 Collection members)
          throws WTException
Constructs an EPMFamily. It can be incompatible and incomplete EPMFamily. Completeness will not be checked.

Supported API: false

Parameters:
familyTable - family table object
members - list of members

EPMFamily

public EPMFamily(EPMFamilyTable familyTable,
                 Collection members,
                 boolean checkCompleteness)
          throws WTException
Constructs an EPMFamily. It can be incompatible and incomplete EPMFamily.

Supported API: false

Parameters:
familyTable - family table object
members - list of members
checkCompleteness - whether to check family completeness or not

EPMFamily

public EPMFamily(EPMFamilyTable familyTable,
                 EPMDocument topGeneric,
                 Collection instances,
                 boolean checkCompleteness)
          throws WTException
Constructs an EPMFamily. It can be incompatible and incomplete EPMFamily.

Supported API: false

Parameters:
familyTable - family table object
topGeneric - family table top generic
instances - list of instances
checkCompleteness - whether to check family completeness or not

EPMFamily

public EPMFamily(EPMFamily.FamilyTableSnapshot familyTableSnapshot,
                 boolean checkCompleteness)
          throws WTException
Constructs an EPMFamily. It can be incompatible and incomplete EPMFamily.

Supported API: false

Parameters:
familyTableSnapshot - family table snapshot object
checkCompleteness - whether to check family completeness or not

EPMFamily

private EPMFamily(Collection links,
                  boolean isComplete)
           throws WTException
Method Detail

getFamilyTable

public EPMFamilyTable getFamilyTable()
Returns the family table (container) associated with this family.

Supported API: false

Returns:
EPMFamilyTable -- The container object that contains the family table

getGeneric

public EPMDocument getGeneric()
Returns the top-level generic.

Supported API: false

Returns:
EPMDocument -- top-level generic

getInstances

public List getInstances()
Returns a list of instances that belong to this family table.

Supported API: false

Returns:
List -- list of instances

getEPMFamily

public static EPMFamily getEPMFamily(EPMDocument doc)
                              throws WTException
static method to get the EPMFamily for a given Document If document is a top-level generic, all the latest-compatible instances are added in EPMFamily If document is a normal EPMDocument (not participating in any Family) null is returned If document is instance, latest-compatible generic is used to fetch all the instances. EPMFamily with all latest-compatible instances is returned

Returns:
EPMFamily --
Throws:
WTException

isComplete

public boolean isComplete()
Returns whether or not this EPMFamily holds all of the instances that belong to this family table.

Supported API: false

Returns:
boolean

isCompatible

public boolean isCompatible()
Returns whether or not all of the instances that this EPMFamily holds are compatible with the EPMFamily's top-level generic.

Supported API: false

Returns:
boolean

getIncompatibles

public List getIncompatibles()
Returns all instances that are not compatible with the top-level generic.

Supported API: false

Returns:
List -- list of instances that are not compatible with the top-level generic

findCompatibleGeneric

public EPMDocument findCompatibleGeneric()
                                  throws WTException
Returns an iteration of the top-level generic that is compatible with all instances in this family.

Supported API: false

Returns:
EPMDocument -- compatible iteration of the top-level generic
Throws:
WTException

toString

public String toString()

updateIncompatiblesAndCompleteness

private void updateIncompatiblesAndCompleteness(boolean checkCompleteness)
                                         throws WTException
Throws:
WTException

getObjectIdAsLong

private long getObjectIdAsLong(Persistable object)

getObjectMasterIdAsLong

private long getObjectMasterIdAsLong(Iterated object)

containsId

private boolean containsId(long[] array,
                           long value)

cleanId

private boolean cleanId(long[] array,
                        long value)

isOldFamilyTable

private boolean isOldFamilyTable()

findCompatibleGeneric

private static EPMDocument findCompatibleGeneric(Collection instances)
                                          throws WTException
Throws:
WTException

findFamilies

public static QueryResult findFamilies(QueryResult documents)
                                throws WTException
Finds all families in the given list of documents.

Returns:
QueryResult -- families found in the given list of documents
Throws:
WTException

findFamilies

public static QueryResult findFamilies(QueryResult documents,
                                       boolean checkCompleteness)
                                throws WTException
Finds all families in the given list of documents and checks their completeness.

Returns:
QueryResult -- families found in the given list of documents
Throws:
WTException

getCompatibleLinks

public List getCompatibleLinks()
                        throws WTException
getCompatibleLinks: Get compatible ContainedIn links between family table and its members If EPMFamily is not complete, it returns empty List

Returns:
List of EPMContainedIn links
Throws:
WTException

getGeneric

public static EPMDocument getGeneric(EPMDocument instance,
                                     WTContainerRef sandboxContainerRef)
                              throws WTException
Throws:
WTException

getAllMembers

public static List getAllMembers(Collection families)
Return the instances and the generic for each family in the collection.

Returns:
List of instances and generics

getAllInstances

public static List getAllInstances(Collection families)
Return the instances that belong to each family in the collection.

Returns:
List of instances

findFamilies

public static List findFamilies(Collection documents,
                                ConfigSpec configSpec)
                         throws WTException
Finds all families in the given collection of documents. This method uses the supplied config spec to retrieve the appropriate iteration of any instance or generic that is not in the given list of documents.

Returns:
List -- families found in the given list of documents
Throws:
WTException

findInstances

private static List findInstances(Collection documents,
                                  ConfigSpec configSpec)
                           throws WTException
Throws:
WTException

findGenerics

private static List findGenerics(Collection documents,
                                 ConfigSpec configSpec)
                          throws WTException
Throws:
WTException

navigateIterationToMaster

public static List navigateIterationToMaster(Collection documents)
                                      throws WTException
Throws:
WTException

buildId

public static long buildId(Object databaseId)
                    throws WTException
Throws:
WTException

buildObjectId

public static ObjectIdentifier buildObjectId(Class clazz,
                                             Object databaseId)
                                      throws WTException
Throws:
WTException

buildFamilies

private static List buildFamilies(Collection linksToInstances,
                                  boolean isComplete)
                           throws WTException
Throws:
WTException

filterByMaster

private static List filterByMaster(Collection objects,
                                   Collection masterIds)
                            throws WTException
Throws:
WTException

groupByFamily

private static Map groupByFamily(QueryResult idPairs,
                                 QueryResult documents)
                          throws WTException
Throws:
WTException

getName

private static String getName(EPMDocument doc)

splitFamilyTables

public static void splitFamilyTables(QueryResult familyTables,
                                     Collection oldFamilyTables,
                                     Collection newFamilyTables)
                              throws WTException
Throws:
WTException

splitFamilyTables

public static void splitFamilyTables(Collection familyTables,
                                     Collection oldFamilyTables,
                                     Collection newFamilyTables)
                              throws WTException
Throws:
WTException

getLatestFamilyTable

public static EPMFamilyTable getLatestFamilyTable(Collection familyTables)
                                           throws WTException
Returns "latest" family table object for a given family table collection

Parameters:
familyTables - family table object collection
Returns:
"latest" family table object
Throws:
WTException

getFamilyTableMembersList

public static List getFamilyTableMembersList(Collection familyTables)
                                      throws WTException
Throws:
WTException

findFamilyTableMembers

public static EPMFamily.FamilyTableSnapshot findFamilyTableMembers(EPMFamilyTable familyTable)
                                                            throws WTException
Throws:
WTException

findFamilyTableMembers

public static Map findFamilyTableMembers(Collection familyTables)
                                  throws WTException
Throws:
WTException

findFamilyTableTopGeneric

public static EPMDocument findFamilyTableTopGeneric(EPMFamilyTable familyTable)
                                             throws WTException
Throws:
WTException

findFamilyTableTopGenerics

public static WTKeyedMap findFamilyTableTopGenerics(Collection familyTables)
                                             throws WTException
Throws:
WTException

findFamilyTableInstances

public static EPMFamily.FamilyTableSnapshot findFamilyTableInstances(EPMFamilyTable familyTable)
                                                              throws WTException
Throws:
WTException

findFamilyTableInstances

public static Map findFamilyTableInstances(Collection familyTables)
                                    throws WTException
Throws:
WTException

createQueryByFamilyTable

public static EPMFamily.FamilyTableQueryByFamilyTable createQueryByFamilyTable(EPMFamilyTable familyTable)
                                                                        throws WTException
Throws:
WTException

createQueryByFamilyTables

public static EPMFamily.FamilyTableQueryByFamilyTable createQueryByFamilyTables(Collection familyTables,
                                                                                Map familyTableMap,
                                                                                boolean returnSourceId)
                                                                         throws WTException
Throws:
WTException

createQueryByMember

public static EPMFamily.FamilyTableQueryByMember createQueryByMember(EPMDocument member)
                                                              throws WTException
Throws:
WTException

createQueryByMembers

public static EPMFamily.FamilyTableQueryByMember createQueryByMembers(Collection members,
                                                                      Map memberMap,
                                                                      boolean returnSourceId)
                                                               throws WTException
Throws:
WTException

id2Persistable

private static Persistable id2Persistable(Object id,
                                          Map persistables)

id2Persistable

private static Persistable id2Persistable(long id,
                                          Map persistables)

isTopGeneric

public static boolean isTopGeneric(int memberStatus)

isTopGeneric

public static boolean isTopGeneric(Object memberStatus)

isGeneric

public static boolean isGeneric(int memberStatus)

isGeneric

public static boolean isGeneric(Object memberStatus)

isInstance

public static boolean isInstance(int memberStatus)

isInstance

public static boolean isInstance(Object memberStatus)

getContainedInLinks

public List getContainedInLinks()
                         throws WTException
Throws:
WTException

getFamilyMembers

public List getFamilyMembers()
Return the instances and the generic of the family.

Returns:
List of instances and generic