org.eclipse.higgins.idas.api
Interface IHasAttributes

All Known Subinterfaces:
IAuthNAttributesMaterials, IComplexAttrValue, IEntity

public interface IHasAttributes


Method Summary
 IAttribute addAttribute(IAttribute copyFrom)
          Creates a new Attribute for this container of attributes (typically IEntity) by copying the data from the passed IAttribute.
 IAttribute addAttribute(URI attrID)
          Creates a new Attribute for this container of attributes (typically IEntity).
 boolean equals(IHasAttributes attributes)
          Returns true if the passed attribute set is equal to this one.
 IAttribute getAttribute(URI attrID)
          Returns the specified attribute of this object.
 Iterator getAttributes()
          Return all attributes of this object
 ISingleValuedAttribute getSingleValuedAttribute(URI attrID)
          Returns the specified attribute of this object as an ISingleValuedAttribute.
 void removeAttribute(URI attrID)
          Deletes the attribute specified by attrID.
 void removeAttributeValue(IAttribute attr)
          Deletes an attribute's value(s) based on the information passed in attr.
 void removeAttributeValue(URI attrID, Object value)
          Deletes the specified value from the specified attrID.
 

Method Detail

getAttributes

public Iterator getAttributes()
                       throws IdASException
Return all attributes of this object

Returns:
An Iterator of IAttributes.
Throws:
IdASException

getAttribute

public IAttribute getAttribute(URI attrID)
                        throws IdASException
Returns the specified attribute of this object.

Parameters:
attrID - The identifier of the attribute to be returned.
Returns:
An IAttribute or if none exits.
Throws:
IdASException

getSingleValuedAttribute

public ISingleValuedAttribute getSingleValuedAttribute(URI attrID)
                                                throws IdASException,
                                                       NotSingleValuedAttributeException
Returns the specified attribute of this object as an ISingleValuedAttribute. The caller of this is assumed to have knowledge that the attribute specified in attrID is in fact a single-valued attribute (as defined by the model for that attribute).

Parameters:
attrID - The identifier of the attribute to be returned.
Returns:
An IAttribute or if none exits.
Throws:
IdASException
NotSingleValuedAttributeException - when the specified attrID is not specified by its model as a single-valued attribute.

addAttribute

public IAttribute addAttribute(URI attrID)
                        throws IdASException,
                               InvalidTypeException
Creates a new Attribute for this container of attributes (typically IEntity). This call is typically followed by one or more calls to IAttribute.addValue(java.net.URI), IAttribute.addSimpleValue(java.net.URI, java.lang.Object), IAttribute.addComplexValue(java.net.URI), (@link IHasMetadata#addMetadata} on the returned IAttribute Note: If the specified attribute already exists, the subsequently added values are added to the entity, adding to the existing values of that attribute (subject to any model restrictions). Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
attrID - The URI specifying the identifier of the Attribute being created
Throws:
{@link - IdASException}
{@link - InvalidTypeException} when the attribute type is invalid
IdASException
InvalidTypeException

addAttribute

public IAttribute addAttribute(IAttribute copyFrom)
                        throws IdASException
Creates a new Attribute for this container of attributes (typically IEntity) by copying the data from the passed IAttribute. Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
copyFrom - an IAttribute from which data is copied to construct a new Attribute
Throws:
{@link - IdASException}
IdASException

removeAttribute

public void removeAttribute(URI attrID)
                     throws IdASException
Deletes the attribute specified by attrID. On one hand, this is a convenience method (in that the caller can call this rather than fetching the attribute using getAttribute(URI) and then calling remove on the returned IAttribute. More importantly however is that this method allows an attribute to be removed when the caller has permissions to remove, but no permissions to read that attribute. Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
attrID - identifies the attribute to be removed
Throws:
IdASException

removeAttributeValue

public void removeAttributeValue(URI attrID,
                                 Object value)
                          throws IdASException
Deletes the specified value from the specified attrID. This can only be used on simple attributes (not on complex attributes). On one hand, this is a convenience method (in that the caller can call this rather than fetching the attribute using getAttribute(URI), then fetching the appropriate value from the returned IAttribute, and then calling remove on that value. More importantly however is that this method allows an attribute value to be removed when the caller has permissions to remove values, but no permissions to read that attribute or its values. Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
attrID - identifies the simple attribute to be removed
value - identifies the attribute value to be removed. Note that this represents the data backing the simple attribute and is not an ISimpleAttribute itself.
Throws:
IdASException

removeAttributeValue

public void removeAttributeValue(IAttribute attr)
                          throws IdASException
Deletes an attribute's value(s) based on the information passed in attr. The attribute type of the passed attr signifies which attribute is being affected, and the value or values passed in attr signify the attribute values to be removed. TODO: document the expected behavior when all passed in values are not found in the attribute. Or remove this method and add one which may be used to remove a single complex attribute value. This is simply a convenience method which is equal to calling removeAttributeValue(URI, Object) once for each value in attr. Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
attr - Holds one or more values to be deleted from the attribute (named in attr)
Throws:
IdASException

equals

public boolean equals(IHasAttributes attributes)
               throws IdASException
Returns true if the passed attribute set is equal to this one. The sets are compared for size, and then each attribute in the set is compared for equality Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
attributes - the set of attributes to compare to this one
Returns:
true if the sets are equal, false otherwise.
Throws:
IdASException