Dynamic view object within dynamic form in HA mode - oracle-adf

The issue is not reproducible in HA mode
We are hitting an application issue with dynamic view object within dynamic form in HA mode. As indicated below we have a dynamic form in UI which binds to dynamic view object:
<dynamic:form value="#{bindings.ZcqDqInput1Iterator}" id="idf" />
The ZcqDqInput1Iterator binds a dynamic view object within an AM :
<iterator Binds="ZcqDqInput1" RangeSize="25" DataControl="DQRealTimeUtilityAMDataControl" id="ZcqDqInput1Iterator"/>
The application has been enabled with HA mode recently, to handle passivation and activation scenario. I have overriden the activateState within AM to recreate the view object. that binds to view object ZcqDqInput1.
Navigating to this screen from some steps shows the below error:
Caused by: oracle.jbo.InvalidParamException: JBO-25006: Value 00010000000EACED00057708FFFFFFFFFFFFFFFF passed as parameter String to method Constructor:Key is invalid: {3}.
at oracle.jbo.Key.parseBytes(Key.java:543)
at oracle.jbo.Key.<init>(Key.java:185)
at oracle.jbo.server.IteratorStateHolder.getCurrentRowKey(IteratorStateHolder.java:35)
at oracle.jbo.server.ViewRowSetIteratorImpl.activateIteratorState(ViewRowSetIteratorImpl.java:3998)
at oracle.jbo.server.ViewRowSetIteratorImpl.getRangeSize(ViewRowSetIteratorImpl.java:646)
at oracle.jbo.server.ViewRowSetImpl.getRangeSize(ViewRowSetImpl.java:3194)
at oracle.jbo.server.ViewObjectImpl.getRangeSize(ViewObjectImpl.java:12199)
at oracle.adf.model.binding.DCIteratorBinding.initSourceRSI(DCIteratorBinding.java:2114)
at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1854)

Related

Controller returning un rendered view

I am facing an issue with my controllers refs and the returned object being invalid. And by invalid it returning me an object that says it has not been rendered even though i am in the process of using it.
In my controller I have a ref defined as the following.
refs : [ {
ref : 'selectDeltaView',
selector : '[itemId=selectDeltaView]'
}]
and later in my controller I access this view using the created accessor
this.getSelectDeltaView()
What is strange is that the first time this view is presented, inside of an Ext.Window it works just fine. However, on the second launch the view I get back is not rendered.
this.getSeletDeltaView().rendered === false
Reading the documentation over at Sencha it seems that this simply passes my selector to the Ext.ComponentQuery.query function. However, if I call Ext.ComponentQuery.query('[itemId=selectDeltaView]') I get an array with a single element of which rendered is true.
Am i missing something? Why is my controllers reference returning me invalid data.
Update
Some additional details not mentioned in the original post. My initial assumption was that my view was not being destroyed. However, I have log statements in my ondestory and beforedestory events and can confirm that on closing the window my view is being destroyed.
What is the most confusing is that if refs simply use Ext.ComponentQuery.query, why does Ext.ComponentQuery.query only return one view when the window is re-opened and it returns the correct view. I understand from the question below that refs will catch the view, but that view no longer exist.. or shouldn't.. If the view is destroyed, can I force the controller to clear its catch?
The controllers reference is cached after the first evaluation.
What happens is this:
You open your view a first time.
getSeletDeltaView() finds that view, and stores a reference to it in the reference lookup cache.
You close the view, but you do not destroy it completely.
You open the view a second time, but it is a different instance.
getSeletDeltaView() finds the first view, that is no longer rendered, but still exists, because it was not destroyed. You cannot use this reference, because it point to the wrong view.
Solution:
Make sure to destroy() your view, when you hide it. You can also use autoDestroy as a property. Usually, autoDestroy is true by default.

Backbone.js - Properties vs Attributes

What is the difference between properties and attributes of a Backbone model.
I believe one would use attributes to trigger model changes when the model gets modified.
In the below example.
var Vehicle = Backbone.Model.extend({prop1:'1'});
var v1 = new Vehicle({prop1 : '1111'});
console.log(v1.prop1); // accessing the property
console.log(v1.get('prop1')); // accessing the attribute
The object v1 has both a property called prop1 and also an attribute called prop1. There is no relation between them.
The difference is really that a property is a language feature (Javascript), whereas an attribute is a feature of the Backbone framework. To put it another way, a property exists independently of Backbone, whereas an attribute relies on the Backbone framework and its infrastructure.
Specifically, attributes participate in all the model-related things:
sync (when you call save or fetch)
validation on save
view rendering (via toJSON)
events and notification

Forcing Object Data Source To Reinstantiate

I am using the XPages Mobile Controls with an Object data source (Java Class which is NOT a managed bean) tied to View scope on a second app page. I have resetContent on the second page set to true. So I would have assumed the Object Data Source would be destroyed and recreated every time I transitioned to the second page.
When I transition to the second page the first time, the createObject() method is invoked as expected. If I transition to the second page using a button AND set forceFullRefresh to true the createObject() method is invoked. If, however I have a Rounded List Item with a moveTo specified for the second page the createObject() method does not get invoked. Instead the object remains set to the last value it was using when that application page was last accessed.
Is there a way to force the createObject() method to be invoked every time I transition to the page?
Another way is to call the refresh method of the datasource in SSJS.
Assumning you have only one datasource on the page, you can access the ObjectDataSource from the view:
var ods:com.ibm.xsp.extlib.model.ObjectDataSource = view.getData().get(0);
ods.refresh()
This executes the createObject method binding and reinstantiate the datasource.
The solution turned out to be to move the object data source from view scope to request scope. This is possible because I do not have the need for any partial refreshes on that page until the details are ready to be submitted.

Show custom pop up warning message when user changes any value (text box/LOV) on page

I have requirement to show custom pop up warning message when user changes any value (text box/LOV) on page and close tab/cancel button by mistake.
Option I tried are:
a) Within application we are using a complex task flow/RegionModel for 7 different scenario's. Also requirement is to display custom message - Hence could not use approach "unsaveddatawarning"
http://www.oracle.com/technetwork/developer-tools/adf/unsaveddatawarning-100139.html
b) Second option I tried was to have custom region controller:
CustomRegionController implements RegionController
Inside validateRegion(RegionContext regionContext) thought to find if page data is dirty
AdfFacesContext.getCurrentInstance().getDirtyPageHandler().isDataDirty();
or
DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCDataControl cDataControl = dcBindings.getDataControl();
boolean dirtyFlag = cDataControl.isTransactionModified();
In both scenario it always gives true (seems due to common set of VO/View Link application module always gets dirty when data is being rendered on page load).
Last option I am left with is to invoke valueChangeListener for each element (textbaox, LOV, Check box). I do not like this option at all. Please suggest if there can be better way to handle this scenario.
Why is using a value change listener a problem? Have each input component call the same VCL method in the backing bean. If necessary you can get the component id from the vcl event object.

tabbedPane selectionChangeListener not invoking method on tab selection

I am having some problems getting the method specified in selectionChangeListener invoked on tab change.
The loadingMode is default, ajaxLazy, which means it should be called the first time a tab is selected. The tabbedPane is wrapped in
The el expression looks like:
selectionChangeListener="#{pageController.tabSelected}"
The method signature of the method binding is:
#Component("pageController") // Using spring for bean management
#Scope("request)"
public class PageController {
public void tabSelected(SelectionChangeEvent e)
}
It is not throwing any exceptions so it is not even trying to resolve the method binding.
Any ideas?
Try this:
<o:tabbedPane loadingMode="server" rendered="true" selectionChangeListener="#{yourBeanName.listenerMethod}">
...
</o:tabbedPane>
As you can see I`m using server as loading mode. That way the listener method will be invoked each time a tab is clicked. If you use client as loading mode, the tab click event will not be picked up by the server.
For more info you can view the documentation for tabbedPane

Resources