-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathABMobileAppCore.js
68 lines (61 loc) · 1.6 KB
/
ABMobileAppCore.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var ABMLClass = require("../platform/ABMLClass");
module.exports = class ABMobileAppCore extends ABMLClass {
constructor(attributes, application) {
super(["label"]);
/*
{
id: uuid(),
name: 'name',
labelFormat: 'xxxxx',
isImported: 1/0,
isExternal: 1/0,
urlPath:'string',
importFromObject: 'string', // JSON Schema style reference: '#[ABApplication.id]/objects/[ABObject.id]'
// to get other object: ABApplication.objectFromRef(obj.importFromObject);
translations:[
{}
],
fields:[
{ABDataField}
]
}
*/
this.id = attributes.id;
this.type = attributes.type || "mobile.application";
this.name = attributes.name || "";
this.settings = attributes.settings;
// let the MLClass now process the translations:
super.fromValues(attributes);
}
///
/// Static Methods
///
/// Available to the Class level object. These methods are not dependent
/// on the instance values of the Application.
///
///
/// Instance Methods
///
/**
* @method toObj()
*
* properly compile the current state of this ABApplication instance
* into the values needed for saving to the DB.
*
* Most of the instance data is stored in .json field, so be sure to
* update that from all the current values of our child fields.
*
* @return {json}
*/
toObj() {
// MLClass translation
var obj = super.toObj();
return {
id: this.id,
type: this.type || "mobile.application",
name: this.name,
settings: this.settings,
translations: obj.translations,
};
}
};