org.eclipse.higgins.idas.api
Interface IAttribute

All Superinterfaces:
IHasAttributes
All Known Subinterfaces:
ISingleValuedAttribute

public interface IAttribute
extends IHasAttributes

As defined at (TODO (Doc): add reference), This interface represents an attribute of an Entity.

An attribute is a typed set of values. When the attribute's model dictates that it is single-valued isSingleValued() then this object may be cast to an ISingleValuedAttribute

This extends IHasAttributes so that metadata about the attribute may be presented as attributes on this attribute.


Method Summary
 IEntity addComplexValue(String entityID)
          Add a reference to the entity with passed entityId.
 IEntity addComplexValue(URI type)
          Creates a new complex value for this attribute.
 ISimpleValue addSimpleValue(URI dataType, Object data)
          Creates a new simple value for this attribute.
 IValue addValue(IValue copyFrom)
          Creates a new value for this attribute by copying the passed IValue If passed value is not blank entity (has not null entityId), a reference to this entity is created.
 IValue addValue(URI dataType)
          Creates a new value for this attribute.
 IAttributeModel getModel()
          Returns a model of this type of attribute as it defined in the context's schema.
 URI getType()
          Returns the attribute type of this attribute as a URI.
 Iterator getValues()
          Returns all values for this attribute.
 Iterator getValues(IExtension[] extensions)
          Returns all values for this attribute.
 boolean isSingleValued()
          Convenience method which returns true when the model for this attribute dictates that only a single value may exist.
 void remove()
          Removes all values of this attribute.
 
Methods inherited from interface org.eclipse.higgins.idas.api.IHasAttributes
addAttribute, addAttribute, addAttributeValue, getAttribute, getAttributes, getSingleValuedAttribute, removeAttribute, removeAttributeValue, removeAttributeValue
 

Method Detail

getType

URI getType()
            throws IdASException
Returns the attribute type of this attribute as a URI.

From this URI, a consumer should be able to derive some kind of human-readable identifier (such as "age", "title", "employeeNumber", etc.).

This attribute type is used to distinguish this attribute from other attributes within a collection of attributes. Note that IModel.getType() will return the same URI that this method returns.

Throws:
IdASException

getValues

Iterator getValues()
                   throws IdASException
Returns all values for this attribute.

Returns:
an Iterator of IValues
Throws:
IdASException

getValues

Iterator getValues(IExtension[] extensions)
                   throws IdASException
Returns all values for this attribute.

Parameters:
extensions - may be null. One or more extensions valid for this operation.
Returns:
an Iterator of IValues
Throws:
IdASException

addValue

IValue addValue(URI dataType)
                throws IdASException,
                       InvalidTypeException
Creates a new value for this attribute. This method is useful when the caller doesn't know whether the URI specified in the dataType param will build an ITypedValue or IEntity. Otherwise callers will typically call addSimpleValue(URI, Object) or addComplexValue(URI) This call is typically followed by a call to IValue.isSimple() on the returned IValue. When found to be an ISimpleValue, ITypedValue.setData(Object) is typically called on the returned IValue (cast as an ISimpleValue). When found to be an IEntity, one typically calls IHasAttributes.addAttribute(URI) on the returned IValue (cast as an IEntity or IHasAttributes). Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
dataType - The URI specifying the data type of Value being created
Throws:
{@link - IdASException}
{@link - InvalidTypeException} when the type is invalid
IdASException
InvalidTypeException

addValue

IValue addValue(IValue copyFrom)
                throws IdASException
Creates a new value for this attribute by copying the passed IValue If passed value is not blank entity (has not null entityId), a reference to this entity is created. Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
copyFrom - The IValue from which data is copied to create the returned IValue
Throws:
{@link - IdASException}
IdASException

addSimpleValue

ISimpleValue addSimpleValue(URI dataType,
                            Object data)
                            throws IdASException,
                                   InvalidTypeException
Creates a new simple value for this attribute. Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
dataType - The URI specifying the type of Value being created
data - The data of the attribute value
Throws:
{@link - IdASException}
{@link - InvalidTypeException} when the type is invalid
IdASException
InvalidTypeException

addComplexValue

IEntity addComplexValue(URI type)
                        throws IdASException,
                               InvalidTypeException
Creates a new complex value for this attribute. This call is typically followed by one or more calls to IHasAttributes.addAttribute(java.net.URI) on the returned IEntity. Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Parameters:
type - The URI specifying the type of complex value being created
Throws:
{@link - IdASException}
{@link - InvalidTypeException} when the type is invalid
IdASException
InvalidTypeException

addComplexValue

IEntity addComplexValue(String entityID)
                        throws IdASException,
                               InvalidTypeException
Add a reference to the entity with passed entityId. The same as IAttribute#addValue(IValue

Parameters:
entityID -
Returns:
Throws:
IdASException
InvalidTypeException

remove

void remove()
            throws IdASException
Removes all values of this attribute. Note: This operation is only applied to any backing data store after IContext.applyUpdates() is called.

Throws:
{@link - IdASException}
IdASException

getModel

IAttributeModel getModel()
                         throws IdASException
Returns a model of this type of attribute as it defined in the context's schema. The returned model could be used to analyze the attribute's type and discover what its value model is.

Returns:
a model of this type of attribute
Throws:
IdASException

isSingleValued

boolean isSingleValued()
                       throws IdASException
Convenience method which returns true when the model for this attribute dictates that only a single value may exist. This is analogous to calling
 (myAttribute.getModel().getMaxCardinality() == 1) 
 

Returns:
boolean. When true, this object may be cast to an ISingleValuedAttribute
Throws:
IdASException