From 0f7bcfa40cb7e3bbc954bf4ec193a89855eb9ec1 Mon Sep 17 00:00:00 2001
From: Florian Lambers <fl462057@fh-muenster.de>
Date: Tue, 9 Nov 2021 15:49:49 +0100
Subject: [PATCH] added matching, moved migration-component

---
 .../Testgenerator/migration/MigrationService.java | 15 +++++++++++++++
 .../src/app/app-routing.module.ts                 |  2 +-
 .../testgenerator-web/src/app/app.module.ts       |  2 +-
 .../migration-overview.component.css              |  0
 .../migration-overview.component.html             |  0
 .../migration-overview.component.spec.ts          |  0
 .../migration-overview.component.ts               |  4 ++--
 7 files changed, 19 insertions(+), 4 deletions(-)
 rename testgenerator-web/testgenerator-web/src/app/{ => components}/migration-overview/migration-overview.component.css (100%)
 rename testgenerator-web/testgenerator-web/src/app/{ => components}/migration-overview/migration-overview.component.html (100%)
 rename testgenerator-web/testgenerator-web/src/app/{ => components}/migration-overview/migration-overview.component.spec.ts (100%)
 rename testgenerator-web/testgenerator-web/src/app/{ => components}/migration-overview/migration-overview.component.ts (85%)

diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/MigrationService.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/MigrationService.java
index d48a93f..932e39c 100644
--- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/MigrationService.java
+++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/MigrationService.java
@@ -9,9 +9,11 @@ import javax.annotation.PostConstruct;
 
 import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import de.fhmuenster.masterthesis.Testgenerator.rest.dto.MigrationResultWrapperDTO;
+import de.fhmuenster.masterthesis.Testgenerator.rest.service.change.ChangeService;
 import de.fhmuenster.masterthesis.Testgenerator.yaml.MigrationResultStatus;
 import de.fhmuenster.masterthesis.Testgenerator.yaml.MigrationYaml;
 import de.fhmuenster.masterthesis.Testgenerator.yaml.YamlReader;
@@ -34,6 +36,9 @@ public class MigrationService {
 	
 	private MigrationYaml yaml;
 	
+	@Autowired
+	private ChangeService changeService;
+	
 	public MigrationService() {
 	}
 	
@@ -65,10 +70,20 @@ public class MigrationService {
 	
 	private List<FlowChangeWrapper> detectActivityAddActions(List<Flow> oldFlows, List<Flow> newFlows) {
 		List<FlowChangeWrapper> result = new ArrayList<>();
+		
+		//Flow Matching
+		Flow [][] matchingFlows = this.changeService.compareFlows(newFlows, oldFlows);
+		
+		for(int i=0; i < matchingFlows.length; i++) {
+			result.addAll(compareFlowsForAddAction(matchingFlows[i][1], matchingFlows[i][0]));
+		}
+		
 		//Flows miteinander vergleichen
+		/*
 		for(int i=0; i < oldFlows.size(); i++) {
 			result.addAll(compareFlowsForAddAction(oldFlows.get(i), newFlows.get(i)));
 		}
+		*/
 		
 		return result;
 	}
diff --git a/testgenerator-web/testgenerator-web/src/app/app-routing.module.ts b/testgenerator-web/testgenerator-web/src/app/app-routing.module.ts
index 6b34003..d47aafc 100644
--- a/testgenerator-web/testgenerator-web/src/app/app-routing.module.ts
+++ b/testgenerator-web/testgenerator-web/src/app/app-routing.module.ts
@@ -16,7 +16,7 @@ import { DeleteProjectComponent } from './components/delete-project/delete-proje
 import { LoopsComponent } from './components/loops/loops.component';
 import { LoopComponent } from './components/loop/loop.component';
 import { UpdateProjectComponent } from './components/update-project/update-project.component';
-import { MigrationOverviewComponent } from './migration-overview/migration-overview.component';
+import { MigrationOverviewComponent } from './components/migration-overview/migration-overview.component';
 
 
 const routes: Routes = [
diff --git a/testgenerator-web/testgenerator-web/src/app/app.module.ts b/testgenerator-web/testgenerator-web/src/app/app.module.ts
index 0fe1530..015a77f 100644
--- a/testgenerator-web/testgenerator-web/src/app/app.module.ts
+++ b/testgenerator-web/testgenerator-web/src/app/app.module.ts
@@ -30,7 +30,7 @@ import { DeleteProjectComponent } from './components/delete-project/delete-proje
 import { LoopsComponent } from './components/loops/loops.component';
 import { LoopComponent } from './components/loop/loop.component';
 import { UpdateProjectComponent } from './components/update-project/update-project.component';
-import { MigrationOverviewComponent } from './migration-overview/migration-overview.component';
+import { MigrationOverviewComponent } from './components/migration-overview/migration-overview.component';
 
 @NgModule({
   declarations: [
diff --git a/testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.css b/testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.css
similarity index 100%
rename from testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.css
rename to testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.css
diff --git a/testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.html b/testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.html
similarity index 100%
rename from testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.html
rename to testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.html
diff --git a/testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.spec.ts b/testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.spec.ts
similarity index 100%
rename from testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.spec.ts
rename to testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.spec.ts
diff --git a/testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.ts b/testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.ts
similarity index 85%
rename from testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.ts
rename to testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.ts
index a0aec04..ca40a67 100644
--- a/testgenerator-web/testgenerator-web/src/app/migration-overview/migration-overview.component.ts
+++ b/testgenerator-web/testgenerator-web/src/app/components/migration-overview/migration-overview.component.ts
@@ -1,7 +1,7 @@
 import { Component, OnInit } from '@angular/core';
 import { ActivatedRoute } from '@angular/router';
-import { MigrationResultWrapper } from '../models/migration-result-wrapper';
-import { MigrationService } from '../services/migration-service';
+import { MigrationResultWrapper } from '../../models/migration-result-wrapper';
+import { MigrationService } from '../../services/migration-service';
 
 @Component({
   selector: 'app-migration-overview',
-- 
GitLab