IRISLIB database
ObjectDataModel Class Reference

This class is used to implement the Model portion of the Zen Model-View-Controller mechanism. More...

Inheritance diagram for ObjectDataModel:
Collaboration diagram for ObjectDataModel:

Static Public Attributes

 DOMAIN = None
 This class is used to implement the Model portion of the Zen Model-View-Controller mechanism. More...
 
 DYNAMICPROPERTIES = None
 If true (the default), then this dataModel class supports dynamic properties: More...
 
- Static Public Attributes inherited from DataModel
 READONLYMODEL = None
 This is the abstract base class used by all model classes within the Zen Model-View-Controller mechanism. More...
 
- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Private Member Functions

_.Library.Status OnCopyDataFromModel (pData)
 If defined, this callback method is invoked just as this DataModel object. More...
 
_.Library.Status OnCopyDataToModel (pData)
 If defined, this callback method is invoked just before the dataController. More...
 
_.Library.Status OnLoadModel (_.Library.RegisteredObject pSource)
 This callback method does the actual work of loading values from the source object.
 
_.Library.RegisteredObject OnNewSource (_.Library.Status pSC)
 This callback method is invoked when a new instance of DataModel is required. More...
 
_.Library.RegisteredObject OnOpenSource (_.Library.String pID, _.Library.Integer pConcurrency, _.Library.Status pSC)
 This callback method is invoked when a DataModel is loaded into memory. More...
 
_.Library.Status OnSaveSource (_.Library.RegisteredObject pSource)
 This callback method is called when the DataModel is saved. More...
 
_.Library.Status OnStoreModel (_.Library.RegisteredObject pSource)
 This callback method does the actual work of copying values. More...
 
_.Library.Status OnSubmit (_.ZEN.Submit pSubmit)
 If defined, this callback is called when a form connected to this. More...
 
_.Library.Status SaveModel ()
 Save the values currently within this DataModel object back to a data source. More...
 

Static Private Member Functions

_.Library.RegisteredObject CreateModelInstance (_.Library.String pID, _.Library.Integer pConcurrency, _.Library.Status pSC)
 Create an instance of this DataModel object. More...
 
_.Library.Status DeleteModel (_.Library.String pID)
 Delete a given DataModel instance. More...
 
_.Library.String GetJSValidationCode ()
 Internal method. More...
 
_.Library.Status GetPropertyInfo (_.Library.String pInfo, _.Library.Boolean pExtended, _.Library.String pModelId, _.Library.String pContainer)
 Return an array, subscripted by property name, describing the properties within this DataModel. More...
 
_.Library.Status OnDeleteModel (_.Library.String pID)
 This callback method is invoked when the DataModel is deleted. More...
 
_.Library.Status OnDeleteSource (_.Library.String pID)
 This callback method is called when the DataModel is deleted. More...
 
_.Library.Status OnGetPropertyInfo (_.Library.Integer pIndex, _.Library.String pInfo, _.Library.Boolean pExtended, _.Library.String pModelId, _.Library.String pContainer)
 This callback method, if present, is called by the <method>GetPropertyInfo</method> More...
 
_.Library.RegisteredObject OpenModel (_.Library.String pID, _.Library.Integer pConcurrency, _.Library.Status pSC)
 Open and return an instance of this DataModel object (given an id value pID and. More...
 
_.Library.Status SubmitHandler (_.ZEN.Submit pSubmit)
 Internal method. More...
 

Additional Inherited Members

- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Detailed Description

This class is used to implement the Model portion of the Zen Model-View-Controller mechanism.


An ObjectDataModel is specific type of <class>DataModel</class> that contains a set of named values (properties).
The properties of an ObjectDataModel can either be formally defined within the ObjectDataModel class, or they can be "virtual" properties - properties defined at run-time.
When an ObjectDataModel is displayed using a <class>ZEN.Component.dynaForm</class>, the properties will be displayed in the following default ways:

  • Private properties - Not displayed.
  • Reference properties - Using a <class>ZEN.Component.dataCombo</class>.
  • Strings - Using a <class>ZEN.Component.text</class>.
  • Strings with MAXLEN over 250 - Using a <class>ZEN.Component.textarea</class>.
  • Numerics - Using a <class>ZEN.Component.text</class>.
  • Dates - Using a <class>ZEN.Component.dateText</class>.
  • Enumerated value (using VALUELIST) - Using a <class>ZEN.Component.radioSet</class> or <class>ZEN.Component.comboBox</class>.

Member Function Documentation

◆ CreateModelInstance()

_.Library.RegisteredObject CreateModelInstance ( _.Library.String  pID,
_.Library.Integer  pConcurrency,
_.Library.Status  pSC 
)
staticprivate

Create an instance of this DataModel object.


Subclasses may override this for special behavior.
The default implementation returns the DataModel itself as the source object (this allows for simple DataModel classes that have no actual source object).

Reimplemented in Adaptor.

◆ DeleteModel()

_.Library.Status DeleteModel ( _.Library.String  pID)
staticprivate

Delete a given DataModel instance.


This is implemented by the subclasses of this class by providing implementations of the <method>OnDeleteModel</method> and <method>OnDeleteSource</method> methods.

Reimplemented from DataModel.

◆ GetJSValidationCode()

_.Library.String GetJSValidationCode ( )
staticprivate

Internal method.


This generated method contructs client-side JS validation code for the properties within this provider. The client-side code is returned as a string that is converted to JS function at run-time.

◆ GetPropertyInfo()

_.Library.Status GetPropertyInfo ( _.Library.String  pInfo,
_.Library.Boolean  pExtended,
_.Library.String  pModelId,
_.Library.String  pContainer 
)
staticprivate

Return an array, subscripted by property name, describing the properties within this DataModel.


These are returned as an array of the form:
pInfo(name) = seqno
If pExtended is true (1), then the array will include additional nodes for each property. This information is used to create dynamic forms for this model.
Applications should not change this method. To modify the information returned by this method, override the <method>OnGetPropertyInfo</method> callback method.

◆ OnCopyDataFromModel()

_.Library.Status OnCopyDataFromModel (   pData)
private

If defined, this callback method is invoked just as this DataModel object.

is about to copy its values into a dataController.
pData is an array containing the values that will be provided to the controller, subscripted by property name.

◆ OnCopyDataToModel()

_.Library.Status OnCopyDataToModel (   pData)
private

If defined, this callback method is invoked just before the dataController.

copies its values into the properties of this DataModel object.
pData is an array containing the values provided by the controller, subscripted by property name.

◆ OnDeleteModel()

_.Library.Status OnDeleteModel ( _.Library.String  pID)
staticprivate

This callback method is invoked when the DataModel is deleted.

This is implemented by the subclasses of this class.

Reimplemented from DataModel.

◆ OnDeleteSource()

_.Library.Status OnDeleteSource ( _.Library.String  pID)
staticprivate

This callback method is called when the DataModel is deleted.

If

implemented, it is responsible for making the appropriate deletes against the data source.

Reimplemented from DataModel.

Reimplemented in Adaptor.

◆ OnGetPropertyInfo()

_.Library.Status OnGetPropertyInfo ( _.Library.Integer  pIndex,
_.Library.String  pInfo,
_.Library.Boolean  pExtended,
_.Library.String  pModelId,
_.Library.String  pContainer 
)
staticprivate

This callback method, if present, is called by the <method>GetPropertyInfo</method>

method. This gives subclasses the opportunity to add additional property descriptions to the DataModel.
pIndex is the index number that should be used to add the next property to the list.
pInfo is a multidimensional array containing information about the properties of this data model.
If pExtended is true, then complete information about the properties should be returned; if false, then only property names need be returned (applications can simply ignore this).
pModelId is the id value of the current Data Model instance. This is provided for cases where the contents of a dynamic form may vary by instance of the Data Model object.

◆ OnNewSource()

_.Library.RegisteredObject OnNewSource ( _.Library.Status  pSC)
private

This callback method is invoked when a new instance of DataModel is required.

If implemented, it returns a new instance of the data source object used by the DataModel.
The default implementation returns the DataModel itself as the source object (this allows for simple DataModel classes that have no actual source object).

Reimplemented from DataModel.

◆ OnOpenSource()

_.Library.RegisteredObject OnOpenSource ( _.Library.String  pID,
_.Library.Integer  pConcurrency,
_.Library.Status  pSC 
)
private

This callback method is invoked when a DataModel is loaded into memory.

If implemented, it loads an instance of the data source object used by the DataModel.
The default implementation returns the DataModel itself as the source object (this allows for simple DataModel classes that have no actual source object).

Reimplemented from DataModel.

Reimplemented in Adaptor.

◆ OnSaveSource()

_.Library.Status OnSaveSource ( _.Library.RegisteredObject  pSource)
private

This callback method is called when the DataModel is saved.

If

implemented, it is responsible for saving changes to the data source.

Reimplemented from DataModel.

Reimplemented in Adaptor.

◆ OnStoreModel()

_.Library.Status OnStoreModel ( _.Library.RegisteredObject  pSource)
private

This callback method does the actual work of copying values.

from the DataModel to the data source.
The default implementation is an expression method.

Reimplemented from DataModel.

◆ OnSubmit()

_.Library.Status OnSubmit ( _.ZEN.Submit  pSubmit)
private

If defined, this callback is called when a form connected to this.

DataModel is submitted.
The contents of this DataModel will be filled in from the submitted values before this callback is invoked.
The default implementation is to store the submitted values back to the model.

Reimplemented from DataModel.

Reimplemented in reportPage.

◆ OpenModel()

_.Library.RegisteredObject OpenModel ( _.Library.String  pID,
_.Library.Integer  pConcurrency,
_.Library.Status  pSC 
)
staticprivate

Open and return an instance of this DataModel object (given an id value pID and.

fill in its property values.
The actual loading of the properties is carried out by the <method>OnLoadModel</method> method. The property values can come from an independent data source object or may be local to this data model object.
If pID is "", then a new instance of data model object should be created.
pConcurrency is an optional concurrency flag that can be used in cases where the data source is a persistent object.
On return, pSC contains a status code indicating success of failure.

Reimplemented from DataModel.

◆ SaveModel()

_.Library.Status SaveModel ( )
private

Save the values currently within this DataModel object back to a data source.

Before saving, the values of the properties will be validated (as specified by the property definitions).
The actual save operation works as follows:
The <method>OnStoreModel</method> callback is invoked. This copies the properties of this model back to the data source object (if there is an independent data source).
The <method>OnSaveSource</method> callback is invoked. This causes the independent data source object to be saved.
Returns a status code indicating success or failure.

Reimplemented from DataModel.

◆ SubmitHandler()

_.Library.Status SubmitHandler ( _.ZEN.Submit  pSubmit)
staticprivate

Internal method.


If a form connected to this DataModel is submitted, this method handles the server-side processing of the submit.

Reimplemented from DataModel.

Member Data Documentation

◆ DOMAIN

DOMAIN = None
static

This class is used to implement the Model portion of the Zen Model-View-Controller mechanism.


An ObjectDataModel is specific type of <class>DataModel</class> that contains a set of named values (properties).
The properties of an ObjectDataModel can either be formally defined within the ObjectDataModel class, or they can be "virtual" properties - properties defined at run-time.
When an ObjectDataModel is displayed using a <class>ZEN.Component.dynaForm</class>, the properties will be displayed in the following default ways:

  • Private properties - Not displayed.
  • Reference properties - Using a <class>ZEN.Component.dataCombo</class>.
  • Strings - Using a <class>ZEN.Component.text</class>.
  • Strings with MAXLEN over 250 - Using a <class>ZEN.Component.textarea</class>.
  • Numerics - Using a <class>ZEN.Component.text</class>.
  • Dates - Using a <class>ZEN.Component.dateText</class>.
  • Enumerated value (using VALUELIST) - Using a <class>ZEN.Component.radioSet</class> or <class>ZEN.Component.comboBox</class>.

Localization domain.

DataModel classes that wish to support localization must provide a value for this within subclasses.

◆ DYNAMICPROPERTIES

DYNAMICPROPERTIES = None
static

If true (the default), then this dataModel class supports dynamic properties:

that is, you can reference arbitrary property names within the data model object. Any such properties that are not formally defined will refer to a location within the private property, <property>data</property> using the dynamic dispatch mechanism. Set this to false to disable this feature.