OneData 10.7 | Managing Master Data with webMethods OneData | Developing for webMethods OneData | OneData Hooks | Process Flow Designer | Process Flow Java Code Samples
 
Process Flow Java Code Samples
All variables and data values are of type string.
Checking for null string/if statement
if (StringUtils.isEmpty(CreatID))
ResultID=AssocID;
else
ResultID=CreatID;
Assignment
ResultId=AssocID;
String comparison
if ( str1.equalsIgnoreCase(str2))
Test1=1;
Date Comparison
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.text.DateFormatter;
 SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
 Date date1 = dateFormatter.parse(str1);
 Date date2 = dateFormatter.parse(str2);
 same = (date1.compareTo(date2) == 0);
Number Comparison
int integer1 = Integer.parseInt(str1);
int integer2 = Integer.parseInt(str2);
same = integer1 == integer2;
}catch(Exception e){
 same = str1.equalsIgnoreCase(str2); 
 }
return same;