%ZEN.DataModel.DataModel
Class %ZEN.DataModel.DataModel Extends %RegisteredObject [ Abstract, DependsOn = (%ZEN.Generator, %ZEN.DataModelUtils), Deprecated, System = 3 ]
This is the abstract base class used by all model classes within the Zen Model-View-Controller mechanism.
Subclasses of this class are used to implement the Model portion of the Zen Model-View-Controller mechanism.
A DataModel class provides a generic mechanism to take data values from one or more sources (such as from a persistent object, external database, or directly from a global) and place these values into the properties of the DataModel.
Parameters
READONLYMODEL
Parameter READONLYMODEL As BOOLEAN = 0;
If this parameter is true, then this is a read-only data model. Instances of this data model cannot be saved or deleted.
Properties
%id
Property %id As %ZEN.Datatype.string(XMLPROJECTION = "NONE") [ ClientName = dataModelId, Transient ];
The ID value used to identify a specific instance of DataModel object.
The form and possible values of the ID are up the implementor of a specific DataModel class.
%seriesCount
Property %seriesCount As %ZEN.Datatype.integer(XMLPROJECTION = "NONE") [ InitialExpression = 1, Transient ];
Number of data series contained within the data model.
%seriesNames
Property %seriesNames As %ZEN.Datatype.string(XMLPROJECTION = "NONE") [ MultiDimensional, Transient ];
An array containing the display names for data series subscripted by series number (1-based).
Methods
%OpenModel
ClassMethod %OpenModel(pID As %String, pConcurrency As %Integer = -1, Output pSC As %Status = {$$$OK}) As %RegisteredObject
Create an in-memory instance of a DataModel object and load data into it properties.
This is implemented by the subclasses of this class. The signature of this method is designed to match the %OpenId method of persistent classes.
%OnOpenSource
Method %OnOpenSource(pID As %String, pConcurrency As %Integer = -1, Output pSC As %Status = {$$$OK}) As %RegisteredObject
This callback method is invoked when a DataModel is opened. If implemented, it opens an instance of the data source object used by the DataModel.
%OnNewSource
Method %OnNewSource(Output pSC As %Status = {$$$OK}) As %RegisteredObject
This callback method is invoked when a DataModel needs a new instance. If implemented, it opens a new (unsaved) instance of the data source object used by the DataModel.
%OnLoadModel
Method %OnLoadModel(pSource As %RegisteredObject) As %Status
This callback method does the actual work of loading values from the data source into this DataModel object.
%SaveModel
Method %SaveModel() As %Status
Save the data in this instance of DataModel back to its original source, if possible.
This is implemented by the subclasses of this class.
%OnStoreModel
Method %OnStoreModel(pSource As %RegisteredObject) As %Status
This callback method does the actual work of copying values from the DataModel to the data source.
%OnSaveSource
Method %OnSaveSource(pSource As %RegisteredObject) As %Status
This callback method is called when the DataModel is saved. If implemented, it is responsible for saving changes to the data source.
%DeleteModel
ClassMethod %DeleteModel(pID As %String) As %Status
Delete a given DataModel instance.
This is implemented by the subclasses of this class.
%OnDeleteModel
ClassMethod %OnDeleteModel(pID As %String) As %Status
This callback method is invoked when the DataModel is deleted. This is implemented by the subclasses of this class.
%OnDeleteSource
ClassMethod %OnDeleteSource(pID As %String) As %Status
This callback method is called when the DataModel is deleted. If implemented, it is responsible for making the appropriate deletes against the data source.
%IsReadOnly
ClassMethod %IsReadOnly() As %Boolean [ CodeMode = expression ]
Returns whether this data model class is readonly.
%InvokeAction
Method %InvokeAction(pAction As %String, pData As %String) As %Status [ Final ]
Invoke a user-defined named action on this model object.
The actual work of perfoming the action is carried out by the %OnInvokeAction callback method.
%OnInvokeAction
Method %OnInvokeAction(pAction As %String, pData As %String) As %Status
Invoke a user-defined named action on this model object.
This is implemented by the subclasses of this class.
%CopyDataToModel
Method %CopyDataToModel(ByRef pData) As %Status [ Internal ]
Internal method.
Called by the dataController to move data into this model. Copies the values in the array pData (subscripted by property name) into this data model.
%CopyDataFromModel
Method %CopyDataFromModel(Output pData, Output pTypes) As %Status [ Internal ]
Internal method.
Called by the dataController to get data from this model. Copies the values in the data demo to the array pData (subscripted by property name). pTypes holds type information about the properties, as needed.
%GetPropertyInfo
ClassMethod %GetPropertyInfo(Output pList As %String, pExtended As %Boolean = 0, pContainer As %String = "") As %Status
Return a list describing the properties within this DataModel.
These are returned as an array of the form:
pList(propname) = seqno
seqno, if present, is the ordinal position of this control on the form.
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. The extra nodes may include:
pList(name,"%type") = suggested control type for dynaForm<.br> pList(name,"size") = size used for controls.
pList(name,"group") = id of group within dynaForm to place control.
pContainer is the name of the containing property if this data model is embedded in another data model object.
%OnGetPropertyInfo
ClassMethod %OnGetPropertyInfo(pIndex As %Integer, ByRef pList As %String, pExtended As %Boolean = 0) As %Status [ Abstract ]
This callback method, if present, is called by the %GetPropertyInfo method. This gives subclasses the opportunity to add additional property descriptions to the DataModel.
pIndex is the number of elements (plus one) already in the list. This should be used as a starting sequence number when adding new properties to the list.
%GetPropertyList
ClassMethod %GetPropertyList(pModelId As %String) As %String [ Internal ]
Return a comma-delimited list of properties within this DataModel, including any virtual properties provided by the %OnGetPropertyInfo A property may optionally specify a type, such as "Memo:stream".
%SubmitHandler
ClassMethod %SubmitHandler(pSubmit As %ZEN.Submit) As %Status
Internal method.
If a form connected to this DataModel is submitted, this method handles the server-side processing of the submit.
%OnSubmit
Method %OnSubmit(pSubmit As %ZEN.Submit) As %Status
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.