wt.epm.upload
Class Cache

java.lang.Object
  extended bywt.epm.upload.Cache
All Implemented Interfaces:
CacheObjectOwner, EPMCacheInterface

public class Cache
extends Object
implements EPMCacheInterface, CacheObjectOwner


Nested Class Summary
static class Cache.CacheDocument
           
static class Cache.CacheFamilyTable
           
static interface Cache.CacheHandler
           
static class Cache.CacheHandlerAdapter
           
static class Cache.CacheIterator
           
static class Cache.CacheObjectReference
           
static class Cache.ClassFilter
           
static interface Cache.Filter
           
static class Cache.Flusher
           
static interface Cache.Iterated
           
static class Cache.IteratedCacheHandler
           
static interface Cache.Named
           
static class Cache.NamedCacheHandler
           
static interface Cache.UndoCheckoutDependent
           
 
Field Summary
private  Map cacheHandlers
           
private  boolean isNonLatest
           
private  Cache.IteratedCacheHandler iteratedCacheHandler
           
static boolean log
           
static boolean logFlush
           
static boolean logFlushOrder
           
private  Cache.NamedCacheHandler namedCacheHandler
           
private  Map nameFTMasterMap
           
private  Map objectsByCacheId
           
private static String RESOURCE
           
private  EPMWorkspace workspace
           
 
Constructor Summary
Cache()
           
Cache(boolean isNonLatest)
           
 
Method Summary
private  Collection addTo(Collection target, Collection source)
           
 void cacheDependencyLink(EPMDependencyLink link)
           
 Cache.CacheDocument cacheDocument(EPMDocument document)
           
 void cacheDocuments(Collection documents)
           
 void cacheDocumentsFromArray(Collection documents, int index)
           
 Cache.CacheFamilyTable cacheFamilyTable(EPMFamilyTable familyTable)
           
 void cacheFamilyTableCells(Collection cells, Map columnsByObjectIdentifier)
           
 void cacheFamilyTableColumns(Collection columns, Map columnsByObjectIdentifier)
           
 void cacheFamilyTables(Collection familyTables)
           
 void cacheFamilyTablesFromArray(Collection familyTables, int index)
           
 void cacheFeatureDefinitions(Collection featureDefinitions)
           
 Cache.CacheDocument cacheMemberAndContainedInLink(EPMDocument instance, EPMContainedIn containedIn)
           
 void cacheMembersAndContainedInLinks(Collection pears, Collection instances, Collection containedInLinks)
           
 void cacheMembersAndContainedInLinks(Map pears, Collection instances, Collection containedInLinks)
           
 CacheObject cacheObject(CacheObject cacheObject)
           
 CacheObject cacheObject(Persistable persistable)
           
static void cacheObjects2Persistables(Collection cacheObjects, Collection persistables)
           
 void cacheParameterDefinitions(Collection parameterDefinitions)
           
 void cacheParameterMap(EPMParameterMap map)
           
 void cacheVariantLink(EPMVariantLink variantLink)
           
 void cacheVariantLink(EPMVariantLink variantLink, EPMDocument generic)
           
 void cacheVariantLinks(Collection variantLinks)
           
 void dump()
           
 void dump(PrintStream out)
           
 void dump(PrintStream out, String message)
           
 void dump(String message)
           
static Collection filterObjects(Collection objects, Cache.Filter filter, boolean needCacheObjects)
           
static Collection filterObjects(Collection objects, Class filterClass, boolean needCacheObjects)
           
private  Collection findAdditionalProminentFamilyTables(Collection topGenericNames, Collection excludeFT)
           
 Cache.Flusher flush()
           
 Cache.Flusher flush(boolean delete, boolean create, boolean update)
           
 Cache.Flusher flush(Class clazz)
           
 Cache.Flusher flush(Class clazz, boolean delete, boolean create, boolean update)
           
 Cache getCache()
           
 Cache.CacheDocument getCacheDocumentByCADName(String cadName)
           
 Cache.CacheDocument getCacheDocumentByMasterObjectIdentifier(ObjectIdentifier id)
           
 Cache.CacheDocument getCacheDocumentByObjectIdentifier(ObjectIdentifier id)
           
 Collection getCacheDocuments()
           
 Cache.CacheFamilyTable getCacheFamilyTableByMasterObjectIdentifier(ObjectIdentifier id)
           
 Cache.CacheFamilyTable getCacheFamilyTableByObjectIdentifier(ObjectIdentifier id)
           
 Collection getCacheFamilyTables()
           
 CacheObject getCacheObjectByCacheId(CacheId id)
           
 CacheObject getCacheObjectByMaster(Persistable master)
           
 CacheObject getCacheObjectByMasterObjectIdentifier(ObjectIdentifier id)
           
 CacheObject getCacheObjectByMasterReference(WTReference reference)
           
 CacheObject getCacheObjectByName(String scope, String name)
           
 CacheObject getCacheObjectByObjectIdentifier(ObjectIdentifier id)
           
 CacheObject getCacheObjectByPersistable(Persistable persistable)
           
 CacheObject getCacheObjectByReference(WTReference reference)
           
 Collection getCacheObjects(Cache.Filter filter)
           
 Collection getCacheObjects(Class filter)
           
static Collection getCacheObjects(Collection objects, Cache.Filter filter)
           
static Collection getCacheObjects(Collection objects, Class filterClass)
           
 EPMDocument getDocumentByCADName(String cadName)
           
 EPMDocument getDocumentByMasterObjectIdentifier(ObjectIdentifier id)
           
 EPMDocument getDocumentByObjectIdentifier(ObjectIdentifier id)
           
 EPMFamilyTable getFamilyTableByMasterObjectIdentifier(ObjectIdentifier id)
           
 EPMFamilyTable getFamilyTableByObjectIdentifier(ObjectIdentifier id)
           
 EPMFamilyTableMaster getFamilyTableMasterByName(String name)
           
 Collection getNewCacheDocuments()
           
 Collection getNewDocuments()
           
 Persistable getPersistableByMasterObjectIdentifier(ObjectIdentifier id)
           
 Persistable getPersistableByName(String scope, String name)
           
 Persistable getPersistableByObjectIdentifier(ObjectIdentifier id)
           
static Collection getPersistableObjects(Collection objects, Cache.Filter filter)
           
static Collection getPersistableObjects(Collection objects, Class filterClass)
           
 Collection getPersistables(Cache.Filter filter)
           
 Collection getPersistables(Class filter)
           
 EPMWorkspace getWorkspace()
           
private  void loadDependencies(String dependencyClass)
           
private  Collection loadOtherDocumentOids(Map documentsByCadName)
           
private  void loadVariantLinks()
           
 void queryAndCacheDependentDocuments(Collection dependentCADNames)
           
 void queryAndCacheDocumentsWithDependents(Map documentsByCadName, Collection topGenericCadNames)
           
private  void queryAndCacheFeatures()
           
private  void queryAndCacheIBAS()
           
 void queryAndCacheNewInWorkspace()
           
private  void queryAndCacheParameters()
           
private  void queryAndCacheParamMaps()
           
protected static List queryResult2List(QueryResult queryResult)
           
protected static ObjectIdentifier reference2ObjectId(ObjectReference ref)
           
 void refreshCreatedObjects()
           
 void registerCacheHandler(Class clazz, Cache.CacheHandler cacheHandler)
           
 void releaseChildObject(CacheObject cacheObject)
          Removes child cache object from this owner cache object.
(package private)  void releaseObject(CacheObject cacheObject)
          Removes cache object from cache and all handlers.
 CacheObject releaseObject(ObjectIdentifier id)
           
static void releaseObjects(Collection cacheObjects)
           
static void releaseObjects(Map cacheObjects)
           
 void removeCacheHandler(Class clazz, Cache.CacheHandler cacheHandler)
           
 void setWorkspace(EPMWorkspace workspace)
           
 
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

workspace

private EPMWorkspace workspace

isNonLatest

private boolean isNonLatest

objectsByCacheId

private Map objectsByCacheId

iteratedCacheHandler

private Cache.IteratedCacheHandler iteratedCacheHandler

namedCacheHandler

private Cache.NamedCacheHandler namedCacheHandler

log

public static boolean log

logFlush

public static boolean logFlush

logFlushOrder

public static boolean logFlushOrder

cacheHandlers

private Map cacheHandlers

nameFTMasterMap

private Map nameFTMasterMap
Constructor Detail

Cache

public Cache(boolean isNonLatest)
      throws WTException

Cache

public Cache()
      throws WTException
Method Detail

registerCacheHandler

public void registerCacheHandler(Class clazz,
                                 Cache.CacheHandler cacheHandler)
                          throws WTException
Throws:
WTException

removeCacheHandler

public void removeCacheHandler(Class clazz,
                               Cache.CacheHandler cacheHandler)
                        throws WTException
Throws:
WTException

getCacheObjects

public static Collection getCacheObjects(Collection objects,
                                         Class filterClass)
                                  throws WTException
Throws:
WTException

getPersistableObjects

public static Collection getPersistableObjects(Collection objects,
                                               Class filterClass)
                                        throws WTException
Throws:
WTException

filterObjects

public static Collection filterObjects(Collection objects,
                                       Class filterClass,
                                       boolean needCacheObjects)
                                throws WTException
Throws:
WTException

getCacheObjects

public static Collection getCacheObjects(Collection objects,
                                         Cache.Filter filter)
                                  throws WTException
Throws:
WTException

getPersistableObjects

public static Collection getPersistableObjects(Collection objects,
                                               Cache.Filter filter)
                                        throws WTException
Throws:
WTException

filterObjects

public static Collection filterObjects(Collection objects,
                                       Cache.Filter filter,
                                       boolean needCacheObjects)
                                throws WTException
Throws:
WTException

getCache

public Cache getCache()
               throws WTException
Specified by:
getCache in interface CacheObjectOwner
Throws:
WTException

releaseChildObject

public void releaseChildObject(CacheObject cacheObject)
                        throws WTException
Description copied from interface: CacheObjectOwner
Removes child cache object from this owner cache object. This method is called by CacheObject.release(). DO NOT USE THIS METHOD DIRECTLY.

Specified by:
releaseChildObject in interface CacheObjectOwner
Parameters:
cacheObject - CacheObject
Throws:
WTException

releaseObject

void releaseObject(CacheObject cacheObject)
             throws WTException
Removes cache object from cache and all handlers. This method is called by CacheObject.release(). DO NOT USE THIS METHOD DIRECTLY. Use CacheObject.release() instead.

Parameters:
cacheObject - CacheObject
Throws:
WTException

getWorkspace

public EPMWorkspace getWorkspace()

setWorkspace

public void setWorkspace(EPMWorkspace workspace)

getCacheObjectByCacheId

public CacheObject getCacheObjectByCacheId(CacheId id)
                                    throws WTException
Throws:
WTException

getCacheObjectByPersistable

public CacheObject getCacheObjectByPersistable(Persistable persistable)
                                        throws WTException
Throws:
WTException

getCacheObjectByReference

public CacheObject getCacheObjectByReference(WTReference reference)
                                      throws WTException
Throws:
WTException

getCacheObjectByObjectIdentifier

public CacheObject getCacheObjectByObjectIdentifier(ObjectIdentifier id)
                                             throws WTException
Throws:
WTException

getCacheObjectByMaster

public CacheObject getCacheObjectByMaster(Persistable master)
                                   throws WTException
Throws:
WTException

getCacheObjectByMasterReference

public CacheObject getCacheObjectByMasterReference(WTReference reference)
                                            throws WTException
Throws:
WTException

getCacheObjectByMasterObjectIdentifier

public CacheObject getCacheObjectByMasterObjectIdentifier(ObjectIdentifier id)
                                                   throws WTException
Throws:
WTException

getCacheObjectByName

public CacheObject getCacheObjectByName(String scope,
                                        String name)

getPersistableByObjectIdentifier

public Persistable getPersistableByObjectIdentifier(ObjectIdentifier id)
                                             throws WTException
Throws:
WTException

getPersistableByMasterObjectIdentifier

public Persistable getPersistableByMasterObjectIdentifier(ObjectIdentifier id)
                                                   throws WTException
Throws:
WTException

getPersistableByName

public Persistable getPersistableByName(String scope,
                                        String name)

getCacheObjects

public Collection getCacheObjects(Class filter)
                           throws WTException
Throws:
WTException

getPersistables

public Collection getPersistables(Class filter)
                           throws WTException
Throws:
WTException

getCacheObjects

public Collection getCacheObjects(Cache.Filter filter)
                           throws WTException
Throws:
WTException

getPersistables

public Collection getPersistables(Cache.Filter filter)
                           throws WTException
Throws:
WTException

cacheObject

public CacheObject cacheObject(CacheObject cacheObject)
                        throws WTException
Throws:
WTException

cacheObject

public CacheObject cacheObject(Persistable persistable)
                        throws WTException
Throws:
WTException

releaseObject

public CacheObject releaseObject(ObjectIdentifier id)
                          throws WTException
Throws:
WTException

releaseObjects

public static void releaseObjects(Collection cacheObjects)
                           throws WTException
Throws:
WTException

releaseObjects

public static void releaseObjects(Map cacheObjects)
                           throws WTException
Throws:
WTException

getCacheDocuments

public Collection getCacheDocuments()
Specified by:
getCacheDocuments in interface EPMCacheInterface

getDocumentByObjectIdentifier

public EPMDocument getDocumentByObjectIdentifier(ObjectIdentifier id)
                                          throws WTException
Specified by:
getDocumentByObjectIdentifier in interface EPMCacheInterface
Throws:
WTException

getCacheDocumentByObjectIdentifier

public Cache.CacheDocument getCacheDocumentByObjectIdentifier(ObjectIdentifier id)
                                                       throws WTException
Specified by:
getCacheDocumentByObjectIdentifier in interface EPMCacheInterface
Throws:
WTException

getDocumentByCADName

public EPMDocument getDocumentByCADName(String cadName)
Specified by:
getDocumentByCADName in interface EPMCacheInterface

getCacheDocumentByCADName

public Cache.CacheDocument getCacheDocumentByCADName(String cadName)
Specified by:
getCacheDocumentByCADName in interface EPMCacheInterface

getDocumentByMasterObjectIdentifier

public EPMDocument getDocumentByMasterObjectIdentifier(ObjectIdentifier id)
                                                throws WTException
Specified by:
getDocumentByMasterObjectIdentifier in interface EPMCacheInterface
Throws:
WTException

getCacheDocumentByMasterObjectIdentifier

public Cache.CacheDocument getCacheDocumentByMasterObjectIdentifier(ObjectIdentifier id)
                                                             throws WTException
Specified by:
getCacheDocumentByMasterObjectIdentifier in interface EPMCacheInterface
Throws:
WTException

getCacheFamilyTables

public Collection getCacheFamilyTables()
Specified by:
getCacheFamilyTables in interface EPMCacheInterface

getFamilyTableByObjectIdentifier

public EPMFamilyTable getFamilyTableByObjectIdentifier(ObjectIdentifier id)
Specified by:
getFamilyTableByObjectIdentifier in interface EPMCacheInterface

getCacheFamilyTableByObjectIdentifier

public Cache.CacheFamilyTable getCacheFamilyTableByObjectIdentifier(ObjectIdentifier id)
Specified by:
getCacheFamilyTableByObjectIdentifier in interface EPMCacheInterface

getFamilyTableByMasterObjectIdentifier

public EPMFamilyTable getFamilyTableByMasterObjectIdentifier(ObjectIdentifier id)
                                                      throws WTException
Specified by:
getFamilyTableByMasterObjectIdentifier in interface EPMCacheInterface
Throws:
WTException

getCacheFamilyTableByMasterObjectIdentifier

public Cache.CacheFamilyTable getCacheFamilyTableByMasterObjectIdentifier(ObjectIdentifier id)
                                                                   throws WTException
Specified by:
getCacheFamilyTableByMasterObjectIdentifier in interface EPMCacheInterface
Throws:
WTException

getFamilyTableMasterByName

public EPMFamilyTableMaster getFamilyTableMasterByName(String name)

reference2ObjectId

protected static ObjectIdentifier reference2ObjectId(ObjectReference ref)

queryResult2List

protected static List queryResult2List(QueryResult queryResult)

queryAndCacheDocumentsWithDependents

public void queryAndCacheDocumentsWithDependents(Map documentsByCadName,
                                                 Collection topGenericCadNames)
                                          throws WTException
Throws:
WTException

loadOtherDocumentOids

private Collection loadOtherDocumentOids(Map documentsByCadName)
                                  throws WTException
Throws:
WTException

findAdditionalProminentFamilyTables

private Collection findAdditionalProminentFamilyTables(Collection topGenericNames,
                                                       Collection excludeFT)
                                                throws WTException
Throws:
WTException

loadDependencies

private void loadDependencies(String dependencyClass)
                       throws WTException
Throws:
WTException

loadVariantLinks

private void loadVariantLinks()
                       throws WTException
Throws:
WTException

queryAndCacheParameters

private void queryAndCacheParameters()
                              throws WTException
Throws:
WTException

queryAndCacheFeatures

private void queryAndCacheFeatures()
                            throws WTException
Throws:
WTException

queryAndCacheIBAS

private void queryAndCacheIBAS()
                        throws WTException
Throws:
WTException

queryAndCacheParamMaps

private void queryAndCacheParamMaps()
                             throws WTException
Throws:
WTException

queryAndCacheDependentDocuments

public void queryAndCacheDependentDocuments(Collection dependentCADNames)
                                     throws WTException
Throws:
WTException

queryAndCacheNewInWorkspace

public void queryAndCacheNewInWorkspace()
                                 throws WTException
Throws:
WTException

cacheDocumentsFromArray

public void cacheDocumentsFromArray(Collection documents,
                                    int index)
                             throws WTException
Throws:
WTException

cacheDocuments

public void cacheDocuments(Collection documents)
                    throws WTException
Throws:
WTException

cacheDocument

public Cache.CacheDocument cacheDocument(EPMDocument document)
                                  throws WTException
Throws:
WTException

cacheFamilyTablesFromArray

public void cacheFamilyTablesFromArray(Collection familyTables,
                                       int index)
                                throws WTException
Throws:
WTException

cacheFamilyTables

public void cacheFamilyTables(Collection familyTables)
                       throws WTException
Throws:
WTException

cacheFamilyTable

public Cache.CacheFamilyTable cacheFamilyTable(EPMFamilyTable familyTable)
                                        throws WTException
Throws:
WTException

cacheMembersAndContainedInLinks

public void cacheMembersAndContainedInLinks(Map pears,
                                            Collection instances,
                                            Collection containedInLinks)
                                     throws WTException
Throws:
WTException

cacheMembersAndContainedInLinks

public void cacheMembersAndContainedInLinks(Collection pears,
                                            Collection instances,
                                            Collection containedInLinks)
                                     throws WTException
Throws:
WTException

cacheMemberAndContainedInLink

public Cache.CacheDocument cacheMemberAndContainedInLink(EPMDocument instance,
                                                         EPMContainedIn containedIn)
                                                  throws WTException
Throws:
WTException

cacheVariantLinks

public void cacheVariantLinks(Collection variantLinks)
                       throws WTException
Throws:
WTException

cacheVariantLink

public void cacheVariantLink(EPMVariantLink variantLink,
                             EPMDocument generic)
                      throws WTException
Throws:
WTException

cacheVariantLink

public void cacheVariantLink(EPMVariantLink variantLink)
                      throws WTException
Throws:
WTException

cacheFamilyTableCells

public void cacheFamilyTableCells(Collection cells,
                                  Map columnsByObjectIdentifier)
                           throws WTException
Throws:
WTException

cacheFamilyTableColumns

public void cacheFamilyTableColumns(Collection columns,
                                    Map columnsByObjectIdentifier)
                             throws WTException
Throws:
WTException

cacheParameterDefinitions

public void cacheParameterDefinitions(Collection parameterDefinitions)
                               throws WTException
Throws:
WTException

cacheFeatureDefinitions

public void cacheFeatureDefinitions(Collection featureDefinitions)
                             throws WTException
Throws:
WTException

cacheDependencyLink

public void cacheDependencyLink(EPMDependencyLink link)
                         throws WTException
Throws:
WTException

cacheParameterMap

public void cacheParameterMap(EPMParameterMap map)
                       throws WTException
Throws:
WTException

cacheObjects2Persistables

public static void cacheObjects2Persistables(Collection cacheObjects,
                                             Collection persistables)

flush

public Cache.Flusher flush()
                    throws WTException
Throws:
WTException

flush

public Cache.Flusher flush(Class clazz)
                    throws WTException
Throws:
WTException

flush

public Cache.Flusher flush(boolean delete,
                           boolean create,
                           boolean update)
                    throws WTException
Throws:
WTException

flush

public Cache.Flusher flush(Class clazz,
                           boolean delete,
                           boolean create,
                           boolean update)
                    throws WTException
Throws:
WTException

refreshCreatedObjects

public void refreshCreatedObjects()
                           throws WTException
Throws:
WTException

dump

public void dump()
          throws WTException
Throws:
WTException

dump

public void dump(String message)
          throws WTException
Throws:
WTException

dump

public void dump(PrintStream out)
          throws WTException
Throws:
WTException

dump

public void dump(PrintStream out,
                 String message)
          throws WTException
Throws:
WTException

getNewDocuments

public Collection getNewDocuments()
                           throws WTException
Throws:
WTException

getNewCacheDocuments

public Collection getNewCacheDocuments()
                                throws WTException
Throws:
WTException

addTo

private Collection addTo(Collection target,
                         Collection source)