com.ptc.windchill.uwgm.proesrv.rrc
Class DbObjCache

java.lang.Object
  extended bycom.ptc.windchill.uwgm.proesrv.rrc.DbObjCache
Direct Known Subclasses:
RequestHolder

public class DbObjCache
extends Object

Maintains a set of uwgmdb objects.


Nested Class Summary
static interface DbObjCache.Visitor
           
static class DbObjCache.VisitorAdapter
           
 
Field Summary
private  Map dbObjMap
           
 
Constructor Summary
DbObjCache()
           
 
Method Summary
 com.ptc.windchill.uwgm.soap.uwgmdb.DbObj addDbObj(com.ptc.windchill.uwgm.soap.uwgmdb.DbObj object)
          Cache DbObj uniquely by object ID.
 void addIterations(com.ptc.windchill.uwgm.soap.uwgmdb.Iteration[] iterations)
          Convenience method.
 void clear()
           
 boolean contains(com.ptc.windchill.uwgm.soap.uwgmdb.DbObj object)
          Check if the cache contains an object
 boolean contains(String dbObjId)
          Check if the cache contains an object
 com.ptc.windchill.uwgm.soap.uwgmdb.DbObj getDbObj(String dbObjId)
          Access by ObjectIdentifier's string representation.
 Collection getDbObjects()
          All cached DbObj objects as a Collection.
 Collection getDbObjects(Class objectClass)
          Select all collected objects of a given class.
 boolean isEmpty()
          Check if the cache is empty
 void visitDbObjects(Class objectClass, DbObjCache.Visitor visitor)
          Visit all collected objects of a given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbObjMap

private final Map dbObjMap
Constructor Detail

DbObjCache

public DbObjCache()
Method Detail

addDbObj

public com.ptc.windchill.uwgm.soap.uwgmdb.DbObj addDbObj(com.ptc.windchill.uwgm.soap.uwgmdb.DbObj object)
Cache DbObj uniquely by object ID. If an object with the same ID found in the cache, new object will be ignored and an old one returned.

Parameters:
object - DbObj to add
Returns:
cached DbObj

isEmpty

public final boolean isEmpty()
Check if the cache is empty

Returns:
boolean

clear

public void clear()

contains

public final boolean contains(com.ptc.windchill.uwgm.soap.uwgmdb.DbObj object)
Check if the cache contains an object

Parameters:
object - DbObj
Returns:
boolean

contains

public final boolean contains(String dbObjId)
Check if the cache contains an object

Parameters:
dbObjId - String
Returns:
boolean

getDbObj

public final com.ptc.windchill.uwgm.soap.uwgmdb.DbObj getDbObj(String dbObjId)
Access by ObjectIdentifier's string representation. Value of dbObjId may be obtained as ObjectIdentifier.toString() or DbObj.getDbObjId().

Parameters:
dbObjId - String
Returns:
DbObj

getDbObjects

public final Collection getDbObjects()
All cached DbObj objects as a Collection.

Returns:
Collection

getDbObjects

public final Collection getDbObjects(Class objectClass)
Select all collected objects of a given class.

Parameters:
objectClass - must be a subclass of uwgmdb.DbObj
Returns:
Collection

visitDbObjects

public final void visitDbObjects(Class objectClass,
                                 DbObjCache.Visitor visitor)
                          throws UwgmErrorException
Visit all collected objects of a given class.

Parameters:
objectClass - must be a subclass of uwgmdb.DbObj
visitor - Visitor
Throws:
UwgmErrorException

addIterations

public final void addIterations(com.ptc.windchill.uwgm.soap.uwgmdb.Iteration[] iterations)
Convenience method. Calls addDbObj() for each Iteration.

Parameters:
iterations - Iteration[]