File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
src/main/kotlin/infrastructure/digitaltwins/adtpresenter Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2023. Smart Operating Block
3+ *
4+ * Use of this source code is governed by an MIT-style
5+ * license that can be found in the LICENSE file or at
6+ * https://opensource.org/licenses/MIT.
7+ */
8+
9+ package infrastructure.digitaltwins.adtpresenter
10+
11+ import com.azure.digitaltwins.core.BasicDigitalTwin
12+ import com.azure.digitaltwins.core.BasicDigitalTwinMetadata
13+ import entity.healthprofessional.HealthProfessionalData.HealthProfessional
14+
15+ /* *
16+ * Module with the data of Azure Digital Twin of Health Professional.
17+ */
18+ object HealthProfessionalAdt {
19+
20+ private const val HEALTH_PROFESSIONAL_MODEL = " dtmi:io:github:smartoperatingblock:HealthProfessional;1"
21+ private const val NAME_PROPERTY = " name"
22+ private const val SURNAME_PROPERTY = " surname"
23+ private const val ROLE_PROPERTY = " role"
24+
25+ /* *
26+ * Extension function to create a digital twin from the health professional.
27+ */
28+ fun HealthProfessional.toDigitalTwin (): BasicDigitalTwin =
29+ BasicDigitalTwin (this .healthProfessionalId)
30+ .setMetadata(BasicDigitalTwinMetadata ().setModelId(HEALTH_PROFESSIONAL_MODEL ))
31+ .addToContents(NAME_PROPERTY , HealthProfessional ::name)
32+ .addToContents(SURNAME_PROPERTY , HealthProfessional ::surname)
33+ .addToContents(ROLE_PROPERTY , HealthProfessional ::role.name)
34+ }
You can’t perform that action at this time.
0 commit comments