toHealthElementDto method
DecryptedHealthElementDto
toHealthElementDto()
Implementation
DecryptedHealthElementDto toHealthElementDto() =>
DecryptedHealthElementDto(
id: this.id?.also((it) {
if (!Uuid.isValidUUID(fromString: it)) {
throw FormatException("Invalid id, id must be a valid UUID");
}
}) ?? uuid.v4(options: { 'rng': UuidUtil.cryptoRNG}),
identifiers: this.identifiers.map((it) => it.toIdentifierDto()).toList(),
tags: this.labels.map((it) => it.toCodeStubDto()).toSet(),
codes: this.codes.map((it) => it.toCodeStubDto()).toSet(),
rev: this.rev,
created: this.created,
modified: this.modified,
author: this.author,
responsible: this.responsible,
medicalLocationId: this.medicalLocationId,
endOfLife: this.endOfLife,
deletionDate: this.deletionDate,
healthElementId: this.healthcareElementId,
valueDate: this.valueDate,
openingDate: this.openingDate,
closingDate: this.closingDate,
descr: this.description,
note: this.note,
relevant: true,
status: 0,
secretForeignKeys: this.systemMetaData?.secretForeignKeys.toSet() ?? const <String>{},
cryptedForeignKeys:
this.systemMetaData?.cryptedForeignKeys.map((key, value) => MapEntry(key, value.map((e) => e.toDelegationDto()).toSet())) ??
const <String, Set<DelegationDto>>{},
delegations: this.systemMetaData?.delegations.map((key, value) => MapEntry(key, value.map((e) => e.toDelegationDto()).toSet())) ??
const <String, Set<DelegationDto>>{},
encryptionKeys: this.systemMetaData?.encryptionKeys.map((key, value) => MapEntry(key, value.map((e) => e.toDelegationDto()).toSet())) ?? const <String, Set<DelegationDto>>{},
encryptedSelf: this.systemMetaData?.encryptedSelf
);