Rogue Wave Server
API Reference Guide
Product Documentation:

Rogue Wave Server
Documentation Home
List of all members | Public Member Functions
IlsEntity Class Reference

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>

Inheritance diagram for IlsEntity:
IlsLockableEntity IlsMvUser IlsSafelyLockableEntity

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.
 

Detailed Description

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.

See also
IlsException, IlsDerived, IlsEntry, IlsIdentifier, IlsModel, IlsObject, IlsOwns, IlsOwnsDynamicArray, IlsOwnsFixedArray, IlsOwnsList, IlsOwnsSet, IlsString, IlsUses, IlsUsesDynamicArray, IlsUsesFixedArray, IlsUsesList, IlsUsesSet, IlsViewed.

Constructor & Destructor Documentation

§ IlsEntity()

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.

Member Function Documentation

§ areUsersModified()

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.

§ cut()

virtual void IlsEntity::cut ( ILS_CUT_DIRECTIVE  = ILS_ALL)
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.
Exceptions
IlsUpdateForbiddenIf the function isUpdateAllowed(), described below, returns IlsFalse.

§ getActivity()

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.

§ remove()

IlsBoolean IlsEntity::remove ( )
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.

§ rename()

void IlsEntity::rename ( IlsIdentifier  )

Renames the identifier stored in the class IlsEntity. This function automatically maintains consistency in the dictionary containing the entity.

Exceptions
IlsUpdateForbiddenIf the function isUpdateAllowed returns IlsFalse.
IlsAlreadyInDictionaryIf 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.