org.eclipse.higgins.idas.impl
Class BasicEntity

Package class diagram package BasicEntity
java.lang.Object
  extended by org.eclipse.higgins.idas.impl.BasicEntity
All Implemented Interfaces:
IEntity
Direct Known Subclasses:
BasicResource

public class BasicEntity
extends Object
implements IEntity

Basic implementation used by basic implementations of subinterfaces of IEntity (i.e. BasicResource). May also be used by providers to help implement IDigitalSubject. This class uses a HashMap of URI and String to hold the attributes.


Constructor Summary
BasicEntity(String name, String type)
           
BasicEntity(String name, String type, Iterable<IAttribute> attrs)
           
 
Method Summary
 void addAttribute(IAttribute attribute)
           
 IAttribute createAttribute(URI type, IPropertyValue value)
          Creates and adds an attribute for this Entity.
 IAttribute createAttribute(URI type, Iterable<IPropertyValue> values)
          Creates and adds an attribute for this Entity.
 IAttribute getAttribute(URI attrID)
          Return specified attribute of this Entity
 Iterable<IAttribute> getAttributes()
          Return all attributes of this Entity
 String getName()
           
 String getType()
          Returns the type of this Entity.
As all Entities are required to have a type attribute, this is a shortcut for calling getAttribute("<URI of type attrID>").
 void removeAttribute(IAttribute attribute)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicEntity

public BasicEntity(String name,
                   String type)

BasicEntity

public BasicEntity(String name,
                   String type,
                   Iterable<IAttribute> attrs)
Method Detail

getName

public String getName()
               throws IdASException
Specified by:
getName in interface IEntity
Throws:
IdASException

getType

public String getType()
               throws IdASException
Description copied from interface: IEntity
Returns the type of this Entity.
As all Entities are required to have a type attribute, this is a shortcut for calling getAttribute("<URI of type attrID>"). TODO: The above comment presumes we have a higgins-defined attribute type called "type". Do we need this? TODO: We decided to make the type be a String rather than URI -- need to remember why, and document it.

Specified by:
getType in interface IEntity
Returns:
The type of this Entity.
Throws:
IdASException

createAttribute

public IAttribute createAttribute(URI type,
                                  IPropertyValue value)
                           throws IdASException
Description copied from interface: IEntity
Creates and adds an attribute for this Entity.

Specified by:
createAttribute in interface IEntity
Parameters:
type - The attribute's type.
value - The attribute's value.
Returns:
The resulting Attribute.
Throws:
IdASException

createAttribute

public IAttribute createAttribute(URI type,
                                  Iterable<IPropertyValue> values)
                           throws IdASException
Description copied from interface: IEntity
Creates and adds an attribute for this Entity.

Specified by:
createAttribute in interface IEntity
Parameters:
type - The attribute's type.
values - The attribute's values.
Returns:
The resulting Attribute.
Throws:
IdASException

addAttribute

public void addAttribute(IAttribute attribute)
                  throws IdASException
Specified by:
addAttribute in interface IEntity
Throws:
IdASException

removeAttribute

public void removeAttribute(IAttribute attribute)
                     throws IdASException
Specified by:
removeAttribute in interface IEntity
Throws:
IdASException

getAttributes

public Iterable<IAttribute> getAttributes()
                                   throws IdASException
Description copied from interface: IEntity
Return all attributes of this Entity

Specified by:
getAttributes in interface IEntity
Returns:
An Iterable object of IAttributes.
Throws:
IdASException

getAttribute

public IAttribute getAttribute(URI attrID)
                        throws IdASException
Description copied from interface: IEntity
Return specified attribute of this Entity

Specified by:
getAttribute in interface IEntity
Parameters:
attrID - The identifier of the attribute to be returned.
Returns:
An IAttribute or null if none exits.
Throws:
IdASException