isoxml
Version:
JavaScript library to parse and generate ISOXML (ISO11783-10) files
76 lines (75 loc) • 2.06 kB
JavaScript
import { TAGS } from './constants';
import { registerEntityClass } from '../classRegistry';
import { fromXML, toXML } from '../utils';
const ATTRIBUTES = {
A: {
name: 'SourceClientNAME',
type: 'xs:hexBinary',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
},
B: {
name: 'UserClientNAME',
type: 'xs:hexBinary',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
},
C: {
name: 'SourceDeviceStructureLabel',
type: 'xs:hexBinary',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
},
D: {
name: 'UserDeviceStructureLabel',
type: 'xs:hexBinary',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
},
E: {
name: 'SourceDeviceElementNumber',
type: 'xs:unsignedShort',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
minValue: 0,
maxValue: 4095,
},
F: {
name: 'UserDeviceElementNumber',
type: 'xs:unsignedShort',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
minValue: 0,
maxValue: 4095,
},
G: {
name: 'ProcessDataDDI',
type: 'xs:hexBinary',
isPrimaryId: false,
isOptional: false,
isOnlyV4: undefined,
},
};
const CHILD_TAGS = {
ASP: { name: 'AllocationStamp', isOnlyV4: undefined },
};
export class ControlAssignment {
constructor(attributes, isoxmlManager) {
this.attributes = attributes;
this.isoxmlManager = isoxmlManager;
this.tag = TAGS.ControlAssignment;
}
static fromXML(xml, isoxmlManager, internalId, targetClass = ControlAssignment) {
return fromXML(xml, isoxmlManager, targetClass, ATTRIBUTES, CHILD_TAGS, internalId);
}
toXML() {
return toXML(this, ATTRIBUTES, CHILD_TAGS);
}
}
registerEntityClass('main', TAGS.ControlAssignment, ControlAssignment);