Friday, November 27, 2009

العيد بعيدين

and maybe more,

the first reason is because it is EID Al Adha, and instead for writing again and agian about it, i will just refer to
http://oraclejo.blogspot.com/2008/09/eid-dj-vu.html.

and for the second Eid, it about some technical issue that i figured about ADF technology. If you are not familiar with what Oracle ADF is, stop reading because this is not for YOU, or continue at our own risk

Well, i spend the day yesterday fiddling around with ADF binding concepts until i believe i have got it all figured out. I was working with this technology for quite sometime (only from out of the box) but since i am asked to do some consulting job next week in Kuwait, i have been doing nitty gritty details and trying to come done to core of the material.

I have designed two pages one based on on Table DEPT and with the following page definition information

Page definition name ="untitled1PageDef"
iterator name ="deptView1Iterator"

and the other is page is based on TRADE table with the following page definition information

Page definition name ="untitled1PageDef"
iterator name ="tradeView1Iterator"

A trivial scenario would be to read some page1 attribute (Text item) from page1 while running page one. All ADF programmers must have encountered this situation and have done it many times through several different solution. The solution i pick is a solution that i can always use and a solution that depends on the basics (No Eid here)

FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
ValueBinding bind = app.createValueBinding("#{data}");

BindingContext bindingCtx = (BindingContext)bind.getValue(ctx);
DCBindingContainer dcb = (DCBindingContainer)bindingCtx.findBindingContainer("untitled1PageDef");
DCIteratorBinding Iter = dcb.findIteratorBinding("DeptView1Iterator");
String attr =Iter.getCurrentRow().getAttribute(2).toString();

(note: i know that there are short cuts that would probably eliminate a few lines of code, but at the expense of hiding the basics).


Now, let us move to the following situation. I am running page1 and selected a specific row, and i am moving to page 2 and i am required to find an attribute of on page 1 (which i have already left) . Well many techniques exist and most of them depend on other standard web techniques like using Session Variables, or ADF actions set Action listener etc..
The basic concept in ADF relies on a model object that holds that sources based on View Object. Since view objects are already instantiated by the Application Module and their data is persistent as long as the application module is alive, and since such objects are bound to ADF iterator binding in the binding containers, then, its only makes sense that we should be able to read the iterator binding of any visited page definition.

Well, during my past readings , i came to know more things about iterator binding, that i undermined at that time. The Literature about ADF iterator binding says, that after the completion of the JSF and ADF lifecycle, the framework unbinds the iterator binding from its data source and rebinds it again when the page is loaded again. This is done automatically to save resources. This of course does not cause the loss of any data, because the view object is still there in the model layer. It is only the iterator binding pointer is not there and in most cases, it needs not be there since at that time the user is on a different page

So, for now, page2 is displayed on the screen and there is a button on page2 screen and i want to read information from page1, the same information that i read when i was already on page 1.

An innocent attempt would be to use the same code as before, and if you do, you will face a NullPointer exception when you run

DCIteratorBinding Iter = dcb.findIteratorBinding("DeptView1Iterator");

Because as i explained earlier the binding iterator of page 1 (DeptView1Iterator) is not bound after the page lifecycle is complete even though the iterator itself exists?? It will be bound during the iterator refresh step during page reload.

Well, then i can find some why to manually refresh the iterator binding, i should be able to accomplish what i want, and Eureka, after some brain drain investigating, i found it


call getRowSetIterator();


and then I included the above call in my code with my fingers crossed, and the Second Eid emerged for me , it worked like a
charm

FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
ValueBinding bind = app.createValueBinding("#{data}");

BindingContext bindingCtx = (BindingContext)bind.getValue(ctx);
DCBindingContainer dcb = (DCBindingContainer)bindingCtx.findBindingContainer("untitled1PageDef");
DCIteratorBinding Iter = dcb.findIteratorBinding("DeptView1Iterator");
String attr =Iter.getRowSetIterator().getCurrentRow().getAttribute(2).toString();
//simialr to DCBindingIterator Iter = (DCBindingIterator)Iter.get("binding iterator)
DCIteratorBinding Iter1 = dcb.findIteratorBinding("tradeView1Iterator");
String attr2 =Iter1.getRowSetIterator().getCurrentRow().getAttribute(2).toString();
System.out.println(attr);
System.out.println(attr2);

The getRowSetIterator() binds it again to the data control and hence it now points to current row of the view object (which would be the row you selected in the previous page when you navigated out of it)

Since I became more confident about my knowledge, i thought, ok what if the user ran page2 immediately without running page 1, and tried to access some data from page (1).
There is no data in page 1!!! and that is exactly the case, running the above code would legitimately yield NullPointer Exception. To demonstrate my understanding, i thought i would manipulate the code is a way, that in case the user skipped page1 , it only makes sense to say that in this case, the current row of the first page would be the first row in the view object, I figure what if i execute a query of the first page iterator after accessing it using

Iter.executeQuery();

Again, it worked like a charm

FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
ValueBinding bind = app.createValueBinding("#{data}");

BindingContext bindingCtx = (BindingContext)bind.getValue(ctx);
DCBindingContainer dcb = (DCBindingContainer)bindingCtx.findBindingContainer("untitled1PageDef");
DCIteratorBinding Iter = dcb.findIteratorBinding("DeptView1Iterator");
String attr =Iter.getRowSetIterator().getCurrentRow().getAttribute(2).toString();
//simialr to DCBindingIterator Iter = (DCBindingIterator)Iter.get("binding iterator)
DCIteratorBinding Iter1 = dcb.findIteratorBinding("tradeView1Iterator");
Iter1.executeQuery();
String attr2 =Iter1.getRowSetIterator().getCurrentRow().getAttribute(2).toString();
System.out.println(attr);
System.out.println(attr2);

I know it means nothing to most of you, but it sure does to me and others in who opt to understand the framework that way i want ....

Which brings up a new reason why it a Eid, well, right now, at about 8:10 PM, we are leaving home and heading for a 36 hours vacation at Aqaba, a decision taken at the spur of the moment

Happy Me

7 comments:

Anonymous said...

PS3-controlling phone launched in Blighty - reghardware.co.uk/2009/10/14/aino_launch/

Anonymous said...

[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://www.euzert.hu/euzertonlinekepzes/user/view.php?id=1916]exstream software[/url]
[url=http://www.prisoneducation.eu/user/view.php?id=2348]vector nti crack[/url]
[url=http://cdxqf.freewebhostx.com/polar_precision_performance_software.html]polar precision performance software[/url]
[url=http://n7yn.720north.com/spytector_crack.html]spytector crack[/url]
[url=http://www.medicine.cu.edu.eg/elearning/user/view.php?id=9551]ems billing software[/url]
[url=http://en.netlog.com/verzera/blog/blogid=3526704]ac97 soft data fax modem with[/url]
[url=http://caribbeanmis.mymisclass.com/user/view.php?id=2849]easy worship 2007 crack[/url]
[url=http://www.blogigo.ch/RbhJLScCkjOT]timbuktu software[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://sk7v3t9cr.5nxs.com/mgf_soft_top.html]mgf soft top[/url]
[url=http://www.euzert.hu/euzertonlinekepzes/user/view.php?id=1916]exstream software[/url]

Wealth is the ability to fully experience life.
babblo003s

Anonymous said...

Good day !.
might , probably very interested to know how one can collect a huge starting capital .
There is no initial capital needed You may begin earning with as small sum of money as 20-100 dollars.

AimTrust is what you thought of all the time
The company incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

Its head office is in Panama with affiliates around the world.
Do you want to become really rich in short time?
That`s your choice That`s what you wish in the long run!

I`m happy and lucky, I started to take up real money with the help of this company,
and I invite you to do the same. If it gets down to select a correct partner utilizes your money in a right way - that`s the AimTrust!.
I make 2G daily, and my first investment was 500 dollars only!
It`s easy to start , just click this link http://ygixiqolop.arcadepages.com/udokig.html
and go! Let`s take this option together to become rich

Anonymous said...

Good day !.
You re, I guess , probably very interested to know how one can manage to receive high yields .
There is no need to invest much at first. You may begin to get income with as small sum of money as 20-100 dollars.

AimTrust is what you need
The firm incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

It is based in Panama with affiliates around the world.
Do you want to become an affluent person?
That`s your chance That`s what you desire!

I`m happy and lucky, I began to take up real money with the help of this company,
and I invite you to do the same. It`s all about how to choose a correct companion utilizes your savings in a right way - that`s it!.
I earn US$2,000 per day, and what I started with was a funny sum of 500 bucks!
It`s easy to get involved , just click this link http://ybylavorot.100freemb.com/hihyky.html
and lucky you`re! Let`s take this option together to become rich

Anonymous said...

[url=http://sunkomutors.net/][img]http://sunkomutors.net/img-add/euro2.jpg[/img][/url]
[b]buy software adobe, [url=http://sunkomutors.net/]soft cheap software[/url]
[url=http://sunkomutors.net/][/url] antivirus software for sale nero 9 software
software-manager macromedia [url=http://sunkomutors.net/]educational discount for software[/url] cheap oem software scam
[url=http://sunkomutors.net/]office softwares[/url] microsoft office government discount
[url=http://sunkomutors.net/]nero 9 keeps asking for registration[/url] buying software
filemaker pro migration [url=http://sunkomutors.net/]biggest discount software[/b]

Anonymous said...

Hello !.
You re, I guess , probably curious to know how one can reach 2000 per day of income .
There is no initial capital needed You may commense to receive yields with as small sum of money as 20-100 dollars.

AimTrust is what you haven`t ever dreamt of such a chance to become rich
The firm incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

Its head office is in Panama with structures everywhere: In USA, Canada, Cyprus.
Do you want to become really rich in short time?
That`s your choice That`s what you wish in the long run!

I feel good, I began to get income with the help of this company,
and I invite you to do the same. If it gets down to select a correct companion who uses your funds in a right way - that`s AimTrust!.
I take now up to 2G every day, and what I started with was a funny sum of 500 bucks!
It`s easy to get involved , just click this link http://ododinaxe.s-enterprize.com/ucacydi.html
and go! Let`s take this option together to become rich

Anonymous said...

[url=http://www.hi5.com/friend/group/4441177--natrol+tonalin+cla--front-html]natrol tonalin cla[/url]
[url=http://www.hi5.com/friend/group/4440535--soft+hackle--front-html]soft hackle[/url]
[url=http://www.hi5.com/friend/group/4441347--nail+salon+software--front-html]nail salon software[/url]
[url=http://www.hi5.com/friend/group/4440490--murad+acne+complex+kit--front-html]murad acne complex kit[/url]
[url=http://www.hi5.com/friend/group/4441743--codeine+cough+syrup--front-html]codeine cough syrup[/url]
[url=http://www.hi5.com/friend/group/4442403--kirkland+vitamin+c--front-html]kirkland vitamin c[/url]
[url=http://www.hi5.com/friend/group/4440594--metoprolol+tartrate--front-html]metoprolol tartrate[/url]
[url=http://www.hi5.com/friend/group/4442319--ageless+skin+care--front-html]ageless skin care[/url]
[url=http://www.hi5.com/friend/group/4440486--ginseng+powder--front-html]ginseng powder[/url]
[url=http://www.hi5.com/friend/group/4442036--edms+software--front-html]edms software[/url]
[url=http://www.hi5.com/friend/group/4441025--edms+software--front-html]edms software[/url]
[url=http://www.hi5.com/friend/group/4440527--natrol+tonalin+cla--front-html]natrol tonalin cla[/url]
[url=http://www.hi5.com/friend/group/4441785--pc+miler+software--front-html]pc miler software[/url]
[url=http://www.hi5.com/friend/group/4442120--maker--front-html]maker[/url]
[url=http://www.hi5.com/friend/group/4442285--ab+initio+software--front-html]ab initio software[/url]
[url=http://www.hi5.com/friend/group/4440501--soft+sole+infant+shoes--front-html]soft sole infant shoes[/url]
[url=http://www.hi5.com/friend/group/4440788--spironolactone+hair+loss--front-html]spironolactone hair loss[/url]
[url=http://www.hi5.com/friend/group/4442210--edms+software--front-html]edms software[/url]
[url=http://www.hi5.com/friend/group/4440845--mortgage+loan+origination+software--front-html]mortgage loan origination software[/url]
[url=http://www.hi5.com/friend/group/4441678--oxycontin+addiction+treatment--front-html]oxycontin addiction treatment[/url]

Choose a subject equal to your abilities; think carefully what your shoulders may refuse, and what they are capable of bearing.
wadon9981k

Getting Ref of the View Object referenced by the current Iterator binding for One iterator page without knowing the name of the iterator

Getting Ref of the View Object referenced by the current Iterator binding for One iterator page without knowing the name of the iterator ...