org.entityfs.cap.entityattrs.impl.metadata
Class DatabaseChildEntityAttributeManager<T extends EntityAttributes>

java.lang.Object
  extended by org.entityfs.cap.entityattrs.impl.metadata.DatabaseChildEntityAttributeManager<T>
Type Parameters:
T - The type of EntityAttributes managed by this object.
All Implemented Interfaces:
ChildEntityAttributeManager<T>

public class DatabaseChildEntityAttributeManager<T extends EntityAttributes>
extends Object
implements ChildEntityAttributeManager<T>

The ChildEntityAttributeManager is used by an EntityAttributes-enabling DirectoryDelegate to keep track of all entity attributes for its child entities. The attributes file is fetched from a AttributeFileRepository. A HeliDB database is used for reading and writing to the file.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
entityfs-entity_attributes

Constructor Summary
DatabaseChildEntityAttributeManager(AttributeFileRepository fr, Serializer<T> attrSerializer, Map<EntityType,ObjectFactory<T>> af, int bufferSize, LogAdapterHolder lah)
           
 
Method Summary
 void add(String name, T attr)
          Set the attribute record for the entity
 boolean containsKey(String name)
          Does this object contain attributes for the named entity.
 void delete(String name)
          Delete the attribute record for the supplied entity.
 T get(String name, EntityType et)
          Get the attributes for the entity.
 void update(String name, T attr)
          Update the attribute record for the entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseChildEntityAttributeManager

public DatabaseChildEntityAttributeManager(AttributeFileRepository fr,
                                           Serializer<T> attrSerializer,
                                           Map<EntityType,ObjectFactory<T>> af,
                                           int bufferSize,
                                           LogAdapterHolder lah)
Method Detail

containsKey

public boolean containsKey(String name)
Does this object contain attributes for the named entity.

Specified by:
containsKey in interface ChildEntityAttributeManager<T extends EntityAttributes>
Parameters:
name - The name of the entity.
Returns:
true if there is an attribute record for the entity.

get

public T get(String name,
             EntityType et)
Get the attributes for the entity. If no attribute record is stored for the entity, default attributes are returned.

Specified by:
get in interface ChildEntityAttributeManager<T extends EntityAttributes>
Parameters:
name - The entity name,
et - The type of entity. This is used to create default attributes if no attribute record is saved for the entity.
Returns:
The attributes for the entity.

add

public void add(String name,
                T attr)
Set the attribute record for the entity

Specified by:
add in interface ChildEntityAttributeManager<T extends EntityAttributes>
Parameters:
name - The name of the entity.
attr - The attributes.

update

public void update(String name,
                   T attr)
Update the attribute record for the entity.

Specified by:
update in interface ChildEntityAttributeManager<T extends EntityAttributes>
Parameters:
name - The name of the entity.
attr - The new attributes for the entity.

delete

public void delete(String name)
Delete the attribute record for the supplied entity.

Specified by:
delete in interface ChildEntityAttributeManager<T extends EntityAttributes>
Parameters:
name - The name of the entity whose record should be deleted.