summaryrefslogtreecommitdiffstats
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.ts21
1 files changed, 16 insertions, 5 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
index e63b17fa2..a994da4a3 100644
--- 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
@@ -1,5 +1,5 @@
import { ResourceDictionary } from './ResourceDictionary.model';
-import { JsonObject, JsonProperty, JsonConvert } from 'json2typescript';
+import { JsonObject, JsonProperty } from 'json2typescript';
// Convert ResourceDictionary object to store Mapping.
export class MappingAdapter {
@@ -14,17 +14,26 @@ export class MappingAdapter {
const mapping = new Mapping();
mapping.name = this.resourceDictionary.name;
mapping.dictionaryName = this.resourceDictionary.name;
+ // move all properties at once
mapping.property = Object.assign({}, this.resourceDictionary.definition.property);
- mapping.inputParam = this.resourceDictionary['input-param'] || false;
- // tslint:disable-next-line: no-string-literal
- mapping.property['required'] = this.resourceDictionary['required'] || false;
+ mapping.inputParam = this.resourceDictionary.definition.property['input-param'] || false;
+ // for reading
+ mapping.sources = this.resourceDictionary.definition.sources;
+ console.log(mapping.sources);
+ mapping.version = 0;
+ return mapping;
+ }
+
+ // Get the final object to save
+ finalize(mapping: Mapping): Mapping {
+
mapping.dictionarySource = this.dependanciesSource.get(mapping.name);
if (this.dependancies.get(mapping.name)) {
mapping.dependencies = this.dependancies.get(mapping.name);
} else {
mapping.dependencies = [];
}
- mapping.version = 0;
+ delete mapping.sources;
return mapping;
}
}
@@ -39,6 +48,8 @@ export class Mapping {
inputParam: boolean;
@JsonProperty('dictionary-name')
dictionaryName: string;
+ @JsonProperty(true)
+ sources: string[];
@JsonProperty('dictionary-source')
dictionarySource: string;
@JsonProperty()