UNPKG

isoxml

Version:

JavaScript library to parse and generate ISOXML (ISO11783-10) files

84 lines (83 loc) 2.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProductAllocation = exports.ProductAllocationTransferModeEnum = void 0; const constants_1 = require("./constants"); const classRegistry_1 = require("../classRegistry"); const utils_1 = require("../utils"); var ProductAllocationTransferModeEnum; (function (ProductAllocationTransferModeEnum) { ProductAllocationTransferModeEnum["Filling"] = "1"; ProductAllocationTransferModeEnum["Emptying"] = "2"; ProductAllocationTransferModeEnum["Remainder"] = "3"; })(ProductAllocationTransferModeEnum || (exports.ProductAllocationTransferModeEnum = ProductAllocationTransferModeEnum = {})); const ATTRIBUTES = { A: { name: 'ProductIdRef', type: 'xs:IDREF', isPrimaryId: false, isOptional: false, isOnlyV4: false, }, B: { name: 'QuantityDDI', type: 'xs:hexBinary', isPrimaryId: false, isOptional: true, isOnlyV4: false, }, C: { name: 'QuantityValue', type: 'xs:long', isPrimaryId: false, isOptional: true, isOnlyV4: false, minValue: 0, maxValue: 2147483647, }, D: { name: 'TransferMode', type: 'xs:NMTOKEN', isPrimaryId: false, isOptional: true, isOnlyV4: false, }, E: { name: 'DeviceElementIdRef', type: 'xs:IDREF', isPrimaryId: false, isOptional: true, isOnlyV4: false, }, F: { name: 'ValuePresentationIdRef', type: 'xs:IDREF', isPrimaryId: false, isOptional: true, isOnlyV4: false, }, G: { name: 'ProductSubTypeIdRef', type: 'xs:IDREF', isPrimaryId: false, isOptional: true, isOnlyV4: true, }, }; const CHILD_TAGS = { ASP: { name: 'AllocationStamp', isOnlyV4: false }, }; class ProductAllocation { constructor(attributes, isoxmlManager) { this.attributes = attributes; this.isoxmlManager = isoxmlManager; this.tag = constants_1.TAGS.ProductAllocation; } static fromXML(xml, isoxmlManager, internalId, targetClass = ProductAllocation) { return (0, utils_1.fromXML)(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId); } toXML() { return (0, utils_1.toXML)(this, ATTRIBUTES, CHILD_TAGS); } } exports.ProductAllocation = ProductAllocation; (0, classRegistry_1.registerEntityClass)('main', constants_1.TAGS.ProductAllocation, ProductAllocation);