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

added validationstatus to variables, added constraints

parent 0c1753db
No related branches found
No related tags found
No related merge requests found
......@@ -107,21 +107,25 @@ Variable:
StringVariable | IntVariable | BooleanVariable;
VariableReference:
ref=[Variable];
ref=[Variable]
("(" validationStatus=ValidationState ")")?;
StringVariable:
"String" name=ID
"with" "proposals" ASSOCIATION LIST_OPEN (proposals+=STRING (SEPARATOR proposals+=STRING)*)? LIST_CLOSED
"with" "constraints" ASSOCIATION LIST_OPEN (constraints+=Constraint (SEPARATOR constraints+=Constraint)*)? LIST_CLOSED
DECLARATION_FINISHED;
IntVariable:
"Integer" name=ID
"with" "proposals" ASSOCIATION LIST_OPEN (proposals+=INT (SEPARATOR proposals+=INT)*)? LIST_CLOSED
"with" "constraints" ASSOCIATION LIST_OPEN (constraints+=Constraint (SEPARATOR constraints+=Constraint)*)? LIST_CLOSED
DECLARATION_FINISHED;
BooleanVariable:
"Boolean" name=ID
"with" "proposals" ASSOCIATION LIST_OPEN (proposals+=Boolean (SEPARATOR proposals+=Boolean)*)? LIST_CLOSED
"with" "constraints" ASSOCIATION LIST_OPEN (constraints+=Constraint (SEPARATOR constraints+=Constraint)*)? LIST_CLOSED
DECLARATION_FINISHED;
enum Boolean:
......@@ -239,6 +243,9 @@ IntCompare:
BooleanCompare:
key=[BooleanVariable] compareSymbol=BooleanCompareSymbol value=Boolean;
Constraint:
key=STRING ASSOCIATION value=INT;
enum StringCompareSymbol:
EQUALS = "==" |
......@@ -261,6 +268,11 @@ enum Flag:
GREEN = "GREEN" |
YELLOW = "YELLOW" |
RED = "RED";
enum ValidationState:
REQUIRED = "REQUIRED" |
OPTIONAL = "OPTIONAL"
;
terminal LIST_OPEN : '[';
terminal LIST_CLOSED : ']';
......
......@@ -2,6 +2,7 @@ package de.fhmuenster.masterthesis.serialization;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import de.fhmuenster.masterthesis.testgeneratorDSL.BPMNDiagram;
......@@ -31,7 +32,7 @@ public class Main {
FlowElement start = TestgeneratorDSLObjectCreator.createStartFlowElement("Start_123", Arrays.asList());
FlowElement gateway = TestgeneratorDSLObjectCreator.createGatewayFlowElement("Gateway_123");
FlowElement activity = TestgeneratorDSLObjectCreator.createUserTaskFlowElement("Activity_123", Arrays.asList(), Arrays.asList(), "Activity 123");
FlowElement activity = TestgeneratorDSLObjectCreator.createUserTaskFlowElement("Activity_123", Arrays.asList(), Arrays.asList(), "Activity 123", null);
FlowElement end = TestgeneratorDSLObjectCreator.createEndFlowElement("End_123");
FlowElement activity2 = TestgeneratorDSLObjectCreator.createServiceTaskFlowElement("Activity_234");
FlowElement end2 = TestgeneratorDSLObjectCreator.createEndFlowElement("End_234");
......
......@@ -16,6 +16,7 @@ import de.fhmuenster.masterthesis.testgeneratorDSL.BooleanVariableEquals;
import de.fhmuenster.masterthesis.testgeneratorDSL.BooleanVariableNotEquals;
import de.fhmuenster.masterthesis.testgeneratorDSL.BusinessRuleTaskFlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.Compare;
import de.fhmuenster.masterthesis.testgeneratorDSL.Constraint;
import de.fhmuenster.masterthesis.testgeneratorDSL.DelegateMock;
import de.fhmuenster.masterthesis.testgeneratorDSL.DelegateServiceTaskFlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.DelegateServiceTaskReference;
......@@ -57,6 +58,7 @@ import de.fhmuenster.masterthesis.testgeneratorDSL.StringVariableNotEquals;
import de.fhmuenster.masterthesis.testgeneratorDSL.Test;
import de.fhmuenster.masterthesis.testgeneratorDSL.TestgeneratorDSLFactory;
import de.fhmuenster.masterthesis.testgeneratorDSL.UserTaskFlowElement;
import de.fhmuenster.masterthesis.testgeneratorDSL.ValidationState;
import de.fhmuenster.masterthesis.testgeneratorDSL.Variable;
import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclaration;
import de.fhmuenster.masterthesis.testgeneratorDSL.VariableDeclarations;
......@@ -108,7 +110,8 @@ public class TestgeneratorDSLObjectCreator {
return element;
}
public static UserTaskFlowElement createUserTaskFlowElement(String name, List<Variable> inputVariables, List<Variable> outputVariables, String label) {
public static UserTaskFlowElement createUserTaskFlowElement(String name, List<Variable> inputVariables, List<Variable> outputVariables, String label,
HashMap<String, List<Constraint>> taskSpecificConstraints) {
UserTaskFlowElement element = TestgeneratorDSLFactory.eINSTANCE.createUserTaskFlowElement();
element.setName(name);
element.setLabel(label);
......@@ -116,6 +119,18 @@ public class TestgeneratorDSLObjectCreator {
for (Variable inputVariable : inputVariables) {
VariableReference variableReference = TestgeneratorDSLFactory.eINSTANCE.createVariableReference();
variableReference.setRef(inputVariable);
if(taskSpecificConstraints.get(inputVariable.getName()) != null) {
for(Constraint c : taskSpecificConstraints.get(inputVariable.getName())) {
if(c.getKey().equals("required")) {
if(c.getValue() == 0) {
variableReference.setValidationStatus(ValidationState.OPTIONAL);
}
}
}
}
element.getInputVariables().add(variableReference);
}
......
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