1. Expose the method recreateDynamicViewObjectWithNewQuery(String newSQL) to the client in the AM. This method will basically find the view object, remove it, create a new instance of vo from the query and executes the query:
findViewObject(DYNAMIC_VO_NAME).remove();
ViewObject vo = createViewObjectFromQueryStmt(DYNAMIC_VO_NAME,newSQL);
vo.executeQuery();
2. In the Client side(controller), override the prepareModel. The overriden method should
- unset the tokenvalidation through : ctx.getBindingContainer().setEnableTokenValidation(false);
- Unbind the rowsetIterator from the dynamicqueryiteratorbinding through : ctx.getBindingContainer(). findIteratorBinding(DYNAMIC_VO_ITER_NAME).bindRowSetIterator(null,false);
- call the method exposed by AM to bind the newSQL to the view object.
- remove the control binding by name. removeControlBinding(ctx,DYNAMIC_VO_RANGE);(basically remove the control binding from the iterator binding list and remove it from the binding container).
removeControlBinding:
---------------------------
DCBindingContainer bc = ctx.getBindingContainer();
DCControlBinding binding = bc.findCtrlBinding(name);
binding.getDCIteratorBinding().removeValueBinding(binding);
bc.removeControlBinding(binding);
- recreate the control binding and add it to the binding container:addDynamicRangeBinding(ctx,DYNAMIC_VO_RANGE, DYNAMIC_VO_ITER_NAME);
addDynamicRangeBinding
-------------------------------
DCBindingContainer bc = ctx.getBindingContainer();
JUCtrlRangeBinding dynamicRangeBinding =
new JUCtrlRangeBinding(null,bc.findIteratorBinding(iterName),null);
bc.addControlBinding(bindingName,dynamicRangeBinding);
- Execute super.prepareModel(ctx);
- Reset the tokenvalidation through : ctx.getBindingContainer().setEnableTokenValidation(true);
Sunday, May 22, 2005
ADF - Dynamic rendering of UI irrespective of dataobjects
The following code in the view layer will render the dataobjects without any change in the view layer even though the view object gets re-constructed in the transaction.
<pre>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<c:forEach var="attributeLabel" items="${bindings.(voname).labelSet">
<th>
<c:out value="${attributeLable}" />
</th>
</c:forEach>
</tr>
<c:forEach var="Row" items="${bindings.(voname).rangeSet">
<tr>
<c:forEach var="attrValue" items="${Row.attributeValues}" >
<td>
<c:out value="${attrValue}" />
</td>
</c:forEach>
</tr>
</c:forEach>
</table>
</pre>
Basically the above code makes use of the labelSet and rangeSet properties of the VO object in the bindings and loop through them and print the same.
<pre>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<c:forEach var="attributeLabel" items="${bindings.(voname).labelSet">
<th>
<c:out value="${attributeLable}" />
</th>
</c:forEach>
</tr>
<c:forEach var="Row" items="${bindings.(voname).rangeSet">
<tr>
<c:forEach var="attrValue" items="${Row.attributeValues}" >
<td>
<c:out value="${attrValue}" />
</td>
</c:forEach>
</tr>
</c:forEach>
</table>
</pre>
Basically the above code makes use of the labelSet and rangeSet properties of the VO object in the bindings and loop through them and print the same.
Open new window in UIX
Had a question on how to open new window in UIX using javascript. Then got the following link which explains clearly how the javascript support is provided in UIX.
Look out the LovXXXX components demo in uix.
See <script> demo of component guide. This should help you clearly understand the functionalities.
See documentation of above UIX components
Like providing handlers to HTML elements, you can attach event handlers to UIX components too. You can attach event handlers on onClick, onMouseOver,... on UIX components just as you would do in HTML.
Look out the LovXXXX components demo in uix.
See <script> demo of component guide. This should help you clearly understand the functionalities.
See documentation of above UIX components
Like providing handlers to HTML elements, you can attach event handlers to UIX components too. You can attach event handlers on onClick, onMouseOver,... on UIX components just as you would do in HTML.
Personalizing google home page
check this link http://www.google.com/ig to start personalizing your own Google home page.
Thursday, May 19, 2005
JBO-30003
Getting this error:
oracle.jbo.common.ampool.ApplicationPoolException: JBO-30003: The application pool (model.AppModuleLocal) failed to checkout an application module due to the following exception:
Solution:
- May be the database is down. Bring it up.
oracle.jbo.common.ampool.ApplicationPoolException: JBO-30003: The application pool (model.AppModuleLocal) failed to checkout an application module due to the following exception:
Solution:
- May be the database is down. Bring it up.
Tuesday, May 17, 2005
Master-Detail design using ADF in uix page
In case the view layer is using UIX page, this requirement can even be simplified by dragging the child view object in view link with the option of Master to Detail(many to many). This will automatically take care of synchronization between master and details during navigation.
Simplest way to design Master-detail tables using ADF
Simplese way to design a master-detail table using ADF,
1. Create the master and detail entity objects. Create the appropriate association objects and view links.
2. Using the master view object in data control, create the master table.
3. Using the detail view object(present in view link) and create a child table
4. In the master table, add a column with ADF operation: setCurrentRowWithKey
that's it... now run the page, clicking on the select link in master will automatically refresh the child table(vo gets refreshed automatically by viewlink).
1. Create the master and detail entity objects. Create the appropriate association objects and view links.
2. Using the master view object in data control, create the master table.
3. Using the detail view object(present in view link) and create a child table
4. In the master table, add a column with ADF operation: setCurrentRowWithKey
that's it... now run the page, clicking on the select link in master will automatically refresh the child table(vo gets refreshed automatically by viewlink).
Conditional display of table data
This code snippet makes use of JSTL core taglib to display no data found if the table contains no records, else it display the records.
------------------------------------
<table border="1" width="100%">
<tr>
<th> </th>
<th>
<c:out value="${bindings.DummyView1.labels['Field1']}"/>
</th>
<th>
<c:out value="${bindings.DummyView1.labels['Field2']}"/>
</th>
<th>
<c:out value="${bindings.DummyView1.labels['Field3']}"/>
</th>
</tr>
<c:choose>
<c:when test="${bindings.DummyView1Iterator.estimatedRowCount>0}">
<c:forEach var="Row" items="${bindings.DummyView1.rangeSet}">
<tr>
<td>
<c:out value="${Row.currencyString}"/>
</td>
<td>
<c:out value="${Row['Field1']}"/>
</td>
<td>
<c:out value="${Row['Field2']}"/>
</td>
<td>
<c:out value="${Row['Field3']}"/>
</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="4">no data found</td>
</tr>
</c:otherwise>
</c:choose>
</table>
------------------------------------
<table border="1" width="100%">
<tr>
<th> </th>
<th>
<c:out value="${bindings.DummyView1.labels['Field1']}"/>
</th>
<th>
<c:out value="${bindings.DummyView1.labels['Field2']}"/>
</th>
<th>
<c:out value="${bindings.DummyView1.labels['Field3']}"/>
</th>
</tr>
<c:choose>
<c:when test="${bindings.DummyView1Iterator.estimatedRowCount>0}">
<c:forEach var="Row" items="${bindings.DummyView1.rangeSet}">
<tr>
<td>
<c:out value="${Row.currencyString}"/>
</td>
<td>
<c:out value="${Row['Field1']}"/>
</td>
<td>
<c:out value="${Row['Field2']}"/>
</td>
<td>
<c:out value="${Row['Field3']}"/>
</td>
</tr>
</c:forEach>
</c:when>
<c:otherwise>
<tr>
<td colspan="4">no data found</td>
</tr>
</c:otherwise>
</c:choose>
</table>
Saturday, May 14, 2005
Question in ADF
I got this question: In a multi-page data entry flow where all the pages share the same underlying Entity Object, how should the entity level validation(validateEntity) be prevented until the user navigates to the final review and submit page. So, posted this question in a forum and got the response:
We have this SAME question.
We were thinking of:
1. add an attribute to the entity (not persistent) called pagenum
2. Expose this in the view
3. Expose in page as hidden value with the page# filled in
In validation methods (in EO) say:
public boolean validateEOfield1()
{
if thisFieldNeedsValidateOnPage( "field", getPageNum() )
{
// perform the validation logic here...
if ( thisFieldInError( "field" ) )
return false;
else
return true;
}
// if not on this page, then ...
// everything is ok
return true;
}
I haven't gotten very far with this idea and wanted to post a question, but I don't receive much feedback on my posts, so I wasn't sure what to do with it...
My Reply:
The above suggestion resolves the issue where the field validation is manually written by me in the EO. But, in case of declarative validations which I specify through Jdeveloper, how can I control the field validations.
One question here: model layer validations should be independent of the view layer right(either single/multi step). In this case, are n't we mixing the page flow logic
in our entity objects, which is a violation of MVC.
Instead, is it possible to get all the validation exceptions for all the EO's in the current transaction in the controller and check whether these exception can happen in the current page. If so, we will display these exceptions. Else, we will silently disregard these validation exceptions.
We have this SAME question.
We were thinking of:
1. add an attribute to the entity (not persistent) called pagenum
2. Expose this in the view
3. Expose in page as hidden value with the page# filled in
In validation methods (in EO) say:
public boolean validateEOfield1()
{
if thisFieldNeedsValidateOnPage( "field", getPageNum() )
{
// perform the validation logic here...
if ( thisFieldInError( "field" ) )
return false;
else
return true;
}
// if not on this page, then ...
// everything is ok
return true;
}
I haven't gotten very far with this idea and wanted to post a question, but I don't receive much feedback on my posts, so I wasn't sure what to do with it...
My Reply:
The above suggestion resolves the issue where the field validation is manually written by me in the EO. But, in case of declarative validations which I specify through Jdeveloper, how can I control the field validations.
One question here: model layer validations should be independent of the view layer right(either single/multi step). In this case, are n't we mixing the page flow logic
in our entity objects, which is a violation of MVC.
Instead, is it possible to get all the validation exceptions for all the EO's in the current transaction in the controller and check whether these exception can happen in the current page. If so, we will display these exceptions. Else, we will silently disregard these validation exceptions.
BC4J Entity States
Entity States in BC4J are as follows:
STATUS_INITIALIZED = -1
STATUS_NEW = 0
STATUS_UNMODIFIED = 1
STATUS_MODIFIED = 2
STATUS_DELETED = 3
STATUS_DEAD = 4
STATUS_INITIALIZED = -1
STATUS_NEW = 0
STATUS_UNMODIFIED = 1
STATUS_MODIFIED = 2
STATUS_DELETED = 3
STATUS_DEAD = 4
Subscribe to:
Posts (Atom)