The class IlsEntity
is a base class for classes declaring server data members: derived data members, entry data members, and relations.
More...
#include <ilserver/model.h>
Public Member Functions | |
IlsEntity (IlsIdentifier id, IlsActivity activity=IlsModel::GetDefaultActivity()) | |
IlsEntity (IlsEntity &rhs) | |
Copy constructor. The identifier is copied as well. | |
virtual | ~IlsEntity () |
Virtual destructor. | |
IlsActivity | getActivity () const |
Returns ILS_ACTIVE if the entity has been set as active. Otherwise, it returns ILS_INACTIVE . More... | |
virtual IlsString | getKeyIdentifier () const |
This virtual member function is used in subclasses of IlsViewed (see the IlsDynObject class). By default, it returns a null string. | |
Cutting Relations | |
virtual void | cut (ILS_CUT_DIRECTIVE=ILS_ALL) |
Cuts all the relations of which the entity is the target. More... | |
Identifiers | |
IlsIdentifier | getIdentifier () const |
Returns the identifier stored in the class IlsEntity . Thus, you do not have to store this identifier in the derived type. | |
void | rename (IlsIdentifier) |
Renames the identifier stored in the class IlsEntity . This function automatically maintains consistency in the dictionary containing the entity. More... | |
Notification | |
IlsBoolean | isIdentifierModified () |
During a notification phase, this member function returns IlsTrue if the entity identifier has been modified since the last notification phase. | |
IlsIdentifier | getOldIdentifier () |
During a notification phase, this member function returns the old identifier of the entity. It returns a null smart pointer if the entity has not been modified since the last notification phase. | |
IlsBoolean | remove () |
Overrides the function IlsViewed::remove() . More... | |
IlsBoolean | areUsersModified () |
During a notification phase, this function returns IlsTrue if a use relation has been added or removed since the last notification phase. More... | |
Locking Entities | |
virtual IlsBoolean | lock () |
Locks the entity, and returns IlsTrue once the entity is locked. | |
virtual IlsBoolean | unlock () |
Unlocks the entity and returns IlsTrue once the entity is unlocked. | |
virtual IlsBoolean | trylock () |
Tries to lock the entity. It returns IlsFalse if the operation fails. | |
virtual IlsBoolean | isUpdateAllowed () |
By default, this virtual member function returns IlsFalse when the entity is locked and IlsTrue if you have the right to modify the entity. It is called if the static member function IlsModel::SetUpdateChecked() returns IlsTrue . | |
The class IlsEntity
is a base class for classes declaring server data members: derived data members, entry data members, and relations.
Library: server
Instances of a class deriving from IlsEntity
can be the target of a use relation, but cannot be the target of an ownership relation. This rule will be enforced at compile time.
IlsEntity::IlsEntity | ( | IlsIdentifier | id, |
IlsActivity | activity = IlsModel::GetDefaultActivity() |
||
) |
As its first argument, the constructor of an entity takes an identifier of type IlsIdentifier
. This identifier behaves like an instance of IlsString
and thus, like a character string. The identifier is stored in IlsEntity
. Consequently, you just have to pass the identifier to the constructor of IlsEntity
when deriving from this class.
The argument activity
specifies whether the entity is active or not. An entry is active if its modification sets off the recomputation of derived data members. The default value is the one returned by the static member function IlsModel::GetDefaultActivity()
, which is ILS_INACTIVE
by default.
IlsBoolean IlsEntity::areUsersModified | ( | ) |
During a notification phase, this function returns IlsTrue
if a use relation has been added or removed since the last notification phase.
These functions return IlsFalse
by default. They are meant to be overridden.
|
virtual |
Cuts all the relations of which the entity is the target.
The argument supplied to this function is an enumerated type that provides the following three values:
ILS_ALL
cuts all relations;ILS_USE
cuts use relations only. In the case of an entity, this value is equivalent to ILS_ALL
;ILS_OWNERSHIP
cuts the ownership relation. This value does not apply to an entity.IlsUpdateForbidden | If the function isUpdateAllowed() , described below, returns IlsFalse . |
IlsActivity IlsEntity::getActivity | ( | ) | const |
Returns ILS_ACTIVE
if the entity has been set as active. Otherwise, it returns ILS_INACTIVE
.
For details, see the constructor.
|
virtual |
Overrides the function IlsViewed::remove()
.
It removes the entity from each dictionary in which it is stored. Then, it calls the cut()
function and notifies components that the entity is to be deleted. This function always returns IlsTrue
.
Implements IlsViewed.
void IlsEntity::rename | ( | IlsIdentifier | ) |
Renames the identifier stored in the class IlsEntity
. This function automatically maintains consistency in the dictionary containing the entity.
IlsUpdateForbidden | If the function isUpdateAllowed returns IlsFalse . |
IlsAlreadyInDictionary | If the identifier passed as its argument is already contained in one of the dictionaries storing the entity. |
© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.