Wednesday, January 19, 2011

Opening a Remote HTTP URL inan ADF Dialog using Bounded Taskflow

Requirement
We want to open an HTTP remote URL(say http://www.google.com) in an ADF Dialog Framework window while user clicks a commandLink in the base jspx/jsff page.

Implementation
1.Create a wrapper TF called MyFlowTF in adfc-config.xml.

<?xml version="1.0" encoding="UTF-8" ?>
<adfc-config xmlns=" http://xmlns.oracle.com/adf/controller" version="1.2" id="__8">
<task-flow-definition id="MyFlowTF">
<default-activity id="__1">MyPage</default-activity>
<transaction id="__6">
<new-transaction/>
</transaction>
<data-control-scope id="__7">
<isolated/>
</data-control-scope>
<managed-bean id="__4">
<managed-bean-name id="__2">popupBean</managed-bean-name>
<managed-bean-class id="__3">oracle.ui.bean.popupBean</managed-bean-class>
<managed-bean-scope id="__5">backingBean</managed-bean-scope>
</managed-bean>
<view id="NotificationPage">
<page id="__9">/oracle/ui/page/MyPage.jsff</page>
</view>
<task-flow-call id="PopupNotifWrapperTF">
<task-flow-reference>
<document>/WEB-INF/oracle/ui/flow/PopupWrapperTF.xml</document>
<id>PopupWrapperTF</id>
</task-flow-reference>
<input-parameter id="__11">
<name>mesgUrl</name>
<value>#{backingBeanScope.popupBean.remoteAppUrl}</value>
</input-parameter>
<input-parameter id="__12">
<name>taskDefId</name>
<value>#{backingBeanScope.popupBean.taskDefId}</value>
</input-parameter>
<input-parameter id="__13">
<name>remoteAppUrl</name>
<value>#{backingBeanScope.popupBean.remoteAppUrl}</value>
</input-parameter>
<input-parameter id="__14">
<name>dynamicTaskDefId</name>
<value>#{backingBeanScope.popupBean.taskDefId}</value>
</input-parameter>
<run-as-dialog id="__10"/>
</task-flow-call>
<control-flow-rule id="__20">
<from-activity-id id="__21">MyPage</from-activity-id>
<control-flow-case id="__22">
<from-outcome id="__24">taskDetails</from-outcome>
<to-activity-id id="__23">PopupWrapperTF</to-activity-id>
</control-flow-case>
</control-flow-rule>
<use-page-fragments/>
</task-flow-definition>
</adfc-config>



2.Wrapper TF code:

<?xml version="1.0" encoding="UTF-8" ?>
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
<task-flow-definition id="PopupWrapperTF">
<default-activity id="__3">remoteTaskFlowCall</default-activity>
<input-parameter-definition id="__1">
<name id="__2">remoteAppUrl</name>
<value>#{requestScope.remoteAppUrl}</value>
<class>java.lang.String</class>
<required/>
</input-parameter-definition>
<input-parameter-definition id="__6">
<name id="__5">dynamicTaskDefId</name>
<value>#{requestScope.dynamicTaskDefId}</value>
<class>oracle.adf.controller.TaskFlowId</class>
<required/>
</input-parameter-definition>
<managed-bean id="__10">
<managed-bean-name id="__8">opupBean</managed-bean-name>
<managed-bean-class id="__9">oracle.ui.bean.PopupBean</managed-bean-class>
<managed-bean-scope id="__7">backingBean</managed-bean-scope>
</managed-bean>
<task-flow-call id="remoteTaskFlowCall">
<dynamic-task-flow-reference>#{requestScope.dynamicTaskDefId}</dynamic-task-flow-reference>
<remote-app-url>#{requestScope.remoteAppUrl}</remote-app-url>
</task-flow-call>
</task-flow-definition>
</adfc-config>



Add the permission for this TF in jazn-data.xml, if your WebApp is secured.

UI Change: 

<af:commandImageLink text="#{'MyMessage'}" id="cil2"
inlineStyle="white-space:normal;"
clientComponent="true"
shortDesc="#{'shortDesc'}"
action="taskDetails"
useWindow="true"
windowHeight="600"
windowWidth="750"
actionListener="#{backingBeanScope.popupBean.onClick}">
<af:setActionListener from="#{'http://www.google.com'}"
to="#{pageFlowScope.detailsUrl}"/>
</af:commandImageLink>

3.Add required code in the bean method..

public String remoteAppUrl = null;
public TaskFlowId taskflowDefId = null;

public void setTaskDefId(TaskFlowId taskflowDefId) {
this.taskflowDefId = taskflowDefId;
}

public TaskFlowId getTaskflowDefId() {
return taskflowDefId;
}

public void setRemoteAppUrl(String remoteAppUrl) {
this.remoteAppUrl = remoteAppUrl;
}

public String getRemoteAppUrl() {
return remoteAppUrl;
}


public void onClick(ActionEvent actionEvent) {
// Add event code here...
//gets the taskflow details url.
String taskflowUrl = (String)ADFUtil.evaluateEL("#{pageFlowScope.detailsUrl}");
//sets the taskflow Id and remote url to be passed to the remote task flow call activity.
this.setTaskDefId(this.getTaskFlowDefinitionId(taskflowUrl));
this.setRemoteAppUrl(this.getRemoteAppURL(taskflowUrl));
}

/**@
* This method gets the task flow Id from the complete url.
* @param taskDetailsURL
* @return
*/
public TaskFlowId getTaskFlowDefinitionId(String detailsURL) {
//Checks if the url is null.
if (detailsURL == null)
return null;
//gets the parameter list from the url.
String parameterList =
detailsURL.substring(detailsURL.indexOf("?") + 1,
detailsURL.length());
//tokenizes the url.
StringTokenizer stok = new StringTokenizer(parameterList, "&");
String taskFlowId = null;
String documentName = null;
//gets the taskflowId from the url.
while (stok.hasMoreTokens()) {
String parameter = stok.nextToken();
String[] parts = parameter.split("=", 2);
if (parts[0].equals("_id"))
taskFlowId = parts[1];
if (parts[0].equals("_document"))
documentName = parts[1];
}

//decodes the encoded url.
try {

documentName = URLDecoder.decode(documentName, "UTF-8");
taskFlowId = URLDecoder.decode(taskFlowId, "UTF-8");

} catch (Exception ex) {
ex.printStackTrace();
}

return new TaskFlowId(documentName, taskFlowId);
}


/**@
* This method extracts the remoteAppUrl.
* @param detailsURL
* @return
*/
public String getRemoteAppURL(String detailsURL) {
if (detailsURL == null)
return null;
int index = detailsURL.indexOf("&_id");

String url = "";
//extracts the remote app url part.
if(index > 0)
url = detailsURL.substring(0,taskDetailsURL.indexOf("&_id"));

return url;

}


Register the notification bean in WrapperTF as backing bean scope to read the input parameters.

17 comments:

Anonymous said...

[url=http://loveepicentre.com][img]http://loveepicentre.com/uploades/photos/2.jpg[/img][/url]
bret michaels dating [url=http://loveepicentre.com/]christian dating oklahoma[/url] the best european dating sites
dating someone older [url=http://loveepicentre.com/taketour.php]corporate dating sites sa[/url] dating disparity east asian women
dating sim games 18 [url=http://loveepicentre.com/testimonials.php]gay dating site nz[/url] best adult dating search engine

Anonymous said...

ebook palm french dictionary http://audiobookscollection.co.uk/Integrated-Solid-Waste-Management-A-Life-Cycle-Inventory/p210243/ laptop ebook reader [url=http://audiobookscollection.co.uk/Good-Manufacturing-Practices-and-Inspection/p125045/]arc of justice boyal ebook download[/url] cpa prophet system ebook pdf megaupload

Anonymous said...

jodi picoult ebook free download http://audiobookscollection.co.uk/Realism-and-Religion-Philosophical-and-Theological-Perspectives/p182911/ greatest money making ebook ever [url=http://audiobookscollection.co.uk/es/Evaluaci-n-y-Diagn-stico/c2621/]voip ebook[/url] direct marketing ebook

Anonymous said...

ad aware se anit virus software http://buyoemsoftware.co.uk/product-37183/Watermark-Master-2-2-Portable t 37 fax software ifax [url=http://buyoemsoftware.co.uk/de/product-11998/Windows-Vista-Ultimate-x86-SP1]shame software[/url] gps mapping pda software
[url=http://buyoemsoftware.co.uk/product-37225/Notepad-Pro-3-2]Notepad Pro 3.2 - Software Store[/url] wii software solution
[url=http://buyoemsoftware.co.uk/fr/product-17985/Transmit-3-5-Mac][img]http://buyoem.co.uk/image/5.gif[/img][/url]

Anonymous said...

system software hp zv5000 http://buysoftwareonline.co.uk/category-1/Operation-Systems?page=1 slotting software [url=http://buysoftwareonline.co.uk/product-36188/Fund-Manager-Advisor-10-9]serena software on google[/url] snapfire 1.0 software
[url=http://buysoftwareonline.co.uk/product-36275/CORExpress-0-1]CORExpress 0.1 - Download OEM, Software Sale, OEM Software[/url] adms-4b software
[url=http://buysoftwareonline.co.uk/es/category-100-106/Programas-del-servidor-?page=5][img]http://buyoem.co.uk/image/4.gif[/img][/url]

Anonymous said...

math magic software http://buysoftwareonline.co.uk/it/product-36504/MONyog-Ultimate-4-5 geforce 260 nvidia cad software [url=http://buysoftwareonline.co.uk/de/product-37100/Alabe-Reports-2-8]writing iaq reports software[/url] mediamatics player software
[url=http://buysoftwareonline.co.uk/product-37374/Aurora-Web-Editor-2008-Professional-3-4]Aurora Web Editor 2008 Professional 3.4 - Software Store[/url] wink mate kirk ruddy software
[url=http://buysoftwareonline.co.uk/de/product-33532/Artizen-Natural-3-0-for-Photoshop-x64][img]http://buyoem.co.uk/image/4.gif[/img][/url]

Anonymous said...

blocker downloads free pop software up http://buysoftwareonline.co.uk/product-15260/MacGPS-Pro-7-Mac gnu software [url=http://buysoftwareonline.co.uk/es/category-7/Programaci-n-y-elaboraci-n?page=5]wintotal software[/url] tcp ip model example software
[url=http://buysoftwareonline.co.uk/category-100-103/Graphics-and-Publishing?page=3]Graphics & Publishing - Software Store[/url] big oven cookbook program software
[url=http://buysoftwareonline.co.uk/fr/category-10/Internet?page=4][img]http://buyoem.co.uk/image/5.gif[/img][/url]

Anonymous said...

[url=http://certifiedpharmacy.co.uk/products/evecare.htm][img]http://onlinemedistore.com/10.jpg[/img][/url]
pharmacy painting http://certifiedpharmacy.co.uk/products/reminyl.htm buying diazapam in a pharmacy in spain [url=http://certifiedpharmacy.co.uk/catalogue/1.htm]pfs pharmacy westerville[/url]
canadain pharmacy http://certifiedpharmacy.co.uk/products/allopurinol.htm veterans affair pharmacy formulary [url=http://certifiedpharmacy.co.uk/products/synthroid.htm]synthroid[/url]
pharmacy formullary http://certifiedpharmacy.co.uk/categories/gums.htm sav on pharmacy glenwood state boise [url=http://certifiedpharmacy.co.uk/products/minocycline.htm]ncmh pharmacy telephone number chapel hill[/url]
what does the hierarchy for a pharmacy technician look like http://certifiedpharmacy.co.uk/products/betapace.htm texas pharmacy schools [url=http://certifiedpharmacy.co.uk/products/minocycline.htm]minocycline[/url]

Anonymous said...

[url=http://englandpharmacy.co.uk/products/activ8--energy-booster-.htm][img]http://onlinemedistore.com/3.jpg[/img][/url]
alabama state board of pharmacy http://englandpharmacy.co.uk/catalogue/d.htm allied pharmacy management [url=http://englandpharmacy.co.uk/products/levitra-super-active-plus.htm]example pharmacy entrance essay[/url]
mcfarlands pharmacy morristown http://englandpharmacy.co.uk/products/ilosone.htm pharmacy refuses to dispense drug lawsuit [url=http://englandpharmacy.co.uk/products/diovan.htm]diovan[/url]
fort collins safeway pharmacy harmony http://englandpharmacy.co.uk/products/tenormin.htm state of minnesota board of pharmacy [url=http://englandpharmacy.co.uk/products/doxycycline.htm]online pharmacy degree[/url]
phendimetrazine online pharmacy http://englandpharmacy.co.uk/products/seroquel.htm health care screening in community pharmacy practice [url=http://englandpharmacy.co.uk/products/evista.htm]evista[/url]

Anonymous said...

mariupol dating agencies [url=http://freeinternetdating.info/personals/swingers-women-personals-huge-swinging]swingers women personals huge swinging[/url] how dating websites advertise
speed dating lake geneva wi http://freeinternetdating.info/love/summer-love-by-grease dating someone with brain injury
go fishing dating [url=http://freeinternetdating.info/singles/singles-crusies]dating with herpes in seattle[/url] advice dating

Anonymous said...

Wait for the burning procedure to complete so you're able to monetize your blog, allowing you to make your cake beautiful. If the team gets it in one minute they get three points. Montag has concluded t I went to the famous Anchor Bar with Andrew Kulyk and Peter Farrell, the local guys who have been requesting casino video game ideas wanted for download, today is your lucky day. As covert operative Sam Fisher, you'll infiltrate a vicious terrorist group and seek to destroy it from within.


Visit my homepage monster Jam video game

Anonymous said...

If they enjoy gaming, find games that you can negotiate with the
operator of the house for the sake of personal greed.

Xbox 360, OS Windows 7, the browser is a bit much, especially when underwater.
There are a variety of handheld controllers that are attached to the gaming
consoles using cords or are powered with wireless networking technologies that allow children to play.
Today there is an extensive video game terms, jargon and
genres as used by passionate gamers worldwide.

my web site ... video game timeline

Anonymous said...

adult dating sites site http://loveepicentre.com/testimonials/ dating wikipedia
jeremiah shapero hb dating sites [url=http://loveepicentre.com/articles/]dating rules teenangers[/url] al qaeda on internet dating sites
free new dating sites in europe [url=http://loveepicentre.com/faq/]what to write in dating sites[/url] list of dating pet names [url=http://loveepicentre.com/user/ninna/]ninna[/url] online rpg strategy dating sims

Anonymous said...

millionaire women dating sites http://loveepicentre.com/faq/ www dating com
fish online dating [url=http://loveepicentre.com/success_stories/]wcmf dating[/url] aarp online dating
texas nights dating [url=http://loveepicentre.com/testimonials/]lynndee southern california dating[/url] craiglist dating site [url=http://loveepicentre.com/user/mountainbirdd/]mountainbirdd[/url] free background check internet dating

Anonymous said...

Publica bien si vas a publicar dice el ioryi

Anonymous said...

rihanna who she is dating http://plenty-of-fish-search.biz/plentyoffish/el-paso-women-seeking-men 100 free dating usa 2008 [url=http://plenty-of-fish-search.biz/plentyoffish/pof-iphone]pof iphone[/url]
guam online dating service [url=http://plenty-of-fish-search.biz/plentyoffish/alot-of-fish-in-the-sea]divorce rate verses time dating[/url] piano dating
alison fay dating http://plenty-of-fish-search.biz/plentyoffish/girls-in-san-antonio-texas middle school dating stories [url=http://plenty-of-fish-search.biz/plentyoffish/plenty-of-fish-review-2013]plenty of fish review 2013[/url]
johnhamler dating [url=http://plenty-of-fish-search.biz/plentyoffish/cincinnati-adult-personals]tips for safely dating onling[/url] times encounters dating

Jagna Co Kalani said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.