1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { XMLElem } from "@/util/XmlElem";
- import { UABaseNode, type UABaseNodeOptions } from "./UABaseNode";
- import type { NamespaceTable } from "./NameSpaceTable";
- export class UAObject extends UABaseNode {
- constructor(options: UAObjectNodeOptions) {
- super(options);
- this.nodeClass="Object";
- }
- static fromXML(uaObject: any): UAObject{
- const bn=super.fromXML(uaObject)
- return new UAObject({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('UAObject');
- 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 UAObjectNodeOptions extends UABaseNodeOptions{
-
- }
|