|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--bill.util.persist.EntityCollection
Holds a collection of related entities. Used for 'queries' that retrieve multiple entities of the same type (i.e. Users, Cars, Trucks, etc).
Field Summary | |
protected Hashtable |
_criteria
|
protected Vector |
_entities
|
protected String |
_entityName
|
protected EntityData |
_sampleEntity
Sample EntityData of the type contained in the list. |
Constructor Summary | |
EntityCollection()
Default creator, normally only used when creating an object via introspection. |
|
EntityCollection(String entityName,
Hashtable criteria)
Main creator, takes the selection criteria for populating the entity collection as input. |
Method Summary | |
protected EntityData |
createSampleEntity()
Creates an instance of the entity that is contained in this collecion. |
Hashtable |
getCriteria()
Retrieves the selection criteria used to populate the entity colleciton. |
Vector |
getEntities()
Retrieves the list of entities that make up the collection. |
EntityData |
getEntity(int index)
Retrieve a specific entity from the collection. |
String |
getEntityName()
Gets the class name of the entities that are contained in this collection. |
abstract void |
populateCollection()
Must be implemented by the subclass, this is the method that actually performs the read from the persistent data store and populates the collection with it's entities. |
void |
save()
Loops through all the entities in the collection and calls their save method so they are updated in the persistent store. |
void |
setAllDeleted()
Marks all entities in the collection as deleted. |
void |
setCriteria(Hashtable criteria)
Sets the selection criteria used to populate the entity colleciton. |
void |
setEntityName(String entityName)
Sets the class name of the entity that is contained in this collection. |
int |
size()
Returns the number of entities contained in this collection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String _entityName
protected Vector _entities
protected Hashtable _criteria
protected EntityData _sampleEntity
Constructor Detail |
public EntityCollection()
public EntityCollection(String entityName, Hashtable criteria) throws PersistException
entityName
- Name of the entity that is contained in this
collection. Must match the entitiy's Java class name as we will use
introspection to create one. Use the full package name if neccessary,
such as com.mycompany.UserData.criteria
- The criteria to use to populate the entity collection.
Keyed by the element name, the result is the element value.Method Detail |
public void setEntityName(String entityName) throws PersistException
entityName
- Value to set the entity name to.PersistException
- Thrown when a sample entity cannot be created.public String getEntityName()
public void setCriteria(Hashtable criteria)
criteria
- The cirteria to use to populate the entity collection.
Keyed by the element name, the result is the element value.public Hashtable getCriteria()
public Vector getEntities()
public EntityData getEntity(int index)
index
- The index of the entity to be retrieved, this is a 0 based
index.public void setAllDeleted()
public void save() throws PersistException
PersistException
- Thrown when the save method fails, forwards on
the exception from the save method.EntityData.save()
protected EntityData createSampleEntity() throws PersistException
PersistException
- Thrown when we cannot instantiate the new
entity object.public int size()
public abstract void populateCollection() throws PersistException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |