InterSystems IRIS Data Platform 2019.2  /  Using Studio

Using Studio
Adding Projections to a Class
Previous section           Next section
InterSystems: The power behind what matters   

This chapter discusses how to add projection definitions in a class definition.
A projection definition instructs the InterSystems IRIS class compiler to perform specified operations when a class definition is compiled or removed. A projection defines the name of a projection class (derived from the %Projection.AbstractProjection class) that implements methods that are called when either of the following is true:
A class can contain any number of projection definitions. The actions for all of them are invoked when the class is compiled (the order in which they are invoked is not defined).
InterSystems IRIS includes predefined projection classes that generate client code that allows access to a class from Java, MV, and so on.
Projection Classes
Class Description
%Projection.Java Generates a Java client class to enable access to the class from Java.
%Projection.Monitor Registers this class as a routine that works with Log Monitor. Metadata is written to Monitor.Application, Monitor.Alert, Monitor.Item and Monitor.ItemGroup. A new persistent class is created called Monitor.Sample.
%Projection.MV Generates an MV class that enables access to the class from MV.
%Projection.StudioDocument Registers this class as a routine that works with Studio.
%Studio.Extension.Projection Projects the XData 'menu' block to the menu table.
You can also create your own projection classes and use them from Studio as you would any built-in projection class.
You can add a new projection to a class definition in two ways:
To add a projection using the Class Editor, position the cursor at a blank line and enter a projection declaration.
Alternatively, you can copy and paste an existing projection declaration and then edit it.
For details, see “Projection Definitions” in the Class Definition Reference.
New Projection Wizard
You can invoke the New Projection wizard by selecting Class > Add > Projection. Alternatively right-click in the Class Inspector and select Add > New Projection.
The New Projection wizard displays pages prompting you for information about the new projection. You can click Finish before completing all of the wizard pages; in this case, default values are provided for any information you have not specified.
Name and Description Page
The New Projection wizard prompts you for the following information (you can later modify any of these values):
Projection Name
(required) Name of the new projection. This name must be a valid projection name and must not conflict with the name of a previously defined projection.
See the section “Class Members” in the appendix “Rules and Guidelines for Identifiers” in the Orientation Guide for Server-Side Programming.
(optional) Description of the new projection.
Projection Type Page
The projection type determines what actions happen when your class definition is compiled or removed. You can select what kind of projection you would like to define.
Projection Type
Name of a projection class whose methods are executed when a class definition is compiled or removed.
Projection Parameters
A set of name-value pairs that control the behavior of the projection class. The list of available parameter names is determined by the selected projection class.
Results of Running the New Projection Wizard
When you finish running the New Projection wizard, the Class Editor window is updated to include the new projection definition. For example:
/// This is a Person class
class MyApp.Person extends %Persistent 

Property Name As %String;

Projection JavaClient As %Projection.Java;
To edit this projection definition, use either the Class Editor or the Class Inspector.

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-10-18 05:16:51