Can you help me with the use of fluent camunda API?
Now I’ll tell you what I have to do with my project:
Here is the code of my class (called FromTextToBPMN.java):
package Prova.Prova;
import java.util.Random;
import java.util.StringTokenizer; //Bisogna importare la classe
import org.apache.poi.ss.formula.functions.Count;
import org.camunda.bpm.model.bpmn.Bpmn;
import org.camunda.bpm.model.bpmn.BpmnModelInstance;
import org.camunda.bpm.model.bpmn.impl.instance.TimeDateImpl;
import org.camunda.bpm.model.bpmn.impl.instance.TimerEventDefinitionImpl;
import org.camunda.bpm.model.bpmn.instance.BoundaryEvent;
import org.camunda.bpm.model.bpmn.instance.EndEvent;
import org.camunda.bpm.model.bpmn.instance.EventBasedGateway;
import org.camunda.bpm.model.bpmn.instance.ExclusiveGateway;
import org.camunda.bpm.model.bpmn.instance.FlowNode;
import org.camunda.bpm.model.bpmn.instance.IntermediateCatchEvent;
import org.camunda.bpm.model.bpmn.instance.MessageEventDefinition;
import org.camunda.bpm.model.bpmn.instance.Participant;
import org.camunda.bpm.model.bpmn.instance.SendTask;
import org.camunda.bpm.model.bpmn.instance.SignalEventDefinition;
import org.camunda.bpm.model.bpmn.instance.StartEvent;
import org.camunda.bpm.model.bpmn.instance.Task;
import org.camunda.bpm.model.bpmn.instance.TimeDuration;
import org.camunda.bpm.model.bpmn.instance.TimerEventDefinition;
import java.io.;
import java.lang.;
public class FromTextToBPMN{
public static void main(String [] args) throws IOException{
HelpClass helpClass = new HelpClass();
helpClass.create();
Random random = new Random();
String input = "The process CSR is a pool." +
"The process Customer is a pool." +
"The process Admin is a black pool." +
"The process CSR starts by propose mortgage offer before perform a send message send offer." +
"The process CSR performs a send message mortgage offer by send offer after the start and before wait for a reply." +
"The process CSR expects a reply after perform a send message mortgage offer and before receive a message reject offer and before receive a message accept offer." +
"The process Customer receives a message mortgage offer and starts by offer received before the decision." +
"The process Customer must take a decision (Offer accepted?) after the start and before perform a send message offer rejected and before perform a send message offer accepted." +
"The decision is: “Offer accepted?”." +
"In the first case, the process Customer performs a send message offer rejected by reject offer after the decision and before the end." +
"The process Customer ends by offer rejected after perform a send message offer rejected." +
"In the second case, the process Customer performs a send message offer accepted by accept offer after the decision and before wait for a reply." +
"The process Customer expects a reply after perform a send message offer accepted and before receive a message requesting docs and before receive a message ok offer." +
"The process CSR receives a message offer rejected by reject offer after wait for a reply and before perform the activity update details." +
"The process CSR performs the activity by update details after receive a message offer rejected and before perform the activity work archived." +
"The process CSR performs the activity by work archived after the activity update details and before the activity order cancelled." +
"The process CSR performs the activity by order cancelled after the activity work archived and before the end." +
"The process CSR ends by order cancelled after the activity order cancelled." +
"The process CSR receives a message offer accepted by accept offer after wait for a reply and before perform the activity check documents." +
"The process CSR performs the activity by check documents after receive a message offer accepted and before the decision." +
"The process CSR must take a decision (Documents attached?) after the activity check documents and before perform a send message requesting docs and before perform a send message move." +
"The decision is: “Documents attached?”." +
"In the first case, the process CSR performs a send message move by inistration after the decision and before perform a send message ok offer." +
"The process Admin catches the message move."+
"The process CSR performs a send message ok order by ok offer after perform a send message move and before the end." +
"The process CSR ends by offer sold after perform a send message ok offer." +
"The process Customer receives a message ok offer by ok offer after wait for a reply and before the end." +
"The process Customer ends by offer accepted after receive a message ok offer." +
"In the second case, the process CSR performs a send message requesting docs by requesting outstanding documents after the decision end before receive a message documents." +
"The process Customer receives a message requesting docs by outstanding documents requested after wait for a reply and before perform a send message documents." +
"The process Customer performs a send message documents by send documents after receive a message requesting docs and before end." +
"The process Customer ends by documents sent after perform a send message documents." +
"The process CSR receives a message documents by documents received after perform a send message requesting docs and before wait." +
"The process CSR waits by 2 weeks after receive a message documents and before a decision." +
"The process CSR must take a decision (Documents received?) after wait and before perform a send message move and before the activity update details." +
"In the first case, the process CSR performs a send message move by move to administration after the decision and before the end." +
"The process Admin catches the message move." +
"The process CSR ends by offer sold after perform a send message move." +
"In the second case, the process CSR performs the activity by update details after the decision and before the activity archive." +
"The process CSR performs the activity by archive after the activity update details and before the activity cancellation." +
"The process CSR performs the activity by cancellation after the activity archive and before the end." +
"The process CSR ends by offer cancelled after the activity cancellation." + "The process PIPPO performs a receive message ID MESSAGGIO by LABEL MESSAGGIO after AFTERQUALCOSA and before BEFOREQUALCOS'ALTRO." +
"The process PIPPO sends a message ID MESSAGGIO and ends by LABEL MESSAGGIO after AFTERQUALCOSA and before BEFOREQUALCOS'ALTRO." + "The process PIPPO customer sends a message ID MESSAGGIO by LABEL MESSAGGIO after AFTERQUALCOSA and before BEFOREQUALCOS'ALTRO." +
"The choice is: “Which kind of goods?”." +
"The process PIPPO begins at LABEL TIMER before BEFORE QUALCOSA." +
"The process PIPPO begins in LABEL TIMER before BEFORE QUALCOSA." +
"The process PIPPO begins every LABEL TIMER before BEFORE QUALCOSA." +
"The process PIPPO waits by LABEL START-TIMER after AFTER QUALCOSA and before BEFORE QUALCOS'ALTRO."+
"SCRIVI QUALCOSA DI SBAGLIATO.";
String common = "The process "; // This string is in common in all the sentences and I will find it in every BPMN element.
String pool = "is a pool"; // The "common" string + the "pool" string gives me the pool BPMN element
String Bpool = "is a black"; // The "common" string + the "Bpool" string gives me the Blackpool BPMN element
String BpoolMsg = "catches the message"; // The "BpoolMsg" string must draw a Bpool receiving a message.
String start = "starts "; // The "common" string + the "start" string gives me the start event BPMN element
String msgR = "receives a message "; // The "common" string + the "msgR" string gives me the INTERMEDIATE RECEIVE MESSAGE BPMN element. If in the sentence there is also the "start" string I must draw the START-RECEIVING MESSAGE.
String end = "ends "; //The "common" string + the "end" string gives me the end BPMN element
String msgS = "sends a message "; // The "common" string + the "msgS" string gives me the INTERMEDIATE SEND MESSAGE BPMN element. If in the sentence there is also the "and" string(declared in the next step) I must draw the END-SEND-MESSAGE.
String and ="and ends"; // I will use this string to distinguish the simple INTERMEDIATE SEND MESSAGE-EVENT from the END MESSAGE-EVENT.
String task = "performs the activity"; // The "common" string + the "task" string gives me the task BPMN element
String taskS = "performs a send message "; // The "common" string + the "taskS" string gives me the TASK-SEND MESSAGE BPMN element.
String taskR = "performs a receive message "; // The "common" string + the "taskR" string gives me theTASK-RECEIVE MESSAGE BPMN element.
String xorS = "must take a decision"; // The "common" string + the "xorS" string gives me the XOR SPLIT BPMN element
String xorJ = "completes the decision"; //The "common" string + the "xorJ" string gives me the XOR JOIN BPMN element
String andS = "must take a parallel selection"; //The "common" string + the "andS" string gives me the AND SPLIT BPMN element
String andJ = "completes the selection"; // The "common" string + the "andJ" string gives me the AND JOIN BPMN element
String inclS = "must make a choice"; // The "common" string + the "inclS" string gives me the INCLUSIVE SPLIT BPMN element
String inclJ = "completes the choice"; // The "common" string + the "inclJ" string gives me the INCLUSIVE JOIN BPMN element.
String eventBased = "expects a reply"; // The "common" string + the "eventBased" string gives me the EVENT-BASED GATEWAY BPMN element.
String timerStart1 = "begins at"; // The "common" string + the "timerStart1" string gives me the START TIMER EVENT BPMN element.
String timerStart2 = "begins in"; // The "common" string + the "timerStart2" string gives me the START TIMER EVENT BPMN element.
String timerStart3 = "begins every"; // The "common" string + the "timerStart3" string gives me the START TIMER EVENT BPMN element.
String timerIntermediate = "waits by"; // The "common" string + the "timerIntermediate" string gives me the INTEMREDIATE TIMER EVENT BPMN element.
String intrLabel = "by "; // used to write labels of the elements (like tasks and others)
String conj = "and "; // used to find the id of the messages in the START-RECEIVING MESSAGE ELEMENT and in the END-SENDING MESSAGE.
String before = "before "; //used for linking elements purpose.
String after = "after "; //used for linking elements purpose.
String[] result = input.split("\."); // I create an array of strings and inside it there is the input text splitted in sentences (strings) by the “dot” character.
for (String inputStr:result) { // For each single sentence I am going to apply the rules here below.
if(inputStr.contains(common)&&inputStr.contains(pool)) { // If in the sentence I will find "The process" + "is a pool"
String processName = inputStr.substring((inputStr.indexOf(common.toLowerCase())+common.length()), inputStr.indexOf(pool));
System.out.println("\n" + "POOL:" + inputStr);// print POOL
System.out.println("POOL NAME:"+ processName.trim()); // print POOL NAME + name of the pool;
}
else if(inputStr.contains(common)&&inputStr.contains(Bpool)) { // If in the sentence I will find "The process" + "is a black"
// String processName = inputStr.substring((inputStr.indexOf(common.toLowerCase())+common.length()), inputStr.indexOf(Bpool));
// System.out.println("\n" + "BLACKPOOL:" + inputStr); // print BLACKPOOL
// System.out.println("BLACKPOOL NAME:"+processName.trim()); // print BLACKPOOL NAME: + name of the pool
}
else if(inputStr.contains(common)&&inputStr.contains(BpoolMsg)) { // If in the sentence I will find "The process" + "catches the message"
// String processName = inputStr.substring((inputStr.indexOf(common.toLowerCase())+common.length()), inputStr.indexOf(BpoolMsg));
// String idMsgR = inputStr.substring(inputStr.indexOf(BpoolMsg)+BpoolMsg.length(), inputStr.length());
// System.out.println("\n" + "BLACKPOOL CATCHING MESSAGE:" + inputStr); // print BLACKPOOL CATCHING MESSAGE
// System.out.println("BLACKPOOL NAME:"+processName.trim()); // print BLACKPOOL NAME: + name of the pool
// System.out.println("ID-MESSAGE:"+idMsgR.trim()); // print ID-MESSAGE: + the id of the message received.
}
else if(inputStr.contains(common)&&inputStr.contains(start)&&inputStr.contains(msgR)) { // If in the sentence I will find "The process" + "starts" + "receives a message"
// String processName = inputStr.substring((inputStr.indexOf(common.toLowerCase())+common.length()), inputStr.indexOf(msgR));
// String idMsgReceive =inputStr.substring(inputStr.indexOf(msgR)+msgR.length(), inputStr.indexOf(conj));
// String label = inputStr.substring(inputStr.indexOf(intrLabel)+intrLabel.length(), inputStr.indexOf(before));
// System.out.println("\n" + "START RECEIVE-MESSAGE:" + inputStr); // print START RECEIVE-MESSAGE
// System.out.println("PROCESS NAME:"+ processName.trim()); // print PROCESS NAME: + name of the process
// System.out.println("ID-MESSAGE:"+idMsgReceive.trim()); // print ID-MESSAGE: + id of the message received.
// System.out.println("LABEL:"+label.trim()); // print LABEL: + label of the element
}
else if(inputStr.contains(common)&&inputStr.contains(msgR)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(msgR))) { // If in the sentence I will find "The process" / ""the process" + "receives a message"
// String processName = inputStr.substring((inputStr.indexOf(common.toLowerCase())+common.length()), inputStr.indexOf(msgR));
// String idMsgReceive = inputStr.substring(inputStr.indexOf(msgR)+msgR.length(), inputStr.indexOf(intrLabel));
String label = inputStr.substring(inputStr.indexOf(intrLabel)+intrLabel.length(), inputStr.indexOf(after));
// System.out.println("\n" + "INTERMEDIATE RECEIVE-MESSAGE:" + inputStr); // print INTERMEDIATE RECEIVE-MESSAGE
// System.out.println("PROCESS NAME:"+ processName.trim()); // print PROCESS NAME: + name of the process
// System.out.println("ID-MESSAGE:" + idMsgReceive.trim()); // print ID-MESSAGE: + id of the received message
// System.out.println("LABEL:" + label.trim()); // print LABEL: + label of the element
IntermediateCatchEvent intermediateCatchEvent = helpClass.createElement(helpClass.process, label.replace(" ", "")+label.valueOf(random.nextInt()).replace(" ", ""), label, IntermediateCatchEvent.class,
helpClass.plane, 250, 250, 50, 50, true);
// ISTEAD OF DOING ALL THE SYSTEM.OUT STEPS, HERE I TRIED TO EFFECTIVELY DRAW THE INTERMEDIATE CATCHEVENT ELEMENT FOR EVERY SENTENCE WHICH SATISFY MY CONDITIONS.
}
else if(inputStr.contains(common)&&inputStr.contains(start)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(start))) { // If in the sentence I will find "The process" / ""the process" + "starts"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(start));
String label = inputStr.substring((inputStr.indexOf(intrLabel)+intrLabel.length()), inputStr.indexOf(before));
// System.out.println("\n" + "START EVENT:" + inputStr); // printSTART EVENT
// System.out.println("PROCESS NAME:"+processName.trim());
// System.out.println("LABEL:"+label.trim());
StartEvent startEvent = helpClass.createElement(helpClass.process, "start", label, StartEvent.class,
helpClass.plane, 15, 15, 50, 50, true);
// ISTEAD OF DOING ALL THE SYSTEM.OUT STEPS, HERE I TRIED TO EFFECTIVELY DRAW THE START EVENT ELEMENT FOR EVERY SENTENCE WHICH SATISFY MY CONDITIONS.
}
else if(inputStr.contains(common)&&inputStr.contains(msgS)&&inputStr.contains(and)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(msgS))&&inputStr.contains(and)) { // If in the sentence I will find "The process" / ""the process" + "sends a message" + "and ends"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(msgS));
String idMsgSend = inputStr.substring(inputStr.indexOf(msgS)+msgS.length(), inputStr.indexOf(conj));
String label = inputStr.substring(inputStr.indexOf(intrLabel)+intrLabel.length(), inputStr.indexOf(after));
// System.out.println("\n" + "END SEND-MESSAGE:" + inputStr); // stampa END SEND-MESSAGE
// System.out.println("PROCESS NAME:" + processName.trim());
// System.out.println("ID-MESSAGE:" + idMsgSend.trim());
// System.out.println("LABEL:" + label.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(msgS)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(msgS))) { // If in the sentence I will find "The process" / ""the process" + "sends a message"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(msgS));
String idMsgSend = inputStr.substring(inputStr.indexOf(msgS)+msgS.length(), inputStr.indexOf(intrLabel));
String label = inputStr.substring(inputStr.indexOf(intrLabel)+intrLabel.length(), inputStr.indexOf(after));
// System.out.println("\n" + "INTERMEDIATE SEND-MESSAGE:" + inputStr); // stampa INTERMEDIATE SEND-MESSAGE
// System.out.println("PROCESS NAME:" + processName.trim());
// System.out.println("ID-MESSAGE:" + idMsgSend.trim());
// System.out.println("LABEL:" + label.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(end)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(end))) { // If in the sentence I will find "The process" / "the process" + "ends"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(end));
String label = inputStr.substring(inputStr.indexOf(intrLabel)+intrLabel.length(), inputStr.indexOf(after));
// System.out.println("\n" + "END EVENT:" + inputStr); // stampa END EVENT
// System.out.println("PROCESS NAME:" + processName.trim());
// System.out.println("LABEL:" + label.trim());
EndEvent EndEvent = helpClass.createElement(helpClass.process, label.replace(" ", "")+label.valueOf(random.nextInt()).replace(" ", ""), label, EndEvent.class,
helpClass.plane, 15, 15, 50, 50, true);
// ISTEAD OF DOING ALL THE SYSTEM.OUT STEPS, HERE I TRIED TO EFFECTIVELY DRAW THE END EVENT ELEMENT FOR EVERY SENTENCE WHICH SATISFY MY CONDITIONS.
}
else if(inputStr.contains(common)&&inputStr.contains(task)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(task))) { // If in the sentence I will find "The process" / "the process" + "performs the activity"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(task));
String label = inputStr.substring(inputStr.indexOf(intrLabel)+intrLabel.length(), inputStr.indexOf(after));
// System.out.println("\n" + "TASK:" + inputStr); // stampa TASK
// System.out.println("PROCESS NAME:" + processName.trim());
// System.out.println("LABEL:" + label.trim());
Task Task = helpClass.createElement(helpClass.process, label.replace(" ", "")+label.valueOf(random.nextInt()).replace(" ", ""), label, Task.class,
helpClass.plane, 25, 25, 80, 80, true);
// ISTEAD OF DOING ALL THE SYSTEM.OUT STEPS, HERE I TRIED TO EFFECTIVELY DRAW THE TASK ELEMENT FOR EVERY SENTENCE WHICH SATISFY MY CONDITIONS.
}
else if(inputStr.contains(common)&&inputStr.contains(taskS)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(taskS))) { // If in the sentence I will find "The process" / "the process" + "performs a send message"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(taskS));
String idMsgSend = inputStr.substring(inputStr.indexOf(taskS)+taskS.length(), inputStr.indexOf(intrLabel));
String label = inputStr.substring(inputStr.indexOf(intrLabel)+intrLabel.length(), inputStr.indexOf(after));
// System.out.println("\n" + "SEND-TASK:" + inputStr); // stampa SEND-TASK
// System.out.println("PROCESS NAME:"+ processName.trim());
// System.out.println("ID-MESSAGE:" + idMsgSend.trim());
// System.out.println("LABEL:" + label.trim());
SendTask sendTask = helpClass.createElement(helpClass.process, label.replace(" ", "")+label.valueOf(random.nextInt()).replace(" ", ""), label, SendTask.class,
helpClass.plane, 25, 25, 80, 80, true);
// ISTEAD OF DOING ALL THE SYSTEM.OUT STEPS, HERE I TRIED TO EFFECTIVELY DRAW THE SEND TASK ELEMENT FOR EVERY SENTENCE WHICH SATISFY MY CONDITIONS.
}
else if(inputStr.contains(common)&&inputStr.contains(taskR)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(taskR))) { // If in the sentence I will find "The process" / "the process" + "performs a receive message"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(taskR));
String idMsgR = inputStr.substring(inputStr.indexOf(taskR)+taskR.length(), inputStr.indexOf(intrLabel));
String label = inputStr.substring(inputStr.indexOf(intrLabel)+intrLabel.length(), inputStr.indexOf(after));
// System.out.println("\n" + "RECEIVE-TASK:" + inputStr); // print RECEIVE-TASK
// System.out.println("PROCESS NAME:"+ processName.trim());
// System.out.println("ID-MESSAGE:" + idMsgR.trim());
// System.out.println("LABEL:" + label.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(xorS)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(xorS))) { // If in the sentence I will find "The process" / "the process" + "must take a decision"
String label = inputStr.substring(inputStr.indexOf(xorS.toLowerCase())+xorS.length()+2, inputStr.indexOf(after)-2);
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(xorS));
// System.out.println("\n" + "XOR-SPLIT:" + inputStr); // print XOR-SPLIT
// System.out.println("PROCESS NAME:"+ processName.trim());
ExclusiveGateway exclusiveSplit = helpClass.createElement(helpClass.process, "exclusiveSplit"+"exclusiveSplit".valueOf(random.nextInt()).replace(" ", "") , label,
ExclusiveGateway.class, helpClass.plane, 120, 120, 50, 50, true);
// ISTEAD OF DOING ALL THE SYSTEM.OUT STEPS, HERE I TRIED TO EFFECTIVELY DRAW THE EXCLUSIVE GATEWAY FOR EVERY SENTENCE WHICH SATISFY MY CONDITIONS.
}
else if(inputStr.contains(common)&&inputStr.contains(xorJ)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(xorJ))) { // If in the sentence I will find "The process" / "the process" + "completes the decision"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(xorJ));
// System.out.println("\n" + "XOR-JOIN:" + inputStr); // stampa XOR-JOIN
// System.out.println("PROCESS NAME:"+ processName.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(andS)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(andS))) { // If in the sentence I will find "The process" / "the process" + "must take a parallel selection"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(andS));
// System.out.println("\n" + "AND-SPLIT:" + inputStr); // stampa AND-SPLIT
// System.out.println("PROCESS NAME:"+ processName.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(andJ)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(andJ))) { // se nella frase trovo "The process"/"the process" + "completes the selection"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(andJ));
// System.out.println("\n" + "AND-JOIN:" + inputStr); // print AND-JOIN
// System.out.println("PROCESS NAME:"+ processName.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(inclS)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(inclS))) { // If in the sentence I will find "The process" / "the process" + "must make a choice"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(inclS));
// System.out.println("\n" + "INCLUSIVE-SPLIT:" + inputStr); // print INCLUSIVE-SPLIT
// System.out.println("PROCESS NAME:" + processName.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(inclJ)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(inclJ))) { // If in the sentence I will find "The process" / "the process" + "completes the choice"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(inclJ));
// System.out.println("\n" + "INCLUSIVE-JOIN:" + inputStr); // print INCLUSIVE-JOIN
// System.out.println("PROCESS NAME:" + processName.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(eventBased)||(inputStr.contains(common.toLowerCase())&&inputStr.contains(eventBased))) { // If in the sentence I will find "The process" / "the process" + "expects a reply"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(eventBased));
// System.out.println("\n" + "EVENT-BASED GATEWAY:" + inputStr); // print EVENT-BASED GATEWAY
// System.out.println("PROCESS NAME:" + processName.trim());
EventBasedGateway exclusiveSplit = helpClass.createElement(helpClass.process, "eventBasedSplit"+"eventBasedSplit".valueOf(random.nextInt()).replace(" ", ""), "",
EventBasedGateway.class, helpClass.plane, 500, 500, 50, 50, true);
/ ISTEAD OF DOING ALL THE SYSTEM.OUT STEPS, HERE I TRIED TO EFFECTIVELY DRAW THE EVENT BASED SPLIT ELEMENT FOR EVERY SENTENCE WHICH SATISFY MY CONDITIONS.
}
else if(inputStr.contains(common)&&inputStr.contains(timerStart1)||inputStr.contains(common.toLowerCase())&&inputStr.contains(timerStart1)) { // If in the sentence I will find "The process" / "the process" + "begins at"
String processName1 = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(timerStart1));
String label = inputStr.substring(inputStr.indexOf(timerStart1)+timerStart1.length(), inputStr.indexOf(before));
//System.out.println("\n" + "START-TIMER EVENT:" + inputStr); // print START-TIMER EVENT
//System.out.println("PROCESS NAME:" + processName1.trim());
//System.out.println("LABEL:" + label.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(timerStart2)||inputStr.contains(common.toLowerCase())&&inputStr.contains(timerStart2)){ // If in the sentence I will find "The process" / "the process" + "begins in"
String processName2 = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(timerStart2));
String label = inputStr.substring(inputStr.indexOf(timerStart2)+timerStart2.length(), inputStr.indexOf(before));
//System.out.println("\n" + "START-TIMER EVENT:" + inputStr); // print START-TIMER EVENT
//System.out.println("PROCESS NAME:" + processName2.trim());
//System.out.println("LABEL:" + label.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(timerStart3)||inputStr.contains(common.toLowerCase())&&inputStr.contains(timerStart3)){ // If in the sentence I will find "The process" / "the process" + "begins every"
String processName3 = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(timerStart3));
String label = inputStr.substring(inputStr.indexOf(timerStart3)+timerStart3.length(), inputStr.indexOf(before));
//System.out.println("\n" + "START-TIMER EVENT:" + inputStr); // print START-TIMER EVENT
//System.out.println("PROCESS NAME:" + processName3.trim());
//System.out.println("LABEL:" + label.trim());
}
else if(inputStr.contains(common)&&inputStr.contains(timerIntermediate)||inputStr.contains(common.toLowerCase())&&inputStr.contains(timerIntermediate)) { // If in the sentence I will find "The process" / "the process" + "waits by"
String processName = inputStr.substring(inputStr.indexOf(common.toLowerCase())+common.length(), inputStr.indexOf(timerIntermediate));
String label = inputStr.substring(inputStr.indexOf(timerIntermediate)+timerIntermediate.length(), inputStr.indexOf(after));
// System.out.println("\n" + "INTERMEDIATE-TIMER EVENT:" + inputStr); // print INTERMEDIATE-TIMER EVENT
// System.out.println("PROCESS NAME:" + processName.trim());
// System.out.println("LABEL:" + label.trim());
}
else {System.out.println("\n" + "YOU HAVE WRITTEN WRONG THIS ELEMENT: "+ inputStr);
}
}
//System.out.println("\n" + "------TOTALE ELEMENTI:------ " + result.length);
Bpmn.validateModel(helpClass.modelInstance);
File file = File.createTempFile("bpmn-model-api-", ".bpmn");
Bpmn.writeModelToFile(file, helpClass.modelInstance);
// THESE LAST THREE LINES OF CODES ARE NEEDED TO VALIDATE AND CREATE THE MODEL.
}
}