From b01c93691c1fad5502a5cec0f84a3d093e194f62 Mon Sep 17 00:00:00 2001
From: Henning <henning.schmeink@fh-muenster.de>
Date: Wed, 15 Dec 2021 22:27:27 +0100
Subject: [PATCH] added removeVariables to xtext. Extended createXFlowElement
 with removeVariables

---
 .../masterthesis/TestgeneratorDSL.xtext       |  6 +++
 .../masterthesis/serialization/Main.java      |  2 +-
 .../TestgeneratorDSLObjectCreator.java        | 54 ++++++++++++++++---
 3 files changed, 54 insertions(+), 8 deletions(-)

diff --git a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/TestgeneratorDSL.xtext b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/TestgeneratorDSL.xtext
index fda5676..997e587 100644
--- a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/TestgeneratorDSL.xtext
+++ b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/TestgeneratorDSL.xtext
@@ -36,6 +36,7 @@ UserTaskFlowElement:
 	('with' 'hardcoded' 'inputs' ASSOCIATION LIST_OPEN (hardcodedInputs+=VariableDeclaration (SEPARATOR hardcodedInputs+=VariableDeclaration)*)? LIST_CLOSED)?
 	('with' 'readVariables' ASSOCIATION LIST_OPEN (inputVariables+=VariableReference (SEPARATOR inputVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('with' 'writeVariables' ASSOCIATION LIST_OPEN (outputVariables+=VariableReference (SEPARATOR outputVariables+=VariableReference)*)? LIST_CLOSED)? 
+	('with' 'removeVariables' ASSOCIATION LIST_OPEN (removeVariables+=VariableReference (SEPARATOR removeVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('and' 'label' ASSOCIATION label=STRING)?
 	DECLARATION_FINISHED;
 	
@@ -44,6 +45,7 @@ ManualTaskFlowElement:
 	('with' 'hardcoded' 'inputs' ASSOCIATION LIST_OPEN (hardcodedInputs+=VariableDeclaration (SEPARATOR hardcodedInputs+=VariableDeclaration)*)? LIST_CLOSED)?
 	('with' 'readVariables' ASSOCIATION LIST_OPEN (inputVariables+=VariableReference (SEPARATOR inputVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('with' 'writeVariables' ASSOCIATION LIST_OPEN (outputVariables+=VariableReference (SEPARATOR outputVariables+=VariableReference)*)? LIST_CLOSED)? 
+	('with' 'removeVariables' ASSOCIATION LIST_OPEN (removeVariables+=VariableReference (SEPARATOR removeVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('and' 'label' ASSOCIATION label=STRING)?
 	DECLARATION_FINISHED;
 	
@@ -52,6 +54,7 @@ ScriptTaskFlowElement:
 	('with' 'hardcoded' 'inputs' ASSOCIATION LIST_OPEN (hardcodedInputs+=VariableDeclaration (SEPARATOR hardcodedInputs+=VariableDeclaration)*)? LIST_CLOSED)?
 	('with' 'readVariables' ASSOCIATION LIST_OPEN (inputVariables+=VariableReference (SEPARATOR inputVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('with' 'writeVariables' ASSOCIATION LIST_OPEN (outputVariables+=VariableReference (SEPARATOR outputVariables+=VariableReference)*)? LIST_CLOSED)? 
+	('with' 'removeVariables' ASSOCIATION LIST_OPEN (removeVariables+=VariableReference (SEPARATOR removeVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('and' 'label' ASSOCIATION label=STRING)?
 	DECLARATION_FINISHED;
 
@@ -63,6 +66,7 @@ DelegateServiceTaskFlowElement:
 	'with' 'delegate' ASSOCIATION delegate=STRING
 	('with' 'readVariables' ASSOCIATION LIST_OPEN (inputVariables+=VariableReference (SEPARATOR inputVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('with' 'writeVariables' ASSOCIATION LIST_OPEN (outputVariables+=VariableReference (SEPARATOR outputVariables+=VariableReference)*)? LIST_CLOSED)? 
+	('with' 'removeVariables' ASSOCIATION LIST_OPEN (removeVariables+=VariableReference (SEPARATOR removeVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('and' 'label' ASSOCIATION label=STRING)?
 	DECLARATION_FINISHED;
 	
@@ -72,6 +76,7 @@ ExternalServiceTaskFlowElement:
 	('with' 'hardcoded' 'inputs' ASSOCIATION LIST_OPEN (hardcodedInputs+=VariableDeclaration (SEPARATOR hardcodedInputs+=VariableDeclaration)*)? LIST_CLOSED)?
 	('with' 'readVariables' ASSOCIATION LIST_OPEN (inputVariables+=VariableReference (SEPARATOR inputVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('with' 'writeVariables' ASSOCIATION LIST_OPEN (outputVariables+=VariableReference (SEPARATOR outputVariables+=VariableReference)*)? LIST_CLOSED)? 
+	('with' 'removeVariables' ASSOCIATION LIST_OPEN (removeVariables+=VariableReference (SEPARATOR removeVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('and' 'label' ASSOCIATION label=STRING)?
 	DECLARATION_FINISHED;
 
@@ -80,6 +85,7 @@ BusinessRuleTaskFlowElement:
 	('with' 'hardcoded' 'inputs' ASSOCIATION LIST_OPEN (hardcodedInputs+=VariableDeclaration (SEPARATOR hardcodedInputs+=VariableDeclaration)*)? LIST_CLOSED)?
 	('with' 'readVariables' ASSOCIATION LIST_OPEN (inputVariables+=VariableReference (SEPARATOR inputVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('with' 'writeVariables' ASSOCIATION LIST_OPEN (outputVariables+=VariableReference (SEPARATOR outputVariables+=VariableReference)*)? LIST_CLOSED)? 
+	('with' 'removeVariables' ASSOCIATION LIST_OPEN (removeVariables+=VariableReference (SEPARATOR removeVariables+=VariableReference)*)? LIST_CLOSED)? 
 	('and' 'label' ASSOCIATION label=STRING)?
 	DECLARATION_FINISHED;
 	
diff --git a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/Main.java b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/Main.java
index dac4746..b9b9bb2 100644
--- a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/Main.java
+++ b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/Main.java
@@ -32,7 +32,7 @@ public class Main {
 		
 		FlowElement start = TestgeneratorDSLObjectCreator.createStartFlowElement("Start_123", Arrays.asList(), null);
 		FlowElement gateway = TestgeneratorDSLObjectCreator.createGatewayFlowElement("Gateway_123");
-		FlowElement activity = TestgeneratorDSLObjectCreator.createUserTaskFlowElement("Activity_123", Arrays.asList(), Arrays.asList(), "Activity 123", null);
+		FlowElement activity = TestgeneratorDSLObjectCreator.createUserTaskFlowElement("Activity_123", Arrays.asList(), Arrays.asList(), "Activity 123", null, null);
 		FlowElement end = TestgeneratorDSLObjectCreator.createEndFlowElement("End_123");
 		FlowElement activity2 = TestgeneratorDSLObjectCreator.createServiceTaskFlowElement("Activity_234");
 		FlowElement end2 = TestgeneratorDSLObjectCreator.createEndFlowElement("End_234");
diff --git a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLObjectCreator.java b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLObjectCreator.java
index 7afcad6..594fb92 100644
--- a/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLObjectCreator.java
+++ b/de.fhmuenster.masterthesis.textgeneratordsl/src/de/fhmuenster/masterthesis/serialization/TestgeneratorDSLObjectCreator.java
@@ -122,7 +122,7 @@ public class TestgeneratorDSLObjectCreator {
 	}
 	
 	public static UserTaskFlowElement createUserTaskFlowElement(String name, List<Variable> inputVariables, List<Variable> outputVariables, String label,
-			HashMap<String, List<Constraint>> taskSpecificConstraints) {
+			HashMap<String, List<Constraint>> taskSpecificConstraints, List<Variable> removeVariables) {
 		UserTaskFlowElement element = TestgeneratorDSLFactory.eINSTANCE.createUserTaskFlowElement();
 		element.setName(name);
 		element.setLabel(label);
@@ -151,10 +151,17 @@ public class TestgeneratorDSLObjectCreator {
 			element.getOutputVariables().add(variableReference);
 		}
 		
+		for (Variable removeVariable : removeVariables) {
+			VariableReference variableReference = TestgeneratorDSLFactory.eINSTANCE.createVariableReference();
+			variableReference.setRef(removeVariable);
+			element.getRemoveVariables().add(variableReference);
+		}
+		
 		return element;
 	}
 	
-	public static ManualTaskFlowElement createManualTaskFlowElement(String name, List<Variable> inputVariables, List<Variable> outputVariables, String label) {
+	public static ManualTaskFlowElement createManualTaskFlowElement(String name, List<Variable> inputVariables, List<Variable> outputVariables, 
+			String label, List<Variable> removeVariables) {
 		ManualTaskFlowElement element = TestgeneratorDSLFactory.eINSTANCE.createManualTaskFlowElement();
 		element.setName(name);
 		element.setLabel(label);
@@ -171,10 +178,17 @@ public class TestgeneratorDSLObjectCreator {
 			element.getOutputVariables().add(variableReference);
 		}
 		
+		for (Variable removeVariable : removeVariables) {
+			VariableReference variableReference = TestgeneratorDSLFactory.eINSTANCE.createVariableReference();
+			variableReference.setRef(removeVariable);
+			element.getRemoveVariables().add(variableReference);
+		}
+				
 		return element;
 	}
 	
-	public static ScriptTaskFlowElement createScriptTaskFlowElement(String name, List<Variable> inputVariables, List<Variable> outputVariables, String label) {
+	public static ScriptTaskFlowElement createScriptTaskFlowElement(String name, List<Variable> inputVariables, List<Variable> outputVariables, String label,
+			List<Variable> removeVariables) {
 		ScriptTaskFlowElement element = TestgeneratorDSLFactory.eINSTANCE.createScriptTaskFlowElement();
 		element.setName(name);
 		element.setLabel(label);
@@ -190,6 +204,12 @@ public class TestgeneratorDSLObjectCreator {
 			variableReference.setRef(outputVariable);
 			element.getOutputVariables().add(variableReference);
 		}
+		
+		for (Variable removeVariable : removeVariables) {
+			VariableReference variableReference = TestgeneratorDSLFactory.eINSTANCE.createVariableReference();
+			variableReference.setRef(removeVariable);
+			element.getRemoveVariables().add(variableReference);
+		}
 
 		return element;
 	}
@@ -197,11 +217,12 @@ public class TestgeneratorDSLObjectCreator {
 	public static ServiceTaskFlowElement createServiceTaskFlowElement(String name) {
 		ServiceTaskFlowElement element = TestgeneratorDSLFactory.eINSTANCE.createServiceTaskFlowElement();
 		element.setName(name);
-		
+	
 		return element;
 	}
 	
-	public static ServiceTaskFlowElement createDelegateServiceTaskFlowElement(String name, String delegate, List<Variable> inputVariables, List<Variable> outputVariables, String label) {
+	public static ServiceTaskFlowElement createDelegateServiceTaskFlowElement(String name, String delegate, List<Variable> inputVariables, List<Variable> outputVariables, 
+			String label, List<Variable> removeVariables) {
 		DelegateServiceTaskFlowElement element = TestgeneratorDSLFactory.eINSTANCE.createDelegateServiceTaskFlowElement();
 		element.setName(name);
 		element.setLabel(label);
@@ -218,12 +239,18 @@ public class TestgeneratorDSLObjectCreator {
 			variableReference.setRef(outputVariable);
 			element.getOutputVariables().add(variableReference);
 		}
+		
+		for (Variable removeVariable : removeVariables) {
+			VariableReference variableReference = TestgeneratorDSLFactory.eINSTANCE.createVariableReference();
+			variableReference.setRef(removeVariable);
+			element.getRemoveVariables().add(variableReference);
+		}
 
 		return element;
 	}
 	
 	public static ServiceTaskFlowElement createExternalServiceTaskFlowElement(String name, ExternalTopic externalTopic, List<VariableDeclaration> hardcodedInputs, 
-			String label, List<Variable> inputVariables, List<Variable> outputVariables) {
+			String label, List<Variable> inputVariables, List<Variable> outputVariables, List<Variable> removeVariables) {
 		ExternalTopicReference externalTopicRef = TestgeneratorDSLFactory.eINSTANCE.createExternalTopicReference();
 		externalTopicRef.setRef(externalTopic);
 		
@@ -243,11 +270,18 @@ public class TestgeneratorDSLObjectCreator {
 			variableReference.setRef(outputVariable);
 			element.getOutputVariables().add(variableReference);
 		}
+		
+		for (Variable removeVariable : removeVariables) {
+			VariableReference variableReference = TestgeneratorDSLFactory.eINSTANCE.createVariableReference();
+			variableReference.setRef(removeVariable);
+			element.getRemoveVariables().add(variableReference);
+		}
 
 		return element;
 	}
 	
-	public static BusinessRuleTaskFlowElement createBusinessRuleTaskFlowElement(String name, String resultVariable, List<Variable> inputVariables, List<Variable> outputVariables, String label) {
+	public static BusinessRuleTaskFlowElement createBusinessRuleTaskFlowElement(String name, String resultVariable, List<Variable> inputVariables, List<Variable> outputVariables, 
+			String label, List<Variable> removeVariables) {
 		BusinessRuleTaskFlowElement element = TestgeneratorDSLFactory.eINSTANCE.createBusinessRuleTaskFlowElement();
 		element.setName(name);
 		element.setResultVariable(resultVariable);
@@ -265,6 +299,12 @@ public class TestgeneratorDSLObjectCreator {
 			element.getOutputVariables().add(variableReference);
 		}
 		
+		for (Variable removeVariable : removeVariables) {
+			VariableReference variableReference = TestgeneratorDSLFactory.eINSTANCE.createVariableReference();
+			variableReference.setRef(removeVariable);
+			element.getRemoveVariables().add(variableReference);
+		}
+		
 		return element;
 	}
 	
-- 
GitLab