%ZEN.DataModel.ObjectDataModel
deprecated abstract class %ZEN.DataModel.ObjectDataModel extends %ZEN.DataModel.DataModel
This class is used to implement the Model portion of the Zen Model-View-Controller mechanism.An ObjectDataModel is specific type of DataModel 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 %ZEN.Component.dynaForm, the properties will be displayed in the following default ways:
- Private properties - Not displayed.
- Reference properties - Using a %ZEN.Component.dataCombo.
- Strings - Using a %ZEN.Component.text.
- Strings with MAXLEN over 250 - Using a %ZEN.Component.textarea.
- Numerics - Using a %ZEN.Component.text.
- Dates - Using a %ZEN.Component.dateText.
- Enumerated value (using VALUELIST) - Using a %ZEN.Component.radioSet or %ZEN.Component.comboBox.
Property Inventory
Method Inventory
- %CreateModelInstance()
- %DeleteModel()
- %GetJSValidationCode()
- %GetPropertyInfo()
- %OnCopyDataFromModel()
- %OnCopyDataToModel()
- %OnDeleteModel()
- %OnDeleteSource()
- %OnGetPropertyInfo()
- %OnLoadModel()
- %OnNewSource()
- %OnOpenSource()
- %OnSaveSource()
- %OnStoreModel()
- %OnSubmit()
- %OpenModel()
- %SaveModel()
- %SubmitHandler()
Parameters
parameter DOMAIN;
Localization domain.
DataModel classes that wish to support localization must provide a value for this
within subclasses.
parameter DYNAMICPROPERTIES = 1;
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, %data using the dynamic dispatch mechanism.
Set this to false to disable this feature.
Properties
property %source as %RegisteredObject (POPORDER = -1, XMLPROJECTION = "NONE") [ Transient ];
If needed, this transient property is used to hold a copy of the source
object used by this model.
Property methods: %sourceGet(), %sourceGetSwizzled(), %sourceIsValid(), %sourceNewObject(), %sourceSet()
Methods
classmethod %CreateModelInstance(pID As %String, pConcurrency As %Integer = -1, Output pSC As %Status = $$$OK) as %RegisteredObject
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).
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).
Delete a given DataModel instance.
This is implemented by the subclasses of this class by providing implementations of the %OnDeleteModel() and %OnDeleteSource() methods.
This is implemented by the subclasses of this class by providing implementations of the %OnDeleteModel() and %OnDeleteSource() methods.
classmethod %GetJSValidationCode() as %String
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.
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.
final classmethod %GetPropertyInfo(Output pInfo As %String, pExtended As %Boolean = 0, pModelId As %String = "", pContainer As %String = "") as %Status
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 %OnGetPropertyInfo() callback method.
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 %OnGetPropertyInfo() callback method.
abstract method %OnCopyDataFromModel(ByRef pData) as %Status
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.
pData is an array containing the values that will be provided to the controller, subscripted by property name.
abstract method %OnCopyDataToModel(ByRef pData) as %Status
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.
pData is an array containing the values provided by the controller, subscripted by property name.
This callback method is invoked when the DataModel is deleted.
This is implemented by the subclasses of this class.
This callback method is called when the DataModel is deleted. If
implemented, it is responsible for making the appropriate deletes
against the data source.
abstract classmethod %OnGetPropertyInfo(pIndex As %Integer, ByRef pInfo As %String, pExtended As %Boolean = 0, pModelId As %String = "", pContainer As %String = "") as %Status
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 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.
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.
method %OnLoadModel(pSource As %RegisteredObject) as %Status
This callback method does the actual work of loading values from the source object.
method %OnNewSource(Output pSC As %Status = $$$OK) as %RegisteredObject
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).
The default implementation returns the DataModel itself as the source object (this allows for simple DataModel classes that have no actual source object).
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 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).
The default implementation returns the DataModel itself as the source object (this allows for simple DataModel classes that have no actual source object).
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.
method %OnStoreModel(pSource As %RegisteredObject) as %Status
This callback method does the actual work of copying values
from the DataModel to the data source.
The default implementation is an expression method.
The default implementation is an expression method.
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.
The default implementation is to store the submitted values back to the model.
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.
final classmethod %OpenModel(pID As %String, pConcurrency As %Integer = -1, Output pSC As %Status = $$$OK) as %RegisteredObject
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 %OnLoadModel() 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.
The actual loading of the properties is carried out by the %OnLoadModel() 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.
final method %SaveModel() as %Status
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 %OnStoreModel() callback is invoked. This copies the properties of this model back to the data source object (if there is an independent data source).
The %OnSaveSource() callback is invoked. This causes the independent data source object to be saved.
Returns a status code indicating success or failure.
The actual save operation works as follows:
The %OnStoreModel() callback is invoked. This copies the properties of this model back to the data source object (if there is an independent data source).
The %OnSaveSource() callback is invoked. This causes the independent data source object to be saved.
Returns a status code indicating success or failure.
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.
If a form connected to this DataModel is submitted, this method handles the server-side processing of the submit.
Inherited Members
Inherited Properties
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %Extends()
- %GetParameter()
- %InvokeAction()
- %IsA()
- %IsModified()
- %IsReadOnly()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OnInvokeAction()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()