|
@@ -1,23 +1,37 @@
|
|
|
import { XMLElem, type IToXML } from "@/util/XmlElem";
|
|
|
+import { UARequiredModel } from "./UARequiredModel";
|
|
|
|
|
|
export class UAModel implements IToXML{
|
|
|
constructor(public modelUri: string,
|
|
|
- public publicationDate: string,
|
|
|
- public version: string,
|
|
|
- public xmlSchemaUri: string)
|
|
|
+ public xmlSchemaUri: string,
|
|
|
+ public version: string,
|
|
|
+ public publicationDate: string,
|
|
|
+ public modelVersion: string,
|
|
|
+ public accessRestrictions: string,
|
|
|
+ public requiredModels: UARequiredModel[])
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
toXML(): XMLElem {
|
|
|
- return new XMLElem('Model')
|
|
|
- .attr('ModelUri', this.modelUri)
|
|
|
- .attr('XmlSchemaUri', this.xmlSchemaUri)
|
|
|
- .attr('Version', this.version)
|
|
|
- .attr('PublicationDate', this.publicationDate)
|
|
|
+ const model= new XMLElem('Model')
|
|
|
+ .attr('ModelUri', this.modelUri)
|
|
|
+ .attr('XmlSchemaUri', this.xmlSchemaUri)
|
|
|
+ .attr('Version', this.version)
|
|
|
+ .attr('PublicationDate', this.publicationDate)
|
|
|
+ .attr('ModelVersion', this.modelVersion)
|
|
|
+ .attr('AccessRestrictions', this.accessRestrictions);
|
|
|
+ for(const rm of this.requiredModels) {
|
|
|
+ model.add(rm.toXML());
|
|
|
+ }
|
|
|
+ return model;
|
|
|
}
|
|
|
|
|
|
static fromXML(xmlObject: any): UAModel{
|
|
|
- return new UAModel(xmlObject['@_ModelUri'], xmlObject['@_PublicationDate'], xmlObject['@_Version'], xmlObject['@_XmlSchemaUri']);
|
|
|
+ const reqModels:UARequiredModel[]=[];
|
|
|
+ for(const model of xmlObject['RequiredModel']||[]) {
|
|
|
+ reqModels.push(UARequiredModel.fromXML(model));
|
|
|
+ }
|
|
|
+ return new UAModel(xmlObject['@_ModelUri'], xmlObject['@_XmlSchemaUri'],xmlObject['@_Version'], xmlObject['@_PublicationDate'], xmlObject['@_ModelVersion'], xmlObject['@_AccessRestrictions'], reqModels);
|
|
|
}
|
|
|
}
|