Though Pega suggest us not to use java , certain times we are forced to use java for the complex solutions.
For a guy like me , who did not do java as curriculum always depends on google for the java code.
This post is going to help me to identify the syntax of certain java code which I have used
Click the button to copy the syntax and paste in the Java beautifier for alignment
https://codebeautify.org/javaviewer
Use case
Add Log message
Syntax copy
oLog.infoForced("Log message Here");
Use case
Add try and catch block
Syntax copy
try {
oLog.infoForced("try block executed");
} catch (Exception ex) {
oLog.error("catch block executed", ex.toString());
}
Use case
To get current Date and Time
Syntax copy
Date date1 = java.util.Calendar.getInstance().getTime();
oLog.infoForced("Current Date Time"+ date1);
Use case
To get current Date and Time
Syntax copy
Date date1 = java.util.Calendar.getInstance().getTime();
oLog.infoForced("Current Date Time"+ date1);
Use case
Convert Bigdecimal(input) to date format
Syntax copy
DateFormat df = new SimpleDateFormat("dd/MMM/YYYY");
String date = df.format(input);
oLog.infoForced("Converted Date format"+ date);
Use case
To create a Clipboard page object from step page/ Page/ datapage
Syntax copy
ClipboardPage sp1 = myStepPage;
ClipboardPage sp2 = tools.getStepPage();
ClipboardPage cp tools.findPage("PageName");
ClipboardPage dp tools.findPage("D_PageName");
Use case
To create a Clipboard property object from step page/ Page/ datapage
Syntax copy
ClipboardPage cp tools.findPage("PageName");
String ABC = cp.getProperty("pyLabel").toString();
Use case
To Loop over PageList / datapage - (D_PageName.pxResults(1).PNAME)
Syntax copy
String DatapageName = "D_PageName";
ClipboardPage dpage tools.findPage(DatapageName);
if (dpage != null) {
ClipboardProperty Results = dpage.getIfPresent("pxResults");
Iterator it = Results.iterator();
while (it.hasNext()) {
ClipboardProperty next = (ClipboardProperty) it.next();
ClipboardPage nextPage = next.getPageValue();
ClipbaordProperty propertyname = nextPage.getIfPresent("PNAME");
oLog.infoForced("Print Property"+ propertyname);
}
}
Use case
For Loop Logic
Syntax copy
int size = 10000;
int size = sp.getProperty("PropertyName").size();
for (int i=1 ; i <= size ; i++)
{
oLog.infoForced("For logic"+ i);
}
Post a Comment