Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

Creating a New Class

Begin by creating the Contact class using the Studio New Class Wizard:

  1. Click File–>New on the Studio menu bar.

    generated description: studiofilenew 20112

  2. On the New dialog, click the General category and then the Caché Class Definition template. Click OK. This launches the New Class Wizard.

    generated description: newclass1 20142

  3. On the first page of the New Class Wizard , enter ContactDB for the Package Name and Contact for the Class Name. Click Next.

    generated description: newclass2 20111

  4. The Wizard's second page allows you to select the class type. Click Persistent and then click Next.

    generated description: newclass3 20111

  5. The Wizard's third page allows you to specify additional characteristics for the class. Click XML Enabled, Zen DataModel, and Data Population. Click Finish.

    generated description: newclass4 20112

  6. The Studio Editor displays the newly created class definition:

    generated description: newclass5 20112

  7. Notice that Contact extends several classes:

    • %Persistent—We chose this when we selected the class type at step 4. Extending %Persistent allows instances of our Contact class to be saved in the database.

    • %Populate—We chose this when we selected additional characteristics at step 5. Extending %Populate allows Contact to use the Caché auto-population features for generating test data.

    • %XML.Adaptor—We chose this when we selected additional characteristics at step 5. Extending %XML.Adaptor allows Contact to be used with Caché's XML tools. For example, we can export Contact instances as XML and use Contact in Web Services scenarios. We will not be using these features in this tutorial.

    • %ZEN.DataModel.Adaptor—We chose this when we selected additional characteristics at step 5. Extending %ZEN.DataModel.Adaptor allows Contact to interact easily with the ZEN web framework. In particular, it allows us to easily create Zen forms for creating and updating Contact instances.

Note:

To learn more about Caché XML tools, read Using Caché XML Tools.

%ZEN.DataModel.Adaptor is part of the Zen MVC (Model-View-Controller) framework. To learn more about Zen MVC, read Model View Controller in Using Zen Components.

Feedback