1 import { ResourceDictionary } from './ResourceDictionary.model';
2 import { JsonObject, JsonProperty, JsonConvert } from 'json2typescript';
4 // Convert ResourceDictionary object to store Mapping.
5 export class MappingAdapter {
8 private resourceDictionary: ResourceDictionary,
9 private dependancies: Map<string, Array<string>>,
10 private dependanciesSource: Map<string, string>) { }
12 ToMapping(): Mapping {
13 const mapping = new Mapping();
14 mapping.name = this.resourceDictionary.name;
15 mapping.dictionaryName = this.resourceDictionary.name;
16 mapping.property = this.resourceDictionary.definition.property;
17 mapping.inputParam = false;
18 mapping.dictionarySource = this.dependanciesSource.get(mapping.name);
19 if (this.dependancies.get(mapping.name)) {
20 mapping.dependencies = this.dependancies.get(mapping.name);
22 mapping.dependencies = [];
29 @JsonObject('Mapping')
30 export class Mapping {
35 @JsonProperty('input-param', Boolean)
37 @JsonProperty('dictionary-name')
38 dictionaryName: string;
39 @JsonProperty('dictionary-source')
40 dictionarySource: string;
42 dependencies: string[];