import {Store} from '../../../../common/core/stores/Store';
import {CBAPackage, DslDefinition} from './mapping-models/CBAPacakge.model';
-import {PackageCreationService} from './package-creation.service';
-import {FolderNodeElement, MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model';
-import * as JSZip from 'jszip';
+import {MetaDataTabModel} from './mapping-models/metadata/MetaDataTab.model';
+import {TemplateTopology} from './mapping-models/definitions/CBADefinition';
@Injectable({
})
export class PackageCreationStore extends Store<CBAPackage> {
- private folder: FolderNodeElement = new FolderNodeElement();
- private zipFile: JSZip = new JSZip();
- constructor(private packageCreationService: PackageCreationService) {
+ constructor() {
super(new CBAPackage());
}
});
}
+ setCustomKeys(mapOfCustomKey: Map<string, string>) {
+ this.setState({
+ ...this.state,
+ metaData: this.state.metaData.setCustomKey(mapOfCustomKey)
+ });
+ }
+
+ istemplateExist(): boolean {
+ return this.state.templates.files.size > 0 && this.state.mapping.files.size > 0;
+ }
+
changeDslDefinition(dslDefinition: DslDefinition) {
this.setState({
}
addScripts(name: string, content: string) {
-
this.setState({
...this.state,
scripts: this.state.scripts.setScripts(name, content)
}
+ addPlans(name: string, content: string) {
+ this.setState({
+ ...this.state,
+ plans: this.state.plans.setContent(name, content)
+ });
+
+ }
+
+ addRequirements(name: string, content: string) {
+ this.setState({
+ ...this.state,
+ requirements: this.state.requirements.setContent(name, content)
+ });
+
+ }
+
removeFileFromState(name: string) {
this.state.scripts.files.delete(name);
}
+ fileExist(key: string) {
+ return this.state.templates.files.has(key);
+ }
+
removeFileFromDefinition(filename) {
this.state.definitions.imports.delete(filename);
}
- saveBluePrint(blob) {
- this.packageCreationService.savePackage(blob);
- }
addTemplate(filePath: string, fileContent: string) {
this.setState({
templates: this.state.templates.setTemplates(filePath, fileContent)
});
}
+
+ addMapping(filePath: string, fileContent: string) {
+ this.setState({
+ ...this.state,
+ mapping: this.state.mapping.setContent(filePath, fileContent)
+ });
+ }
+
+ clear() {
+ console.log('clearing the store');
+ this.setState(new CBAPackage());
+ console.log('it should be empty');
+ }
+
+ setEntryDefinition(data: string) {
+ console.log('setting manual enrichment ');
+ }
+
+ addTopologyTemplate(templateTopology: TemplateTopology) {
+ this.setState({
+ ...this.state,
+ templateTopology
+ });
+ }
+
+ getMetaData() {
+ return this.state.metaData;
+ }
}