The Zen Proxy class provides a way to assemble data that can be conveniently passed between the web client and the server. More...
Public Member Functions | |
_.Library.Status | SaveDocument (_.ZEN.Datatype.string pWhere, _.ZEN.Datatype.string pDocumentID) |
SaveDocument will save the proxyObject to a global or local variable reference (GLVN) with the specified pDocumentID. More... | |
![]() | |
_.Library.Status | OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount) |
This callback method is invoked when the current object is added to the SaveSet,. More... | |
_.Library.Status | OnClose () |
This callback method is invoked by the <METHOD>Close</METHOD> method to. More... | |
_.Library.Status | OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned) |
This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More... | |
_.Library.Status | OnNew () |
This callback method is invoked by the <METHOD>New</METHOD> method to. More... | |
_.Library.Status | OnValidateObject () |
This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More... | |
Static Public Member Functions | |
_.Library.Status | DeleteDocument (_.ZEN.Datatype.string pWhere, _.ZEN.Datatype.string pDocumentID) |
DeleteDocument will delete a document identified by ID from the specified global or local variable reference (GLVN). More... | |
_.ZEN.Datatype.boolean | DocumentExists (_.ZEN.Datatype.string pWhere, _.ZEN.Datatype.string pDocumentID) |
DocumentExists() returns a boolean value indicate whether or not the documentID exists in the global/local variable reference (GLVN). More... | |
_.ZEN.proxyObject | OpenDocument (_.ZEN.Datatype.string pWhere, _.ZEN.Datatype.string pDocumentID, _.Library.Status pStatus) |
OpenDocument will retrieve a previously saved document from the specified global or local variable reference (GLVN) with the specified pDocumentID More... | |
_.ZEN.proxyObject | OpenEmbeddedDocument (_.ZEN.Datatype.string pWhere, _.ZEN.Datatype.string pDocumentID, _.ZEN.Datatype.string pObjectID, _.Library.Status pStatus) |
OpenEmbeddedDocument will retrieve a document embedded in a previously saved document from the specified global or local variable reference (GLVN) with the specified pDocumentID More... | |
Private Member Functions | |
Clear () | |
The Zen Proxy class provides a way to assemble data that can be conveniently passed between the web client and the server. More... | |
CopyFromArray (pArray) | |
Copy the values from a local array. More... | |
CopyToArray (pArray) | |
Copy the properties in this proxyObject into. More... | |
Additional Inherited Members | |
![]() | |
CAPTION = None | |
Optional name used by the Form Wizard for a class when generating forms. More... | |
JAVATYPE = None | |
The Java type to be used when exported. | |
PROPERTYVALIDATION = None | |
This parameter controls the default validation behavior for the object. More... | |
The Zen Proxy class provides a way to assemble data that can be conveniently passed between the web client and the server.
It works in conjunction with the zenProxy JavaScript class defined in zenutils.js. The zenProxy class is the client-side representation of the server-side <class>ZEN.proxyObject</class> class and vice versa.
The <class>ZEN.proxyObject</class> class is useful for cases where you do not know what run-time properties will exist when you are designing your application (perhaps it is user-configurable).
The proxy class can be used in several ways. You can use it to send an arbitrary set of data values from the client to a server-side method. To do this, create an instance of zenProxy in a client-side JavaScript method:
// create instance of zenProxy var obj = new zenProxy(); obj.name = 'Smith'; obj.code = 'CRM114';
The zenProxy object is basically a generic JavaScript object with a few pre-defined behaviors. You can dynamically add properties to it simply by setting them. These properties should have literal values, that is, they should not refer to other JavaScript objects.
If you define a server-side ZenMethod whose signature includes an argument of type <class>ZEN.proxyObject</class>, then you can invoke this method from the client passing it an instance of a zenProxy object. Zen will automatically marshal the values in the zenProxy object into an instance of the <class>ZEN.proxyObject</class> object.
For example, suppose you have defined a server method:
ClassMethod MyMethod(pProxy as ZEN.proxyObject) As Boolean [ZenMethod] { Set tName = pProxy.name Set tCode = pProxy.code Quit 1 }
The client can invoke this method as it would any other Zen method, passing an instance of zenProxy as the pProxy argument:
var obj = new zenProxy(); obj.name = 'Smith'; obj.code = 'CRM114'; var ok = this.MyMethod(obj);
The <method>MyMethod</method> method will see the values 'Smith' and 'CRM114' for the properties <property>name</property> and <property>code</property>, respectively.
You can also use the <class>ZEN.proxyObject</class> class to pass values from a server method back to the client. To do this, create a server method whose return type is <class>ZEN.proxyObject</class>:
ClassMethod GetServerInfo() As ZEN.proxyObject [ZenMethod] { Set tProxy = ##class(ZEN.proxyObject).New() Set tProxy.whatever = "Some server value" Quit tProxy }
The client can invoke this method and use its return value as an object:
var obj = this.GetServerInfo(); alert(obj.whatever);
The <class>ZEN.proxyObject</class> does not actually define any properties. Instead it maintains an internal array of property names along with their corresponding values and uses dynamic dispatch to handle references to specific properties. This means that there is no name checking for properties of <class>ZEN.proxyObject</class> (the same behavior as JavaScript objects). You can remove the current set of properties within a <class>ZEN.proxyObject</class> object using the <method>Clear</method> method. You can find out what the current set of properties is (as a local array) or supply a new set using the <method>CopyToArray</method> and <method>CopyFromArray</method> methods.
The client-side zenProxy class defines only one public method, <method>clear</method>, which deletes the current set of properties from the object. In all other ways, you can treat is an instance of JavaScript Object.
You can get the set of values within a <class>ZEN.Auxiliary.dataController</class> objects using its <method>getDataAsObject</method> method.
When using the <class>ZEN.proxyObject</class> class keep the following things in mind:
Note that <class>ZEN.proxyObject</class> DOES support various property names that are valid in Javascript but were not traditionally valid Objectscript property names. In general, these property names include symbols like "$" and "_" that are relatively common in Javascript. To reference such a property in a <class>ZEN.proxyObject</class> instance, simply delimit the property name using quotes:
Set myProperty = tProxy."my_property" Set tProxy."$$foo" = "bar"
|
private |
The Zen Proxy class provides a way to assemble data that can be conveniently passed between the web client and the server.
It works in conjunction with the zenProxy JavaScript class defined in zenutils.js. The zenProxy class is the client-side representation of the server-side <class>ZEN.proxyObject</class> class and vice versa.
The <class>ZEN.proxyObject</class> class is useful for cases where you do not know what run-time properties will exist when you are designing your application (perhaps it is user-configurable).
The proxy class can be used in several ways. You can use it to send an arbitrary set of data values from the client to a server-side method. To do this, create an instance of zenProxy in a client-side JavaScript method:
// create instance of zenProxy var obj = new zenProxy(); obj.name = 'Smith'; obj.code = 'CRM114';
The zenProxy object is basically a generic JavaScript object with a few pre-defined behaviors. You can dynamically add properties to it simply by setting them. These properties should have literal values, that is, they should not refer to other JavaScript objects.
If you define a server-side ZenMethod whose signature includes an argument of type <class>ZEN.proxyObject</class>, then you can invoke this method from the client passing it an instance of a zenProxy object. Zen will automatically marshal the values in the zenProxy object into an instance of the <class>ZEN.proxyObject</class> object.
For example, suppose you have defined a server method:
ClassMethod MyMethod(pProxy as ZEN.proxyObject) As Boolean [ZenMethod] { Set tName = pProxy.name Set tCode = pProxy.code Quit 1 }
The client can invoke this method as it would any other Zen method, passing an instance of zenProxy as the pProxy argument:
var obj = new zenProxy(); obj.name = 'Smith'; obj.code = 'CRM114'; var ok = this.MyMethod(obj);
The <method>MyMethod</method> method will see the values 'Smith' and 'CRM114' for the properties <property>name</property> and <property>code</property>, respectively.
You can also use the <class>ZEN.proxyObject</class> class to pass values from a server method back to the client. To do this, create a server method whose return type is <class>ZEN.proxyObject</class>:
ClassMethod GetServerInfo() As ZEN.proxyObject [ZenMethod] { Set tProxy = ##class(ZEN.proxyObject).New() Set tProxy.whatever = "Some server value" Quit tProxy }
The client can invoke this method and use its return value as an object:
var obj = this.GetServerInfo(); alert(obj.whatever);
The <class>ZEN.proxyObject</class> does not actually define any properties. Instead it maintains an internal array of property names along with their corresponding values and uses dynamic dispatch to handle references to specific properties. This means that there is no name checking for properties of <class>ZEN.proxyObject</class> (the same behavior as JavaScript objects). You can remove the current set of properties within a <class>ZEN.proxyObject</class> object using the <method>Clear</method> method. You can find out what the current set of properties is (as a local array) or supply a new set using the <method>CopyToArray</method> and <method>CopyFromArray</method> methods.
The client-side zenProxy class defines only one public method, <method>clear</method>, which deletes the current set of properties from the object. In all other ways, you can treat is an instance of JavaScript Object.
You can get the set of values within a <class>ZEN.Auxiliary.dataController</class> objects using its <method>getDataAsObject</method> method.
When using the <class>ZEN.proxyObject</class> class keep the following things in mind:
Note that <class>ZEN.proxyObject</class> DOES support various property names that are valid in Javascript but were not traditionally valid Objectscript property names. In general, these property names include symbols like "$" and "_" that are relatively common in Javascript. To reference such a property in a <class>ZEN.proxyObject</class> instance, simply delimit the property name using quotes:
Set myProperty = tProxy."my_property" Set tProxy."$$foo" = "bar"
Delete all properties and data currently in the proxy object.
|
private |
Copy the values from a local array.
(subscripted by property name) into this proxyObject.
|
private |
Copy the properties in this proxyObject into.
a local array subscripted by property name.
|
static |
DeleteDocument will delete a document identified by ID from the specified global or local variable reference (GLVN).
If a document with the specified ID does not exist in that GLVN then DeleteDocument will return an error in the returned Status value.
Parameters
pWhere
Input
Global or local variable reference. This is the location from where the proxyObject instance will be deleted.
pDocumentID
Input
The document ID.
|
static |
DocumentExists() returns a boolean value indicate whether or not the documentID exists in the global/local variable reference (GLVN).
Parameters
pWhere
Input
Global or local variable reference where documents are stored.
pDocumentID
Input
The document ID.
|
static |
OpenDocument will retrieve a previously saved document from the specified global or local variable reference (GLVN) with the specified pDocumentID
and return an oref referencing an instance of ZEN.proxyObject. If a document with the specified ID does not exist in that GLVN then OpenDocument will return an error in the output pStatus parameter.
Parameters
pWhere
Input
Global or local variable reference. This is the location where the proxyObject instance will be saved.
pDocumentID
Input
The ID of the document to be opened.
pStatus
Output
The returned Status value, indicating success or failure.
|
static |
OpenEmbeddedDocument will retrieve a document embedded in a previously saved document from the specified global or local variable reference (GLVN) with the specified pDocumentID
and return an oref referencing an instance of ZEN.proxyObject. If a document with the specified documentID does not exist in that GLVN then OpenDocument will return an error in the output pStatus parameter. If an embedded document with the specified objectID does not exist in that GLVN then OpenDocument will return an error in the output pStatus parameter.
Parameters
pWhere
Input
Global or local variable reference. This is the location where the proxyObject instance will be saved.
pDocumentID
Input
The ID of the document containing the embedded document.
pObjectID
Input
The objectID of the document embedded in the specified pDocumentID.
pStatus
Output
The returned Status value, indicating success or failure.
_.Library.Status SaveDocument | ( | _.ZEN.Datatype.string | pWhere, |
_.ZEN.Datatype.string | pDocumentID | ||
) |
SaveDocument will save the proxyObject to a global or local variable reference (GLVN) with the specified pDocumentID.
If a document with the same ID already exists in that GLVN then SaveDocument will return an error in the returned Status value.
Parameters
pWhere
Input
Global or local variable reference. This is the location where the proxyObject instance will be saved.
pDocumentID
Input
The document ID. This value must be unique within the GLVN specified in pWhere.