Skip to content
Snippets Groups Projects

Update to DCC Schema V3.2

Merged Jan Loewe requested to merge feat-dcc-v-3-2 into master
1 file
+ 6
0
Compare changes
  • Side-by-side
  • Inline
+ 133
36
@@ -2,7 +2,7 @@ import * as si from "./DSI";
import { XMLDate, XMLElement, XMLNumber, XMLBoolean, XMLList, INamespaced, ISchemaInformation, IAttributes } from "./BaseTypes";
import { ensureArray } from "./Util";
const schemaVersion = "3.1.2";
const schemaVersion = "3.2.0";
const namespace = "dcc";
const namespaceUrl = `https://ptb.de/${namespace}`;
const schemaLocation = `${namespaceUrl}/v${schemaVersion}/dcc.xsd`;
@@ -15,31 +15,31 @@ export const DCC: ISchemaInformation = {
};
export class DCCXMLElement extends XMLElement implements INamespaced {
get namespace() {
get ns() {
return DCC.namespace;
}
}
export class DCCXMLBoolean extends XMLBoolean implements INamespaced {
get namespace() {
get ns() {
return DCC.namespace;
}
}
export class DCCXMLNumber extends XMLNumber implements INamespaced {
get namespace() {
get ns() {
return DCC.namespace;
}
}
export class DCCXMLDate extends XMLDate implements INamespaced {
get namespace() {
get ns() {
return DCC.namespace;
}
}
export class DCCXMLList extends XMLList implements INamespaced {
get namespace() {
get ns() {
return DCC.namespace;
}
}
@@ -73,15 +73,17 @@ export class DigitalCalibrationCertificateType extends DCCXMLElement {
administrativeData: AdministrativeDataType;
measurementResults: MeasurementResultListType;
comment?: DCCXMLElement;
comment?: Comment;
document?: ByteDataType;
"ds:Signature"?: any;
constructor(el: Partial<DigitalCalibrationCertificateType> = {}) {
super(el);
this.administrativeData = new AdministrativeDataType(el.administrativeData);
this.measurementResults = new MeasurementResultListType(el.measurementResults);
if (el.comment) this.comment = new DCCXMLElement(el.comment);
if (el.comment) this.comment = new Comment(el.comment);
if (el.document) this.document = new ByteDataType(el.document);
if (el["ds:Signature"]) this["ds:Signature"] = el["ds:Signature"];
}
}
@@ -89,6 +91,7 @@ export class DigitalCalibrationCertificateType extends DCCXMLElement {
* The entries in this area are basically the same and regulated in all DCCs. */
export class AdministrativeDataType extends DCCXMLElement {
dccSoftware: SoftwareListType;
refTypeDefinitions?: RefTypeDefinitionListType;
coreData: CoreDataType;
items: ItemListType;
calibrationLaboratory: CalibrationLaboratoryType;
@@ -99,6 +102,7 @@ export class AdministrativeDataType extends DCCXMLElement {
constructor(el: Partial<AdministrativeDataType> = {}) {
super(el);
this.dccSoftware = new SoftwareListType(el.dccSoftware);
if (el.refTypeDefinitions) this.refTypeDefinitions = new RefTypeDefinitionListType(el.refTypeDefinitions);
this.coreData = new CoreDataType(el.coreData);
this.items = new ItemListType(el.items);
this.calibrationLaboratory = new CalibrationLaboratoryType(el.calibrationLaboratory);
@@ -108,6 +112,40 @@ export class AdministrativeDataType extends DCCXMLElement {
}
}
/* This type allows the give information about the used refTypes in a DCC. */
export class RefTypeDefinitionListType extends DCCXMLElement {
refTypeDefinition: RefTypeDefinitionType[];
constructor(el: Partial<RefTypeDefinitionListType> = {}) {
super(el);
this.refTypeDefinition = ensureArray(el.refTypeDefinition).map((x) => new RefTypeDefinitionType(x));
}
}
/* This type contains the information about the wording of the refTypes used in a DCC. */
export class RefTypeDefinitionType extends DCCXMLElement {
_attr: IIdAndRefTypeAttributes;
name: TextType;
description?: RichContentType;
namespace: DCCXMLElement;
link: DCCXMLElement;
release?: DCCXMLElement;
value?: DCCXMLElement;
procedure?: DCCXMLElement;
constructor(el: Partial<RefTypeDefinitionType> = {}) {
super(el);
this.name = new TextType(el.name);
if (el.description) this.description = new RichContentType(el.description);
this.namespace = new DCCXMLElement(el.namespace);
this.link = new DCCXMLElement(el.link);
if (el.release) this.release = new DCCXMLElement(el.release);
if (el.value) this.value = new DCCXMLElement(el.value);
if (el.procedure) this.procedure = new DCCXMLElement(el.procedure);
}
}
/** List of measurement results that are part of a DCC. */
export class MeasurementResultListType extends DCCXMLElement {
measurementResult: MeasurementResultType[];
@@ -121,7 +159,7 @@ export class MeasurementResultListType extends DCCXMLElement {
/** The byteDataType defines a type which allows to add binary encoded files to the measurement result
* section. */
export class ByteDataType extends DCCXMLElement {
_attr: IIdAttributes;
_attr: IIdAndRefIdAndRefTypeAttributes;
name?: TextType;
description?: RichContentType;
@@ -160,6 +198,7 @@ export class CoreDataType extends DCCXMLElement {
beginPerformanceDate: DCCXMLDate;
endPerformanceDate: DCCXMLDate;
performanceLocation: PerformanceLocationType;
issueDate?: DCCXMLDate;
previousReport?: HashType;
constructor(el: Partial<CoreDataType> = {}) {
@@ -173,6 +212,7 @@ export class CoreDataType extends DCCXMLElement {
this.beginPerformanceDate = new DCCXMLDate(el.beginPerformanceDate);
this.endPerformanceDate = new DCCXMLDate(el.endPerformanceDate);
this.performanceLocation = new PerformanceLocationType(el.performanceLocation);
if (el.issueDate) this.issueDate = new DCCXMLDate(el.issueDate);
if (el.previousReport) this.previousReport = new HashType(el.previousReport);
}
}
@@ -189,7 +229,7 @@ export class PerformanceLocationType extends DCCXMLElement {
* Contains one or more item elements. */
export class ItemListType extends DCCXMLElement {
name?: TextType;
equipmentClass?: EquipmentClassType;
equipmentClass?: EquipmentClassType[];
description?: RichContentType;
owner?: ContactType;
identifications?: IdentificationListType;
@@ -198,7 +238,7 @@ export class ItemListType extends DCCXMLElement {
constructor(el: Partial<ItemListType> = {}) {
super(el);
if (el.name) this.name = new TextType(el.name);
if (el.equipmentClass) this.equipmentClass = new EquipmentClassType(el.equipmentClass);
if (el.equipmentClass) this.equipmentClass = ensureArray(el.equipmentClass).map((x) => new EquipmentClassType(x));
if (el.description) this.description = new RichContentType(el.description);
if (el.owner) this.owner = new ContactType(el.owner);
if (el.identifications) this.identifications = new IdentificationListType(el.identifications);
@@ -210,11 +250,17 @@ export class ItemListType extends DCCXMLElement {
export class CalibrationLaboratoryType extends DCCXMLElement {
calibrationLaboratoryCode?: DCCXMLElement;
contact: ContactType;
cryptElectronicSeal?: DCCXMLBoolean;
cryptElectronicSignature?: DCCXMLBoolean;
cryptElectronicTimeStamp?: DCCXMLBoolean;
constructor(el: Partial<CalibrationLaboratoryType> = {}) {
super(el);
if (el.calibrationLaboratoryCode) this.calibrationLaboratoryCode = new DCCXMLElement(el.calibrationLaboratoryCode);
this.contact = new ContactType(el.contact);
if (el.cryptElectronicSeal) this.cryptElectronicSeal = new DCCXMLBoolean(el.cryptElectronicSeal);
if (el.cryptElectronicSignature) this.cryptElectronicSignature = new DCCXMLBoolean(el.cryptElectronicSignature);
if (el.cryptElectronicTimeStamp) this.cryptElectronicTimeStamp = new DCCXMLBoolean(el.cryptElectronicTimeStamp);
}
}
@@ -232,7 +278,7 @@ export class ContactType extends DCCXMLElement {
_attr: IIdAttributes;
name: TextType;
eMail: DCCXMLElement;
eMail?: DCCXMLElement;
phone?: DCCXMLElement;
fax?: DCCXMLElement;
location: LocationType;
@@ -241,7 +287,7 @@ export class ContactType extends DCCXMLElement {
constructor(el: Partial<ContactType> = {}) {
super(el);
this.name = new TextType(el.name);
this.eMail = new DCCXMLElement(el.eMail);
if (el.eMail) this.eMail = new DCCXMLElement(el.eMail);
if (el.phone) this.phone = new DCCXMLElement(el.phone);
if (el.fax) this.fax = new DCCXMLElement(el.fax);
this.location = new LocationType(el.location);
@@ -373,7 +419,7 @@ export class RichContentType extends DCCXMLElement {
/** List of measuring equipment and instruments */
export class MeasuringEquipmentListType extends DCCXMLElement {
name?: TextType;
equipmentClass?: EquipmentClassType;
equipmentClass?: EquipmentClassType[];
description?: RichContentType;
owner?: ContactType;
identifications?: IdentificationListType;
@@ -382,7 +428,7 @@ export class MeasuringEquipmentListType extends DCCXMLElement {
constructor(el: Partial<MeasuringEquipmentListType> = {}) {
super(el);
if (el.name) this.name = new TextType(el.name);
if (el.equipmentClass) this.equipmentClass = new EquipmentClassType(el.equipmentClass);
if (el.equipmentClass) this.equipmentClass = ensureArray(el.equipmentClass).map((x) => new EquipmentClassType(x));
if (el.description) this.description = new RichContentType(el.description);
if (el.owner) this.owner = new ContactType(el.owner);
if (el.identifications) this.identifications = new IdentificationListType(el.identifications);
@@ -392,7 +438,7 @@ export class MeasuringEquipmentListType extends DCCXMLElement {
/** Clear name(s) of the item(s) and identifier(s). */
export class EquipmentClassType extends DCCXMLElement {
_attr: IIdAttributes;
_attr: IIdAndRefTypeAttributes;
reference: DCCXMLElement;
classID: DCCXMLElement;
@@ -419,7 +465,7 @@ export class MeasuringEquipmentType extends DCCXMLElement {
_attr: IIdAndRefTypeAttributes;
name: TextType;
equipmentClass?: EquipmentClassType;
equipmentClass?: EquipmentClassType[];
description?: RichContentType;
certificate?: HashType;
manufacturer?: ContactNotStrictType;
@@ -430,7 +476,7 @@ export class MeasuringEquipmentType extends DCCXMLElement {
constructor(el: Partial<MeasuringEquipmentType> = {}) {
super(el);
this.name = new TextType(el.name);
if (el.equipmentClass) this.equipmentClass = new EquipmentClassType(el.equipmentClass);
if (el.equipmentClass) this.equipmentClass = ensureArray(el.equipmentClass).map((x) => new EquipmentClassType(x));
if (el.description) this.description = new RichContentType(el.description);
if (el.certificate) this.certificate = new HashType(el.certificate);
if (el.manufacturer) this.manufacturer = new ContactNotStrictType(el.manufacturer);
@@ -441,12 +487,15 @@ export class MeasuringEquipmentType extends DCCXMLElement {
}
export class HashType extends DCCXMLElement {
_attr: IIdAttributes;
_attr: IIdAndRefTypeAttributes;
referral: TextType;
referralID: DCCXMLElement;
procedure: DCCXMLElement;
value: DCCXMLElement;
description?: RichContentType;
inValidityRange?: DCCXMLBoolean;
traceable?: DCCXMLBoolean;
linkedReport?: HashType;
constructor(el: Partial<HashType> = {}) {
@@ -455,6 +504,9 @@ export class HashType extends DCCXMLElement {
this.referralID = new DCCXMLElement(el.referralID);
this.procedure = new DCCXMLElement(el.procedure);
this.value = new DCCXMLElement(el.value);
if (el.description) this.description = new RichContentType(el.description);
if (el.inValidityRange) this.inValidityRange = new DCCXMLBoolean(el.inValidityRange);
if (el.traceable) this.traceable = new DCCXMLBoolean(el.traceable);
if (el.linkedReport) this.linkedReport = new HashType(el.linkedReport);
}
}
@@ -482,16 +534,15 @@ export class ContactNotStrictType extends DCCXMLElement {
/** List of values which describes the measurement equipment. */
export class MeasuringEquipmentQuantityListType extends DCCXMLElement {
measuringEquipmentQuantity: MeasuringEquipmentQuantityType[];
measuringEquipmentQuantity: PrimitiveQuantityType[];
constructor(el: Partial<MeasuringEquipmentQuantityListType> = {}) {
super(el);
this.measuringEquipmentQuantity = ensureArray(el.measuringEquipmentQuantity).map((x) => new MeasuringEquipmentQuantityType(x));
this.measuringEquipmentQuantity = ensureArray(el.measuringEquipmentQuantity).map((x) => new PrimitiveQuantityType(x));
}
}
/** Value which describes the measuringEquipment */
export class MeasuringEquipmentQuantityType extends DCCXMLElement {
export class PrimitiveQuantityType extends DCCXMLElement {
_attr: IIdAndRefIdAndRefTypeAttributes;
name?: TextType;
@@ -499,6 +550,7 @@ export class MeasuringEquipmentQuantityType extends DCCXMLElement {
// region choice
noQuantity?: RichContentType;
charsXMLList?: DCCXMLList;
/** Metadata element definition for a real measurement quantity.
*
* The following statements of a real quantity are possible.
@@ -634,13 +686,14 @@ export class MeasuringEquipmentQuantityType extends DCCXMLElement {
// endregion choice
constructor(el: Partial<MeasuringEquipmentQuantityType> = {}) {
constructor(el: Partial<PrimitiveQuantityType> = {}) {
super(el);
if (el.name) this.name = new TextType(el.name);
if (el.description) this.description = new RichContentType(el.description);
// choice
if (el.noQuantity) this.noQuantity = new RichContentType(el.noQuantity);
else if (el.charsXMLList) this.charsXMLList = new DCCXMLList(el.charsXMLList);
else if (el.real) this.real = new si.RealQuantityType(el.real);
else if (el.hybrid) this.hybrid = new si.HybridType(el.hybrid);
else if (el.complex) this.complex = new si.ComplexQuantityType(el.complex);
@@ -651,25 +704,37 @@ export class MeasuringEquipmentQuantityType extends DCCXMLElement {
/** A item that is calibrated in this DCC. */
export class ItemType extends DCCXMLElement {
_attr: IIdAttributes;
_attr: IIdAndRefTypeAttributes;
name: TextType;
equipmentClass?: EquipmentClassType;
equipmentClass?: EquipmentClassType[];
description?: RichContentType;
installedSoftwares?: SoftwareListType;
manufacturer: ContactNotStrictType;
model?: DCCXMLElement;
identifications: IdentificationListType;
itemQuantities: ItemQuantityListType;
constructor(el: Partial<ItemType> = {}) {
super(el);
this.name = new TextType(el.name);
if (el.equipmentClass) this.equipmentClass = new EquipmentClassType(el.equipmentClass);
if (el.equipmentClass) this.equipmentClass = ensureArray(el.equipmentClass).map((x) => new EquipmentClassType(x));
if (el.description) this.description = new RichContentType(el.description);
if (el.installedSoftwares) this.installedSoftwares = new SoftwareListType(el.installedSoftwares);
this.manufacturer = new ContactNotStrictType(el.manufacturer);
if (el.model) this.model = new DCCXMLElement(el.model);
this.identifications = new IdentificationListType(el.identifications);
if (el.itemQuantities) this.itemQuantities = new ItemQuantityListType(el.itemQuantities);
}
}
/** List of value(s) which belongs to the to be calibrated item. */
export class ItemQuantityListType extends DCCXMLElement {
itemQuantity: PrimitiveQuantityType[];
constructor(el: Partial<ItemQuantityListType> = {}) {
super(el);
this.itemQuantity = ensureArray(el.itemQuantity).map((x) => new PrimitiveQuantityType(x));
}
}
@@ -691,7 +756,7 @@ export class IdentificationType extends DCCXMLElement {
/** A person responsible for a DCC. */
export class RespPersonType extends DCCXMLElement {
_attr: IIdAttributes;
_attr: IIdAndRefTypeAttributes;
person: ContactNotStrictType;
description?: RichContentType;
@@ -716,13 +781,20 @@ export class RespPersonType extends DCCXMLElement {
export class StatementMetaDataType extends DCCXMLElement {
_attr: IIdAndRefIdAndRefTypeAttributes;
name?: TextType;
description?: RichContentType;
countryCodeISO3166_1?: DCCXMLElement[];
convention?: DCCXMLElement;
traceable?: DCCXMLBoolean;
norm?: DCCXMLElement[];
reference?: DCCXMLElement[];
declaration?: RichContentType;
// region choice
valid?: DCCXMLBoolean;
validXMLList?: DCCXMLList;
// endregion choice
date?: DCCXMLDate;
period?: DCCXMLElement;
respAuthority?: ContactType;
@@ -739,13 +811,19 @@ export class StatementMetaDataType extends DCCXMLElement {
constructor(el: Partial<StatementMetaDataType> = {}) {
super(el);
if (el.name) this.name = new TextType(el.name);
if (el.description) this.description = new RichContentType(el.description);
if (el.countryCodeISO3166_1) this.countryCodeISO3166_1 = ensureArray(el.countryCodeISO3166_1).map((x) => new DCCXMLElement(x));
if (el.convention) this.convention = new DCCXMLElement(el.convention);
if (el.traceable) this.traceable = new DCCXMLBoolean(el.traceable);
if (el.norm) this.norm = ensureArray(el.norm).map((x) => new DCCXMLElement(x));
if (el.reference) this.reference = ensureArray(el.reference).map((x) => new DCCXMLElement(x));
if (el.declaration) this.declaration = new RichContentType(el.declaration);
// choice
if (el.valid) this.valid = new DCCXMLBoolean(el.valid);
else if (el.validXMLList) this.validXMLList = new DCCXMLList(this.validXMLList);
if (el.date) this.date = new DCCXMLDate(el.date);
if (el.period) this.period = new DCCXMLElement(el.period);
if (el.respAuthority) this.respAuthority = new ContactType(el.respAuthority);
@@ -949,6 +1027,7 @@ export class QuantityType extends DCCXMLElement {
// region choice
noQuantity?: RichContentType;
charsXMLList?: DCCXMLList;
/** Metadata element definition for a real measurement quantity.
*
* The following statements of a real quantity are possible.
@@ -1105,6 +1184,7 @@ export class QuantityType extends DCCXMLElement {
// choice
if (el.noQuantity) this.noQuantity = new RichContentType(el.noQuantity);
else if (el.charsXMLList) this.charsXMLList = new DCCXMLList(el.charsXMLList);
else if (el.real) this.real = new si.RealQuantityType(el.real);
else if (el.list) this.list = new si.SIListType(el.list);
else if (el.hybrid) this.hybrid = new si.HybridType(el.hybrid);
@@ -1146,7 +1226,6 @@ export class ListType extends DCCXMLElement {
// region choice
list?: ListType[];
quantity?: QuantityType[];
// endregion choice
constructor(el: Partial<ListType> = {}) {
@@ -1159,9 +1238,9 @@ export class ListType extends DCCXMLElement {
if (el.dateTime) this.dateTime = new DCCXMLDate(el.dateTime);
else if (el.dateTimeXMLList) this.dateTimeXMLList = new DCCXMLList(el.dateTimeXMLList);
// choice
// choice but maxOccurs = unbounded
if (el.list) this.list = ensureArray(el.list).map((x) => new ListType(x));
else if (el.quantity) this.quantity = ensureArray(el.quantity).map((x) => new QuantityType(x));
if (el.quantity) this.quantity = ensureArray(el.quantity).map((x) => new QuantityType(x));
if (el.usedMethods) this.usedMethods = new UsedMethodListType(el.usedMethods);
if (el.usedSoftware) this.usedSoftware = new SoftwareListType(el.usedSoftware);
@@ -1173,17 +1252,28 @@ export class ListType extends DCCXMLElement {
export class RelativeUncertaintyType extends DCCXMLElement {
// region choice
relativeUncertaintyXmlList?: si.RealListXMLListType;
relativeUncertaintySingle?: si.RealQuantityType;
relativeUncertaintyXmlList?: RelativeUncertaintyXmlList;
relativeUncertaintySingle?: RelativeUncertaintySingle;
// endregion choice
constructor(el: Partial<RelativeUncertaintyType> = {}) {
super(el);
// choice
if (el.relativeUncertaintyXmlList) this.relativeUncertaintyXmlList = new si.RealListXMLListType(el.relativeUncertaintyXmlList);
else if (el.relativeUncertaintySingle) this.relativeUncertaintySingle = new si.RealQuantityType(el.relativeUncertaintySingle);
if (el.relativeUncertaintyXmlList) this.relativeUncertaintyXmlList = new RelativeUncertaintyXmlList(el.relativeUncertaintyXmlList);
else if (el.relativeUncertaintySingle) this.relativeUncertaintySingle = new RelativeUncertaintySingle(el.relativeUncertaintySingle);
}
}
export class RelativeUncertaintyXmlList extends si.RealListXMLListType {
get ns(): string {
return DCC.namespace;
}
}
export class RelativeUncertaintySingle extends si.RealQuantityType {
get ns(): string {
return DCC.namespace;
}
}
@@ -1245,3 +1335,10 @@ export class PositionCoordinatesType extends DCCXMLElement {
if (el.positionCoordinate3) this.positionCoordinate3 = new si.RealQuantityType(el.positionCoordinate3);
}
}
export class Comment extends DCCXMLElement {
constructor(el: Partial<Comment | any>) {
super(el);
Object.assign(this, el);
}
}
Loading