12345678910111213141516171819202122232425262728293031323334353637 |
- import { XMLElem, type IToXML } from "@/util/XmlElem";
- import { UARequiredModel } from "./UARequiredModel";
- export class UAModel implements IToXML{
- constructor(public modelUri: string,
- public xmlSchemaUri: string,
- public version: string,
- public publicationDate: string,
- public modelVersion: string,
- public accessRestrictions: string,
- public requiredModels: UARequiredModel[])
- {
- }
- toXML(): XMLElem {
- 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{
- 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);
- }
- }
|