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 (IlsEntity &rhs) | |
Copy constructor. The identifier is copied as well. | |
IlsEntity (IlsIdentifier id, IlsActivity activity=IlsModel::GetDefaultActivity()) | |
virtual | ~IlsEntity () |
Virtual destructor. | |
IlsActivity | getActivity () const |
Cutting Relations | |
virtual void | cut (ILS_CUT_DIRECTIVE=ILS_ALL) |
Identifiers | |
IlsIdentifier | getIdentifier () const |
virtual IlsString | getKeyIdentifier () const |
IlsEntity * | getEntity () |
void | rename (IlsIdentifier) |
void | setEntityContext (IlsEntityContext &) |
void | unsetEntityContext (IlsEntityContext &) |
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 () |
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... | |
void | onRmFromDictionary () |
During a notification phase, this member function returns IlsTrue if the entity identifier has been modified since the last notification phase. | |
void | removeFromDictionaries () |
During a notification phase, this member function returns IlsTrue if the entity identifier has been modified since the last notification phase. | |
Locking Entities | |
virtual IlsBoolean | lock () |
virtual IlsBoolean | unlock () |
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 |
\short 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 |
\short Returns \c ILS_ACTIVE if the entity has been set
as active. Otherwise, it returns ILS_INACTIVE
.
For details, see the constructor.
IlsEntity* IlsEntity::getEntity | ( | ) |
\short Returns the identifier stored in the class
IlsEntity
. Thus, you do not have to store this identifier in the derived type.
IlsIdentifier IlsEntity::getIdentifier | ( | ) | const |
\short Returns the identifier stored in the class
IlsEntity
. Thus, you do not have to store this identifier in the derived type.
|
virtual |
|
virtual |
\short Locks the entity, and returns \c
IlsTrue once the entity is locked.
Reimplemented in IlsSafelyLockableEntity, and IlsLockableEntity.
|
virtual |
void IlsEntity::rename | ( | IlsIdentifier | ) |
\short 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. |
void IlsEntity::setEntityContext | ( | IlsEntityContext & | context | ) |
\short Returns the identifier stored in the class
IlsEntity
. Thus, you do not have to store this identifier in the derived type.
|
virtual |
\short Unlocks the entity and returns \c
IlsTrue once the entity is unlocked.
Reimplemented in IlsSafelyLockableEntity, and IlsLockableEntity.
void IlsEntity::unsetEntityContext | ( | IlsEntityContext & | context | ) |
\short Returns the identifier stored in the class
IlsEntity
. Thus, you do not have to store this identifier in the derived type.