/* Hello World in Groovy */ //println("Hello world") /*class Example { static void sum(int a,int b = 5) { int c = a+b; println(c); } static void main(String[] args) { sum(6,7); } }*/ class Example { int x; public int getX() { return x; } public void setX(int pX) { x = pX; } static void main(String[] args) { Example ex = new Example(); ex.setX(100); println(ex.getX()); } }
import java.util.Properties; import java.io.InputStream; //import com.boomi.execution.ExecutionUtil; import static groovyx.gpars.actor.Actors.actor; //logger = ExecutionUtil.getBaseLogger(); //logger.warning("Start"); println("Start"); // THIS PART IS NOT BEING EXECUTED def decryptor = actor { // logger.warning("In decryptor"); println("In decryptor"); loop { react { message -> if (message instanceof String) reply message.reverse() else stop() } } } // // THIS PART IS NOT BEING EXECUTED def console = actor { decryptor.send 'lellarap si yvoorG' //logger.warning("In console"); println("In console"); react { // logger.warning('Decrypted message: ' + it) println('Decrypted message: ' + it) decryptor.send false } } // //for( int i = 0; i < dataContext.getDataCount(); i++ ) { //InputStream is = dataContext.getStream(i); //Properties props = dataContext.getProperties(i); //logger.warning("Middle"); println("Middle"); [decryptor, console]*.join() //dataContext.storeStream(is, props); //} // logger.warning("End"); println("End");
//import java.util.ArrayList class Example { static void main(String[] args) { String a = "DBSTART|a6b5e62f-bb11-4fcc-bf26-493ee966b793|2|@|BEGIN|2|@|OUT_START|3|@|1|^||^||^||^||^|322|^|Reverse: QM Confirm Stock at Plant|^|Plant|^|4900109864|^|000000000000110079|^||^|000000000000156691|^|000000000000156691|^|RV_8I4000S_H_NF3__US__U___200B_A|^|KRB6|^|EMPT|^|KRB6|^|SER03|^|-|^||#|2|^||^||^||^||^|322|^|Reverse: QM Confirm Stock at Plant|^|Plant|^|4900109864|^|000000000000110079|^||^|000000000000156691|^|000000000000156691|^|RV_8I4000S_H_NF3__US__U___200B_A|^|KRB6|^|EMPT|^|KRB6|^|SER03|^|-|^||#|3|^||^||^||^||^|322|^|Reverse: QM Confirm Stock at Plant|^|Plant|^|4900109864|^|000000000000110079|^||^|000000000000156691|^|000000000000156691|^|RV_8I4000S_H_NF3__US__U___200B_A|^|KRB6|^|EMPT|^|KRB6|^|SER03|^|-|^||#|4|^||^||^||^||^|322|^|Reverse: QM Confirm Stock at Plant|^|Plant|^|4900109864|^|000000000000110079|^||^|000000000000156691|^|000000000000156691|^|RV_8I4000S_H_NF3__US__U___200B_A|^|KRB6|^|EMPT|^|KRB6|^|SER03|^|-|^||#|5|^||^||^||^||^|561|^|Receipt to unrestricted stock|^|Plant|^|4900068091|^|000000000000110079|^||^|000000000000156691|^|000000000000156691|^|RV_8I4000S_H_NF3__US__U___200B_A|^|KRB6|^|EMPT|^|KRB6|^|SER03|^|+|^||#||#|OUT_END|3|@|END|2|@|DBEND|a6b5e62f-bb11-4fcc-bf26-493ee966b793|2|@|"; String firstPartString; String lastPartString; String output; String[] str; str = a.split("#"); //Data preparation String[] row1Array; row1Array = str[0].split("@"); str[0] = row1Array[3]; int numberOfRows = str.size(); println("Total columns= "+ (str.size()-2)); //END Data preparation for (int i =0; i<(numberOfRows-2); i++){ println("Column:" + str[i]); } //--------------------------------------------------------- println("-----------------------------------------"); println("Data splited"); //Function get value (Rows,SpecificRow,columnN) String row = str[2]; String [] column = row.split("\\|",-1); List cleanedColumn = new ArrayList(); int numberOfValidData = 0; for(int j = 1; j<(column.size()-1);j++){ if(column[j]!="^"){ cleanedColumn.add(column[j]); numberOfValidData++; } } println("numberOfValidData: "+numberOfValidData); println(cleanedColumn); println("Size of cleanedColumn:"+cleanedColumn.size()) //NEW println("-----------------------------------------"); firstPartString = row1Array[0]+"@"+row1Array[1]+"@"+row1Array[2]+"@"; println("firstPartString:" + firstPartString); lastPartString = "#"+str[5]+"#"+str[6]; println("lastpartOfString:"+ lastPartString); println("Data per row:"+ cleanedColumn.join('|^|')); } }
def customersOnSubbucket; def problemlt = "17"; def problemportone = "1"; def problemporttwo = "2"; def deviceCustomerCount = [:]; deviceCustomerCount."17-1" = [1,2,3,4,5,6,7,8,9]; //deviceCustomerCount."17-2" = [2,4,6,8,10,12,14,16,18]; print "deviceCustomerCount = " + deviceCustomerCount + "\n"; print "17-1 = " + deviceCustomerCount["17-1"] + "\n";; print "17-2 = " + deviceCustomerCount["17-2"] + "\n";; customersOnSubbucket = deviceCustomerCount[problemlt + "-" + problemportone].sum() + deviceCustomerCount[problemlt + "-" + problemporttwo].sum(); print "\n$customersOnSubbucket";
class Example { static void main(String[] args) { // Initializing a local variable int a = 200 //Check for the boolean condition if (a<100) { //If the condition is true print the following statement println("The value is less than 100"); else (a>100) println("The valus is grater then 100"); } } }
def SelectAgentAccordToBaFDivision (i, countOfAgents) { def chunk = i % (countOfAgents * 2) def agentIndex = i % countOfAgents if (chunk >= countOfAgents) agentIndex = (countOfAgents - 1) - agentIndex return agentIndex } def missionsTTC = [70,50,90,40] def countOfAgents = missionsTTC.size() def maxTimePerAgent = 100 def ttc = 60 def j = 0 def agentIndex = SelectAgentAccordToBaFDivision(j, countOfAgents) def checks = 0; def checksCount = (countOfAgents * 2) while ((missionsTTC[agentIndex] + ttc) > maxTimePerAgent && checks < checksCount) { j++ agentIndex = SelectAgentAccordToBaFDivision(j, countOfAgents) checks++ } println agentIndex
class User { String firstname; String lastname; void setFirstname(String firstname_) { this.firstname = firstname_ } void setLastname(String lastname_) { this.lastname = lastname_ } } User user = new User(); user.firstname = "Joseph (A)" user.lastname = "Tuffley" println(user.firstname.substring(0, user.firstname.indexOf('(') == -1 ? user.firstname.length() : user.firstname.indexOf('(')).replace('*CONTRACTOR*', '').replace('*FUNCTIONAL-ID*', '').replace('*APPLICATION-ID*', '').trim().concat(' ').concat(user.lastname))
/* Hello World in Groovy */ def allowedStates = ["all","blue","green","red","yellow","black","white"] def displayStates = [] def stateList = "blue,green".tokenize(',') allowedStates.each { if(stateList.contains(it)) { displayStates.add(it + ":selected") } else { displayStates.add(it) } } displayStates.each { println(it) }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more