forked from ARSBlue/ToolBox-4-Iris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Serializable.cls
37 lines (33 loc) · 1.98 KB
/
Serializable.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Include arsblue.util.Json
/// This class gives the possibility to export to JSON or import from JSON
///
/// ARSBlue ToolBox-4-Iris
/// Copyright © 2019 ARS Blue GmbH
/// http://www.ars-blue.at
Class arsblue.io.Serializable Extends %RegisteredObject
{
/// Import data from JSON into this object
/// <ul>
/// <li>json...the JSON object with class information for which an object shall be returned</li>
/// <li>complete...true if all data from given JSON object should be imported, false (default) otherwise</li>
/// <li>ignodeId...true if the GUID/id from given JSON object shall be ignored, false (default) otherwise</li>
/// <li>allowTransient...true if transient data from given JSON object shall be imported, false (default) otherwise</li>
/// </ul>
/// Returns status OK if successfully imported from JSON object into this object, any other status signals failure!
Method %FromJSON(json As %DynamicAbstractObject = {$$$NULLOREF}, complete As %Boolean = {$$$NO}, ignoreId As %Boolean = {$$$NO}, allowTransient As %Boolean = {$$$NO}) As %Status
{
quit $$$JSON.GetObjectFromJSON(json,$this,complete,ignoreId,allowTransient)
}
/// Export data from this object into JSON
/// <ul>
/// <li>json...the JSON object from given object</li>
/// <li>complete...true if all data from given object shall be exported, false (default) otherwise</li>
/// <li>ignodeId...true if the GUID/id from given object shall be ignored, false (default) otherwise</li>
/// <li>allowTransient...true if transient data from given object shall be exported, false (default) otherwise</li>
/// </ul>
/// Returns status OK if successfully exported JSON object from this object, any other status signals failure and the JSON object is set to null!
Method %ToJSON(ByRef json As %DynamicAbstractObject = {$$$NULLOREF}, complete As %Boolean = {$$$NO}, ignoreId As %Boolean = {$$$NO}, allowTransient As %Boolean = {$$$NO}) As %Status
{
quit $$$JSON.GetJSONFromObject($this,.json,complete,ignoreId,allowTransient)
}
}