diff --git a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/FlowChangeWrapper.java b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/FlowChangeWrapper.java index 43f943a5600510924a3ae4bcd34980c30865f714..49ec4494b987f3686213daa7b6c04ec4392e0115 100644 --- a/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/FlowChangeWrapper.java +++ b/Testgenerator/src/main/java/de/fhmuenster/masterthesis/Testgenerator/migration/FlowChangeWrapper.java @@ -87,9 +87,9 @@ public class FlowChangeWrapper { dto.setFlowElement(flowElementDTO); MigrationResultDTO migrationResultDTO = new MigrationResultDTO(); - migrationResultDTO.setPriority(this.getMigrationResult().getPriority()); migrationResultDTO.setPriority(this.getMigrationResult().getPriority()); + migrationResultDTO.setStatus(this.getMigrationResult().getStatus().name()); dto.setMigrationResult(migrationResultDTO); 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 70a08eb15dfb97e85900d48314f111b932019775..d48a93fb2f5ff26163601f51385374406e650822 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 @@ -12,6 +12,7 @@ import org.eclipse.emf.common.util.EList; import org.springframework.stereotype.Service; import de.fhmuenster.masterthesis.Testgenerator.rest.dto.MigrationResultWrapperDTO; +import de.fhmuenster.masterthesis.Testgenerator.yaml.MigrationResultStatus; import de.fhmuenster.masterthesis.Testgenerator.yaml.MigrationYaml; import de.fhmuenster.masterthesis.Testgenerator.yaml.YamlReader; import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLSerializer; @@ -95,12 +96,22 @@ public class MigrationService { for(FlowElementReference e : addedFlowElements) { if(e.getRef() instanceof ManualTaskFlowElement) { - result.add(new FlowChangeWrapper(newFlow, ActionType.ACTIVITY_ADD_MANUAL_TASK, - e.getRef(), yaml.getActivity().getAdd().getManualTask())); + FlowChangeWrapper fcw = new FlowChangeWrapper(newFlow, ActionType.ACTIVITY_ADD_MANUAL_TASK, + e.getRef(), yaml.getActivity().getAdd().getManualTask()); + if(fcw.getMigrationResult().getPriority() == null) { + fcw.getMigrationResult().setPriority(this.loadGlobalPriority(fcw.getMigrationResult().getStatus(), yaml)); + } + + result.add(fcw); } if(e.getRef() instanceof UserTaskFlowElement) { - result.add(new FlowChangeWrapper(newFlow, ActionType.ACTIVITY_ADD_USER_TASK, - e.getRef(), yaml.getActivity().getAdd().getManualTask())); + FlowChangeWrapper fcw = new FlowChangeWrapper(newFlow, ActionType.ACTIVITY_ADD_USER_TASK, + e.getRef(), yaml.getActivity().getAdd().getUserTask()); + if(fcw.getMigrationResult().getPriority() == null) { + fcw.getMigrationResult().setPriority(this.loadGlobalPriority(fcw.getMigrationResult().getStatus(), yaml)); + } + + result.add(fcw); } if(e.getRef() instanceof BusinessRuleTaskFlowElement) { BusinessRuleTaskFlowElement element = (BusinessRuleTaskFlowElement) e.getRef(); @@ -153,4 +164,24 @@ public class MigrationService { return dto; } + + private Integer loadGlobalPriority(MigrationResultStatus status, MigrationYaml yaml) { + Integer globalPriority = 0; + switch(status) { + case GREEN: + globalPriority = yaml.getConfiguration().getGreen(); + break; + case YELLOW: + globalPriority = yaml.getConfiguration().getYellow(); + break; + case RED: + globalPriority = yaml.getConfiguration().getRed(); + break; + default: + globalPriority = yaml.getConfiguration().getGreen(); + break; + } + + return globalPriority; + } } diff --git a/Testgenerator/src/main/resources/migration.yaml b/Testgenerator/src/main/resources/migration.yaml index 8781b0b7bf0cf68def945a8c811999455d16c616..55fe0103660b9f994b2b4ba453bb34b18e927ba5 100644 --- a/Testgenerator/src/main/resources/migration.yaml +++ b/Testgenerator/src/main/resources/migration.yaml @@ -26,5 +26,4 @@ activity: status: RED priority: 0 manualTask: - status: GREEN - priority: 0 \ No newline at end of file + status: GREEN \ No newline at end of file