@@ -205,7 +205,18 @@ class VocabularyManager {
205
205
resolveTerms ( modelManager , namespace , locale , declarationName , propertyName ) {
206
206
const modelFile = modelManager . getModelFile ( namespace ) ;
207
207
const classDecl = modelFile ? modelFile . getType ( declarationName ) : null ;
208
- const property = propertyName ? classDecl ? classDecl . getProperty ( propertyName ) : null : null ;
208
+ let property ;
209
+ if ( classDecl && ! classDecl . isScalarDeclaration ( ) ) {
210
+ if ( classDecl . isMapDeclaration ( ) ) {
211
+ if ( propertyName === 'KEY' ) {
212
+ property = classDecl . getKey ( ) ;
213
+ } else if ( propertyName === 'VALUE' ) {
214
+ property = classDecl . getValue ( ) ;
215
+ }
216
+ } else {
217
+ property = propertyName ? classDecl ? classDecl . getProperty ( propertyName ) : null : null ;
218
+ }
219
+ }
209
220
return this . getTerms ( property ? property . getNamespace ( ) : namespace , locale , property ? property . getParent ( ) . getName ( ) : declarationName , propertyName ) ;
210
221
}
211
222
@@ -286,6 +297,16 @@ class VocabularyManager {
286
297
'commands' : [ ]
287
298
} ;
288
299
300
+ const getPropertyNames = ( declaration ) => {
301
+ if ( declaration . getProperties ) {
302
+ return declaration . getProperties ( ) . map ( property => property . getName ( ) ) ;
303
+ } else if ( declaration . isMapDeclaration ?. ( ) ) {
304
+ return [ 'KEY' , 'VALUE' ] ;
305
+ } else {
306
+ return [ ] ;
307
+ }
308
+ } ;
309
+
289
310
modelManager . getModelFiles ( ) . forEach ( model => {
290
311
model . getAllDeclarations ( ) . forEach ( decl => {
291
312
const terms = this . resolveTerms ( modelManager , model . getNamespace ( ) , locale , decl . getName ( ) ) ;
@@ -336,19 +357,21 @@ class VocabularyManager {
336
357
} ) ;
337
358
}
338
359
339
- decl . getProperties ?. ( ) . forEach ( property => {
340
- const propertyTerms = this . resolveTerms ( modelManager , model . getNamespace ( ) , locale , decl . getName ( ) , property . getName ( ) ) ;
360
+ const propertyNames = getPropertyNames ( decl ) ;
361
+ propertyNames . forEach ( propertyName => {
362
+ const propertyTerms = this . resolveTerms ( modelManager , model . getNamespace ( ) , locale , decl . getName ( ) , propertyName ) ;
341
363
if ( propertyTerms ) {
342
364
Object . keys ( propertyTerms ) . forEach ( term => {
343
- if ( term === property . getName ( ) ) {
365
+ const propertyType = propertyName === 'KEY' || propertyName === 'VALUE' ? 'mapElement' : 'property' ;
366
+ if ( term === propertyName ) {
344
367
decoratorCommandSet . commands . push ( {
345
368
'$class' : `${ DC_NAMESPACE } .Command` ,
346
369
'type' : 'UPSERT' ,
347
370
'target' : {
348
371
'$class' : `${ DC_NAMESPACE } .CommandTarget` ,
349
372
'namespace' : model . getNamespace ( ) ,
350
373
'declaration' : decl . getName ( ) ,
351
- 'property' : property . getName ( )
374
+ [ propertyType ] : propertyName
352
375
} ,
353
376
'decorator' : {
354
377
'$class' : `${ MetaModelNamespace } .Decorator` ,
@@ -370,7 +393,7 @@ class VocabularyManager {
370
393
'$class' : `${ DC_NAMESPACE } .CommandTarget` ,
371
394
'namespace' : model . getNamespace ( ) ,
372
395
'declaration' : decl . getName ( ) ,
373
- 'property' : property . getName ( )
396
+ [ propertyType ] : propertyName
374
397
} ,
375
398
'decorator' : {
376
399
'$class' : `${ MetaModelNamespace } .Decorator` ,
0 commit comments