isoxml
Version:
JavaScript library to parse and generate ISOXML (ISO11783-10) files
72 lines (71 loc) • 2.05 kB
JavaScript
import { TAGS } from './constants';
import { registerEntityClass } from '../classRegistry';
import { fromXML, toXML } from '../utils';
export var AttachedFilePreserveEnum;
(function (AttachedFilePreserveEnum) {
AttachedFilePreserveEnum["TaskControllerDoesNotNeedToPreserveAttachedFile"] = "1";
AttachedFilePreserveEnum["PreserveOnTaskControllerAndSendBackToFMIS"] = "2";
})(AttachedFilePreserveEnum || (AttachedFilePreserveEnum = {}));
const ATTRIBUTES = {
A: {
name: 'FilenameWithExtension',
type: 'xs:ID',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
},
B: {
name: 'Preserve',
type: 'xs:NMTOKEN',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
},
C: {
name: 'ManufacturerGLN',
type: 'xs:anyURI',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
},
D: {
name: 'FileType',
type: 'xs:unsignedByte',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
minValue: 1,
maxValue: 254,
},
E: {
name: 'FileVersion',
type: 'xs:string',
isPrimaryId: false,
isOptional: true,
isOnlyV4: undefined,
},
F: {
name: 'FileLength',
type: 'xs:unsignedLong',
isPrimaryId: false,
isOptional: true,
isOnlyV4: undefined,
minValue: 0,
maxValue: 4294967294,
},
};
const CHILD_TAGS = {};
export class AttachedFile {
constructor(attributes, isoxmlManager) {
this.attributes = attributes;
this.isoxmlManager = isoxmlManager;
this.tag = TAGS.AttachedFile;
}
static fromXML(xml, isoxmlManager, internalId, targetClass = AttachedFile) {
return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId);
}
toXML() {
return toXML(this, ATTRIBUTES, CHILD_TAGS);
}
}
registerEntityClass('main', TAGS.AttachedFile, AttachedFile);