12.07.2015 Views

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

Using Zen Components - InterSystems Documentation

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Model3. Make these properties available to be consumed by a data controller.There are two variations on a data model class. Typically you will choose one of these as your parent class when you createa new data model. The variations are closely related, but serve different purposes. The available data model subclasses are%ZEN.DataModel.ObjectDataModel and %ZEN.DataModel.Adaptor, as shown in the following figure.Figure 6–2: Data Model Classes6.1.1 %ZEN.DataModel.ObjectDataModelA subclass of %ZEN.DataModel.ObjectDataModel is called an object data model. It defines one or more properties that adata controller component can consume. Each of these properties is correlated with a value from the data source class. Notevery value in the data source needs to be exposed in the model. This convention allows you to expose in the data modelonly those values that you wish to.An example of this might be a patient record, which contains confidential information that not every application shouldexpose. Keep in mind that when you use this option, the developer of the object data model class is responsible for implementingmethods to load values from a source into data model properties, store values back to a source, and validate values.This is in contrast to the adaptor data model, where <strong>Zen</strong> takes care of these details. However, this is not such a difficultprocedure.For more information about using %ZEN.DataModel.ObjectDataModel, consult the following sources:• For step by step instructions, see the section “Binding a to an Object Data Model.”• For code examples, use Studio to view the classes ZENMVC.FormDataModel and ZENMVC.FormDataModel2 in theSAMPLES namespace.<strong>Using</strong> <strong>Zen</strong> <strong>Components</strong> 153

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!