Sunday, September 13, 2009

Open Workflow status monitor diagram page in OAF

Create a VO for the query which is given below through this you can get the current diagram url,

select WF_MONITOR.GetDiagramURL(WF_CORE.Translate('WF_WEB_AGENT'),NtfEO.MESSAGE_TYPE,NtfEO.ITEM_KEY,'NO') monitor_url from
(SELECT ITEM_KEY,MESSAGE_TYPE FROM WF_NOTIFICATIONS WHERE NOTIFICATION_ID = :1) NtfEO

First find the button component of your page.
call VO with the input parameters which will return the diagram url.
Put that url into the java script function.

Through the java script you can open a new popup window which will display the status monitor diagram

OASubmitButtonBean reAssignBea1n = (OASubmitButtonBean) paramOAWebBean.findChildRecursive("WfMonDiagramCtrl");

Serializable[] parameters1 = { NotificationId };
Serializable aa1 = am.invokeMethod("getMonitorURL", parameters1);
if (aa1 != null && !aa1.toString().equals(""))
{
String url = "window.open('" + aa1.toString() + "')";
paramOAPageContext.putJavaScriptFunction("LaunchMonitor", url);
}

Determine the transaction state that is, whether changes have been made to view objects or not

Use the following methods:

ApplicationModule.getTransaction().isDirty() - This method tells you whether the transaction contains any changes in the view objects. This works for transactions made by entity object-based view objects only.

OAViewObject.isDirty() - This method tells you whether a particular view object contains changes or not. This works for both entity object-based view objects and view objects based on OAPlsqlViewObjectImpl. For view objects based on OAPlsqlViewObjectImpl, you can also use OAPlsqlViewObjectImpl.getState() method

Always call remove() after done using a dynamic view object

Always call VO.remove() after you are done using a dynamic view object:

ViewObject voobject = null;
try
{
voobject = mTransaction.createViewObjectFromQueryStmt("sql statement");
boolean exists = ( voobject.first() != null);
}
finally
{
voobject.remove();
}
Make sure to surround your VO.remove(); with finally.
If you don't, a java runtime exception could fire before you even get to your VO.remove().

Create a run time VO in OA framework

To create a run time VO you have to follow these steps which are given below:

OAApplicationModule am = pageContext.getApplicationModule(webBean);

OADBTransaction oadbtransaction = am.getOADBTransaction();
String validateStr1 = "select column_name from table_name where column_name = :1";

ViewObject validateViewObject1 = (ViewObject)am.findViewObject("ValidateCodeVO1");

if (validateViewObject1 == null)
validateViewObject1 = (ViewObject)am.createViewObjectFromQueryStmt("ValidateCodeVO1", validateStr1);

validateViewObject1 = (ViewObject)am.findViewObject("ValidateCodeVO1");

if (validateViewObject1 != null)
{
validateViewObject1.setWhereClause(null);
validateViewObject1.setWhereClauseParam(0, pageContext.getParameter("NtfId"));
validateViewObject1.executeQuery();
validateViewObject1.reset();

oracle.jbo.Row validaterow = validateViewObject1.first();

if (validaterow != null)
message_type = validaterow.getAttribute(0).toString();
}