net.cnri.do_api
Class EntityMap

java.lang.Object
  extended by net.cnri.do_api.EntityMap

public class EntityMap
extends java.lang.Object

An EntityMap stores a mapping from identifiers to local, human readable names.


Nested Class Summary
 class EntityMap.Entity
           
 
Field Summary
static java.lang.String ADDRESS_BOOK_ELEMENT_ID
           
static java.lang.String ENTITY_LIST
           
static java.lang.String ID_ATTRIBUTE
           
static java.lang.String NAME_ATTRIBUTE
           
static java.lang.String TYPE_ATTRIBUTE
           
 
Constructor Summary
EntityMap()
           
 
Method Summary
 void addEntity(EntityMap.Entity newEntity)
           
 java.util.List getEntities()
          Return a java.util.List containing the EntityMap.Entity objects in the list.
 EntityMap.Entity getEntity(int entityIndex)
          Return the address book entity at the given index
 EntityMap.Entity getEntityForID(java.lang.String entityID)
          Return the entity with the given ID or null if no entity has that ID.
 java.lang.String getEntityLabel(java.lang.String entityID)
          Return a label that can be used to describe the entity having the given ID.
 java.lang.String getEntityName(java.lang.String entityID, java.lang.String defaultVal)
          Return the name that is associated with the given ID.
 int getNumEntities()
          Get the number of known entities in the mapping/list
 void loadFromObject(DigitalObject obj)
          Load the entity map from the given DigitalObject
 void removeEntity(EntityMap.Entity entityToRemove)
          Remove the given entity from the list
 void saveToObject(DigitalObject obj)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADDRESS_BOOK_ELEMENT_ID

public static final java.lang.String ADDRESS_BOOK_ELEMENT_ID
See Also:
Constant Field Values

NAME_ATTRIBUTE

public static final java.lang.String NAME_ATTRIBUTE
See Also:
Constant Field Values

TYPE_ATTRIBUTE

public static final java.lang.String TYPE_ATTRIBUTE
See Also:
Constant Field Values

ID_ATTRIBUTE

public static final java.lang.String ID_ATTRIBUTE
See Also:
Constant Field Values

ENTITY_LIST

public static final java.lang.String ENTITY_LIST
See Also:
Constant Field Values
Constructor Detail

EntityMap

public EntityMap()
Method Detail

getNumEntities

public int getNumEntities()
Get the number of known entities in the mapping/list


getEntities

public java.util.List getEntities()
Return a java.util.List containing the EntityMap.Entity objects in the list.


getEntity

public EntityMap.Entity getEntity(int entityIndex)
Return the address book entity at the given index


getEntityName

public java.lang.String getEntityName(java.lang.String entityID,
                                      java.lang.String defaultVal)
Return the name that is associated with the given ID. If no name is associated with the given ID then return the given value.


getEntityLabel

public java.lang.String getEntityLabel(java.lang.String entityID)
Return a label that can be used to describe the entity having the given ID. If no name is associated with the given ID then return the given entityID.


getEntityForID

public EntityMap.Entity getEntityForID(java.lang.String entityID)
Return the entity with the given ID or null if no entity has that ID.


addEntity

public void addEntity(EntityMap.Entity newEntity)

removeEntity

public void removeEntity(EntityMap.Entity entityToRemove)
Remove the given entity from the list


loadFromObject

public void loadFromObject(DigitalObject obj)
                    throws java.lang.Exception
Load the entity map from the given DigitalObject

Throws:
java.lang.Exception

saveToObject

public void saveToObject(DigitalObject obj)
                  throws java.lang.Exception
Throws:
java.lang.Exception