@@ -21,21 +21,23 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
21
21
return is_abstract
22
22
}
23
23
24
- fun <ValueT > newProperty (name : String , serializer : IPropertyValueSerializer <ValueT >, optional : Boolean ): GeneratedProperty <ValueT > {
25
- return GeneratedProperty (this , name, optional, serializer).also {
24
+ fun <ValueT > newProperty (name : String , uid : String? , serializer : IPropertyValueSerializer <ValueT >, optional : Boolean ): GeneratedProperty <ValueT > {
25
+ return GeneratedProperty (this , name, uid, optional, serializer).also {
26
26
propertiesMap[name] = it
27
27
}
28
28
}
29
29
30
30
fun <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept > newSingleChildLink (
31
31
name : String ,
32
+ uid : String? ,
32
33
isOptional : Boolean ,
33
34
targetConcept : IConcept ,
34
35
childNodeInterface : KClass <ChildNodeT >
35
36
): GeneratedSingleChildLink <ChildNodeT , ChildConceptT > {
36
37
return GeneratedSingleChildLink <ChildNodeT , ChildConceptT >(
37
38
this ,
38
39
name,
40
+ uid,
39
41
isOptional,
40
42
targetConcept,
41
43
childNodeInterface
@@ -46,13 +48,15 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
46
48
47
49
fun <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept > newChildListLink (
48
50
name : String ,
51
+ uid : String? ,
49
52
isOptional : Boolean ,
50
53
targetConcept : IConcept ,
51
54
childNodeInterface : KClass <ChildNodeT >
52
55
): GeneratedChildListLink <ChildNodeT , ChildConceptT > {
53
56
return GeneratedChildListLink <ChildNodeT , ChildConceptT >(
54
57
this ,
55
58
name,
59
+ uid,
56
60
isOptional,
57
61
targetConcept,
58
62
childNodeInterface
@@ -63,13 +67,15 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
63
67
64
68
fun <TargetNodeT : ITypedNode , TargetConceptT : ITypedConcept > newReferenceLink (
65
69
name : String ,
70
+ uid : String? ,
66
71
isOptional : Boolean ,
67
72
targetConcept : IConcept ,
68
73
targetNodeInterface : KClass <TargetNodeT >
69
74
): GeneratedReferenceLink <TargetNodeT , TargetConceptT > {
70
75
return GeneratedReferenceLink <TargetNodeT , TargetConceptT >(
71
76
this ,
72
77
name,
78
+ uid,
73
79
isOptional,
74
80
targetConcept,
75
81
targetNodeInterface
@@ -114,6 +120,7 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
114
120
}
115
121
116
122
override fun getUID (): String {
123
+ // This method is overridden if the concept specifies a UID
117
124
return UID_PREFIX + getLongName()
118
125
}
119
126
@@ -156,11 +163,12 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
156
163
class GeneratedProperty <ValueT >(
157
164
private val owner : IConcept ,
158
165
override val name : String ,
166
+ private val uid : String? ,
159
167
override val isOptional : Boolean ,
160
168
private val serializer : IPropertyValueSerializer <ValueT >
161
169
) : ITypedProperty<ValueT>, IProperty {
162
170
override fun getConcept (): IConcept = owner
163
- override fun getUID (): String = getConcept().getUID() + " ." + name
171
+ override fun getUID (): String = uid ? : ( getConcept().getUID() + " ." + name)
164
172
override fun untyped (): IProperty = this
165
173
166
174
override fun serializeValue (value : ValueT ): String? = serializer.serialize(value)
@@ -172,6 +180,7 @@ fun IProperty.typed() = this as? ITypedProperty<*>
172
180
abstract class GeneratedChildLink <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept >(
173
181
private val owner : IConcept ,
174
182
override val name : String ,
183
+ private val uid : String? ,
175
184
override val isMultiple : Boolean ,
176
185
override val isOptional : Boolean ,
177
186
override val targetConcept : IConcept ,
@@ -182,7 +191,7 @@ abstract class GeneratedChildLink<ChildNodeT : ITypedNode, ChildConceptT : IType
182
191
183
192
override fun getConcept (): IConcept = owner
184
193
185
- override fun getUID (): String = getConcept().getUID() + " ." + name
194
+ override fun getUID (): String = uid ? : ( getConcept().getUID() + " ." + name)
186
195
187
196
override fun untyped (): IChildLink {
188
197
return this
@@ -197,34 +206,37 @@ fun IChildLink.typed() = this as? ITypedChildLink<ITypedNode>
197
206
class GeneratedSingleChildLink <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept >(
198
207
owner : IConcept ,
199
208
name : String ,
209
+ uid : String? ,
200
210
isOptional : Boolean ,
201
211
targetConcept : IConcept ,
202
212
childNodeInterface : KClass <ChildNodeT >
203
- ) : GeneratedChildLink<ChildNodeT, ChildConceptT>(owner, name, false , isOptional, targetConcept, childNodeInterface), ITypedSingleChildLink<ChildNodeT> {
213
+ ) : GeneratedChildLink<ChildNodeT, ChildConceptT>(owner, name, uid, false , isOptional, targetConcept, childNodeInterface), ITypedSingleChildLink<ChildNodeT> {
204
214
205
215
}
206
216
207
217
class GeneratedChildListLink <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept >(
208
218
owner : IConcept ,
209
219
name : String ,
220
+ uid : String? ,
210
221
isOptional : Boolean ,
211
222
targetConcept : IConcept ,
212
223
childNodeInterface : KClass <ChildNodeT >
213
- ) : GeneratedChildLink<ChildNodeT, ChildConceptT>(owner, name, true , isOptional, targetConcept, childNodeInterface), ITypedChildListLink<ChildNodeT> {
224
+ ) : GeneratedChildLink<ChildNodeT, ChildConceptT>(owner, name, uid, true , isOptional, targetConcept, childNodeInterface), ITypedChildListLink<ChildNodeT> {
214
225
215
226
}
216
227
217
228
class GeneratedReferenceLink <TargetNodeT : ITypedNode , TargetConceptT : ITypedConcept >(
218
229
private val owner : IConcept ,
219
230
override val name : String ,
231
+ private val uid : String? ,
220
232
override val isOptional : Boolean ,
221
233
override val targetConcept : IConcept ,
222
234
private val targetNodeInterface : KClass <TargetNodeT >
223
235
) : IReferenceLink, ITypedReferenceLink<TargetNodeT> {
224
236
225
237
override fun getConcept (): IConcept = owner
226
238
227
- override fun getUID (): String = getConcept().getUID() + " ." + name
239
+ override fun getUID (): String = uid ? : ( getConcept().getUID() + " ." + name)
228
240
229
241
override fun untyped (): IReferenceLink = this
230
242
0 commit comments