aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts22
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/ResourceDictionary.model.ts23
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts2
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/mappingAdapter.model.ts38
4 files changed, 83 insertions, 2 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts
index 3595f7872..45a00ff06 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/CBAPacakge.model.ts
@@ -1,4 +1,4 @@
-import {MetaDataTabModel} from './metadata/MetaDataTab.model';
+import { MetaDataTabModel } from './metadata/MetaDataTab.model';
export class Definition {
@@ -34,6 +34,22 @@ export class DslDefinition {
content: string;
}
+export class Base {
+ public files: Map<string, string>;
+
+ constructor() {
+ this.files = new Map<string, string>();
+ }
+
+ public setContent(key: string, value: string) {
+ this.files.set(key, value);
+ return this;
+ }
+
+ public getValue(key: string): string {
+ return this.files.get(key);
+ }
+}
export class Scripts {
public files: Map<string, string>;
@@ -65,12 +81,15 @@ export class Template {
}
}
+export class Mapping extends Base {
+}
export class CBAPackage {
public metaData: MetaDataTabModel;
public definitions: Definition;
public scripts: Scripts;
public templates: Template;
+ public mapping: Mapping;
constructor() {
@@ -78,6 +97,7 @@ export class CBAPackage {
this.scripts = new Scripts();
this.metaData = new MetaDataTabModel();
this.templates = new Template();
+ this.mapping = new Mapping();
}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/ResourceDictionary.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/ResourceDictionary.model.ts
new file mode 100644
index 000000000..558d1c7d0
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/ResourceDictionary.model.ts
@@ -0,0 +1,23 @@
+import { JsonObject, JsonProperty } from 'json2typescript';
+
+@JsonObject('ResourceDictionary')
+export class ResourceDictionary {
+ @JsonProperty()
+ name: string;
+ @JsonProperty('creation_date')
+ creationDate: string;
+ @JsonProperty('data_type')
+ dataType: string;
+ @JsonObject('definition')
+ definition?: any | null;
+ @JsonProperty('description')
+ description: string;
+ @JsonProperty('entry_schema')
+ entrySchema: string;
+ @JsonProperty('esource_dictionary_group')
+ resourceDictionaryGroup: string;
+ @JsonProperty('tags')
+ tags: string;
+ @JsonProperty('upadted_by')
+ updatedBy: string;
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts
index b797050dd..8e2ff475e 100644
--- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/mapping-models/definitions/VlbDefinition.ts
@@ -17,7 +17,7 @@ export class VlbDefinition {
export class DslContent {
}
-
+// Refactor varaibles name and use JsonConverteri
@JsonObject('metadata')
export class Metadata {
@JsonProperty('template_author')
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;
+}