Anil's Blog is Best Viewed on GOOGLE CHROME

Friday, April 10, 2009

Creating VO at RunTime in Controller OR Dynamically created VO

ViewObject viewobject = oapagecontext.getApplicationModule(oawebbean).findViewObject("ObtainProjectId");


if(viewobject == null)
{
String s14 = "SELECT project_id FROM PA_PROJECTS_ALL WHERE segment1 =:1";
viewobject = oaapplicationmodule.createViewObjectFromQueryStmt("ObtainProjectId", s14);
}

viewobject.setWhereClauseParam(0, s5);
viewobject.executeQuery();
int i = viewobject.getRowCount();
if(i != 1)

{
Debug.log(oapagecontext, this, "Error : Project Number is Invalid or not unique", 3);
OAException oaexception4 = null;
oaexception4 = new OAException("PA", "PA_PROJECT_NUMBER_INVALID");
oaexception4.setApplicationModule(oaapplicationmodule);
throw oaexception4;
}

oracle.jbo.Row row = viewobject.last();

if(row != null)
{
Object obj2 = row.getAttribute(0);
if(obj2 != null)
{
s3 = obj2.toString();

if(s3 != null)
{
oapagecontext.putTransactionValue("paProjectId", s3); // Capturing projectid in Session

if(oaapplicationmodule.findViewObject("AddNewAssignmentsVO") != null)

{
oaapplicationmodule.findViewObject("AddNewAssignmentVO").first().setAttribute("ProjectId", s3);
}
}
}
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.