summaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts
blob: 638654a9547493073a8ba62285d43c658138b2d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { ResourceDictionary } from './ResourceDictionary.model';
import { JsonObject, JsonProperty, JsonConvert } from 'json2typescript';

// Convert ResourceDictionary object to store Mapping
export class MappingAdapter {

    constructor(private resourceDictionary: ResourceDictionary) { }

    ToMapping(): Mapping {
        const mapping = new Mapping();
        mapping.name = this.resourceDictionary.name;
        mapping.dictionaryName = this.resourceDictionary.name;
        mapping.property = this.resourceDictionary.definition.property;
        mapping.inputParam = false;
        mapping.dictionarySource = 'sdnc';
        mapping.dependencies = [];
        mapping.version = 0;
        return mapping;
    }
}

@JsonObject('Mapping')
export class Mapping {
    @JsonProperty('name')
    name: string;
    @JsonProperty()
    property: any;
    @JsonProperty('input-param', Boolean)
    inputParam: boolean;
    @JsonProperty('dictionary-name')
    dictionaryName: string;
    @JsonProperty('dictionary-source')
    dictionarySource: string;
    @JsonProperty()
    dependencies: [];
    @JsonProperty()
    version: number;
}