forked from bptlab/fCM-design-support
-
Notifications
You must be signed in to change notification settings - Fork 1
/
TerminationConditionModdle.js
38 lines (27 loc) · 1022 Bytes
/
TerminationConditionModdle.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
import {assign} from 'min-dash';
import {Moddle} from 'moddle';
import {Reader, Writer} from 'moddle-xml';
import Descriptor from './tc.json';
export default function TerminationConditionModdle() {
Moddle.call(this, {tc: Descriptor});
}
TerminationConditionModdle.prototype = Object.create(Moddle.prototype);
TerminationConditionModdle.prototype.fromXML = function (xmlStr, options) {
var typeName = 'tc:Disjunction';
var reader = new Reader(assign({model: this, lax: false}, options));
var rootHandler = reader.handler(typeName);
return reader.fromXML(xmlStr, rootHandler);
};
TerminationConditionModdle.prototype.toXML = function (element, options) {
var writer = new Writer(options);
return new Promise(function (resolve, reject) {
try {
var result = writer.toXML(element);
return resolve({
xml: result
});
} catch (err) {
return reject(err);
}
});
};