@@ -21,21 +21,23 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
2121 return is_abstract
2222 }
2323
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 {
2626 propertiesMap[name] = it
2727 }
2828 }
2929
3030 fun <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept > newSingleChildLink (
3131 name : String ,
32+ uid : String? ,
3233 isOptional : Boolean ,
3334 targetConcept : IConcept ,
3435 childNodeInterface : KClass <ChildNodeT >
3536 ): GeneratedSingleChildLink <ChildNodeT , ChildConceptT > {
3637 return GeneratedSingleChildLink <ChildNodeT , ChildConceptT >(
3738 this ,
3839 name,
40+ uid,
3941 isOptional,
4042 targetConcept,
4143 childNodeInterface
@@ -46,13 +48,15 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
4648
4749 fun <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept > newChildListLink (
4850 name : String ,
51+ uid : String? ,
4952 isOptional : Boolean ,
5053 targetConcept : IConcept ,
5154 childNodeInterface : KClass <ChildNodeT >
5255 ): GeneratedChildListLink <ChildNodeT , ChildConceptT > {
5356 return GeneratedChildListLink <ChildNodeT , ChildConceptT >(
5457 this ,
5558 name,
59+ uid,
5660 isOptional,
5761 targetConcept,
5862 childNodeInterface
@@ -63,13 +67,15 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
6367
6468 fun <TargetNodeT : ITypedNode , TargetConceptT : ITypedConcept > newReferenceLink (
6569 name : String ,
70+ uid : String? ,
6671 isOptional : Boolean ,
6772 targetConcept : IConcept ,
6873 targetNodeInterface : KClass <TargetNodeT >
6974 ): GeneratedReferenceLink <TargetNodeT , TargetConceptT > {
7075 return GeneratedReferenceLink <TargetNodeT , TargetConceptT >(
7176 this ,
7277 name,
78+ uid,
7379 isOptional,
7480 targetConcept,
7581 targetNodeInterface
@@ -114,6 +120,7 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
114120 }
115121
116122 override fun getUID (): String {
123+ // This method is overridden if the concept specifies a UID
117124 return UID_PREFIX + getLongName()
118125 }
119126
@@ -156,11 +163,12 @@ abstract class GeneratedConcept<NodeT : ITypedNode, ConceptT : ITypedConcept>(
156163class GeneratedProperty <ValueT >(
157164 private val owner : IConcept ,
158165 override val name : String ,
166+ private val uid : String? ,
159167 override val isOptional : Boolean ,
160168 private val serializer : IPropertyValueSerializer <ValueT >
161169) : ITypedProperty<ValueT>, IProperty {
162170 override fun getConcept (): IConcept = owner
163- override fun getUID (): String = getConcept().getUID() + " ." + name
171+ override fun getUID (): String = uid ? : ( getConcept().getUID() + " ." + name)
164172 override fun untyped (): IProperty = this
165173
166174 override fun serializeValue (value : ValueT ): String? = serializer.serialize(value)
@@ -172,6 +180,7 @@ fun IProperty.typed() = this as? ITypedProperty<*>
172180abstract class GeneratedChildLink <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept >(
173181 private val owner : IConcept ,
174182 override val name : String ,
183+ private val uid : String? ,
175184 override val isMultiple : Boolean ,
176185 override val isOptional : Boolean ,
177186 override val targetConcept : IConcept ,
@@ -182,7 +191,7 @@ abstract class GeneratedChildLink<ChildNodeT : ITypedNode, ChildConceptT : IType
182191
183192 override fun getConcept (): IConcept = owner
184193
185- override fun getUID (): String = getConcept().getUID() + " ." + name
194+ override fun getUID (): String = uid ? : ( getConcept().getUID() + " ." + name)
186195
187196 override fun untyped (): IChildLink {
188197 return this
@@ -197,34 +206,37 @@ fun IChildLink.typed() = this as? ITypedChildLink<ITypedNode>
197206class GeneratedSingleChildLink <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept >(
198207 owner : IConcept ,
199208 name : String ,
209+ uid : String? ,
200210 isOptional : Boolean ,
201211 targetConcept : IConcept ,
202212 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> {
204214
205215}
206216
207217class GeneratedChildListLink <ChildNodeT : ITypedNode , ChildConceptT : ITypedConcept >(
208218 owner : IConcept ,
209219 name : String ,
220+ uid : String? ,
210221 isOptional : Boolean ,
211222 targetConcept : IConcept ,
212223 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> {
214225
215226}
216227
217228class GeneratedReferenceLink <TargetNodeT : ITypedNode , TargetConceptT : ITypedConcept >(
218229 private val owner : IConcept ,
219230 override val name : String ,
231+ private val uid : String? ,
220232 override val isOptional : Boolean ,
221233 override val targetConcept : IConcept ,
222234 private val targetNodeInterface : KClass <TargetNodeT >
223235) : IReferenceLink, ITypedReferenceLink<TargetNodeT> {
224236
225237 override fun getConcept (): IConcept = owner
226238
227- override fun getUID (): String = getConcept().getUID() + " ." + name
239+ override fun getUID (): String = uid ? : ( getConcept().getUID() + " ." + name)
228240
229241 override fun untyped (): IReferenceLink = this
230242
0 commit comments