|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RemoteBaseEntityInterface
RemoteBaseEntityInterface extends the functionality of RemoteBaseEntityValueInterface. It provides methods for bulk access of attributes, removing attributes, as well as obtaining a list of attribute names associated with the Entity.
getAttribute
calls, you can construct a
bulk accessor property bag that contains the 10 attribute names,
then perform one (remote) method call to get the values.
This works whether the specific Entity class stores
the values as attribute/value pairs in the internal
Entity map, or if the values are stored as explicit
instance variables and are accessed with explicit property set/get
methods such as getName()/setName(). The RemoteEntity class uses JavaBeans
introspection to find the property accessor methods
automatically.
For example, consider a class named Person
which extends
RemoteEntity
and has attributes givenName
, surname
,
nameSuffix
, namePrefix
which each have access methods (type-based attributes).
For an instance of Person
, the
application may also store an attribute named numDependents
by invoking
person.setAttribute("numDependents", new Integer(numDependents));Later, a separate part of the application may wish to retrieve all these attributes in one bulk accessor call:
HashMap query = new HashMap() query.put("namePrefix", null); query.put("givenName", null); query.put("surname", null); query.put("namesuffix", null); query.put("numDependents", null); query = person.getAttributes(query);To satisfy the query, the Entity will look at the requested attributes. If an attribute has an accessor method (like getSurname() or getNamePrefix()), the Entity will invoke the accessor method to retrieve the attribute value. Otherwise, it is read from an internal map of property state.
Entities may be accessed remotely, thus
all methods may throw RemoteException
.
Method Summary | |
---|---|
boolean |
containsAttributeNamed(java.lang.String name)
Test if this entity contains an attribute of a specified name. |
java.lang.Object |
getAttribute(java.lang.String attributeName,
java.lang.Object defaultValue)
Get a value of an attribute from the entity, or return a default value if it does not exist. |
java.util.Map |
getAttributes(java.util.Map query)
Perform a bulk value get on this entity. |
java.lang.String |
getStringAttribute(java.lang.String attributeName,
java.lang.String defaultValue)
Get a string value of an attribute from an entity. |
java.lang.String[] |
listAttributeNames()
Return an array of the attribute names on this entity. |
void |
removeAllAttributes()
Remove all attributes from this entity. |
void |
removeAttribute(java.lang.String attributeName)
Remove an attribute from this entity if the attribute is an instance-based attribute. |
void |
setAttributes(java.util.Map update)
Perform a bulk attribute set on this entity. |
Methods inherited from interface com.sas.entities.RemoteBaseEntityValueInterface |
---|
getAttribute, setAttribute |
Method Detail |
---|
void setAttributes(java.util.Map update) throws java.rmi.RemoteException, AttributeSetException
update
- a set of name/value pairs to assign to the attributes
of this entity
AttributeSetException
- if the AttributeType of a parameter is not compatible
with a previous setting of the attribute OR an attribute
has been designated as non-modifiable
java.rmi.RemoteException
- if there was an IO error communicating with the Entityjava.util.Map getAttributes(java.util.Map query) throws java.rmi.RemoteException
query
- a set of name/value pairs. This
object is updated if the operation is performed locally.
java.rmi.RemoteException
- if there was an IO error communicating with the Entityboolean containsAttributeNamed(java.lang.String name) throws java.rmi.RemoteException
name
- the attribute name to test
java.rmi.RemoteException
- if there was an IO error communicating with the Entityvoid removeAttribute(java.lang.String attributeName) throws java.rmi.RemoteException
containsAttributeNamed(String attributeName)
will return false
and getAttribute(String attributeName)
will throw a NoSuchElementException
attributeName
- the name of the attribute
java.rmi.RemoteException
- if there was an IO error communicating with the Entityvoid removeAllAttributes() throws java.rmi.RemoteException
java.rmi.RemoteException
- if there was an IO error communicating with the Entityjava.lang.String getStringAttribute(java.lang.String attributeName, java.lang.String defaultValue) throws java.rmi.RemoteException
(String) getAttribute(String attributeName)
.
attributeName
- the name of the value.defaultValue
- a default value to return if the named value does
not exist in this entity.
java.lang.ClassCastException
- if the attribute value named by the attributeName
is not a String value.
java.rmi.RemoteException
- if there was an IO error communicating with the Entityjava.lang.Object getAttribute(java.lang.String attributeName, java.lang.Object defaultValue) throws java.rmi.RemoteException
attributeName
- the name of the value.defaultValue
- a default value to return if the named attribute does
not exist in this entity.
java.rmi.RemoteException
- if there was an IO error communicating with the Entityjava.lang.String[] listAttributeNames() throws java.rmi.RemoteException
java.rmi.RemoteException
- if there was an IO error communicating with the Entity
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |