Skip to content
Snippets Groups Projects
Commit efa41dd7 authored by Florian Lambers's avatar Florian Lambers
Browse files

added global migration priority

parent cea36b3e
No related branches found
No related tags found
No related merge requests found
...@@ -87,9 +87,9 @@ public class FlowChangeWrapper { ...@@ -87,9 +87,9 @@ public class FlowChangeWrapper {
dto.setFlowElement(flowElementDTO); dto.setFlowElement(flowElementDTO);
MigrationResultDTO migrationResultDTO = new MigrationResultDTO(); MigrationResultDTO migrationResultDTO = new MigrationResultDTO();
migrationResultDTO.setPriority(this.getMigrationResult().getPriority());
migrationResultDTO.setPriority(this.getMigrationResult().getPriority()); migrationResultDTO.setPriority(this.getMigrationResult().getPriority());
migrationResultDTO.setStatus(this.getMigrationResult().getStatus().name()); migrationResultDTO.setStatus(this.getMigrationResult().getStatus().name());
dto.setMigrationResult(migrationResultDTO); dto.setMigrationResult(migrationResultDTO);
......
...@@ -12,6 +12,7 @@ import org.eclipse.emf.common.util.EList; ...@@ -12,6 +12,7 @@ import org.eclipse.emf.common.util.EList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import de.fhmuenster.masterthesis.Testgenerator.rest.dto.MigrationResultWrapperDTO; 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.MigrationYaml;
import de.fhmuenster.masterthesis.Testgenerator.yaml.YamlReader; import de.fhmuenster.masterthesis.Testgenerator.yaml.YamlReader;
import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLSerializer; import de.fhmuenster.masterthesis.serialization.TestgeneratorDSLSerializer;
...@@ -95,12 +96,22 @@ public class MigrationService { ...@@ -95,12 +96,22 @@ public class MigrationService {
for(FlowElementReference e : addedFlowElements) { for(FlowElementReference e : addedFlowElements) {
if(e.getRef() instanceof ManualTaskFlowElement) { if(e.getRef() instanceof ManualTaskFlowElement) {
result.add(new FlowChangeWrapper(newFlow, ActionType.ACTIVITY_ADD_MANUAL_TASK, FlowChangeWrapper fcw = new FlowChangeWrapper(newFlow, ActionType.ACTIVITY_ADD_MANUAL_TASK,
e.getRef(), yaml.getActivity().getAdd().getManualTask())); 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) { if(e.getRef() instanceof UserTaskFlowElement) {
result.add(new FlowChangeWrapper(newFlow, ActionType.ACTIVITY_ADD_USER_TASK, FlowChangeWrapper fcw = new FlowChangeWrapper(newFlow, ActionType.ACTIVITY_ADD_USER_TASK,
e.getRef(), yaml.getActivity().getAdd().getManualTask())); 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) { if(e.getRef() instanceof BusinessRuleTaskFlowElement) {
BusinessRuleTaskFlowElement element = (BusinessRuleTaskFlowElement) e.getRef(); BusinessRuleTaskFlowElement element = (BusinessRuleTaskFlowElement) e.getRef();
...@@ -153,4 +164,24 @@ public class MigrationService { ...@@ -153,4 +164,24 @@ public class MigrationService {
return dto; 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;
}
} }
...@@ -26,5 +26,4 @@ activity: ...@@ -26,5 +26,4 @@ activity:
status: RED status: RED
priority: 0 priority: 0
manualTask: manualTask:
status: GREEN status: GREEN
priority: 0 \ No newline at end of file
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment