This class is the default implementation of dynamic objects. More...
#include <ilserver/dynobj.h>
Public Member Functions | |
IlsDynObject () | |
Builds a new dynamic object. More... | |
Initialization | |
virtual void | initObject (const IlsString &typeNm, const IlsString &id=IlsString::Null) |
Initializes a dynamic object whose type is typeNm. More... | |
virtual void | initObject (const IlsObjectType &, const IlsString &id=IlsString::Null) |
Must be called just after an object of type IlsDynObject (or of a subclass) has been created. More... | |
IlsBoolean | isInitialized () const |
Returns IlsTrue if the dynamic object has been initialized. More... | |
virtual void | afterInit () |
Called just after the dynamic object has been initialized. More... | |
Object Type | |
const IlsObjectType * | getObjectType () const |
Returns the type associated with the dynamic object. | |
const IlsString & | getObjectTypeName () const |
Returns the name of the type for the dynamic object. | |
Identifiers | |
virtual void | setKeyIdentifier (const IlsString &id) |
Assigns the value of the identifier attribute that has been declared to the server model interpreter. More... | |
virtual IlsString | getKeyIdentifier () const |
Returns the value of the identifier attribute, if this identifier has been declared for the corresponding attribute type. Otherwise, it returns the null string. More... | |
virtual IlsString | getIdentifier () const |
Assigns the value of the identifier attribute that has been declared to the server model interpreter. More... | |
Relations | |
virtual IlsViewedRel * | getRelation (const IlsRelationDef *) const |
IlsBoolean | setRelTarget (const IlsString &relNm, IlsViewed *obj) |
Assigns the target of the dynamic unary relation relNm. More... | |
IlsViewed * | getRelTarget (const IlsString &relNm) const |
Returns the target of the dynamic unary relation relNm. | |
IlsBoolean | insertIntoRel (const IlsString &relNm, IlsViewed *obj) |
Inserts a new target in the dynamic n-ary relation relNm. More... | |
IlsBoolean | extractFromRel (const IlsString &relNm, IlsViewed *obj) |
Extracts (and removes) the target obj from the dynamic n-ary relation relNm. More... | |
virtual IlsViewed * | getElementFromRel (const IlsRelationDef *rel, const IlsString &id) const |
Retrieves the first object identified by the argument id from the relation identified by the rel argument. More... | |
IlsViewed * | getElementFromRel (const IlsString &relNm, int index) const |
Returns the element located at position index in relation relNm. More... | |
virtual IlsViewed * | getElementFromRel (const IlsRelationDef *rel, int index) const |
Returns the element located at position index in the relation identified by rel. More... | |
virtual IlsBoolean | isElementInRel (const IlsRelationDef *rel, IlsViewed &target) const |
Returns IlsTrue if the target is in the relation. More... | |
IlsDynRelation * | getDynRelation (const IlsString &relNm) const |
Returns the dynamic relation relNm or 0 if this relation does not exist. | |
Others | |
virtual IlsMvValue | callFunction (const IlsString &funcName, IlsMvValue *args, int nbParam, IlsBoolean chkErr=IlsTrue) |
Invokes the function funcName with its arguments. More... | |
virtual void | cut (ILS_CUT_DIRECTIVE d=ILS_ALL) |
Calls the Rogue Wave Views Script callback onCut() if exist and calls the base-class method if onCut() returns IlsTrue . | |
Dynamic Views | |
These virtual member functions are overriden from the parent class | |
virtual IlsBoolean | beginEdition (IlsMvView &, IlsRpUpdateType) |
This virtual member function (or the overriding one) is called on each Server object that is directly involved in a transaction triggered by a component on a dynamic view server (see IlsMvComponent::commitC2SCTransaction() ). More... | |
virtual IlsBoolean | endEdition (IlsMvView &, IlsRpUpdateType, IlsBoolean isRollback) |
This virtual member function (or the overriding one) is called on each server object that is directly involved in a transaction triggered by a component on a dynamic view server (see IlsMvComponent::commitC2SCTransaction() ). More... | |
Public Member Functions inherited from IlsObject | |
virtual | ~IlsObject () |
Virtual destructor. | |
IlsBoolean | isInserted () |
Indicates whether the object is owned or not. | |
IlsBoolean | remove () |
virtual IlsBoolean | lock () |
Locks the object. | |
virtual IlsBoolean | trylock () |
virtual IlsBoolean | unlock () |
Unlocks the object. | |
virtual IlsBoolean | isUpdateAllowed () |
virtual IlsBoolean | isUsePossible () |
Locks the object. | |
virtual IlsBoolean | isAlreadyInHierarchy (void *) |
Locks the object. | |
virtual IlsEntity * | getEntity () |
void | setEntityContext (IlsEntityContext &) |
Locks the object. | |
void | unsetEntityContext (IlsEntityContext &) |
Locks the object. | |
IlsBoolean | isOwnerModified () |
During a notification phase, this member function returns IlsTrue if the owner of the object has changed since the last notification phase. | |
IlsBoolean | areUsersModified () |
During a notification phase, this member function returns IlsTrue if a use relation has been added or removed since the last notification phase. | |
Protected Member Functions | |
Protected Member Functions | |
void | beforeRename (const IlsString &oldId, const IlsString &newId) |
Must be called from a subtype before the object identifier is renamed. More... | |
void | afterRename (const IlsString &oldId, const IlsString &newId) |
Must be called from a subtype after the object identifier has been renamed. | |
void | removeFromDictionary () |
Removes a dynamic object from its dynamic dictionary, if such a dictionary exists. | |
Instantiation | |
IlsBoolean | isInDictionary () const |
Returns IlsTrue if the object is stored in a dictionary. More... | |
static IlsDynObject * | NewInstance (const IlsString &typeNm, const IlsString &identifier=IlsString::Null) |
Instantiates a dynamic object of the dynamic type typeNm. More... | |
static IlsDynObject * | Narrow (const IlsString &typeNm, IlsViewed &) |
Performs a safe cast from an IlsViewed object to an instance of IlsDynObject if the object is a dynamic object and its dynamic type is typeNm or a subtype. | |
static IlsDynObject * | GetInstance (const IlsString &typeNm, const IlsString &id) |
Retrieves an instance of the dynamic object that has been registered with the name id into the dictionary associated with the dynamic type. More... | |
static IlsBoolean | UseDictionary (const IlsString &typeNm) |
Returns IlsTrue if the corresponding dynamic type holds a dictionary. | |
Attributes | |
IlsBoolean | setAttributeValue (const IlsString &attrNm, const IlsMvValue &v) |
Assigns the value v to the attribute identified by the attrNm parameter. More... | |
IlsMvValue | getAttributeValue (const IlsString &attrNm) const |
Retrieves the value of the attribute attrNm for this dynamic object. More... | |
IlsDynAttribute * | getDynAttribute (const IlsString &attrNm) const |
Returns the dynamic attribute attrNm or 0 if this attribute does not exist. | |
static IlsBoolean | SetStaticAttributeValue (const IlsString &typeNm, const IlsString &attrNm, const IlsMvValue &) |
Sets the value of the static attribute attrNm for the dynamic type typeNm. More... | |
static IlsMvValue | GetStaticAttributeValue (const IlsString &typeNm, const IlsString &attrNm) |
retrieves the value of the static attribute attrNm for the dynamic type typeNm. | |
This class is the default implementation of dynamic objects.
Library: dynmvsvr
Dynamic objects are instances of dynamic classes declared to the runtime model interpreter. The class IlsDynObject
provides a structure for the dynamic relations and attributes that have been declared for the dynamic type. This class must be the base class of all static types for which a dynamic subtype has been declared. A dynamic object is not meant to be used before it has been initialized by the member function initObject()
.
See section Inheritance from IlsDynobject in Chapter Dynamic Modeling Services of the Rogue Wave Server User's Guide for more information on how to declare dynamic types that inherit from static types.
IlsDynObject::IlsDynObject | ( | ) |
Builds a new dynamic object.
However, it does not initialized it. To initialize the new dynamic object, you must call the member function initObject()
on it.
|
virtual |
Called just after the dynamic object has been initialized.
By default, this function calls the Rogue Wave Script callback afterInit()
if it exists.
Must be called from a subtype before the object identifier is renamed.
See section Identified Objects in chapter Dynamic Modeling Services, in the Rogue Wave Server User's Guide.
|
virtual |
This virtual member function (or the overriding one) is called on each Server object that is directly involved in a transaction triggered by a component on a dynamic view server (see IlsMvComponent::commitC2SCTransaction()
).
It is called before these objects are modified. If the function returns IlsFalse
, the transaction is rolled back both to the server and to the component.
This function takes two arguments:
IlsTrue
but it can be overridden on the derived object types. Reimplemented from IlsViewed.
|
virtual |
Invokes the function funcName with its arguments.
When the chkErr argument is set to IlsTrue
, an error message is generated if the Script implementation of this function is not found. Rogue Wave Server will search for a Script function named <object type name>_<funcName>()
.
|
virtual |
This virtual member function (or the overriding one) is called on each server object that is directly involved in a transaction triggered by a component on a dynamic view server (see IlsMvComponent::commitC2SCTransaction()
).
It is called once all the modifications are performed on these objects. If such a call returns IlsFalse
, the transaction is rolled back on both the server and the component.
IlsRpUpdateEnum
. This function returns IlsTrue
but it can be overridden on the derived object types.IlsTrue
, this indicates that the current transaction is being rolled back. Reimplemented from IlsViewed.
IlsBoolean IlsDynObject::extractFromRel | ( | const IlsString & | relNm, |
IlsViewed * | obj | ||
) |
Extracts (and removes) the target obj from the dynamic n-ary relation relNm.
IlsFalse
if the target cannot be extracted. IlsMvValue IlsDynObject::getAttributeValue | ( | const IlsString & | attrNm | ) | const |
Retrieves the value of the attribute attrNm for this dynamic object.
void
if the value cannot be retrieved.
|
virtual |
Retrieves the first object identified by the argument id from the relation identified by the rel argument.
IlsDynRelation::getElement()
to retrieve the identified element.IlsViewedRel::getIdentifiedElement()
.You can override this method to retrieve relation elements in your own subclass of IlsDynObject
.
|
virtual |
Returns the element located at position index in the relation identified by rel.
null
if index is greater than the length of the relation. Returns the element located at position index in relation relNm.
null
if index is greater than the length of the relation.
|
virtual |
Assigns the value of the identifier attribute that has been declared to the server model interpreter.
This function registers the object to the dynamic dictionary, if any, and calls the beforeRename()
and afterRename()
functions.
|
static |
Retrieves an instance of the dynamic object that has been registered with the name id into the dictionary associated with the dynamic type.
If the useDictionary
property has been specified for the dynamic type, this type holds a dictionary and stores each instance in it. If the type does not hold any dictionary, the function looks up in a superclass for the instance.
|
virtual |
Returns the value of the identifier attribute, if this identifier has been declared for the corresponding attribute type. Otherwise, it returns the null string.
This function is invoked when an object is stored in a dynamic set relation.
Reimplemented from IlsViewed.
|
virtual |
Returns the implementation of the dynamic relation rel
.
|
virtual |
Must be called just after an object of type IlsDynObject
(or of a subclass) has been created.
This function has the following effects:
afterInit()
, documented below.
|
virtual |
Initializes a dynamic object whose type is typeNm.
IlsBoolean IlsDynObject::insertIntoRel | ( | const IlsString & | relNm, |
IlsViewed * | obj | ||
) |
Inserts a new target in the dynamic n-ary relation relNm.
IlsFalse
if the target cannot be added.
|
virtual |
Returns IlsTrue
if the target is in the relation.
Its behavior depends on whether the relation is dynamic or static.
IlsDynRelation::hasTarget()
.IlsViewedRel::hasElement()
. IlsBoolean IlsDynObject::isInDictionary | ( | ) | const |
Returns IlsTrue
if the object is stored in a dictionary.
removeFromDictionary()
. IlsBoolean IlsDynObject::isInitialized | ( | ) | const |
Returns IlsTrue
if the dynamic object has been initialized.
A dynamic object must be initialized by a call to the function initObject()
before it can be manipulated.
|
static |
Instantiates a dynamic object of the dynamic type typeNm.
If the dynamic object is an identified object (in other words, if an identifier attribute has been declared for this type), the identifier is assigned by the identifier argument.
If the dynamic type inherits from a static type, the type of the instantiated object will be the first static type found in the inheritance path. If there is no static type in the inheritance path, the member function IlsDynObjectFactory::newInstance()
is called to create a new dynamic object.
This function initializes the dynamic object by calling the function initObject()
after instantiation.
IlsBoolean IlsDynObject::setAttributeValue | ( | const IlsString & | attrNm, |
const IlsMvValue & | v | ||
) |
Assigns the value v to the attribute identified by the attrNm parameter.
IlsFalse
if the attribute does not belong to the associated type or if the value cannot be assigned.
|
virtual |
Assigns the value of the identifier attribute that has been declared to the server model interpreter.
This function registers the object to the dynamic dictionary, if any, and calls the beforeRename()
and afterRename()
functions.
IlsBoolean IlsDynObject::setRelTarget | ( | const IlsString & | relNm, |
IlsViewed * | obj | ||
) |
Assigns the target of the dynamic unary relation relNm.
IlsFalse
if the target cannot be set.
|
static |
Sets the value of the static attribute attrNm for the dynamic type typeNm.
Note that changing a static attribute does not trigger any notification. This function returns IlsTrue
if the attribute value has been assigned.