class Entity |
Parent: Object |
|
Methods:attribute_dictionaries, attribute_dictionary,delete_attribute, deleted?, entityID, get_attribute, model, parent, set_attribute, to_s, typename, valid? |
|
Sample Code: entitytests.rb |
|
Instance Methods |
attribute_dictionaries |
The AttributeDictionaries is used to retrieve the attribute_dictionaries that are attached to the entity. |
Syntax: |
attributedictionaries = entity.attribute_dictionaries |
Arguments: |
|
Return Value: |
attributedictionaries - the AttributeDictionaries object associated with the entity, or nil if there are none. |
Comments: |
|
Example: |
depth = 100 |
attribute_dictionary |
The AttributeDictionary method is used to retrieve an attribute dictionary with a given name that is attached to an Entity. |
Syntax: |
attributedictionary = entity.attribute_dictionary name, <create_if_needed> |
Arguments: |
name - the name of the attribute dictionary <create_if_needed> - (optional) flag; if set to true then the attribute dictionary will be created if it does not exist. |
Return Value: |
attributedictionary - an AttributeDictionary object if successful, or nil if there is no attribute dictionary |
Comments: |
|
Example: |
depth = 100 |
delete_attribute |
The delete_attribute method is used to delete an attribute from an entity. |
Syntax: |
status = entity.delete_attribute "dictionary_name" status = entity.delete_attribute "dictionary_name", key |
Arguments: |
"dictionary_name" - the name of an attribute dictionary key - an attribute key |
Return Value: |
|
Comments: |
If only the dictionary_name is given, then it deletes the entire AttributeDictionary. Otherwise, delete_attribute deletes the attribute with the given key from the given dictionary. |
Example: |
depth = 100 |
deleted? |
The deleted? method is used to determine if your entity is still valid (not deleted by another script, for example). |
Syntax: |
status = entity.deleted? |
Arguments: |
|
Return Value: |
status - true if deleted, false if not deleted |
Comments: |
|
Example: |
depth = 100 |
entityID |
The entityID method is used to retrieve a unique ID assigned to an entity. |
Syntax: |
id = entity.entityID |
Arguments: |
|
Return Value: |
id - the id for the Entity object |
Comments: |
The entityID is not persistent between sessions. |
Example: |
depth = 100 |
get_attribute |
The get_attribute method is used to retrieve the value of an attribute in the entity's attribute dictionary. |
Syntax: |
value = entity.get_attribute "dictionary_name", key value = entity.get_attribute "dictionary_name", key, default_value |
Arguments: |
"dictionary_name" - the name of an attribute dictionary key - an attribute key default_value - a default value to return if there is no attribute found |
Return Value: |
value - the retrieved value |
Comments: |
In the first form, if there is no attribute that matches the given names, it returns nil. In the second form, if there is no attribute, it returns the given default value. It does not create an attribute with that name though. |
Example: |
depth = 100 |
model |
The model method is used to retrieve model for the entity. |
Syntax: |
model = entity.model |
Arguments: |
|
Return Value: |
model - the model that contains the Entity object |
Comments: |
|
Example: |
depth = 100 |
parent |
The parent method is used to retrieve the parent entity of the entity. |
Syntax: |
entity = entity.parent |
Arguments: |
|
Return Value: |
entity - a Entity object representing the parent of this entity |
Comments: |
|
Example: |
depth = 100 |
set_attribute |
The set attribute is used to set the value of an attribute in an attribute dictionary with the given name. |
Syntax: |
value = entity.set_attribute "dictionary_name", key, value |
Arguments: |
"dictionary_name" - the name of an attribute dictionary key - an attribute key value - the value for the attribute |
Return Value: |
value - the newly set value if successful |
Comments: |
This method will create a new AttributeDictionary if none exists. |
Example: |
depth = 100 |
to_s |
The to_s method is used to retrieve the string representation of the entity. |
Syntax: |
string = entity.to_s |
Arguments: |
|
Return Value: |
string - the string representation of the entity if successful |
Comments: |
|
Example: |
depth = 100 |
typename |
The typename method retrieves the type of the entity. |
Syntax: |
type = entity.typename |
Arguments: |
|
Return Value: |
type - the type of the entity |
Comments: |
|
Example: |
depth = 100 |
valid? |
The valid? method is used to verify that an entity is valid (not deleted). |
Syntax: |
status = entity.valid? |
Arguments: |
|
Return Value: |
status - true if valid, false if invalid |
Comments: |
|
Example: |
depth = 100 |