aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts
diff options
context:
space:
mode:
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.ts38
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;
+}