IlsViewed
 
IlsViewed
Category 
Static view-related class
Inheritance Path 
IlsRefCounted
IlsViewed
Description 
IlsViewed is the parent class of IlsEntity and IlsObject and, as such, the base class for any type of server object. This class is used as an argument to many functions of the class IlsMvView.
Library 
<server>
Header File 
#include <ilserver/viewed.h>
Synopsis 
class IlsViewed{
protected:
IlsViewed();
 
public:
virtual ~IlsViewed();
 
virtual IlsBoolean remove()=0;
Subscribing to an Object
IlsBoolean isViewOrigin();
virtual void onSubscribe(IlsView&){};
virtual void onUnsubscribe(IlsView&){};
void forceModify();
Dynamic Views
virtual IlsBoolean beginEdition(IlsMvView&,IlsRpUpdateType);
virtual IlsBoolean endEdition(IlsMvView&,
IlsRpUpdateType updType,
IlsBoolean isRollback);
virtual IlsBoolean acceptView(IlsMvUser* user,
const char* viewType);
virtual IlsTypeId getTypeId();
virtual IlsString getKeyIdentifier() const;
};
Constructor 
IlsViewed();
This is the protected constructor of the class.
Destructor 
virtual ~IlsViewed();
This is the virtual destructor of the class.
Member Functions 
[virtual] IlsBoolean remove()=0;
This pure virtual member function is used by a dynamic view server to remove a Server object. This function is overriden in classes IlsObject and IlsEntity. It can also be overriden in user-defined object and entity classes.
*If the function returns IlsTrue, the dynamic view server carries on with the current transaction.
*If the function returns IlsFalse, the current transaction is rolled back.
You can learn more about how the dynamic view server manages transactions in Transaction Control on class IlsMvServer.
void forceModify();
This member function lets you designate an object as “modified”, even if the relations in which it is involved or its entries or derived members have not been updated.
Subscribing to an Object
The first three functions below are supplied to maintain upward compatibility. They provide general information about the state of an object that a regular view subscribes to (as opposed to a multithreaded view). For efficiency reasons, multithreaded views do not update the information returned by these functions. However, you can still get this information by overriding the virtual functions onSubscribe and onUnsubscribe.
IlsBoolean isViewOrigin();
This member function is a predicate that returns IlsTrue if the object is the origin of at least one regular view.
[virtual] void onSubscribe(IlsView&){};
This empty virtual member function is called each time a view subscribes to the relation.
[virtual] void onUnsubscribe(IlsView&){};
This virtual member function is called each time a view cancels a subscription to the relation.
Dynamic Views
[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). 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:
*The first one is a reference to the dynamic view through which the object is modified.
*The second one indicates the type of modification that is carried out. This function returns IlsTrue but it can be overridden on the derived object types.
[virtual] IlsBoolean endEdition(IlsMvView&,
IlsRpUpdateType updType,
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). 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.
*The first argument is a reference to the dynamic view through which the object is modified.
*The second argument indicates the type of modification that is carried out, using the enumerated type IlsRpUpdateEnum. This function returns IlsTrue but it can be overridden on the derived object types.
*When the value of the parameter isRollback is IlsTrue, this indicates that the current transaction is being rolled back.
[virtual] IlsBoolean acceptView(IlsMvUser* user,
const char* viewType);
By overriding this virtual member function, you can control how a dynamic view is opened by a user. It is executed when:
*A request to retrieve the list of Server objects is received (see IlsMvComponent::getObjectIds). The member function is called for each one of the objects registered with the server whose label matches the pattern specified by the component. In this case, the viewType argument is null. If the member function returns IlsTrue, the label is included in the list sent to the component.
*A request to retrieve the list of available dynamic view types is received (see IlsMvComponent::getViewIds). The member function is called for each dynamic view type whose name matches the pattern specified by the component.
If the member function returns IlsTrue, the view type name is included in the list returned by the component.
*A request to open an instance of viewType is received (see the functions IlsMvComponent::openView and IlsMvServer::OpenView). Only if the member function returns IlsTrue is the view opened.
[virtual] IlsTypeId getTypeId();
This virtual member function returns the identifier that Rogue Wave Server associates with the actual type of the object. It is implicitly overridden in each Server class by the macros ILS_OBJECT_DECL or ILS_ENTITY_DECL.
[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.
See Also 
IlsEntity, ILS_ENTITY_DECL, IlsMvComponent, IlsMvServer, IlsMvView, IlsMsgEncoder, IlsObject, ILS_OBJECT_DECL

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.