638654a9547493073a8ba62285d43c658138b2d0
[ccsdk/cds.git] /
1 import { ResourceDictionary } from './ResourceDictionary.model';
2 import { JsonObject, JsonProperty, JsonConvert } from 'json2typescript';
3
4 // Convert ResourceDictionary object to store Mapping
5 export class MappingAdapter {
6
7     constructor(private resourceDictionary: ResourceDictionary) { }
8
9     ToMapping(): Mapping {
10         const mapping = new Mapping();
11         mapping.name = this.resourceDictionary.name;
12         mapping.dictionaryName = this.resourceDictionary.name;
13         mapping.property = this.resourceDictionary.definition.property;
14         mapping.inputParam = false;
15         mapping.dictionarySource = 'sdnc';
16         mapping.dependencies = [];
17         mapping.version = 0;
18         return mapping;
19     }
20 }
21
22 @JsonObject('Mapping')
23 export class Mapping {
24     @JsonProperty('name')
25     name: string;
26     @JsonProperty()
27     property: any;
28     @JsonProperty('input-param', Boolean)
29     inputParam: boolean;
30     @JsonProperty('dictionary-name')
31     dictionaryName: string;
32     @JsonProperty('dictionary-source')
33     dictionarySource: string;
34     @JsonProperty()
35     dependencies: [];
36     @JsonProperty()
37     version: number;
38 }