|
@@ -0,0 +1,36 @@
|
|
|
+import { XMLElem } from "@/util/XmlElem";
|
|
|
+import type { NamespaceTable } from "./NameSpaceTable";
|
|
|
+import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode";
|
|
|
+
|
|
|
+export class UAReferenceType extends UABaseNode{
|
|
|
+
|
|
|
+ constructor(options: UAReferenceTypeOptions) {
|
|
|
+ super(options)
|
|
|
+ }
|
|
|
+
|
|
|
+ static fromXML(uaMethod: any): UAReferenceType{
|
|
|
+ const bn=super.fromXML(uaMethod)
|
|
|
+ return new UAReferenceType({nodeId: bn.nodeId,
|
|
|
+ browseName: bn.browseName,
|
|
|
+ displayName: bn.displayName,
|
|
|
+ references: bn.references});
|
|
|
+ }
|
|
|
+
|
|
|
+ toXML(lnst:NamespaceTable, gnst:NamespaceTable): XMLElem {
|
|
|
+ const nid=UABaseNode.localNodeId(this.nodeId, lnst, gnst);
|
|
|
+ const elem =new XMLElem('UAReferenceType');
|
|
|
+ elem.attr('NodeId', nid.toString())
|
|
|
+ .attr('BrowseName', this.browseName)
|
|
|
+ .elem('DisplayName', this.displayName);
|
|
|
+ const refs=elem.add(new XMLElem('References'))
|
|
|
+ for(const ref of this.references) {
|
|
|
+ if(ref.fromNode.nodeId.toString()==this.nodeId.toString()) //on load resolveReferences() duplicates references to both sides. skip them for export
|
|
|
+ refs.add(ref.toXML(lnst, gnst));
|
|
|
+ }
|
|
|
+ return elem;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export interface UAReferenceTypeOptions extends UABaseNodeOptions{
|
|
|
+
|
|
|
+}
|