@mos-connection/helper
Version:
Helper functions for the MOS-connection library
39 lines • 1.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ROAck = void 0;
const XMLBuilder = require("xmlbuilder");
const MosMessage_1 = require("../MosMessage");
const Utils_1 = require("../../utils/Utils");
class ROAck extends MosMessage_1.MosMessage {
/** */
constructor(roAck, strict) {
super('upper', strict);
this.ID = roAck.ID;
this.Status = roAck.Status;
this.Stories = roAck.Stories;
}
/** */
get messageXMLBlocks() {
const root = XMLBuilder.create('roAck');
(0, Utils_1.addTextElementInternal)(root, 'roID', this.ID, undefined, this.strict);
(0, Utils_1.addTextElementInternal)(root, 'roStatus', this.Status, undefined, this.strict);
// Loop over Stories, Items and Object
for (const story of this.Stories) {
for (const item of story.Items) {
for (const obj of item.Objects) {
(0, Utils_1.addTextElementInternal)(root, 'storyID', story.ID, undefined, this.strict);
(0, Utils_1.addTextElementInternal)(root, 'itemID', item.ID, undefined, this.strict);
(0, Utils_1.addTextElementInternal)(root, 'objID', obj.ID, undefined, this.strict);
const channelStr = this.mosTypes.mosString128.stringify(item.Channel);
if (channelStr && channelStr !== 'undefined') {
(0, Utils_1.addTextElementInternal)(root, 'itemChannel', item.Channel, undefined, this.strict);
}
(0, Utils_1.addTextElementInternal)(root, 'status', obj.Status, undefined, this.strict);
}
}
}
return root;
}
}
exports.ROAck = ROAck;
//# sourceMappingURL=ROAck.js.map