diff options
author | 2020-02-26 04:16:14 +0000 | |
---|---|---|
committer | 2020-02-26 04:16:14 +0000 | |
commit | c99df5dd491c9f18044ec483e696739080e80950 (patch) | |
tree | 6f2a271ec154656c69d34743d498968c2b877b0c /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts | |
parent | 2ef7909fd0b9d12a7fe1619639e787c5ee0cf4c3 (diff) | |
parent | e70a0e413947cc3e5e21d041f0ed3d7582b44d7a (diff) |
Merge "import maaping from CSV file or the current template"
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts new file mode 100644 index 000000000..638654a95 --- /dev/null +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts @@ -0,0 +1,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; +} |