X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

Recent Posts

ADF Mobile

Setting-up ADF Mobile for Android using JDeveloper 11.1.2.4 with the latest ADF Mobile patch

Installing the latest ADF Mobile patch for JDeveloper 11.1.2.4 prevented deployment of mobile applications with some weird error messages. I concluded that its probably my Android SDK that needed renewal. To go for a clean approach, I deleted my Android SDK and downloaded the latest and greatest from the Web. Since my last SDK installation, Google has changed the Android directory structure quite a bit. For those struggling, here is what I configured in the Android SDK and JDeveloper.  First observation, to install the gcm.jar file (Google Cloud Messaging) you have to check the "Obsolete" checkbox in the SDK Manager. ============================================= In the JDeveloper preferences, I provided the following entries ============================================= Adroid SDK location--------------------------------------<drive>:\android-home\sdk Android Platform Location--------------------------------------<drive>:\android-home\sdk\platforms\android-19 Android Build Tools Location--------------------------------------<drive>:\android-home\sdk\build-tools\19.0.1  (I installed v. 19 of the SDK) The "<drive>" in my case was D:\ on Windows (funny that on the Apple Mac, which I use for writing this blog the backslash is shift+alt+7) Frank

Installing the latest ADF Mobile patch for JDeveloper 11.1.2.4 prevented deployment of mobile applications with some weird error messages. I concluded that its probably my Android SDK that...

Book Reviews

Review: Oracle Data Integrator Essentials [Video]

Packt Publishing (http://www.packtpub.com/). released a new video tutorial about Oracle Data Integrator http://bit.ly/1i8k1jr  authored by Andreas Nobbmann of TrivadisAG in Switzerland. The video is well paced and structured and in its larger parts focuses on ODI Studio, the IDE for building data integration projects. The TOC shown below is from the Packt Publishing website and while it gives  the timing for each section as +20 minutes, each item on the TOC is provided in its own 3-7 minute video, making it easy to listen and consume: The ODI Core Concepts [24:15 minutes] Key ODI Concepts Differentiating between ETL and ELT Exploring the Graphical UI ODI Basics Defining Your Strategy The ODI Staging Area Developing in ODI – the Core Objects [21:47minutes] Organizing Your Project Creating an Interface Using Joins, Data Sets, Filters, and Sequences Using Temporary Interfaces and Lookups Your Data Transformation Strategy – Knowledge Modules [11:06 minutes] Adapting Knowledge Modules to Your Needs Executing Data Transformation in an ODI Interface Executing a Mapping on Your Source Workflows in ODI [19:08 minutes] Creating a Workflow in ODI Reusable Workflows: Procedures User Functions as Useful Functions Customize Development Objects in ODI Data Quality and Delta Detection [15:08 minutes] Oracle Data Quality Products Using Data Integrity Controls and Integrating Data Quality in ODI Running EDQ Delta Detection via CDC Version Management and Deployment [13:06 minutes] Version Management Scenarios: Smallest Deployment Units Solutions Export and Import Operating and Maintenance [12:51 minutes] Loadplans ODI Repository Tables Security Additional Supporting Functions [11:11 minutes] How to Automate ODI Object Creation Impact and Data Lineaging ODI Studio Enhancements The videos explains the development environment and replaces lots of readings. As someone being new to the whole project of data integration I missed a chapter 0 that introduces data integration principals and concepts to put viewers into a context that allows them to follow the rest of the tutorial. Maybe people like me are not the envisioned audience this video is recorded for. Questions I had while watching the tutorial included i) what is the end product of a Oracle DI project (a script? a service API?), ii) how is the repository installed and where iii) what is the result of data integration, is is a data loading from a source into a target? An end-to-end example would have been nice to see the problem solved by the product and how this solution then looks.  All in all I think its a good tutorial if you are BI savvy and know what the Oracle DI Studio is good for (as it seems to be quite powerful). Given my non-BI background and using the Amazon star ranking as a shared language, I would give 3 stars. If there was a chapter 0 (missing) that introduces the concepts of data integration it would be worth a 4th star. An end-to-end example would have made me giving a 5th star in my rating.

Packt Publishing (http://www.packtpub.com/). released a new video tutorial about Oracle Data Integrator http://bit.ly/1i8k1jr  authored by Andreas Nobbmann of TrivadisAG in Switzerland. The video is...

ADFv

JDeveloper 11g R2 and 12c: How-to "virtually" press a button on page load

A frequent asked question is about how to press a command button upon load of a page or view. If you are on JDeveloper 11g R2 or JDeveloper 12c, then the solution to this programming challenge is the use of JavaServer Faces (JSF) 2 system events (If you are on JDeveloper 11g R1 then you are on JSF 1.2 and this JSF functionality doesn't exist). System events are phase listeners that you  associate with a component instead of a view or page as a whole. In the use case mentioned above, the system event would be added to the command button you want to pres on initial page load, e.g. <af:commandButton text="Press on Page Load" id="cb1"       actionListener="#{viewScope.OnLoadHandler.onButtonPressed}"       partialSubmit="true">   <f:event listener="#{viewScope.OnLoadHandler.pressButton}" type="postAddToView"/></af:commandButton>  As you can see the f:event tag is added as a child tag to the af:commandButton (You find the event tag in the JDeveloper component palette under JSF -> Core) pointing to a listener defined in a managed bean that listens for the "postAddToView" phase. The managed bean is configured in viewScope to ensure the button in the use case is only "virtually pressed" once and not upon PPR of the button area. Using a managed bean in view scope, a flag can be kept that determines whether or not the button has been invoked already. The event handler uses JavaScript to "virtually press" the button after the page or view is loaded: ... boolean initialPageLoad = false; ... public void pressButton(ComponentSystemEvent componentSystemEvent) { //only execute button once and not on PPR is used if (initialPageLoad == false) { //get access to the command button to execute "click"  RichCommandButton rc = (RichCommandButton)componentSystemEvent.getComponent();  String clientId = rc.getClientId(); //compose the JavaSCript to invvoke from the server. The button client ID allows //us to locate the button even if it is saved in a naming container (e.g. a region) //so the absolute component access will do  String javaScript = "var button = AdfPage.PAGE.findComponentByAbsoluteId('"+clientId+"');                      AdfActionEvent.queue(button,true)";      //invoke the JS  FacesContext facesContext = FacesContext.getCurrentInstance();  ExtendedRenderKitService service = Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);  service.addScript(facesContext, javaScript);  //change flag     initialPageLoad = true; }}  This way, whatever is configured for the command button press is executed upon page / view load. A valid question is: "why don't you execute the Java method associated with a command button directly instead of  using JavaScript?" The answer to this is that using JavaScript, associated behavior tags (e.g. for printable behavior or to show a popup) are executed too as it "mimic" a user behavior. Of course, if there is no client side behavior associated with a command button, its better to not use JavaScript but call the Java method associated with the button directly.  Frank

A frequent asked question is about how to press a command button upon load of a page or view. If you are on JDeveloper 11g R2 or JDeveloper 12c, then the solution to this programming challenge is the...

Info

New: Check-out the ADF Architecture TV Channel on Youtube

The new Oracle ADF TV channel - or ADF Architecture TV channel - on YouTube is a direct outcome of the "Real World ADF Design & Architecture Principles" training Oracle Product Management built over the last year and a half. This channel is free and publishes, week by week, episode by episode, a huge array of short, distinct topics as relating to all parts of the ADF development lifecycle, from planning, to design, to development, deployment and delivery.  All in all we have current plans for near 100 episodes. The complete set of topics to be covered is currently indexed on the ADF Architecture Square for you to check out.  We’ve already published episodes on the YouTube channel so you can get a taste of what's to come, which you can enjoy from either work with a small time investment each week, or even from your iPad/Android tablet at home. Important to mention to you that this channel is all about stuff and no fluff. This said, its not an ADF overview or sales pitch to Oracle ADF, nor is it a beginner training to start learning ADF. The goal of this training is to accelerate your skills and understanding of ADF beyond drag and drop and thus teaches to think ADF. Personally I wished we had such a training from the early days on. But in this case late is better than never and I am sure what we produced will turn out to be a great help for you. Check it out and also make sure you subscribe to the channel to receive updates whenever we upload a new episode. Frank

The new Oracle ADF TV channel - or ADF Architecture TV channel - on YouTube is a direct outcome of the "Real World ADF Design & Architecture Principles" training Oracle Product Management built over...

Book Reviews

Book Review: Instant Oracle BPM for Financial Services How-to

Just recently, Packt Publishing released "Instant Oracle BPM for Financial Services How-to" (http://www.packtpub.com/oracle-business-process-management-financial-services/book)  by B. M. Madhusudhan Rao (a.k.a James Smith  - http://jamessmith73.wordpress.com/ - for those familiar with the SOA blog-sphere. The book follows the layout of the cookbook series the sample publisher runs, is cheap as it only costs 3.39 Euro for 62 pages it covers, which appears to be a fair price. The publisher itself sets the expectation towards this book as Learn something new in an Instant! A short, fast, focused guide delivering immediate results Simplifies complex business problems for financial services Optimize, enhance, and modify your business processes Includes enterprise architecture best practices Highlights various roles of Business Process Management The same website then says that: "Oracle Business Process Management helps in process automation and improvement with a very high level of flexibility for all the process participants from the process planning team to the end users. It also makes it possible to have corporate employees and customers collaborating towards common goals. Instant Oracle BPM for Financial Services How-to covers many concepts that can be easily reused across industries such as core banking, healthcare, travel, self service automation, e-governance, and so on. It highlights various roles of Business Process Management such as Business Process Modeling, Process Developer, Process Owner, and Process Participant along with the way they work together in a financial services environment. Instant Oracle BPM for Financial Services How-to is your guide to implementing Oracle Business Process Management whilst working in the Financial Services industry.Starting through the discovering of implementation and Business challenges for financial services we will move on to Modeling, Implementation, Process ork-flow’s, deployment and testing. Moving on to cover advanced topics such as Process administering, changing business processes using process analysts, business reporting, participants and notifications and finally collaboration. You will learn to setup, maintain and alter your Business Process Management aimed specifically for the Financial services industry." and then ....  "Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks. This book is a practical Packt How-to guide that is designed to provide targeted information for experienced BPM professionals in the financial sector." Why am I quoting all of these? Because I think that the text on the publisher website describes a book different from the one I reviewed and in fact the real book falls shorter. Still I think its a good book that you certainly learn from. It however is no book for newbie developers. To give you a background to what I expects a book to deliver, lets talk about my own goals when writing articles, samples or my book. In all of my writings I aim for a specific type of users and skill set. For this group then I try to be as comprehensive as possible to share my experience. Since you cannot start by Adam & Eve in all articles, samples or books, you have to make assumptions at some point. In such cases I usually point to references, which could be articles, blogs, documents and books written by Oracle or 3rd parties so the reader gets all the information he or she needs to get the best out of my writing. I think I demand a great deal of my own writing and do the same for 3rd party and Oracle documentation, articles and books I review. So what to say about this book: This book surely is a good bargain looking at the minimal cost it comes for and the quality of content you get. Technically I feel the book is correct and flawless, written on a good level of knowledge. In Amazon parlance I would rate it 4 for the content and then reduce it by 1 star (to 3) for the delivery which in some areas is too bumpy for my taste.My detailed comments on this book: This book is designed to be a how-to for SOA developers in financial services, though the book preface states: "The book is for Java/SOA/BPM Developers and Architects, and is also for people working in financial services in various roles such as Process Administrator/Developer/Business Process Owner or Process Participant." This in my opinion is a elegant way of saying that I don't know for what audience this book really is. Java developers by definitions have no in depth product specific SOA / BPM knowledge, as otherwise they would be SOA developers. Administrators are no developers and as such are completely overwhelmed with the technical hands-on steps in this mini-book The how-to itself is not very detailed and here-and-there makes assumption about the readers knowledge, which at least means that readers following the hands-on steps must have some previous experience with Oracle JDeveloper and Oracle BPM. You should also be familiar with installing the Oracle SOA Suite and WebCenter software because this part is in wide parts assumed by the author. To quick start the hands-on, the author provides sample project sources. I only wished the author provided a URL for downloading the sources, which are available on his blog (so go and ask Google for it) and the Packt Publishing website (still didn't find it there). So here's the download URL that the author provides on his blog: https://www.dropbox.com/s/3et7ye207x2uuhv/BPMforFS-Sourcecode.zip (Note that this is a dropbox reference, which means that the book may be probably longer on the market than this resources. So you want to download it instantly of hope the publisher provides it on his website) An example for where - as a non BPM expert - I would have liked more explanation is on page 11 "It would also be interesting to know that Oracle has process accelerators—a prebuilt, 'ready to deploy' BPM process that meets industry standards. These process accelerators not only use Oracle BPM, but other Oracle products as well, depending on the business requirements." I have no idea if this means templates, standard software or starter processes (but if you are from BPM or SOA, you maybe know). An example of which Oracle products use these also would have been helpful. In my opinion, this is not a problem of the author but should have been caught during the review process and I would have flagged this. The example implemented in this book is a home loan application to give customers a quote based on their income. For this the author introduces a formula EMI = (L*I)* {(1+I)^N / [(1+I)^N]-1}  for which he explains what all the different variables mean and do. This formula needs to be implemented in PL/SQL by you the reader (and no guidance are provided in the book, so make sure you get the sample sources). I don't have a problem with the sources to be available as a download, however, personally I like books to provide this information so I can follow reading even in a disconnected environment (my personal taste though). An example for where the instructions come with unnecessary gap is on page 1914. Select the Database Adapter service that we have created in the service list.15. Now click on Data Associations and ensure that the necessary input and outputparameters are passed.16. Save the process and deploy on SOA Suite.17. Generate a web service-based Application Development Framework (ADF) datacontrol by using the deployed WSDL URL, and drag-and-drop it on the JSPX page. Note the gap between step 16 and 17. No mentioning about how to create a WS data control, just a mentioning of that you have to do it. Google is your friend and you will find an ADF tutorial in case you are not familiar with ADF. Here I would have liked to see more guidance in form of references to tutorials or documents that provide this information (sorry B. M. Madhusudhan Rao, I had to mention this) All in all this book is good for readers that know the Oracle software involved and that like challenging how-to instructions that don't aim for pushing the mouse for you but outline what you should do (Interestingly I myself found the instructions towards the end of the book more detailed than in the beginning). Its the first book from the Packt Publishing "Instant" series I reviewed and I see room for improvement, which either is to reduce the scope of such a tutorial or increase the page budget to the benefit of more explanations that in the end would have helped me to pick on the authors expertise.  As mentioned earlier, this book is a bargain compared to its cost. If you are familiar with Oracle BPM and JDeveloper then you may enjoy the challenge to test your skills, understanding and what you don't yet know Frank

Just recently, Packt Publishing released "Instant Oracle BPM for Financial Services How-to" (http://www.packtpub.com/oracle-business-process-management-financial-services/book)  by B. M. Madhusudhan...

JavaScript

How-to highlight input field content when accessed from auto-tab

A question on the OTN forum has been how to highlight the content of an input field when navigation to it occurs using the auto tab functionality. As a reminder, the "autotab" property of an input field, if set to "true", tabs out of the field that you currently edit when the maximum length of the field entry is reached. The problem reported on OTN for JDeveloper 11.1.2.4 (and I am sure its the same on other versions of JDeveloper) is that manual tabbing into a next field will highlight the fields content (value) whereas autotab doesn't. To enforce consistent highlighting behavior, you can use JavaScript as shown in the page sample below: <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> <af:document title="AutoTab.jsf" id="d1"> <af:resource type="javascript"> function onFocusHandler(inputEvent){ var textfield = AdfAgent.AGENT.getElementById(inputEvent.getSource().getId()+'::content'); textfield.select();} </af:resource> <af:form id="f1"> <af:panelFormLayout id="pfl1"> <f:facet name="footer"/> <af:inputText label="First Name" id="it1" value="#{viewScope.fieldValues.firstName}" maximumLength="5" autoTab="true"/> <af:inputText label="Last Name" id="it2" value="#{viewScope.fieldValues.lastname}"> <af:clientListener method="onFocusHandler" type="focus"/> </af:inputText> </af:panelFormLayout> </af:form> </af:document></f:view> The af:clientListener is attached to the input field for which you want to show content highlighting on autotab. Attach the same client listener definition to  all field that should have the content highlighting. Instead of adding the JavaScript to the page, you want to create an external JS library file and link it from the page as the JS code above is reusable. Note that the use of "'::content" in the JavaScript uses knowledge about the way component IDs are rendered at runtime in ADF Faces. If component rendering changes in a future release (you never know) then your code will break at this point and needs to be corrected. So heads-up on this risk (though should be a small one). To the time of writing this lines there is no other API (option) available to get to the HTML field handle in ADF Faces. Also note the use of AdfAgent.AGENT.getElementById, which is a performant wrapper API in ADF Faces around the document.findElementById function of the Browser DOM. As a rule of thumb you should always work with ADF Faces JS APIs and don't directly reach out to the DOM yourself.

A question on the OTN forum has been how to highlight the content of an input field when navigation to it occurs using the auto tab functionality. As a reminder, the "autotab" property of an input...

Info

Heads up! ADF News Session - Thursday March 7th, 8.30 - 9:00 AM (CET) - Topic: ADF - Q & A

The German ADF Partner Community organizes a webcast with Duncan Mills. This session is in English and thus suitable for everyone to attend (as far as timezone differences allow it). To quote from the official announcement: Duncan Mills is a senior director of product management.for Oracle´s application development tools. In recent years responsible for the Oracle Application Development Framework (ADF). With a strong background as well in Forms<<< You are invited to join the next ADF News Session, that is going to take place March 7th. speaker:  Duncan Mills / Oracle time:         8.30 AM (CET) duration:  30 minutes topic:        ADF - Q & A dial-in webconf: https://oraclemeetings.webex.com meeting-number:            257 666 519 meeting-password:        123456 (topic:                            ADF) When dialing in you are asked to enter your name and your mail address. The name will be shown in the participants list. The mail address will not be visible. if using WebEx for the first time there will be some minutes needed before you can join thewebcast dial-in telco:           +49 (0)69 2222 16 106 or +49 (0)800 66 485 15           ConfCode: 208 503 9           SecurityPasscode: 112233 to request international dial-in numbers please contactdirk.reinemann@oracle.com prior to the webcast Frank

The German ADF Partner Community organizes a webcast with Duncan Mills. This session is in English and thus suitable for everyone to attend (as far as timezone differences allow it). To quote from the...

Book Reviews

Book Review: SOA Made Simple by L. Dikmans and R.v.Luttikhuizen

Just finished reading "SOA Made Simple" by Lonneke Dikmans and Ronald van Luttikhuizen, published in 12/2012 by Packt Publishing and use this summary to share my thoughts.  "SOA Made Simple" is a very good book that - beside of helping readers to do SOA right - will have an impact to how you look at going out for breakfast. The "breakfast example" is one of the great samples that the authors consistently use throughout the book.In addition, this book is well written and covers really no fluff but just stuff. Reading this book you learn what SOA is, the benefit it brings to IT, as well as how you design and model your SOA and services.  Whenever Packt asks me to review and write about a new book, I ask for a printed copy so I can annotate the page with comments and questions. My copy of this 257 page book has a lot of annotations, mostly about information I want to share in my review.Too many annotations, which clearly indicates I liked the book, though I am not directly involved in SOA (which probably makes me the perfect candidate for reading this book). According to the Preface, yes I read this too, the book is "for anyone (architect, designer, developer, administrator, team lead) who is implementing or is about to implement SOA in anIT-related environmenet". Well, I would call this mission accomplished and recommend you to buy this book for your learning and career. So lets have a look what this book covers and what I liked so much: Chapter 1: Understanding the Problem This chapter is a well structured introduction to the current state of IT that leads to a problem statement that demands for SOA to come for the rescue. However, though A SOA book, the authors don't make it too obvious that SOA is the answer. The chapter also gives you some questions by hand you should ask before starting a SOA project so you ensure your decision is right before starting a SOA project. This chapter also introduces the examples (I already mentioned the diner for breakfast, but there also is an insurance business and others). Chapter 2: The Solution This chapter introduces services and the SOA term. It does so not from a pure technical perspective and without calling WS* services too soon. Or would you have considered the waiter service in a diner to be a service? In fact it is and therefore services don't need to be SOAP or REST to be called a service. SOAP and REST come into play later, when the talk is about standards and SOA. Chapter 3: Service Identification and Design This chapter introduces various concepts around the design of services  like top-down, bottom-up and meet-in-the-middle. Walking towards WS services, this chapter summarizes and explains service characteristics. Unless you are a WS expert already, this is one of the chapters that really help you to understand what a service should be, how isolated and de-coupled it must/can be and how complex IT architectures can be mapped to a sensible service oriented architecture.Here you get a good analogy of services to lasagna (really good examples that stick as pictures) Ps.: As a note to the publisher, I think the images on page 73 and 74 are in the wrong order. Too late though, the ink has dried. Chapter 4: Classification of Services This chapter allows you to organize services into elementary services, composite services and process services.  It also covers the difference between service composition (BPM/BPEL) and aggregation (ESB, client). Other concepts for organizing services in this book are: granularity, actor (who works with a service), channel of access, security requirements and many more. Chapter 5: The SOA PlatformThis chapter switches gear for a moment and uses SOA terminology that hasn't been introduced until here but is getting explained in the following. The chapter also talks about REST and SOAP services as first class citizen technologies in a SOA. This chapter thus is where you learn about ESB, BPM, Case Management, Events, Business rules and user interfaces to SOA (which is also where Oracle ADF gets its mentioning). A lot of pages are dedicated to service security, design and develpment tools. Chapter 6: Solution ArchitecturesChapter 6 is one of my favorites and compares SOA offerings and suites provided by Oracle, IBM and Microsoft, allowing readers to understand what each of these vendors has to offer and how products could integrate. The chapter doesn't announce a winner, which I think would be a bad move for a generic SOA book, but really saves you from investigating this yourself. As the authors stress it, it is important to understand what is best in breed for a project and where you shop this best looking at the full package. Chapter 7: Creating a Roadmap, How to Spend Your Money and WhenThis chapter discusses what it takes to implement SOA in a company: stake holders, requirements, wrong and right expectations, benefits and money gains. Personally I think the graph on page 1999 is a great idea for showing what you can expect on each of the stages involved when implementing SOA. Its really well done.Chapter 8: Life Cycle ManagementWhat you build today is what you maintain tomorrow and throw away the day after tomorrow. This basically is what the authors call the the lifecycle of SOA solutions. and in fact its all about change management and the conflict that exists between developer and administration personnel that both have a different agenda. Governance plays into this as well. Basically you learn that you need to keep the "eye on the bal" during the realization of SOA architectures.  Chapter 9: Pick your BattlesThis chapter is all about how to get people to buy in to a SOA architecture and how to ensure that the implementation - especially when implemented in distributed teams and by different departments - follows defined rules and definitions without being prohibitive to change. Chapter 10: Methodologies and SOAThis chapter discusses the impact SOA has to different aspects of software development and provides methodologies to use. In case you did not order the book while reading my review, here's a dense list for why you should:- Clear story line - Chapters that make sense and float- No fluff just stuff- Explaining complex concepts simple in real life examples- Back / Forward references- External document references- Good SOA coverage from a project perspective looking at SOA as a whole and not just services The one thing I wanted to have immediately when reading this book was a second book that closely follows this book's chapters and that  - by example - shows how to implement various SOA components for people to have example code and instructions. This could be using the Oracle stack (preferred) but also would be valuable for any of the other introduced vendors. However, code and implementation samples was not in focus for this book and this is good the way it is.  Frank

Just finished reading "SOA Made Simple" by Lonneke Dikmans and Ronald van Luttikhuizen, published in 12/2012 by Packt Publishing and use this summary to share my thoughts.  "SOA Made Simple" is a very...

ADF Mobile

How-to programmatically display a popup message

For an ADF mobile sample I needed to display a confirmation message upon successful upload of an image. Because I could not see how to do this from Java using the ADF Mobile popup dialog, I used JavaScript. The JavaScript function I called is part of PhoneGap, which is neat because this ensures I don't have to maintain custom JavaSCript code in my AMX page.  To call the PhoneGap notification dialog, I  added 20-October 2013: important. Since I've written this sample, the libraries have been changed from PhoneGap to Cordova. Make sure the script below is changed to the Cordova JS (!!!) to the AMX page. I added this script tag to the body section of  the amx:panelPage component tag. Note that the relative addressing /../.../.../ in the JS reference is for AMX pages that are in the public_html folder. If your page is in a sub folder, you will need to add an extra "/.." for each folder In my Java bean, which I called from a method binding, I used the ADF Mobile AdfmfContainerUtilities.invokeContainerJavaScriptFunction(...) call to invoke the PhoneGap "navigator.notification.alert" function navigator.notification.alert(message, alertCallback, [title], [buttonName]) See: http://docs.phonegap.com/en/1.0.0/phonegap_notification_notification.md.html The Java call is shown below:  AdfmfContainerUtilities.invokeContainerJavaScriptFunction(           "adf.sample.mobile.PhotoUpload",            "navigator.notification.alert",            new Object[] {"Image uploaded: \n " +            "File Name: "+fileName+"\n File Type: "+fileType,"",            "Image Uploaded to Server", "Ok"}); Note the use of the object array to pass multiple arguments to the JavaScript function. The "adf.sample.mobile.PhotoUpload" string is the ADF Mobile feature Id of the feature that contains the AMX page with the JavaScript reference. The result is shown in the image below: Using the same technique you can call any other PhoneGap JavaScript function from ADF Mobile (and your custom JavaScripts as well)See also: http://docs.oracle.com/cd/E35521_01/doc.111230/e24475/phgapfeatures.htm#BABJGDIGhttp://docs.phonegap.com/en/1.0.0/index.html

For an ADF mobile sample I needed to display a confirmation message upon successful upload of an image. Because I could not see how to do this from Java using the ADF Mobile popup dialog, I...

JavaScript

JavaScript function to intercept or listen for tab remove event

The af:panelTabbed component allows you to remove tabs from display using the tabRemoval property tabRemoval Valid Values: none, all, allExceptLast determines if tab removal is enabled.This attribute supports these tabRemoval types: none - tab removal is not enabled. all - tab removal is enabled on all tabs, regardless if they are disclosed. The last tab in the panelTabbed can be removed. allExceptLast - tab removal is enabled on all tabs, regardless if they are disclosed. The last tab in the panelTabbed cannot be removed.  src: http://docs.oracle.com/cd/E35521_01/apirefs.111230/e17491/tagdoc/af_panelTabbed.html Because tab removal is not automatic in ADF Faces, developers configure an item listener on the af:showDetailItem component that make the tabs within a panel tab itemListener javax.el.MethodExpression Only EL a method reference to an item listener src: http://docs.oracle.com/cd/E35521_01/apirefs.111230/e17491/tagdoc/af_showDetailItem.html "Choosing to remove a tab will cause an ItemEvent of type 'remove' to be launched. This event can be listened for on a showDetailItem using the itemListener attribute. It is up to the developer to handle this event and code the actual removal of the tab. This is because of the dynamic nature of the panelTabbed component, which may have dynamic children. This also allows a finer level of control by the developer, who can then choose a custom implementation that may (for example) include warning dialogs, and control of which tab gains focus after a tab is removed." src: http://docs.oracle.com/cd/E35521_01/apirefs.111230/e17491/tagdoc/af_panelTabbed.html This apparently works with logic written in Java saved on the server. A question on OTN was how to handle or intercept this remove event on the client side using JavaScript. This information - unfortunately - is a bit hidden in our documentation and you have to look into the JavaScript documentation for this. src: http://docs.oracle.com/cd/E35521_01/apirefs.111230/e17489/oracle/adf/view/js/event/AdfItemEvent.html If there is an AdfItemEvent that fires on the ADF Faces client side, then there also must be a configuration available on the af:clientListener to listen for such an event. And there is (just not obvious)  <af:panelTabbed id="pt1" tabRemoval="all">      <af:showDetailItem text="TAB 1" id="sdi1" stretchChildren="first" clientComponent="false">         ...         <af:clientListener method="alertTabClose" type="item"/>      </af:showDetailItem></af:panelTabbed The JavaScript function to this looks similar to function alertTabClose (closureEvent){ var tab = closureEvent.getSource(); ... This allows you to handle (and suppress) the tab remove event on the client using JavaScript in ADF Faces

The af:panelTabbed component allows you to remove tabs from display using the tabRemoval property tabRemoval Valid Values: none, all, allExceptLast determines if tab removal is enabled. This attribute...

Book Reviews

Book Review: Securing WebLogic Server 12c

"Security is a must in modern Enterprise architecture, and WebLogic implements a very complete, complex architecture for this." is a quote taken from the book covers of Securing WebLogic Server 12c book written by Luca Masini and Rinaldi Vincenzo, published by Packt Publishing (http://www.packtpub.com/weblogic-12c-security-handbook/book).The book then sets the reader's expectation within another quote from the book covers: "Securing WebLogic Server 12c will simplify this complex world abd let you develop abd deploy in a production system with best practices for both the development and deployment world." When Packt Publishing asked me to review and write about this book, my expectation was to get a book of 400 pages in size that covers security from its Java EE fundamentals down to its implementation in WebLogic Server 12c. When the long awaited shipment arrived, to my surprise, the book only had 80 pages. Such small format is not uncommon for Packt Publishing and in August 2012 I reviewed the "Oracle WebLogic Server 12c: First Look" book written by Michel Schildmeijer (https://blogs.oracle.com/jdevotnharvest/entry/book_review_oracl_weblogic_server). So my expectation was to find an overview to WebLogic Server 12c features with pointers of how to use them and where to follow up reading about it. Securing WebLogic Server 12c starts with "WebLogic Security Concepts" that introduces Java EE terms like Principals and Subjects and WebLogic server terms like authentication providers, credential mappers and identity assertion. This chapter touches on many topics without going into details. A nice addition to this chapter would have been pointers to follow up readings for readers to be able to gain a deeper understanding of a topic. Chapter 2 is about WebLogic server security realms, the identity store and policy stripe you define for a WebLogic server domain. This chapter is interesting to read (I only have problems with statements like "A user is an entity that can be authenticated and used to protect application resources", which I think is a wrong and misleading definition) and explains the WebLogic server user, role and group architecture. It would have helped if there were screen shots to this chapter for people who are not familiar with WebLogic server to better follow. Maybe the requirement for this book, though not spelled out, is that you have WebLogic server 12c installed or experience with a previous version of it. In the following the chapter explains how to configure authentication providers in WebLogic server, by example of LDAP, which IMO is a good and very useful chapter. The troubleshooting section for the LDAP configuration is well written and really shares the author's experience. Chapter 3 is about Java EE Security with WebLogic and explains how to use Maven to administer WebLogic server by example of creating role mappings on the fly. This chapter clearly is wrongly labeled and should have been titled: "Using Maven to administer WebLogic server" because there is nothing new you learn in regards to security and how to protect WebLogic server or your applications. Instead you learn how to use Maven for configuring role mappings upon deployment instead of editing metadata files at design time.  The security bits mentioned in this chapter are Java EE 6 security annotations for servlets and EJB, so nothing that is really specific to WebLogic server. The Maven information is good and detailed, though lost me here and there in some of its folder and project descriptions. The section "A RESTful and secure EJB component" actually explains that in Java EE 6 EJB modules can be deployed with a servlet in a WAR file, which then - using annotations - you can secure in that you check the user role membership before executing a method. Chapter 4 explains how to build a custom authentication provider using Maven and a JAAS login module. Its an interesting and useful chapter that gives you some good insight in how you build the authentication provider wrapper for a JAAS login module and how WebLogic server MBeans are used for administration. The custom authentication provider authenticates against a JSP file, which the authors use to simulate a legacy or existing SSO system. Again, Maven is used to assemble the provider and to deploy it. The use of Maven adds some complexity to the custom authentication provider explanations and also take a lot of pages from the overall 80 page budget of this book. I wished the use of Maven for deploying the custom authentication provider was explained in a separate chapter. Again, there are no pointers for readers to follow up with a topic. This is a problem with the book as a whole. Chapter 5 is about Kerberos integration for authentication, which is a frequent customer requirement. The chapter is a step-by-step instruction to how to make the Kerberos authentication work with WebLogic server though, in my opinion, assume quite abit for the reader to know and have as to seen a beginners guide. As usual, when doing book reviews, I am annotating book pages with questions I have and follow ups action items. The annotations I used the most in this book were Why and How. For sure pointers to follow-up reading would have been good and welcome. I also had difficulties to identify the audience for this book: As an overview it was too technical and not comprehensive in some areas. As a technical book and reference it wasn't detailed enough, leaving me guessing and wondering far too often. In some parts, like the Kerberos configuration in chapter 5, it reads like notes the authors took while setting up the environment for the company they work for. So who is this book for? To quote the book: "If you are a WebLogic Server administrator who is looking forward to a step-by-step guide to administer and configure WebLogic security, then this guide is for you. This book is also for WebLogic developers who want to leverage the complex but powerful WevLogic security infrastrucure." This book is well written and contains some good information you want to follow up on after reading the book's 80 pages. However, neither the administrators nor developer finds all that he / she needs to know about WebLogic and Java EE application security to protect a business. In my opinion, the book is good, but the title is wrong! A better title would have been  "WebLogic 12c administration and application deployment with Maven by example of Java EE security". "Security is a complex matter, and Java EE is not an exception to this rule. To make things even more complicated, WebLogic Server extends standard securtity [...]" - page 5 of  "Securing WebLogic Server 12c". I agree with this statement, but also read from it that the authors were well aware of the need for a more in depth book. All in all I enjoyed reading this book, though I did not learn a lot in regards to security (the Maven - WebLogic server administration and deployment bits are good though). My final review summary you can quote me on thus is that The book is a good reference for everyone who has "Maven deployement to WebLogic Server 12c", "custom authentication provider development" and "Kerberos authentication for Windows based authentication" on his or her to-do list. Frank Ps.: My suggestion to reviewers: Ask more questions about what you read and don't understand. If I see explanations like the following (taken from page 18): "View User Attributes: Some user attributes" then this clearly has not been reviewed with enough care.

"Security is a must in modern Enterprise architecture, and WebLogic implements a very complete, complex architecture for this." is a quote taken from the book covers of Securing WebLogic Server 12c boo...

ADFv

Accessing ADF Faces components that are read-only from JavaScript

Almost as a note to myself and to justify the time I spent on analyzing aproblem, a quick note on what to watch out for when working trying to access read-only ADF Faces components from JavaScript.  Those who tried JavaScript in ADF Faces probably know that you need to ensure the ADF Faces component  is represented by a JavaScript object on the client. You do this either implicitly by adding an af:clientListener component (in case you want to listen for a component event) or explicitly by setting the ADF Faces component clientComponent property to true. For the use case I looked at in JDeveloper 11g R1 (11.1.1.7) I needed to make an output text component clickable to call a JavaScript function in response. Though I added the af:clientListener tag to the component I recognized that it also needed the clientComponent property set to true. Though I remember this as not being required in 11.1.1.6, I like the new behavior as it helps preventing read-only components from firing client side events unless you tell it to do so by setting the clientComponent property to true. Note: As the time of writing, JDeveloper 11.1.1.7 is not publicly available and I put the note in this blog as a reminder in case you ever hit a similar challenge so you know what to do.

Almost as a note to myself and to justify the time I spent on analyzing aproblem, a quick note on what to watch out for when working trying to access read-only ADF Faces components from JavaScript.  Tho...

Book Reviews

Book Review: Oracle ADF Real World Developer’s Guide

Recently PACKT Publishing published "Oracle ADF Real World Developer’s Guide" by Jobinesh Purushothaman, a product manager in our team. Though already the sixth book dedicated to Oracle ADF, it has a lot of great information in it that none of the previous books covered, making it a safe buy even for those who own the other books published by Oracle Press (McGrwHill) and PACKT Publishing. More than the half of the "Oracle ADF Real World Developer’s Guide" book is dedicated to Oracle ADF Business Components in a depth and clarity that allows you to feel the expertise that Jobinesh gained in this area. If you enjoy Jobinesh blog (http://jobinesh.blogspot.co.uk/) about Oracle ADF, then, no matter what expert you are in Oracle ADF, this book makes you happy as it provides you with detail information you always wished to have. If you are new to Oracle ADF, then this book alone doesn't get you flying, but, if you have some Java background, accelerates your learning big, big, big times. Chapter 1 is an introduction to Oracle ADF and not only explains the layers but also how it compares to plain Java EE solutions (page 13). If you are new to Oracle JDeveloper and ADF, then at the end of this chapter you know how to start JDeveloper and begin your ADF developmentChapter 2 starts with what Jobinesh really is good at: ADF Business Components. In this chapter you learn about the architecture ingredients of ADF Business Components: View Objects, View Links, Associations, Entities, Row Sets, Query Collections and Application Modules. This chapter also provides a introduction to ADFBC SDO services, as well as sequence diagrams for what happens when you execute queries or commit updates. Chapter 3 is dedicated to entity objects and  is one of many chapters in this book you will enjoy and never want to miss. Jobinesh explains the artifacts that make up an entity object, how to work with entities and resource bundles, and many advanced topics, including inheritance, change history tracking, custom properties, validation and cursor handling.  Chapter 4 - you guessed it - is all about View objects. Comparable to entities, you learn about the XM files and classes that make a view object, as well as how to define and work with queries. List-of-values, inheritance, polymorphism, bind variables and data filtering are interesting - and important topics that follow. Again the chapter provides helpful sequence diagrams for you to understand what happens internally within a view object. Chapter 5 focuses on advanced view object and entity object topics, like lifecycle callback methods and when you want to override them. This chapter is a good digest of Jobinesh's blog entries (which most ADF developers have in their bookmark list). Really worth reading !Chapter 6 then is bout Application Modules. Beside of what application modules are, this chapter covers important topics like properties, passivation, activation, application module pooling, how and where to write custom logic. In addition you learn about the AM lifecycle and request sequence. Chapter 7 is about the ADF binding layer. If you are new to Oracle ADF and got lost in the more advanced ADF Business Components chapters, then this chapter is where you get back into the game. In very easy terms, Jobinesh explains what the ADF binding is, how it fits into the JSF request lifecycle and what are the metadata file involved. Chapter 8 then goes into building data bound web user interfaces. In this chapter you get the basics of JavaServer Faces (e.g. managed beans) and learn about the interaction between the JSF UI and the ADF binding layer. Later this chapter provides advanced solutions for working with tree components and list of values. Chapter 9 introduces bounded task flows and ADF controller. This is a chapter you want to read if you are new to ADF of have started. Experts don't find anything new here, which doesn't mean that it is not worth reading it (I for example, enjoyed the controller talk very much)Chapter 10 is an advanced coverage of bounded task flow and talks about contextual events Chapter 11 is another highlight and explains error handling, trains, transactions and more. I can only recommend you read this chapter. I am aware of many documents that cover exception handling in Oracle ADF (and my Oracle Magazine article for January/February 2013 does the same), but none that covers it in such a great depth. Chapter 12 covers ADF best practices, which is a great round-up of all the tips provided in this book (without Jobinesh to repeat himself). Its all cool stuff that helps you with your ADF projects. In summary, "Oracle ADF Real World Developer’s Guide" by Jobinesh Purushothaman is a great book and addition for all Oracle ADF developers and those who want to become one. Frank

Recently PACKT Publishing published "Oracle ADF Real World Developer’s Guide" by Jobinesh Purushothaman, a product manager in our team. Though already the sixth book dedicated to Oracle ADF, it has a...

ADFv

Displaying Exceptions Thrown or Caught in Managed Beans

Just came a cross a sample written by Steve Muench, which somewhere deep in its implementation details uses the following code to route exceptions to the ADF binding layer to be handled by the ADF model error handler (which can be customized by overriding the DCErrorHandlerImpl class and configuring the custom class in DataBindings.cpx file) To route an exception to the ADFm error handler, Steve used the following code ((DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry()).reportException(ex); The same code however can be used in managed beans as well to enforce consistent error handling in ADF. As an example, lets assume a managed bean method hits an exception. To simulate this, let's use the following code: public void onToolBarButtonAction(ActionEvent actionEvent) {   throw new JboException("Just to tease you !!!!!");        } The exception shows at runtime as displayed in the following image: Assuming a try-catch block is used to intercept the exception caused by a managed bean action, you can route the error message display to the ADF model error handler. Again, let's simulate the code that would need to go into a try-catch block public void onToolBarButtonAction(ActionEvent actionEvent) {   JboException ex = new JboException("Just to tease you !!!!!");  BindingContext bctx = BindingContext.getCurrent();   ((DCBindingContainer)bctx.getCurrentBindingsEntry()).reportException(ex);} The error now displays as shown in the image below As you can see, the error is now handled by the ADFm Error handler, which - as mentioned before - could be a custom error handler. Using the ADF model error handling for displaying exceptions thrown in managed beans require the current ADF Faces page to have an associated PageDef file (which is the case if the page or view contains ADF bound components). Note that to invoke methods exposed on the business service it is recommended to always work through the binding layer (method binding) so that in case of an error the ADF model error handler is automatically used.

Just came a cross a sample written by Steve Muench, which somewhere deep in its implementation details uses the following code to route exceptions to the ADF binding layer to be handled by the ADF...

Info

Oracle ADF Coverage at OOW

Below is the schedule for all ADF related sessions at a glance. Note the Meet and greet session added for Wednesday Octiber 3rd from 4.30 pm to 5:30. Oracle ADF and Fusion Development General Session Mon 1 Oct, 2012 Time Title Location 10:45 AM - 11:45 AM General Session: The Future of Development for Oracle Fusion—From Desktop to Mobile to Cloud Marriott Marquis - Salon 8 12:15 PM - 1:15 PM General Session: Extend Oracle Fusion Apps to Tablets/Smartphones with Oracle Mobile Technology Moscone West - 3014 1:45 PM - 2:45 PM General Session: Extend Oracle Applications to Mobile Devices with Oracle’s Mobile Technologies Moscone West - 3002/3004 4:45 PM - 5:45 PM General Session: Building Mobile Applications with Oracle Cloud Moscone West - 2002/2004 Conference Session Mon 1 Oct, 2012 Time Title Location 12:15 PM - 1:15 PM Understanding Oracle ADF and Its Role in Oracle Fusion Moscone South - 306 1:45 PM - 2:45 PM Building Performant Oracle ADF Business Components to Meet Tomorrow’s Needs Marriott Marquis - Golden Gate C3 3:15 PM - 4:15 PM End-to-End Oracle ADF Development in Eclipse Marriott Marquis - Golden Gate C3 4:45 PM - 5:45 PM Classic Mistakes with Oracle Application Development Framework Marriott Marquis - Salon 7 Tues 2 Oct, 2012 Time Title Location 10:15 AM - 11:15 AM One Size Doesn’t Fit All: Oracle ADF Architecture Fundamentals Marriott Marquis - Golden Gate C2 10:15 AM - 11:15 AM Oracle Business Process Management/Oracle ADF Integration Best Practices Marriott Marquis - Golden Gate C3 11:45 AM - 12:45 PM Mobile-Enable Oracle Fusion Middleware and Enterprise Applications with Oracle ADF Moscone South - 306 11:45 AM - 12:45 PM Secrets of Successful Projects with Oracle Application Development Framework Marriott Marquis - Golden Gate C2 1:15 PM - 2:15 PM Develop On-Device iPhone and iPad Apps Without Writing Any Objective-C Code Marriott Marquis - Golden Gate C2 1:15 PM - 2:15 PM BPM, SOA, and Oracle ADF Combined: Patterns Learned from Oracle Fusion Applications Moscone West - 3003 1:15 PM - 2:15 PM The Future of Forms Is … Oracle Forms (and Friends) Moscone South - 306 5:00 PM - 6:00 PM Best Practices for Integrating SOAP and REST Service into Oracle ADF Marriott Marquis - Golden Gate C2 Wed 3 Oct, 2012 Time Title Location 10:15 AM - 11:15 AM Mobile Apps for Oracle E-Business Suite with Oracle ADF Mobile and Oracle SOA Suite Moscone West - 3001 10:15 AM - 11:15 AM Visualize This! Best Practices for Data Visualization in Desktop and Mobile Apps Marriott Marquis - Golden Gate C3 10:15 AM - 11:15 AM Set Up Your Oracle ADF Project and Development Team for Productivity: Seven Essential Tips Marriott Marquis - Golden Gate C2 11:45 AM - 12:45 PM How to Migrate an Oracle Forms Application to Oracle ADF Marriott Marquis - Golden Gate C2 1:15 PM - 2:15 PM Oracle ADF: Lessons Learned in Real-World Implementations Moscone South - 309 3:30 PM - 4:30 PM Oracle ADF Implementations Around the Globe: Best Practices Marriott Marquis - Golden Gate C2 3:30 PM - 4:30 PM Oracle Developer Cloud Services Marriott Marquis - Salon 7 4:30 PM - 5:30 PM Oracle JDeveloper and Oracle ADF: What’s New Hilton San Francisco - Continental Ballroom 5 5:00 PM - 6:00 PM Mobile Solutions for Oracle E-Business Suite Applications: Technical Insight Moscone West - 2020 5:00 PM - 6:00 PM Extending Social into Enterprise Applications and Business Processes Marriott Marquis - Golden Gate C3 5:00 PM - 6:00 PM The Tie That Binds: An Introduction to Oracle ADF Bindings Marriott Marquis - Golden Gate C2 Thur 4 Oct, 2012 Time Title Location 11:15 AM - 12:15 PM Using Oracle ADF with Oracle E-Business Suite: The Full Integration View Moscone West - 3003 11:15 AM - 12:15 PM Deep Dive into Oracle ADF: Advanced Techniques Marriott Marquis - Golden Gate C2 12:45 PM - 1:45 PM Monitor, Analyze, and Troubleshoot Your Oracle ADF Application Marriott Marquis - Golden Gate C2 2:15 PM - 3:15 PM Oracle WebCenter Portal: Creating and Using Content Presenter Templates Marriott Marquis - Golden Gate C2 HOL (Hands-on Lab) Mon 1 Oct, 2012 Time Title Location 10:45 AM - 11:45 AM Developing Applications for Mobile iOS and Android Devices with Oracle ADF Mobile: Hands-on Lab Marriott Marquis - Salon 10A 1:45 PM - 2:45 PM Build Mobile Applications for Oracle E-Business Suite Marriott Marquis - Salon 10A 3:15 PM - 4:15 PM Developing Applications for Mobile iOS and Android Devices with Oracle ADF Mobile: Hands-on Lab Marriott Marquis - Salon 10A 3:15 PM - 4:15 PM Introduction to Oracle ADF: Hands-on Lab Marriott Marquis - Salon 3/4 4:45 PM - 5:45 PM Application Lifecycle Management with Oracle JDeveloper: Hands-on Lab Marriott Marquis - Salon 3/4 Tues 2 Oct, 2012 Time Title Location 10:15 AM - 11:15 AM Developing Applications for Mobile iOS and Android Devices with Oracle ADF Mobile: Hands-on Lab Marriott Marquis - Salon 10A 5:00 PM - 6:00 PM Developing Applications for Mobile iOS and Android Devices with Oracle ADF Mobile: Hands-on Lab Marriott Marquis - Salon 10A Wed 3 Oct, 2012 Time Title Location 10:15 AM - 11:15 AM Introduction to Oracle ADF: Hands-on Lab Marriott Marquis - Salon 3/4 11:45 AM - 12:45 PM Developing Applications for Mobile iOS and Android Devices with Oracle ADF Mobile: Hands-on Lab Marriott Marquis - Salon 10A 1:15 PM - 2:15 PM Build Mobile Applications for Oracle E-Business Suite Marriott Marquis - Salon 10A 3:30 PM - 4:30 PM Developing Applications for Mobile iOS and Android Devices with Oracle ADF Mobile: Hands-on Lab Marriott Marquis - Salon 10A 5:00 PM - 6:00 PM Developing Applications for Mobile iOS and Android Devices with Oracle ADF Mobile: Hands-on Lab Marriott Marquis - Salon 10A Thur 4 Oct, 2012 Time Title Location 11:15 AM - 12:15 PM Developing Applications for Mobile iOS and Android Devices with Oracle ADF Mobile: Hands-on Lab Marriott Marquis - Salon 10A 11:15 AM - 12:15 PM Introduction to Oracle ADF: Hands-on Lab Marriott Marquis - Salon 3/4 12:45 PM - 1:45 PM Oracle ADF for Java EE Developers with Oracle Enterprise Pack for Eclipse Marriott Marquis - Salon 3/4 BOF (Birds-of-a-Feather) Mon 1 Oct, 2012 Time Title Location 6:15 PM - 7:00 PM How to Get Started with Oracle ADF Marriott Marquis - Club Room 7:15 PM - 8:00 PM Building Next-Generation Applications with Oracle ADF and Oracle BPM Marriott Marquis - Golden Gate C3 7:15 PM - 8:00 PM The Future of Oracle Forms: Upgrade, Modernize, or Migrate? Marriott Marquis - Golden Gate C2 7:15 PM - 8:00 PM Oracle ADF Faces: One Site for Many Devices Marriott Marquis - Golden Gate C1 - User Group Forum (Sunday Only) Sun 30 Sept, 2012 Time Title Location 9:00 AM - 10:00 AM Oracle ADF Immersion: How an Oracle Forms Developer Immersed Himself in the Oracle ADF World Moscone South - 305 10:15 AM - 11:15 AM Deploy with Joy: Using Hudson to Build and Deploy Your Oracle ADF Applications Moscone South - 305 11:30 AM - 12:30 PM ADF EMG User Group: A Peek into the Oracle ADF Architecture of Oracle Fusion Applications Moscone South - 305 12:45 PM - 3:45 PM ADF EMG User Group: Oracle Fusion Middleware Live Application Development Demo Moscone South - 305 3:15 PM - 4:15 PM Mobile Development with Oracle JDeveloper and Oracle ADF Moscone West - 2010 Demos Demo Location Developer Moscone North, Upper Lobby - N-002 Oracle ADF Mobile Development Moscone North, Upper Lobby - N-001 Oracle Eclipse Projects Hilton San Francisco, Grand Ballroom - HHJ-008 Oracle Enterprise Pack for Eclipse Moscone South, Right - S-208 Oracle JDeveloper and Oracle ADF Moscone South, Right - S-207 Exhibits0 Exhibitor Location Accenture Moscone South - 1813Moscone South - 2221 Infosys Moscone South - 1701Moscone South - SMR-005 Innowave Technology Moscone South - 2309 ODTUG Moscone West, Level 2 Lobby - Kiosk in the User Groups Pavilion Oracle ADF Developers Meet Up Wednesday, Oct 03 Time Activity Location 4:30 PM - 5:30 PM Stop by the OTN Lounge and meet other Oracle ADF & Fusion developers as well as product managers and engineers who work on Oracle ADF, ADF Mobile and ADF Essentials. Feedback and questions welcome, or simply stop by and say ‘hi!’ and enjoy free beer. OTN Lounge

Below is the schedule for all ADF related sessions at a glance. Note the Meet and greet session added for Wednesday Octiber 3rd from 4.30 pm to 5:30. Oracle ADF and Fusion Development General Session Mon...

Info

ADF Partner Community News Session - Open Invitation: "ADF as a basis of Fusion Apps - the biggest ADF project ever (in English)"

After a successful guest performance of Ted Farrell in 2011, this year's international ADF speaker to speak during an ADF News session is Chris Muir from Oracle.  ADF News Session - Friday September 14, 8:30 AM - 9.00 AM (CET) - Topic: ADF as a basis of Fusion Apps - the biggest ADF project ever (in English) +++ this webcast will be conducted in English +++ dial-in numbers conc. ADF News Session, Sep. 14 2012 You are invited to join the next ADF News Session, that is going to take place September 14 2012 speaker:  Chris Muir / Oracle time:         8:30 AM (CET) duration:  30 minutes topic:        ADF as a basis of Fusion Apps - the biggest ADF project ever (in English) dial-in webconf: https://oraclemeetings.webex.com conf ID:      595 484 157 confkey:    123456 Please enter your name and an abbreviation of you company name when dialing in (please don´t use blanks and special characters). Please notice that this information will be visible to all participants of the webcast. Thank you. dial-in telco:           +49 (0)69 2222 16 106 or +49 (0)800 66 485 15           ConfCode: 208 503 9           SecurityPasscode: 112233  Other toll-free dial in numbers for EMEA countries are listed below (information is supplied without liability): Austria 0800005967 Belgium 080048331 Croatia 0800222323 Czech Republic 800701080 Denmark  80889099 Estonia 8000111325 Egypt 08000000213 Finland 0800112073 France 0805632866 Greece 00800127897 Hungary 0680011201 Iceland 8008779 Ireland 1800932479 Israel 1809452571 Italy 800897629 Latvia 80002397 Luxembourg 80026598 Netherlands 08000235028 Norway 80010796 Poland 8001213557 Portugal 800814990 Romania 0800895563 Russia 81080029351012 Saudi Arabia 8008444320 Slovak Republic 0800001586 Slovenia 080080466 South Africa 0800980961 Spain 800098600 Sweden 856619465 Switzerland 0800650026 Turkey 00800 44632129 Ukraine 0800500166 United Arab Emirates 8000440344 United Kingdom 08006948154

After a successful guest performance of Ted Farrell in 2011, this year's international ADF speaker to speak during an ADF News session is Chris Muir from Oracle.  ADF News Session - Friday...

Info

ADF EMG Sunday at OOW 2012 (30. Sep 2012) - A day full of content

I do know what I am doing on Sunday September 30 2012 at OOW - how about you ? Well, I am sitting in the back of a room packed with ADF enthusiasts at the ADF EMG Sunday session at Moscone South room 305. Chris Muir managed to get a full day track for the EMG on that Sunday, which I know was a lot of work. In addition a he got lots of good speakers with interesting topics lined up. The below is copied from Chris' announcement at: https://blogs.oracle.com/onesizedoesntfitall/entry/the_year_after_the_year : On the user group Sunday 30th of September the ADF EMG has a full day of sessions for anybody interested in ADF.  The collective sessions are designed to have something for everyone, ADF beginners, ADF experts, all.  All sessions will be held in Moscone South room 305. To start out with for OOW attendees coming from a Forms background, Gert Poel and Pieter Gillis from iAdvise will give us the lowdown on ADF for Forms programmers.  This is a very important presentation for the beginners in the ADF community who are coming from a Forms background:  1) UGF3783 - Oracle ADF Immersion: How an Oracle Forms Developer Immersed Himself in the Oracle ADF World - 9am-10am Moscone South room 305  At the other end of the spectrum for EMG members who are looking to expand their ADF skills beyond the basics, Aino Andriessen from AMIS will be looking at using Hudson for building ADF applications.  Surprisingly via the EMG new member's survey around 25% of new members have no idea about CI tools so I think Aino's presentation is a great addition to the ADF EMG line up:  2) UGF4945 - Deploy with Joy: Using Hudson to Build and Deploy Your Oracle ADF Applications - 10:15am-11:15am Moscone South room 305  The 3rd presentation is one ADF EMG members have been asking for such a long time:  3) UGF10463 - A Peek into the Oracle ADF Architecture of Oracle Fusion Applications - 11:30am-12:30am Moscone South room 305  In this presentation Simon Haslam will be discussing the actual Fusion Apps "ADF" architecture.  In other words forgot the high level "yes ADF was used to build Fusion Apps" bullet points, Simon is going for a deep dive into the nitty gritty details of how ADF was used to build Fusion Apps.  For ADF EMG members remember all those times you posted to the EMG wishing to know more details about how ADF was used in Fusion Apps? This is the session for you to learn and bring your own questions. But the fun doesn't stop here.  The final presentation is a muti-slot presentation, where a team of FMW programmers, including ADF programmers, SOA programmers and more will build an end-to-end application, live in front of your very eyes:  4) UGF10464 - Oracle Fusion Middleware Live Application Development Demo - 12:45-3:45pm Moscone South room 305  Why this presentation rocks, is rather than a single presentation on ADF here, then a separate presentation on SOA there, the goal of this presentation is to bring it altogether so you can see an end-to-end Fusion Middleware application being built at once.  I've seen this before, this is a great session, and I highly recommend it.  Is there something I disagree with? Yes, the title Chris chose for his announcement: The Year After the Year of the ADF Developer - the ADF EMG at OOW 2012 Every year is an ADF year! No need to point to the past.  The year after the year of the ADF developer is the year of ADF developer.

I do know what I am doing on Sunday September 30 2012 at OOW - how about you ? Well, I am sitting in the back of a room packed with ADF enthusiasts at the ADF EMG Sunday session at Moscone South room...

Book Reviews

Book Review: Oracle WebLogic Server 12c: First Look

"Oracle WebLogic Server 12c: First Look" written by Michel Schildmeijer and published by Packt Publishing (ISBN 978-1-84968-718-8) is a well structured overview of new features in Java EE 6 and Oracle WebLogic Server 12c. On 117 pages (no typo on my side), Michel provides a well done digest of what you need to know about Java EE 6 development and deployment with WebLogic server 12c. Michel shows in depth expertise in the Java EE and open source landscape as well as in WebLogic server configuration and administration, as well as Oracle Exalogic. Chapter 1 "Ready for the Cloud!" is a brief introduction to Oracle's WLS stratey and the features of Java EE. Chapter 2 "Supporting the Java EE 6" shows an overview of interesting Java EE 6 features like CDI, EJB 3.1, JSF 2.1, JPA, Servlet 3.0 and REST. The book doesn't go in depth when describing the new features but gives you enough information to feed Google for more information.  From a developer perspective its a well written heads up on what you want to research further in preparation for JDeveloper 12c and WLS 12c. Chapter 3 "Deployment, Installation and Configuration Features" lets you know about a lean start option of WLS, class loader analysis, Enterprise Manager functionality and additional packages for application performance monitoring. Again, a lot of heads up to follow up on. Chapter 4 "Integrated and External Services" is about Grid Link and RAC integration, as well as new JDBC features. You also learn about WLS and Java EE security services and the work with RESTful services. Again, this chapter only scratches the surface and is more of a laundry list of what you want to follow up with for your future application development(I at least put down a lot of notes). If you are a project lead or manager (so no developer who need to know exactly how to do things), then this chapter however provides you all information you need to know of. Chapter 5 "Integration and Management with Enterprise Manager 12c Cloud Control is - together with chapter 2 - my personal favorite and explains Enterprise management options a bit closer. Especially WebLogic Server 12c monitoring in this chapter is what I thought "this is what people really need to know about". Chapter 6 "Oracle Weblogic 12c to the Cloud: Exalogic" is less in depth information on what Oracle Exalogic and Exadata is but again provides a reasonable bird's eye overview of the benefits this system provides As mentioned, 117 pages full of information that are worthwhile reading. The perfect holiday novel for geeks. Definitive, this book is a best value you can get for the cost of if. See: http://www.packtpub.com/oracle-weblogic-server-12c-first-look/book

"Oracle WebLogic Server 12c: First Look" written by Michel Schildmeijer and published by Packt Publishing (ISBN 978-1-84968-718-8) is a well structured overview of new features in Java EE 6 and Oracle...

ADFm

How-to add new ADF bound table row at the end of a table

A frequent question on OTN, which I often see answered with new rows created on the ADF BC view object level instead the ADF binding layer, is about how to create a new row for a table and append it as the last row in the table. The following code below shows how to do this properly using the binding layer only. Note that while it adds the row as the last row of the table, it doesn't do this as the last row of all possible rows that haven't yet been queried from the database. There is a difference between the last row in a table and the last row in the database. public String onRowCreate() { BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry(); //access the name of the iterator the table is bound to. Its "allDepartmentsIterator" //in this sample DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("allDepartmentsIterator"); //access the underlying RowSetIterator RowSetIterator rsi = dciter.getRowSetIterator(); //get handle to the last row Row lastRow = rsi.last(); //obtain the index of the last row int lastRowIndex = rsi.getRangeIndexOf(lastRow); //create a new row Row newRow = rsi.createRow(); //initialize the row newRow.setNewRowState(Row.STATUS_INITIALIZED); //add row to last index + 1 so it becomes last in the range set rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow); //make row the current row so it is displayed correctly rsi.setCurrentRow(newRow); return null;} For the table to show the newly created row after this ensure: 1. The table is configured to always show the current selected row by setting  its displayRow property to selected 2. The table is PPR'ed after the row is created, which can be done declarative using the PartialTriggers property of the table pointing to the ID of the command creating the new row But what is wrong with the approach of doing the same on the View Object level in ADF BC if it works? Well, it works but it doesn't ensure separation of the layers unless the functionality is exposed as a method on the view object interface. The code in this blog entry is generic and works the same for other business services, like EJB, POJO and Web Services for creating new table rows (which then however you need to persist explicitly in opposite to what you have to do when using ADF BC). So while the other code works, the one in this is the proper solution.

A frequent question on OTN, which I often see answered with new rows created on the ADF BC view object level instead the ADF binding layer, is about how to create a new row for a table and append it...

ADFm

How-to dynamically filter model-driven LOV

Often developers need to filter a LOV query with information obtainedfrom an ADF Faces form or other where. The sample below shows how to define a launch popup listener configured on the launchPopupListener property of the af:inputListOfValues componentto filter a list of values. <af:inputListOfValues id="departmentIdId"   value="#{bindings.DepartmentId.inputValue}"                                         model="#{bindings.DepartmentId.listOfValuesModel}"   launchPopupListener="#{PopupLauncher.onPopupLaunch}" … >         …</af:inputListOfValues> A list of values is queried using a search binding that gets created inthe PageDef file of a view when a lis of value component gets added. Themanaged bean code below looks this search binding up to then add a viewcriteria that filters the query. public void onPopupLaunch(LaunchPopupEvent launchPopupEvent) {  BindingContext bctx = BindingContext.getCurrent();  BindingContainer bindings = bctx.getCurrentBindingsEntry();  JUCtrlListBinding lov =        (JUCtrlListBinding)bindings.get("DepartmentId");  ViewCriteriaManager vcm =   lov.getListIterBinding().getViewObject().getViewCriteriaManager();            //make sure the view criteria is cleared  vcm.removeViewCriteria(vcm.DFLT_VIEW_CRITERIA_NAME);  //create a new view criteria  ViewCriteria vc =          new ViewCriteria(lov.getListIterBinding().getViewObject());  //use the default view criteria name  //"__DefaultViewCriteria__"  vc.setName(vcm.DFLT_VIEW_CRITERIA_NAME);  //create a view criteria row for all queryable attributes  ViewCriteriaRow vcr = new ViewCriteriaRow(vc);  //for this sample I set the query filter to DepartmentId 60.   //You may determine it at runtime by reading it from a managed bean  //or binding layer   vcr.setAttribute("DepartmentId", 60);  //also note that the view criteria row consists of all attributes   //that belong to the LOV list view object, which means that you can  //filter on multiple attributes  vc.addRow(vcr);             lov.getListIterBinding().getViewObject().applyViewCriteria(vc);}  Note: Instead of using the vcm.DFLT_VIEW_CRITERIA_NAME name you can also define a custom name for theview criteria.

Often developers need to filter a LOV query with information obtained from an ADF Faces form or other where. The sample below shows how to define a launch popup listener configured on the launchPopupLi...

Info

Oracle Fusion Applications Design Patterns Now Available

"The Oracle Fusion Applications user experience design patterns are published! These new, reusable usability solutions and best-practices, which will join Oracledashboard patterns and guidelines that are already available online, are used by Oracle to artfully bring to life a new standard in the user experience, or UX, of enterprise applications. Now, the Oracle applications development community can benefit from the science behind the Oracle Fusion Applications user experience, too.These Oracle Fusion Applications UX Design Patterns, or blueprints, enable Oracle applications developers and system implementers everywhere to leverage professional usability insight when [...]  designing exciting, new, highly usable applications -- in the cloud or on-premise.  Based on the Oracle Application Development Framework (ADF) components, the Oracle Fusion Applications patterns and guidelines are proven with real users and in the Applications UX usability labs, so you can get right to work coding productivity-enhancing designs that provide an advantage for your entire business.  What’s the best way to get started? We’ve made that easy, too. The Design Filter Tool (DeFT) selects the best pattern for your user type and task. Simply adapt your selection for your own task flow and content, and you’re on your way to a really great applications user experience. More Oracle applications design patterns and training are coming your way in the future. To provide feedback on the sets that are currently available, let us know in the comments section or use the contact form provided."

"The Oracle Fusion Applications user experience design patterns are published! These new, reusable usability solutions and best-practices, which will join Oracle dashboard patterns and guidelines that...

ADFv

Partial Submit vs. Auto Submit

Partial Submit ADF Faces adds the concept of partial form submit to JavaServer Faces 1.2 and beyond. A partial submit actually is a form submit that does not require a page refresh and only updates components in the view that are referenced from the command component PartialTriggers property. Another option for refreshing a component in response to a partial submit is call AdfContext.getCurrentInstance.addPartialTarget(component_instance_handle_goes_here)in a managed bean. If a form contains required fields that the user left empty invoking the partial submit, then errors are shown for each of the field as the full form gets submitted. Autosubmit An input component that has its autosubmit property set to true also performs a partial submit of the form. However, this time it doesn't submit the entire form but only the component that triggers the submit plus components referenced it in their PartialTriggers property. For example, consider a form that has three input fields inpA, inpB and inpC with autosubmit=true set on inpA and required=true set on inpB and inpC. use case 1: Running the view, entering data into inpA and then tabbing out of the field will submit the content for inpA but not for inpB and inpC. Further more, none of the required field settings on inpB and inpC causes an error. use case 2: You change the configuration of inpC and set its PartialTriggers property to point to the ID of component inpA. When rerunning the sample, entering a value into inpA and tabbing out of the field will now submit the inpA and inpC fields and thus show an error for the missing required value on inpC. Internally, using autosubmit=true on an input component sets the event root to just this field, which good to have in case of dependent field validation or behavior. The event root can extended to include other components by using the Partial Triggers property on these components to point to the input field that has autosubmit=true defined. PartialSubmit vs. AutoSubmit Partial submit set on a command component submits the whole form and leaves it to the developer to decide which UI component is refreshed in response. Client side required field validation (as well as the server side equivalent) is not disabled by executed in this scenario. Setting immediate=true on the command item to skip validation doesn't help as it would also skip the model update. Auto submit is a functionality on the input components and also performs a partial form submit. However, in addition an event root is defined that narrows the scope for the submitted data and thus the components that are validated on the request. To read more about this topic, see: http://docs.oracle.com/cd/E23943_01/web.1111/b31973/af_lifecycle.htm#CIAHCFJF

Partial Submit ADF Faces adds the concept of partial form submit to JavaServer Faces 1.2 and beyond. A partial submit actually is a form submit that does not require a page refresh and only updates...

Info

OEPE with ADF binding support available: Total Eclipse

The current release of Oracle Enterprise Pack for Eclipse, though in technology preview, brings Oracle ADF binding to the Eclipse IDE. You can download the Software from the link below: Oracle Enterprise Pack for Eclipse (12.1.1.1.0) Technical Preview New June 2012 Certified on Windows 7/XP/Vista, MacOS, and Linux. Supported on JDK 6. For many Eclipse users, ADF is new and therefore I expect them to need guidance and help in case they run into issues they don't know how to recover from. Similar, ADF users familiar with Oracle JDeveloper that want to give OEPE a try, will find things different in Eclipse and thus may have questions.  For both audiences I suggest to post issues to the OEPE forum on the Oracle Technology Network: I'll extend my OTN monitoring to include the OEPE forum on a daily basis to learn about developer needs, requirements and - of course - to catch bugs that need to be filed. From my side this is a part-time involvement, which means that the more ADF questions show on the forum, the more help I could need in answering them. The OTN forum for JDeveloper in my opnion wouldn't be the right place to go to unless the question is a generic ADF question that is not dependent on the integration in Eclipse. Here's the OEPE forum link for a start https://forums.oracle.com/forums/forum.jspa?forumID=578 Frank

The current release of Oracle Enterprise Pack for Eclipse, though in technology preview, brings Oracle ADF binding to the Eclipse IDE. You can download the Software from the link below: Oracle...

Info

Free Advanced ADF eCourse, part II

A second part of the advanced Oracle ADF online training isavailable for free. Lynn Munsinger and her team worked hard to deliver thissecond part of the training as close to the release of the first installment as possible. This two part advancedADF training provides you with a wealth of advanced ADF know-how and insight for you toadopt in a self-paced manner. Part 1 (though I am sure you have this bookmarked): http://tinyurl.com/advadf-part1 Part 2 (the new material): http://tinyurl.com/advadf-part2 Quoting Lynn: "This secondinstallment provides you with all you need to know about regions, includingbest practices for implementing contextual events and other regioncommunication patterns. It also covers thenitty-gritty details of building great looking user interfaces, such as how towork with (not against!) the ADF Faces layout components, how to build pagetemplates and declarative components, and how to skin the application to yourorganization’s needs. It wraps up with an in-depth look at layout components,and a second helping of additional region considerations if you just can’t getenough. Like the firstinstallment, the content for this course comes from Product Management. This2nd eCourse compilation is a bit of a “Swan Song” for Patrice Daux, a long-timeJDeveloper and ADF curriculum developer, who is retiring the end of this month.Thanks for your efforts, Patrice, and bon voyage!" Indeed: Great job Patrice! (and all others involved)

A second part of the advanced Oracle ADF online training is available for free. Lynn Munsinger and her team worked hard to deliver thissecond part of the training as close to the release of the...

ADFv

Pretty URL in ADF Faces of JDeveloper 11.1.2.2

Many features planned for Oracle JDeveloper 12c find their way into current releases of Oracle JDeveloper 11g R1 and JDeveloper 11g R2. One example of such a feature is "pretty URL" - or "clean URL" as the Oracle JDeveloper 11g R2 (11.1.2.2) documentation puts it. "A.2.3.24 Clean URLs Historically, ADF Faces has used URL parameters to hold information, such as window IDs and state. However, URL parameters can prevent search engines from recognizing when URLs are actually the same, and therefore interfere with analytics. URL parameters can also interfere with bookmarking. By default, ADF Faces removes URL parameters using the HTML5 History Management API. If that API is unavailable, then session cookies are used.You can also manually configure how URL parameters are removed using the context parameter oracle.adf.view.rich.prettyURL.OPTIONS. Set the parameter to off so that no parameters are removed. Set the parameter to useHistoryApi to only use the HTML5 History Management API. If a browser does not support this API, then no parameters will be removed. Set the parameter to useCookies to use session cookies to remove parameters. If the browser does not support cookies, then no parameters will be removed." See: http://docs.oracle.com/cd/E26098_01/web.1112/e16181/ap_config.htm#ADFUI12856 So basically, what this part in the documentation says is: In JDeveloper 11g R2 (11.1.2.2), Oracle ADF Faces automatically removes its internally used dynamic parameters from the URL You can influence the setting with the prettyURL.OPTIONS context option, which however is not recommended you to do because the default behavior is able to detect if the browser client supports HTML 5 History management or not. In the latter case it the uses a session cookie and if this doesn't work, falls back to the "old" URL parameter adding. The information that is not so explicit and clearly mentioned in the documentation is that this is only for ADF Faces parameters (such as _afrLoop, Adf-Window-Id, etc.), but not the ADF controller token (_adf.ctrl-state)! Removing the ADF controller token is an enhancement request that will be implemented in Oracle JDeveloper 12c

Many features planned for Oracle JDeveloper 12c find their way into current releases of Oracle JDeveloper 11g R1 and JDeveloper 11g R2. One example of such a feature is "pretty URL" - or "clean URL"...

ADFv

Programmatically disclosing a node in af:tree and af:treeTable

A common developer requirement when working with af:tree or af:treeTable components is to programmatically disclose (expand) a specific node in the tree. If the node to disclose is not a top level node, like a location in a LocationsView -> DepartmentsView -> EmployeesView hierarchy, you need to also disclose the node's parent node hierarchy for application users to see the fully expanded tree node structure. Working on ADF Code Corner sample #101, I wrote the following code lines that show a generic option for disclosing a tree node starting from a handle to the node to disclose. The use case in ADF Coder Corner sample #101 is a drag and drop operation from a table component to a tree to relocate employees to a new department. The tree node that receives the drop is a department node contained in a location. In theory the location could be part of a country and so on to indicate the depth the tree may have. Based on this structure, the code below provides a generic solution to parse the current node parent nodes and its child nodes. The drop event provided a rowKey for the tree node that received the drop. Like in af:table, the tree row key is not of type oracle.jbo.domain.Key but an implementation of java.util.List that contains the row keys. The JUCtrlHierBinding class in the ADF Binding layer that represents the ADF tree binding at runtime provides a method named findNodeByKeyPath that allows you to get a handle to the JUCtrlHierNodeBinding instance that represents a tree node in the binding layer. CollectionModel model = (CollectionModel) your_af_tree_reference.getValue();JUCtrlHierBinding treeBinding = (JUCtrlHierBinding ) model.getWrappedData(); JUCtrlHierNodeBinding treeDropNode = treeBinding.findNodeByKeyPath(dropRowKey); To disclose the tree node, you need to create a RowKeySet, which you do using the RowKeySetImpl class. Because the RowKeySet replaces any existing row key set in the tree, all other nodes are automatically closed. RowKeySetImpl rksImpl = new RowKeySetImpl();//the first key to add is the node that received the drop//operation (departments).            rksImpl.add(dropRowKey);    Similar, from the tree binding, the root node can be obtained. The root node is the end of all parent node iteration and therefore important. JUCtrlHierNodeBinding rootNode = treeBinding.getRootNodeBinding(); The following code obtains a reference to the hierarchy of parent nodes until the root node is found. JUCtrlHierNodeBinding dropNodeParent = treeDropNode.getParent();//walk up the tree to expand all parent nodes while(dropNodeParent != null && dropNodeParent != rootNode){   //add the node's keyPath (remember its a List) to the row key set   rksImpl.add(dropNodeParent.getKeyPath());      dropNodeParent = dropNodeParent.getParent();} Next, you disclose the drop node immediate child nodes as otherwise all you see is the department node. Its not quite exactly "dinner for one", but the procedure is very similar to the one handling the parent node keys ArrayList<JUCtrlHierNodeBinding> childList = (ArrayList<JUCtrlHierNodeBinding>) treeDropNode.getChildren();                     for(JUCtrlHierNodeBinding nb : childList){  rksImpl.add(nb.getKeyPath());} Next, the row key set is defined as the disclosed row keys on the tree so when you refresh (PPR) the tree, the new disclosed state shows tree.setDisclosedRowKeys(rksImpl); AdfFacesContext.getCurrentInstance().addPartialTarget(tree.getParent()); The refresh in my use case is on the tree parent component (a layout container), which usually shows the best effect for refreshing the tree component. 

A common developer requirement when working with af:tree or af:treeTable components is to programmatically disclose (expand) a specific node in the tree. If the node to disclose is not a top level...

ADFv

Solving the context menu problem with drag and drop in trees

The following drag-and-drop problem has been reported onOTN: An ADF Faces tree component is configured with a af:collectionDropTargettag to handle drop events. The same tree component also has a context menu definedthat is shown when users select the tree with the right mouse button. Theproblem now was - and I could reproduce this - that the context menu stoppedworking after the first time the tree handled a drop event. The drag and dropuse case is to associate employees from a table to a department in the treeusing drag and drop. The drop handler code in the managed bean looked up thetree node that received the drop event to determine the department ID to assignto the employee. For this code similar to the one shown below was used List dropRowKey = (List) dropEvent.getDropSite();//if no dropsite then drop area was not a data areaif(dropRowKey == null){   return DnDAction.NONE;}                tree.setRowKey(dropRowKey);JUCtrlHierNodeBinding dropNode = (JUCtrlHierNodeBinding) tree.getRowData(); So what happens in this code? The drop event contains the dropSite reference, which is the row keyof the tree node that received the drop event. The code then sets the key tothe tree in a call to getRowDate() returns the node information for the droptarget (the department). This however causes the tree state to go out of synchwith its model (ADF tree binding), which is known to cause issues. In this use case the issue caused by this is that the context menu nolonger shows up. To fix the problem, the code needs to be changes to read thecurrent row key from the key, then perform the drop operation and at the endset the origin (or model) row key back //memorize current row keyObject currentRowKey = tree.getRowKey();        List dropRowKey = (List) dropEvent.getDropSite();//if no dropsite then drop area was not a data area if(dropRowKey == null){  return DnDAction.NONE;  }              tree.setRowKey(dropRowKey);JUCtrlHierNodeBinding dropNode = (JUCtrlHierNodeBinding) tree.getRowData(); ... do your stuff here .... //set current row key backtree.setRowKey(currentRowKey);AdfFacesContext.getCurrentInstance().addPartialTarget(tree); Note the code line that sets the row key back to its original value.

The following drag-and-drop problem has been reported on OTN: An ADF Faces tree component is configured with a af:collectionDropTargettag to handle drop events. The same tree component also has...

ADFv

Problem with deleting table rows using ctrl+a for row selection

The following code is commonly shown anddocumented for how to access the row key of selected table rows in an ADF Facestable configured for multi row selection. public void onRemoveSelectedTableRows(ActionEvent actionEvent) {   RichTable richTable = … get access to your table instance …   CollectionModel cm =(CollectionModel)richTable.getValue();   RowKeySet rowKeySet = (RowKeySet)richTable.getSelectedRowKeys();             for (Object key : rowKeySet) {      richTable.setRowKey(key);      JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)cm.getRowData();      // do something with rowData e.g.update, print, copy   }   //optional, if you changed data, refresh the table         AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance(); adfFacesContext.addPartialTarget(richTable);   return null;} The code shown above works for 99.5 % of alluse cases that deal with multi row selection enabled ADF Faces tables, exceptfor when users use the ctrl+a key to mark all rows for delete. Just to makesure I am clear: if you use ctrl+a to mark rows to perform any other operationon them – like bulk updating all rows for a specific attribute – then thisworks with the code shown above. Even for bulk row delete, any other mean ofrow selection (shift+click and multiple ctrl+click) works like a charm and therows are deleted. So apparently it is the use of ctrl+a thatcauses the problem when deleting multiple rows of an ADF Faces table. Toimplement code that works for all table selection use cases, including the oneto delete all table rows in one go, you use the code shown below. public void onRemoveSelectedTableRows(ActionEvent actionEvent) {  RichTable richTable = … get access to your table instance …  CollectionModel cm = (CollectionModel)richTable.getValue();  RowKeySet rowKeySet = (RowKeySet)richTable.getSelectedRowKeys();  Object[] rowKeySetArray = rowKeySet.toArray();     for (Object key : rowKeySetArray){               richTable.setRowKey(key);    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)cm.getRowData();                              rowData.getRow().remove();  }   AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();          adfFacesContext.addPartialTarget(richTable);}

The following code is commonly shown and documented for how to access the row key of selected table rows in an ADF Faces table configured for multi row selection. public void...

ADFm

Common mistake when iterating rows

In a blog entry from 2010, Oracle's Jobinesh Purushothamanwrites about exceptions that are getting raised after developers iterate thecollection of a RichTable instance using calls to setRowKey(key). http://jobinesh.blogspot.co.uk/2010/02/common-mistake-while-iterating-through.html The reason for the exception is that the selected row stateis change on the table without synchronization to happen with the ADF bindinglayer. The failure of synchronizing the table selected row state with the ADFbinding layer is because no row selection event is raised on the table if therow currency is changed programmatically. In theory, if you call #{bindings.treebinding.treeModel.makeCurrent}usinga method expression in EL The failed binding synchronization is because no rowselection event is fired when the selected row state is changed on the tableusing Java in a managed bean. A solution to this problem could be to call #{bindings.treebinding.treeModel.makeCurrent}froma method expression in Java each time you called setRowKey(key).But, assuming the iteration of rows in a table is for aggregating numericvalues or to compare two rows, do you really want to change the current row in the ADF binding layer foreach row you need to access? A better implementation for this use case in my opinion isto read the data from the ADF binding layer instead of the RichTable tableinstance, which then will not change the row currency at all. RichTable table = ... get table reference ...Iterator iter = selectedRowKeys.iterator();CollectionModel model = (CollectionModel ) table.getValue(); JUCtrlHierBinding treeBinding = (JUCtrlHierBinding )model.getWrappedData(); if (iter != null && iter.hasNext()) {   Object rowKey = iter.next();  JUCtrlHierNodeBinding rowData = treeBinding.findNodeByKeyPath(rowKey);        //Do something here} Note that the reported problem in Jobinesh's blog is for ADF boundtables configured for single row selection. Still I would prefer my approachover changing the selected row state on a table.

In a blog entry from 2010, Oracle's Jobinesh Purushothaman writes about exceptions that are getting raised after developers iterate the collection of a RichTable instance using calls to setRowKey(key)....

ADFv

Managing component value state correctly

A frequent problem reported on OTN is about failure insaving component values using managed beans especially when multi-select components are used.Usually the problem arises when developers store select choice components values in managed beans they use for JSF component bindings as well (which then makes the managed bean becoming a backing bean). Backing beans however are saved in request scope (at least they should to not err again).Request scope beans however reset their state after eachrequest, which means that no user update in a select component ispersisted beyond the request. The result is that user changes are not displayed in the UI or value change listeners don't execute.The proper way of handling the combination of backing beans andcomponent values saved in a managed bean is to come up with a strategy in whichthe component value is written to a separate bean in a broader scope (I usuallyrecommend viewScope) than the backing bean. The backing bean (request scope)would then access the bean in the larger scope using a ValueExpression or managed beanproperty to access the user selected data. I was about to write this solution up in more detail butthen found the following blog entry by Duncan Mills: https://blogs.oracle.com/groundside/entry/the_uimanager_pattern In his The UIManagerPattern blog entry, Duncan documented the same problem from a differentangle. The programmer mistake Duncan observed was that component bindingreferences (the Bindings property reference on an ADF Faces component) werestored in managed beans with a scope larger than request, which JavaServerFaces component don't support.  In his write-up Duncan documents the samestrategy I was about to document, which is to separate the value saving from the component referenceusing different managed beans in different scope. Well, I think that Duncan'sblog entry saved me some time I today.

A frequent problem reported on OTN is about failure in saving component values using managed beans especially when multi-select components are used.Usually the problem arises when developers store...

ADFv

Scope object serialization failed (object not serializable)

A common reason for the "SEVERE: ADFc: Scope objectserialization failed (object not serializable)" error message is thatapplication developers reference JSF components in managed beans with a scopelarger than request. When using the JSF component Binding property to point to a managed bean, think backing bean and thus don't reference beans that are inscopes larger than request scope (don't: viewScope, pageFlowSope, sessionScope, applicationScope). If, from a managed bean in a scope larger than request youneed to have access to a component instance (though the other way around is amore common use case) then either look up the component on the UIViewRoot. TheTrinidad util class ComponentUtils is a appears to be useful for this too: http://myfaces.apache.org/trinidad/trinidad-api/apidocs/org/apache/myfaces/trinidad/util/ComponentUtils.html resolve an EL reference to a managed bean inrequest scope that holds the component binding As mentioned, a more common use case is to access a bean ina scope larger than request from a backing bean. A use case for this is if youneed to remember a specific state, like a list of selected values in a selectmany list, or the disclosure state of panel tabs. In this case you would save the state information in a beanwith a lifecycle that spans beyond request scope and access it from a requestscope backing bean using a managed property or by resolving EL in Java.

A common reason for the "SEVERE: ADFc: Scope object serialization failed (object not serializable)" error message is that application developers reference JSF components in managed beans with a scopela...

ADFv

How-to invoke a method once upon application start

A requirement on the OTN forum was to execute a method onlyonce upon application start either for the application as a whole (all user instances)or once per application user session. In addition, the method to be executedwas exposed as an Operation binding on the ADF binding layer. One way to provide a solution to this requirement is to withinthe combination of a phase listener on the JSPX of JSF document level and amanaged bean in application or session scope (dependent on whether the methodshould be executed once per application start or once per application usersession). The phase listener can be configured on a JSF document, as mentionedor in the faces-config.xmlfile if there is no single entry to an application. For this example, we assumea single point of entry so that the phase listener can be configured on thef:view attribute. <f:view beforePhase="#{ManagedBean.onBeforePhase}"> The event logic is configured in a bean in request scope soit could also hold component references for the page if required. public void onBeforePhase(PhaseEvent phaseEvent) {//render response is called on an initial page request   if(phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE){ FacesContext fctx = FacesContext.getCurrentInstance(); ELContext elctx = fctx.getELContext(); ExpressionFactory exprFactory = fctx.getApplication().getExpressionFactory(); //call the managed bean in application or session scope. If the //bean instance already exists, then no new instance of it will be  //created,in which case the "initial load" method is not executed ValueExpression ve = exprFactory.createValueExpression( elctx, "#{your_managed_bean_in_application_or-session_scope", Object.class); ve.getValue(elctx); }} The idea for this phase listener is to reference a managedbean in application scope or session scope base on your requirement. Themanaged bean in session or application scope invokes the method you want toinvoke once per application or user session in its post construct method //Managed Bean in application scopeimport javax.annotation.PostConstruct;... @PostConstruct public void methodInvokeOncedOnPageLoad(){   //access the methods you want to invoke. If they are exposed in the //PageDef file, access the BindingContext --> BindingContainer --> //OperationBinding. Alternatively you can call BindingContext --> //findDataControl("Name as in DataBindings.cpx") --> //getApplicationModule --> findViewObject/Execute methods ...} Note that the Java EE @PostConstruct bean is called oncefor each bean instantiation. In the managed bean case, the bean is instantiatedonce per application or session and so is the method executed once.

A requirement on the OTN forum was to execute a method only once upon application start either for the application as a whole (all user instances)or once per application user session. In addition, the...

Web Service

Which option to choose for accessing Web Services in ADF

Oracle ADF provides three options for integrating WebService: · Web Service Data Control · JAX-WS proxy client and POJO Data Control · JAX-WS proxy client and programmatic ViewObjects Note: In theabove, I exclude REST services in my recommendation because this is what ADFwill address much better using the URL data control in JDeveloper 11g R2(available) and with improved functionality in the upcoming Oracle JDeveloper12c release. For deciding which option to use for integrating WebService, here is what I consider "a good rule of thumb" 1. Use WebService Data Control only for simple service like weather reports or stockquotes 2. Use JAX-WSproxy client for all more complex services and access them from a. Programmaticview object and entity if your business service is ADF Business Components asthis allows for better integration with database queried  views i. Use View Objects only for read only access ii. Use View Objects and Entities for CRUD WebService integration b. POJO DataControl i. If yourbusiness service is not ADF BC. ii. If the WS doesn't requireintegration in ADF business component iii. If WS access should be from a bounded taskflow in an ADF library for maximum reuse As a general hint of best practice: Neveruse the JAX-WS generated proxy client directly. Always access it from a wrapperbean to avoid code losses or problem in cases where the proxy client needs tobe re-generated. Note: ADF Code Corner published an article explaining how to cache Web Services results when using JAX-WS proxy clients to avoid unnecessary round trips. See: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/92-cache-ws-queries-523136.pdf

Oracle ADF provides three options for integrating Web Service:· Web Service Data Control · JAX-WS proxy client and POJO Data Control · JAX-WS proxy client and programmatic View Objects Note: In theabove,...

ADFc

Task Flow navigation using QueueActionEventInRegion on ADF Region

A common requirement in Oracle ADF is to perform navigation within an ADF region triggered by the parent page. While contextual event is one option to perform this task, the queueActionEventInRegion method exposed on the RichRegion instance is another. The queueActionEventInRegion performs navigation following control flow cases defined for the current view exposed in the region. Control flow cases can be flows that are defined from the view activity to a next activity or wild card control flow cases. The easiest way for developers to access the RichRegion instance of an af:region tag is to use its Binding property and point it to a managed bean. Once you have a handle to the RichRegion, you can perform navigation from any event raised on the parent view (e.g. menu items action, command button action, value change events etc.)//process navigationpublic String navPickerAction() { //get selected navigation option  String navigationCase = this.currentNavOption;  RichRegion region = this.findRegionById("adfRegion1");          region.queueActionEventInRegion(createMethodExpressionFromString(navigationCase),                                   null, null,false, 0, 0, PhaseId.INVOKE_APPLICATION);       return null;}    //Create Method expression    private MethodExpression createMethodExpressionFromString(String s){  FacesContext fctx = FacesContext.getCurrentInstance();  ELContext elctx = fctx.getELContext();  ExpressionFactory exprFactory = fctx.getApplication().getExpressionFactory();  MethodExpression methodExpr = exprFactory.createMethodExpression(                  elctx,                                s,                 null,                  new Class[]{});    return methodExpr;}Another useful method on the RichRegion instance is the ability to peek into the region for control flow cases defined for the current view. The following code reads the control flow cases that are defined for a view in a region to build a list of SelectItem for use in an af:selectOneChoice//read the navigation case list from the region capabilitiespublic ArrayList<SelectItem> getNavlist() {   RichRegion region = this.findRegionById("adfRegion1");   Set<String> capabilities = region.getRegionModel().getCapabilities();   navlist = new ArrayList<SelectItem>();        for(String navcase : capabilities){                 SelectItem item = new SelectItem();     item.setLabel(navcase);     item.setValue(navcase);     navlist.add(item);            }         return navlist;}The JDeveloper 11.1.1.6 sample workspace you can download at the end blog article contains implementations for all RichRegion methods: queueActionEventInRegion, getCapabilities and RegionNavigationListener The select one choice in component in the sample always shows the control flow cases that are defined for the current view in the ADF Region (just for fun, you may want to add some wild card navigation flows in the task flow and then re-run the application to see that the control flow cases are dynamically looked up). Using the Region Navigation Listener, navigating the region using the "Go to Employees" button on the view will update the select one choice component in the parent view. Get the sample application from here and make sure you configure the database connect to point to the HR schema of your local Oracle database. Download Sample

A common requirement in Oracle ADF is to perform navigation within an ADF region triggered by the parent page. While contextual event is one option to perform this task, the queueActionEventInRegion me...

JavaScript

Gotcha when using JavaScript in ADF Regions

You use the ADF Faces af:resource tag to add or reference JavaScript on a page. However, adding the af:resource tag to a page fragment my not produce the desired result if the script is added as shown below<?xml version='1.0' encoding='UTF-8'?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> <af:resource type="javascript">  function yourMethod(evt){ ... }</af:resource>Adding scripts to a page fragment like this will see the script added for the first page fragment loaded by an ADF region but not for any subsequent fragment navigated to within the context of task flow navigation. The cause of this problem is caching as the af:resource tag is a JSP element and not a lazy loaded JSF component, which makes it a candidate for caching. To solve the problem, move the af:resource tag into a container component like af:panelFormLayout so the script is added when the component is instantiated and added to the page. <?xml version='1.0' encoding='UTF-8'?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"><af:panelFormLayout> <af:resource type="javascript">   function yourMethod(evt){ ... } </af:resource></af:panelFormLayout> Magically this then works and prevents browser caching of the script when using page fragments.

You use the ADF Faces af:resource tag to add or reference JavaScript on a page. However, adding the af:resource tag to a page fragment my not produce the desired result if the script is added as shown...

ADFc

URL Task Flow vs. WSRP Portlets

A URL task flow is bounded task flow that is deployed asa stand-alone Java EE application on a remote server with its URL Invoke property set to url-invoke-allowed. The URL task flowis accessed either from a direct browser GET request or, when called fromanother ADF application, through the task flow call activity. For more information about how to invoke URL task flows froma task flow call activity see chapter 15.6.4How to Call a Bounded Task Flow Using a URL of the Oracle Fusion MiddlewareFusion Developer's Guide for Oracle Application Development Framework at http://docs.oracle.com/cd/E23943_01/web.1111/b31974/taskflows_activities.htm#CHDJDJEF Compared to WRSP portlets, URL task flows in OracleJDeveloper 11g R1 and R2 have a functional limitation in that they cannot beembedded as a region on a page but require the calling ADF application tonavigate off to another application and page. The difference between a URLtask flow call using the task flow call activity and a simple redirect to aremote Java EE application is that the URL task flow has a state tokenattached that allows to restore the state of the calling application upon taskflow return. A use case for a URL task flow call activity is a "yellowpage lookup" scenario in which different ADF applications use an URL task flow to lookup people, products or similar to return a selected value tothe calling application. Note that URL task flow calls need to be performed from a bounded or unbounded top level taskflow of the calling application. If called from a region (using the parent callactivity) in a page, the region state is not recovered upon task flow return. ADF developers recently have identified URL task flowsas an architecture pattern to partition their ADF applications into independentlydeployed Java EE applications. While this sounds like a desirable use of the URL task flow feature, it is not possible to achieve for as long as URLtask flows don't render as an ADF region.

A URL task flow is bounded task flow that is deployed as a stand-alone Java EE application on a remote server with its URL Invoke property set to url-invoke-allowed. The URL task flowis accessed...

JavaScript

Using af:serverListener as a JS client-server proxy

Despite of ADF Faces having a client side JavaScriptarchitecture, JavaScript rule #1 inADF Faces is to use JavaScript as a fallback option only for development usecases in which there is no native solution to a problem. A built-in feature ofthe ADF Faces JavaScript client architecture is security that disallows certaincomponent properties like disabledand readOnly to be changed fromJavaScript. To quote the JavaScript doc for the AdfRichInputText object: http://docs.oracle.com/cd/E12839_01/apirefs.1111/e12046/oracle/adf/view/js/component/rich/input/AdfRichInputText.html#getReadOnly__ public BooleangetReadOnly() Get function for attributefor 'readOnly'. This attribute is secured. You may get it, but you may not setit. Any changes to this attribute will not be transmitted to the server. Note: The disabled property can be enabled for JavaScriptmodification by setting the component unsecureproperty as explained in the component documentation, which however I don'trecommend you to do. If you need to open protected features for modification,do so in a way that you control, for example in that you can check a userpermission to do so. There might be use cases in which you need to change aprotected property from JavaScript, and here is how this can and should bedone: The ADF Faces af:serverListener component allows developers to invokeserver side Java from JavaScript and thus can be used as a proxy to bypass appliedclient side security. For example, to be able to change the readOnly property on an af:inputText component, you define the text field asshown below <af:inputText label="Label 2" id="it2" clientComponent="true"                       value="#{SetInputTextFieldReadOnly.textValue}">        <af:serverListener type="serverAction"                                 method="#{SetInputTextFieldReadOnly.actionEvent}"/></af:inputText> The clientComponentproperty need to be set to true onthe component to ensure a JavaScript object is created on the client architecture.With no clientComponent set to true andno af:clientListenerattached, the text field component is not accessible from JavaScript at all. The af:serverListenerneeds to be configured on the component that is passed as a component referenceto the server. In the sample, the component reference that is sent to theserver is the input text field that you want to switch from updateable toread-only. If the integration is from a non ADF Faces component, like anApplet, you would configure the af:serverListeneron the af:documentcomponent. If this is the case, you may not make use of the component referenceon the server and instead pass additional payload arguments. In the Oracle JDeveloper 11.1.1.6 sample to this articlethe switch between read-only and updateable is simulated by a command buttonyou can press. The sample can be dowloaded from here. In a realistic use case, this switch would be triggeredfrom a non ADF Faces component like Applet or another technology you integratein your ADF Faces page. Note: The use ofa command button in the sample is only for demonstration purpose. If thetrigger was a command button then no JavaScript would be needed at all and JavaScriptrule #1 would apply On the server, a managed bean method is invoked by theclient JavaScript call shown below: <af:resource type="javascript">  function setUpdateable(actionEvent){     actionEvent.cancel();     var commandButton = actionEvent.getSource();     var textFieldId = commandButton.getProperty('componentId');     invokeServerAction(textFieldId,actionEvent,'true'); }       function setReadOnly(actionEvent){       actionEvent.cancel();    var commandButton = actionEvent.getSource();    var textFieldId = commandButton.getProperty('componentId');    invokeServerAction(textFieldId,actionEvent,'false'); }   function invokeServerAction(compId,evt,isUpdateable){   var textField = evt.getSource().findComponent(compId);              AdfCustomEvent.queue(         textField,"serverAction",         {updateable: isUpdateable},false);                                }</af:resource> Note: payloadarguments are surrounded by curly braces. If you want to pass multiplearguments then you use a comma separated list of key1:value1, key2:value2 …pairs. The JavaScript is taken from the sample provided for thistip and – as mentioned – is invoked from a command button. The command buttonhas a custom property (af:clientAttribute)added that tells the script about the text component Id to modify. Thecomponent and the desired switch state "readOnly" or"updateable" is passed to the managed bean method:  /**  * Proxy the client request  * @param clientEvent The client event gives you access to the   * component that raises the event as well as to the paraneters   * passed from the client to the server */ public void actionEvent(ClientEvent clientEvent) {  /*   * This would be a good place to check an ADF Security resource   * permission if the user is allowed to perform the change on the    * attribute. There is no security in JavaScript, but using server    * side JAAS protects you from unauthorized changes   */    RichInputText inputText = (RichInputText) clientEvent.getComponent();   String updateable = (String) clientEvent.getParameters().get("updateable"); inputText.setReadOnly(!Boolean.parseBoolean(updateable));   AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();   adfFacesContext.addPartialTarget(inputText); } Sample Download //cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/f4a5b21d-66fa-4885-92bf-c4e81c06d916/File/669f59d00ddbbc57c3a6b26c8fb8449e/setinputtexttoreadonlyjs.zip

Despite of ADF Faces having a client side JavaScript architecture, JavaScript rule #1 in ADF Faces is to use JavaScript as a fallback option only for development usecases in which there is no native...

ADFv

Creating a custom master-detail presentation using af:panelAccordion

ADF Code Corner sample #81 explains how-to create a customlayout to render master-detail information. In the sample ADF Faces panel tabs are used to render themaster data and DVT components are used in the panel tabs to show the detailinformation. http://www.oracle.com/technetwork/developer-tools/adf/learnmore/81-master-detail-tab-with-graphs-394252.pdf http://www.oracle.com/technetwork/developer-tools/adf/learnmore/81-master-detail-tab-with-graphs-394253.zip The sample reads master information from the selected paneltab to then – using Java in a managed bean – query the detail record for theDVT component. While the solution documented on ADF Code Corner is efficient,there exists another one that is declarative. Note: of course there are differences in the usage, but this I'll discuss later The image below shows an ADF Faces panel accordion thatdisplays the HR schema Departments table information on the accordion tabs andinformation about contained Employees in a panel box that shows when theaccordion is expanded. This sample uses an ADF tree binding to render the panel accordion tabs and the contained employee detail information. The iteration is done by two af:forEach tags, as shown below <af:panelAccordion id="pa1" dimensionsFrom="auto"> <af:forEach items="#{bindings.allDepartmentsWithEmployees.children}" var="departmentsVar"> <af:showDetailItem text="#{departmentsVar.DepartmentName}" id="sdi1"                      stretchChildren="first">    <af:panelBox text="Employees" id="pb1" showDisclosure="false" type="stretch">       <f:facet name="toolbar"/>          <af:panelGroupLayout id="pgl1" layout="scroll">             <af:forEach items="#{departmentsVar.children}" var="employeesVar">                 <af:outputText id="ot1"                       value="#{employeesVar.FirstName} #{employeesVar.LastName}"/>              </af:forEach>          </af:panelGroupLayout>    </af:panelBox>  </af:showDetailItem>  </af:forEach></af:panelAccordion> Note that the departmentVar variable is not accessible within the body of the second af:forEach component. While it can be used to configure the second af:forEach component data access, the variable cannot be referenced from the af:panelBox within the second af:forEach component As shown in the page source above, the first af:forEach tag reads the parent information from the ADF tree binding. Make sure you set the iterator binding for the tree binding to -1 for the RangeSize property as otherwise you would only see the first 10 parent row.  (PageDef file) <executables> <variableIterator id="variables"/>  <iterator Binds="allDepartmentsWithEmployees" RangeSize="-1" DataControl="AppModuleDataControl"          id="allDepartmentsWithEmployeesIterator" Refresh="deferred"/></executables> Sample Download You can download the Oracle JDeveloper 11g R2 (11.1.2.1) sample from here. Just configure the database connection to point to an Oracle database with the HR schema unlocked. The ADF BC model is configured to only show departments that have employees (using a ViewCriteria) Which solution to choose ? And Finally, what's the difference between this declarative approach and the  more code centric solution in ADF Code Corner sample 81? The difference is that this sample fetches all data upon rendering of the panel accordion, which may be expensive if we talk about thousands of child (employee) records. The sample on ADF Code Corner queries the detail data when a panel tab is selected. Sample 81 on ADF Code Corner however doesn't cache the data of previously selected panels and thus always re-fetches detail data. When working with large data sets however he solution on ADF Code Corner performs better.

ADF Code Corner sample #81 explains how-to create a custom layout to render master-detail information. In the sample ADF Faces panel tabs are used to render themaster data and DVT components are used...

ADF Security

Solving JDeveloper 11gR2 issue with ADF Faces login page in IE8

Using Microsoft IE8, forms based authentication in whichthe login form is built with ADF Faces doesn't load and instead the browserconsole report complains about invalid or undefined ADF Faces JavaScript objects.The problem that has been reported for JDeveloper 11g R2 using ADF Faces withFacelets seems to occur only for applications using the ADF Security "ADFAuthentication" configuration option in combination with an ADF Facesbased login form. Using the ADF Security "ADF Authentication"option configures the web.xml descriptor to protect the application Java EE contextroot from unauthenticated access.  <security-constraint> <web-resource-collection>     <web-resource-name>allPages</web-resource-name>     <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint>      <role-name>valid-users</role-name> </auth-constraint></security-constraint> The valid userrole name is mapped in the weblogic.xml file and references the WLS users group that all authenticatedusers are an implicit member of. <security-role-assignment>    <role-name>valid-users</role-name>     <principal-name>users</principal-name></security-role-assignment> Protecting the application Java EE root path fromunauthenticated access however also means that web resources like pictures orstyles sheets, or deferred loaded JavaScript libraries, are blocked until theuser has authenticated. For the same reason customers often report missingimages on their web login pages. In the case of an ADF Faces login form, deferred resourceloading becomes an issue because subsequent JavaScript requests are all blockedby the security constraint defined in the web.xmlfile. Surprisingly, this is only a problem in Microsoft IE8 and not with otherbrowsers, which may indicate differences in the handling of login forms andtheir resource loading. To this time I am not able to say whether IE is doingit right or wrong. Fact however is that the problem only shows on this browsertype and that it needs to be handled without opening a security hole, which youwould do if you changed the security url-pattern to /faces/* in which case onlyJSF page requests would require authentication. Investigating the problem, the following solution has been foundby the ADF Faces team: ADF Faces UIs require additional resources that areloaded through the Trinidad resource loader servlet configured in web.xml file. To allow resources to be loaded when using login formsbuilt with ADF Faces ( in which case the JSF page contains a HTML login form)you need to add another security constraint definition to the web.xml file: <security-constraint>  <web-resource-collection>   <web-resource-name>Allowed ADF Resources</web-resource-name>  <url-pattern>/adf/*</url-pattern>  <url-pattern>/afr/*</url-pattern> <url-pattern>/bi/*</url-pattern>  </web-resource-collection></security-constraint> The above security constraint should do for most of thelogin pages you would build with ADF Faces. However, if the login screen ismore complex and e.g contains DVT graphs or maps, you may have to add more url-patternsfor public (anonymous access), like <url-pattern>/servlet/GraphServlet/*</url-pattern><url-pattern>/servlet/GaugeServlet/*</url-pattern><url-pattern>/mapproxy/*</url-pattern><url-pattern>/adflib/</url-pattern> In my JDeveloper 11gR2 test-case project, I ended up with three security-constraint definitionsadded to the web.xml file: "Allowed ADF Resources", "allPages"and "AdfAuthentication". Always place the"Allowed ADF Resources" security constraint definition first in theweb.xml file so it is looked at before all the others are so it takes precedence. Note that both,the web.xml file and the weblogic.xml file open a visual configuration editorwhen you double click onto the respective file shown in the JDeveloperApplication Navigator (Web Content à WEB-INF folder in theViewController project.

Using Microsoft IE8, forms based authentication in which the login form is built with ADF Faces doesn't load and instead the browserconsole report complains about invalid or undefined ADF...

ADF Security

How-to learn ADF Skinning

Recently I observed an increase of questions on OTN andOracle internal that aim for applying CSS on the generated HTML output of an ADFFaces application. Surely, skinning in ADF is not the same as using CSS in toolslike Dreamweaver, but it is the proper way of applying custom images and colorsto ADF Faces applications. The biggest risk in styling the generated ADF Faces HTMLoutput with CSS is change in the renderer classes. Oracle constantly works onimproving its ADF Faces components, for example using HTML 5 to replace Flashand DHTML on some of the ADF Faces components. If you skinned applications onthe generated output, then with each of the changes Oracle applies, your customstyles will break. ADF sinning applies style sheet definitions to styleclasses at runtime. In contrast to direct output styling, the style classes aredynamically created and derived from the ADF Faces skin selectors. Thecomponent developer ensures that the style classes are always set to thecorrect location in the generated component output, ensuring that changes lastacross Oracle JDeveloper versions and component changes. Though I can't save you from learning, I can helpyou with pointers to sources you want to be aware of: ADF skinning is documented in the Oracle® Fusion MiddlewareWeb User Interface Developer's Guide for Oracle Application Development Framework http://docs.oracle.com/cd/E21764_01/web.1111/b31973/af_skin.htm#BAJFEFCJ An ADF insider recording exists that explains skinning in a40 minute video. Though this recording doesn't show the new skin editor, youlearn a about how skinning works, how you dynamically detect skins at runtimeand how you debug skins using FireBug in FireFox. http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/adf-insider-skinning/adf-insider-skinning.html As mentioned, a visual skin editor exists that you can use inits stand-alone edition for JDeveloper 11g R1 (11.1.1.4, 11.1.1.5) applicationsand integrated in JDeveloper 11g R2. An article that explains working with theskin editor and a recommend workflow is published here http://www.oracle.com/technetwork/issue-archive/2011/11-nov/o61adf-512006.html To download the stand alone skin editor (JDeveloper 11g R2has it integrated and no extra download is required), use the link below http://www.oracle.com/technetwork/developer-tools/adf/downloads/index.html To learn about the stand alone and the integrate skineditor, refer to the Oracle® Fusion Middleware Skin Editor User's Guide forOracle Application Development Framework, which you can access online from http://docs.oracle.com/cd/E16162_01/user.1112/e17456/toc.htm To try the skin editor on a JDeveloper 11g R2 sample, youcan run through the hands-on exercise exposed as part of the Oracle learninglibrary. http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_83/jdtut_11r2_83.htmlA video recording of how to use the skin editor can be found here https://blogs.oracle.com/shay/entry/adf_faces_skin_editor_how  And finally, a list of all skin selectors and ADF Facescomponents can be read up in the Oracle Fusion Middleware Tag Reference forOracle ADF Faces Skin Selectors http://docs.oracle.com/cd/E21764_01/apirefs.1111/e15862/toc.htm This document is a well written by the ADF Faces componentdevelopers and provides information that you don't find in other documentation. If you worked through all of this, Skinning should nolonger be a problem for you.

Recently I observed an increase of questions on OTN and Oracle internal that aim for applying CSS on the generated HTML output of an ADFFaces application. Surely, skinning in ADF is not the same as...

ADFm

Best practice invoking business services methods from JSF beans

Recently there was an increasing interest on OTN in best practices for invoking methods exposed on the ADF Business Components client interface. There exist two options to access methods exposed on ADF Business Components application modules and view objects from a managed bean through ADF. Call findDataControl(String) on the BindingContext and access the application module to invoke a method exposed on the Application Module or View Object client interface. Create a method binding on a PageDef level that binds to a method exposed on the Application Module or View Object client interface Speaking of best practices, it’s the second option  to use a method binding on the PageDef file that I recommend for the following reasons ADF is about abstracting the view and controller layer from the business service implementation details. A method binding instead exposes an ID (the name o the binding) to the JSF developer, which they use to access the binding from a managed bean using the OperationBinding API. Signature or name changes of a method exposed on the business service thus don't require a change in the managed bean(s) referencing it. All changes would be applied in metadata. ADF provides the OperationBinding class as an abstraction for business services methods. Configuring business service method access on the PageDef file using method bindings exposes a single and consistent API to application developers. Programmatic access to a method exposed on the business service require more lines of code than accessing the same method through the binding layer Direct business service access violates the recommendation to always work through the ADF binding layer and not to bypass it. To access a method binding from a managed bean, use the following code BindingContext bctx = BindingContext.getCurrent(); BindingContainer bindings = bctx.getCurrentBindingsEntry(); OperationBinding operationBinding =        bindings.getOperationBinding("name_of_method_binding"); //optional operationBinding.getParamsMap().put("argumentName1",value1); operationBinding.getParamsMap().put("argumentName2",value2); //invoke method operationBinding.execute(); if (!operationBinding.getErrors().isEmpty()) {     //check errors     List errors = operationBinding.getErrors();     ... } //optional Object methodReturnValue = operationBinding.getResult();

Recently there was an increasing interest on OTN in best practices for invoking methods exposed on the ADF Business Components client interface. There exist two options to access methods exposed on...

Book Reviews

Book Review: Do More with SOA Integration: Best of Packt

Packt Publishing released "Do More with SOA Integration: Best of Packt", book that aggregates the knowledge of  eight (!) SOA books into one 650 pages mashup. Lets start my review with a little problem I had when reading this book: For me it was not easy to identify the audience this book a was written for. The book contains chapters that point towards beginners and others pointing towards experienced SOA experts. Other chapters are more hands-on oriented, indicating they are meant for developers. After reading the whole book, I think that the targeted audience is not to qualify though most chapters address IT architects and project leads who need to expose legacy IT infrastructures to external or who plan a new software project based on SOA. The book touches on various aspects of SOA and in chapter 1 presents an explains a wikipedia of SOA acronyms and architecture patterns for readers foreign to SOA. If you are not yet SOA savvy then this chapter will prove itself helpful in understanding the rest of the book as these SOA acronyms are used throughout the remainder of the book. Chapter 2 lists problem statements and solutions that describe what SOA is for and why it is good to adopt it into your IT landscape. "Types of integration" on page 82 had me slowing down in my reading pace as I found it an interesting topic. It introduces important concepts of SOA like service interfaces, brokering and communication. The chapter, as most parts of the book, is about awareness and operates on the theory of things, and less on technical implementation details. Chapter 3 showed that a best of compilation is not always a smooth reading and started with the mentioning of the Trivadis Integration Architecture Blueprint, making me use Google to learn what this is all about. Turns out that this architecture is the documented combined SOA experience of the Switzerland based Trivadis AG. The blueprint is well introduced in this online article on the Packt Publishing website (Note that you need a user account to read the whole article). To quote from this article written by Guido Schmutz, Oracle ACE Directory for FMW and SOA, working for Trvadis AG: "The Trivadis Integration Architecture Blueprint indicates how integration architectures can be implemented in practice. It achieves this by representing common integration approaches, such as Enterprise Application Integration (EAI); Extract, Transform, and Load (ETL); event-driven architecture (EDA); and others, in a clearly and simply structured blueprint. It creates transparency in the confused world of product developers and theoretical concepts. ... The Trivadis Integration Architecture Blueprint shows how to structure, describe, and understand existing application landscapes from the perspective of integration. The process of developing new systems is significantly simplified by dividing the integration architecture into process, mediation, collection and distribution, and communication layers. The blueprint makes it possible to implement application systems correctly without losing sight of the bigger picture: a high performance, flexible, scalable, and affordable enterprise architecture." As a reader I wished this was explained that way in the book (better the same chapter) along with some words about the relevance and how it helps to do more with SOA integration. Chapter 5 explains the use of BPEL for integrating services of different systems into a single process. Here, the focus is put on the process flow and less on how to work with BPEL. Example configurations are given for exposing services on TIBCO and webMethods, for exposing Siebel and SAP services for orchestration in BPEL. Briefly the talk is about security (basic authentication) and logging. Chapter 6 looks at ERP integration between PeopleSoft and Oracle Applications. If you are in the situation in which you need to get the two systems working together, then this chapter is for you. It explains how to create an example BPEL process, how to configure the OA adapter as a partner link and how to transform messages between the two systems. A useful reference shared in this chapter is for the Oracle Applications integration cookbook whitepaper, which you find here. Chapter 6 in my opinion is what I was expecting to find in this book: a real use case for SOA that is explained well to help readers solve a current integration problem. Chapter 7 is about Enterprise Service Bus (ESB) and actually is a quite good read. It teaches the reason why ESB is needed, as well as the individual components, like Normalized Message Router (NMR) it provides. The idea of abstracting different systems, which may be based on different technologies and protocols, and that in the past may not even be designed for communication to the outside world, spoke to me and made this chapter useful. The uses NetBeans Enterprise Pack  5.5 and 6.0 for its screen shots and examples. The current state of the NetBeans enterprise pack is that SOA components have been removed from native NetBeans and instead should be installed from the Open ESB website: "The SOA module has been removed from the standard distribution for NetBeans IDE 6.7. To use the SOA functionality with NetBeans IDE 6.7, you need to install GlassFish ESB v2.1 from the OpenESB website."  (src: http://soa.netbeans.org/#downloadsandstatus) The last release of NetBeans that has SOA on board is NetBeans 6.5. I assume that this change was too late for the book to pick up, but at least it makes it appear dated. Chapter 8 is about binding containers, which is an interesting read that explains NMR bindings to File, FTP, SMTP and JMS (though some of them needs to be downloaded from the Open ESB site to get them working in NetBeans 5.5 or 6.0). The concepts in this chapter are clearly defined and explained, which I liked. A practical example would have been a great addition. Chapter 9 is about SOA and Web Service integration that aims for helping readers to get their SOA poject started without getting lost in the architecture's complexity. The chapter starts with pointing out that the vertical market thinking of the past often makes it difficult to integrate existing software solutions into a horizontal solution, where businesses need to access information from different business lines. For example, booking a trip to a foreign country often involves information from several airlines, hotels and rental car companies, accessed from a single front-end that hides the complexity that lies behind. It then introduces e-business patterns suggested by IBM. I didn't quite understand what IBM has to do with it and why there is no standard for it? The introduction of the IBM patterns is like the Trivadis architecture in chapter 3: It just falls into the book with no word of explanation regarding the why and the industry acceptance of it. However, the IBM patterns do a good job in outlining several architecture options to solve a specific integration problem. I liked that the patterns are not related to a specific technology and instead are expressed as blue prints. At its end, the chapter explains the  creation of WSDL files and the WS-I profile to then conclude with creating "hello world" Web Services in Java and .Net. The example of "hello world" at the end is a bit odd, given that this chapter guides you to more more complex things before. With "Service- and Process-Oriented Approach to Integration Using Web Service", chapter 10 has a similar headline then chapter 9 but is about the Enterprise Service Bus (ESB). This chapter also makes me feel like Bill Murray in "Groundhog Day" from 1993: The problem statement that leads to SOA as a solution is getting introduced to me for the 10th time and I think that I'll have to live with it 4 more times until the end of chapter 14 will release me from this loop. On the positive side, you can read chapters in the order you like and don't miss out the relevance of SOA in today's IT. Chapter 10 nicely spans back to the various connection infrastructure types introduced in chapter 1.The chapter explains the role of the ESB in comparison to a pure Web Service approach for integration and its benefits as a connection infrastructure. The chapter states that as of 2010, when the chapter's original book has been published, there is no common standard definition of ESB (which is a statement that also goes in line with what you find on Wikipedia for ESB) nut that ESB evolve "into a tanglible infrastructure for SOA". The chapter therefore lists criteria to look out for when adopting an ESB to avoid vendor lock-in, which I think is very useful information. ESB advantages listed in the chapter includes scalability, connection to heterogeneous systems, mediation, transformation and routing, as well as orchestration and event notification.Like chapter 9, chapter 10 is a very strong chapter and one you want to read several times as it has so much information and insight to share. Chapter 11 "Loosely Coupling Services" surprisingly already got me out of the "groundhog day" loop and went straight to the subject. It starts off with the criteria defining coupling of a service, the dependencies a services has to its environment, other services and input data streams. The chapter then continues discussing the Oracle Service Bus and Enterprise Service Bus and service virtualization. The content of the chapter is taken from chapter 4 of the Oracle SOA Suite Developer Guide by Antony Reynolds and Matt Wright. I don't understand though why this chapter was taken from the March 2009 version of the book and not from the 11g R1 version printed in June 2010. This decision remains the secret of Carl Jones the series editor but spoils the whole chapter as I kept of wondering which information else I can find is no longer accurate. Chapter 12 "Integrating BPEL with BPM using BPM Suite" is another hands-on oriented chapter. The software used in this chapter is Oracle SoA Suite 11g PS2, which is a contrast to the older version used in the previous chapter. The chapter introduces the Oracle BPM Suite and its architecture. Readers learn about JDeveloper as the modelling environment and Metadata Services (MDS), a common repository used by the web based Oracle Business Process Composer to save projects. The hands-on journey actually gets stuck first time at a broken link that should point to the BPM Studion 11g extension. Since the publication of the original book the chapter was taken from, Oracle obviously has remodeled its website. However, the link is no longer needed and you can install the software directly from JDeveloper choosing Help --> check for updates. Then you install the Oracle SOA Composite Editor in a first installment and then BPM Studion (just in this order). Just in case you are interested in BPM I highly recommend "Getting Started with Oracle BPM Suite 11gR1  (ISBN 978-1-849681-68-1) from Packt Publishing. The remainder of the chapter then steps you through building a BPM flow for a travel request and approval scenario that included human workflow. Chapter 13 "SOA Integratio - Functional View, Implementation, and Architecture" and deals with legacy integration. This chapter actually gets me back to "Groundhog Day" by explaining what SOA is (though it doesn't want to be a primer) and I can see Bill Murray staring at its 6 am alarm listening to "I got you babe". However, though starting with some repetition of what has been said many times earlier in the book, the legacy to SOA chapter provides some good information and methodologies for modernizing existing IT infrastructures. From an Oracle technology perspective it also covers the "why should I use" question for individual Oracle products in the context of SOA, which also is a bit of a sales pitch. All in all, I liked this chapter and the information herein. Chapter 14 is "SOA Integration - Scenarion in Detail" works through a legacy migration project. Its not hands-on driven, but outlines the roles involved as well as the things to consider when approaching such a project. It should go without explicit mentioning that this chapter also repeats some of what the book explained before. Still, a good read. So What's my final verdict - "buy" or "no-buy"? As usually, it depends! Do More with SOA Integration: Best of Packt aggregates content written by people who know SOA. Personally I don't think that this is a book that I would bring to work if I was allowed to bring 3 books to a SOA project (Packt Publishing released other SOA books hat I probably would bring instead). However, this book is not meant to be a programmer guide and for this reason does need to be brought to a job but should be read before planning the overall SOA infrastructure. By my experience in working with Oracle Application Development Framework (though a completely different topic), architecture decisions are too eagerly made driven by technology, which means that already in the planning stage architecture decisions are constraint or mislead by what is working best from an implementation point of view. Here this book really helps you to step back and focus on what you want and then how to achieve it. My general expectation towards a book is that it enable me to do what I wasn't able to do before and that they provide information I did not know before, raising my awareness for good, best and recommended practices. From this perspective I can recommend this book (on an amazon.com rating scale I would give it 4 stars for the content, -1/2 star for dated information, missed out information and old screen shots and -1/2 for the bumpy reading experience = 3 stars). Note that on the real amazon.com website I found an existing 5 start rating for this book, which may mean I had the wrong glasses on) Finally, and my apologies to Packt Publishing for stating this, "best-of" book compilations just don't work. Music best-of compilations are easy to listen to. However, best-of compilations of technical books are hard to read without the original chapter authors to add corrections and updates to the previously published content. The Do More with SOA Integration: Best of Packt book contains unnecessary repetitions, references old (out of date) technologies and introduces SOA core technologies in a non-chronological order that takes from the overall reading experience. An example for the latter is the introduction of a "hello world" Web Service at the end of chapter 9, which beside of this is a strong chapter that I liked. If you have money to spend on a single SOA book, my recommendation would be to buy one of the books the chapters were taken from. If you need a single quick overview at a glance and don't mind repetition and older information, still this book is a good reading (but never be 5 star. Again my apologies to Packt Publishing for having to say this; I know you had good in mind)

Packt Publishing released "Do More with SOA Integration: Best of Packt", book that aggregates the knowledge of  eight (!) SOA books into one 650 pages mashup. Lets start my review with a little problem...

JavaScript

How-to define a default action for page fragments

The af:formcomponent has a DefaultCommandproperty that, when set to the component Id of a command component like af:commandButtoninvokes the associated command action when the enter key is pressed anywhere inthis form. However, if the form fields are contained in a page fragment exposedin a region then using the DefaultCommandproperty may not be an option as it is difficult to predict the command button idand its surrounding naming containers. A solution to this is to use JavaScript on the UI input componentsthat, when the Enter key is pressedvirtually press a button within the page fragment (note that the af:form elementbelongs to the parent page and that you can only have a single af:form component perbrowser page) Let's assume a page fragment with a single input text componentand a command button to press: <af:panelFormLayout id="pfl1"> <f:facet name="footer"> <af:commandButton text="Print Field Value" id="cb1" partialSubmit="true"                                             clientComponent="true" action="#{View1Bean.onButtonPressed}"/>   </f:facet>   <af:inputText label="Enter Field" id="it1" binding="#{View1Bean.inputTextField}">      <af:clientListener method="onFieldEnterKey" type="keyUp"/>   </af:inputText>  </af:panelFormLayout> The command button is bound to a managed bean action method.By default, the action method is invoked when users press the command button. However,with the JavaScript shown next, this can be simulated and mapped to the Enter key press in the text field. <?xml version='1.0' encoding='UTF-8'?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"          xmlns:af=http://xmlns.oracle.com/adf/faces/rich          xmlns:f="http://java.sun.com/jsf/core"><af:resource type="javaScript">   //function called by the client listener  function onFieldEnterKey(inputEvent){    if (event.getKeyCode() == AdfKeyStroke.ENTER_KEY) {      //get the input text component from the event                  var inputTextField = inputEvent.getSource();      //the button is relative to the input text field so      //relative search will do with no worrying about naming      //containers      var defaultButton = inputTextField.findComponent('cb1');      //perform a partial submot   var partialSubmit = true;      AdfActionEvent.queue(defaultButton,partialSubmit);      //Enter key does not need to go to server as we      //queued a new event       event.cancel();   }}</af:resource> For JavaScript to work, note the use of the af:clientListener on the input text field andthe use of the clientComponent="true"configuration on the button.

The af:form component has a DefaultCommand property that, when set to the component Id of a command component like af:commandButtoninvokes the associated command action when the enter key is...

ADFv

Strategies for controlling the af:popup close event

In a previous OTN Harvest summary, I discussed how tohandle the af:dialog OK and Cancel event: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/77-ok-cancel-support-in-dialog-351871.pdf. In this post, I get back to this though not covering the "Cancel"case. There are two options developers have to handle the "Ok"event of an af:dialog component in an af:popup · Using a DialogListener with the default Okbutton· Using a custom command button instead of thedefault Ok button The sample use case is quite simple: A command button addedto a page opens the popup component that contains a dialog with an input textfield in it. Users can provide a value in the input text field and press eithera "custom Ok" button or the default "Ok" button to submitthe value and close the popup. In both cases, the provided value in the textfield is evaluated and if it is not "ADF ROCKS" written in whatevercase, an error message is displayed and the popup is not closed. Example 1: Usingthe default OK button and a DialogListener The sample application opens with a single command buttonvisible on the screen. Pressing the command button uses an af:showPopupBehaviorbehavior tag to open the popup. Typing "Hello World" into the text field andpressing the Ok button (which is thedefault Ok button configured in the Typeproperty of the af:dialogcomponent) invokes a managed bean method that is configured as theDialogListener for the dialog component. <af:dialog …  binding="#{DialogContentHandler.dialogComponent}" contentWidth="300" contentHeight="200"  dialogListener="#{DialogContentHandler.onDialogAction}"> Note that the bindingproperty is set to define a JSF component binding of the dialog to the managedbean to allow the lookup of the input text field in Java. Because the entered text isnot "ADF ROCKS", an error message is displayed below the input field To display error messages ina popup, the af:message tag is added to the popupdialog as shown below <af:dialog …>  <af:panelFormLayout id="pfl1">    <af:panelLabelAndMessage label="Validate Me" id="plam1">     <af:panelGroupLayout id="pgl1" layout="vertical">        <af:inputText id="it1"/>          <af:message id="m1" for="it1"/>        </af:panelGroupLayout>      </af:panelLabelAndMessage>  </af:panelFormLayout></af:dialog> The dialog listener managed bean code displaying the error or, in the case ofthe correct entry, dismissing the dialog is shown next: /** * Dialog Listener that validates the input field for ADF ROCKS.  * If the string doesn't match, an error message is shown *  * @param dialogEvent */ public void onDialogAction(DialogEvent dialogEvent) {  //lookup the text field starting from the dialog component for  //which a JSF component binding has been created  UIComponent inputText = dialogComponent.findComponent("it1");   String inputTextValue = (String)((RichInputText)inputText).getValue();        //If the dialog outcome is OK (the OK button has been pressed)  //validate the entry  if(dialogEvent.getOutcome() == DialogEvent.Outcome.ok){     if(inputTextValue != null &&       inputTextValue.equalsIgnoreCase("ADF ROCKS")){        //ensure the input text value is reset for a second run     ((RichInputText) inputText).resetValue();  }  else{   //show error message so that popup doesn't close   FacesContext fctx = FacesContext.getCurrentInstance();   FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR,                     "Value Validation Failed", "Try: ADF ROCKS");        fctx.addMessage(inputText.getId(), fm); } }} Example 2: Usinga custom command button The af:dialogcomponent renders without default buttons when the Type property is set to none.This is useful if you want to add your own command buttons, which then alsoare better to customize. <af:dialog id="…" …>  <f:facet name="buttonBar">    <af:commandButton text="Custom OK" id="cb2"                                                          action="#{DialogContentHandler.onOK}"                                                            partialSubmit="true"/></af:dialog> The use case is the same as before and a message displayswhen the input text field value is not ADF ROCKS. The only difference to the code executed in a DialogListeneris that the command button action listener needs to explicitly close the dialog public String onOK() {       UIComponent inputText = dialogComponent.findComponent("it1");  String inputTextValue = (String) ((RichInputText)inputText).getValue(); if(inputTextValue != null &&     inputTextValue.equalsIgnoreCase("ADF ROCKS")){     RichPopup rp = (RichPopup) dialogComponent.getParent();     //reset input text component     ((RichInputText)inputText).resetValue();     rp.hide();  }  else{    FacesContext fctx = FacesContext.getCurrentInstance();    FacesMessage fm =          new FacesMessage(FacesMessage.SEVERITY_ERROR,                      "Value Validation Failed", "Try: ADF ROCKS");         fctx.addMessage(inputText.getId(), fm);  }          return null;} Sample Download You can download an Oracle JDeveloper 11g R2 sample workspace from here: //cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/f4a5b21d-66fa-4885-92bf-c4e81c06d916/File/bd91a6dea8f17309b331df2f21e80f69/preventpopupfromclosing.zip. The JSF page has both approaches,default Ok button and custom Ok button on a single dialog. You don't need a database for running the sample.

In a previous OTN Harvest summary, I discussed how to handle the af:dialog OK and Cancel event: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/77-ok-cancel-support-in-dialog-351871.pdf...

ADFm

How to access selected rows in an af:selectManyChoice component

To create an ADF bound select many choice component, drag a collection from the Data Controls panel to a JSF page. In the opened context menu, choose Multiple Selection | ADF Select Many Choice. This generates the page source code similar to this: <af:selectManyChoice value="#{bindings.allDepartments.inputValue}"  label="#{bindings.allDepartments.label}" id="smc1"> <f:selectItems value="#{bindings.allDepartments.items}" id="si1"/></af:selectManyChoice> Note that the value property of the SelectManyChoice component pints to the sane list binding as the f:selectItems tag. To access the user selected values, you use a managed bean to access the ADF binding layer.If you are only interested in the selected values, then you use code like shown below. Note that the sample I built used JDeveloper 11g R2, which is why the ID type is Integer. Doing the same with JDeveloper 11g R1 would require the casting to oracle.jbo.domain.Number for ID columns. public String cb1_action() {  BindingContext bctx = BindingContext.getCurrent();  BindingContainer bindings = bctx.getCurrentBindingsEntry();  JUCtrlListBinding allDepartsmentList =            (JUCtrlListBinding) bindings.get("allDepartments");   Object[] selVals = allDepartsmentList.getSelectedValues();  for (int i = 0; i < selVals.length; i++) {    Integer val = (Integer)selVals[i];    //...  }  return null;} However, what if you wanted to know more about the selected list value; for example the value of another attribute of the selected row? In this case you use similar code, with a little change though. Instead of calling getSelectedValues(), the call is to getSelectedIndices(). public String cb1_action() {  BindingContext bctx = BindingContext.getCurrent();  BindingContainer bindings = bctx.getCurrentBindingsEntry();  JUCtrlListBinding allDepartsmentList =           (JUCtrlListBinding) bindings.get("allDepartments");  int[] selVals = allDepartsmentList.getSelectedIndices();  for (int indx : selVals ) {    Row rw = allDepartsmentList.getRowAtRangeIndex(indx);    //... do your stuff  }  return null;}

To create an ADF bound select many choice component, drag a collection from the Data Controls panel to a JSF page. In the opened context menu, choose Multiple Selection | ADF Select Many Choice.This...

ADF Security

How-to determine the ADF tree node type using EL

Creating an ADF tree in ADF produces an entry similar to this in the PageDef file of the view. <tree IterBinding="AllCountriesIterator" id="AllCountries">   <nodeDefinition       DefName="oracle.summit.model.views.CountryVO" Name="AllCountries0">     <AttrNames>       <Item Value="Country"/>    </AttrNames>     <Accessors>    <Item Value="CustomerVO"/>  </Accessors>  </nodeDefinition>   <nodeDefinition       DefName="oracle.summit.model.views.CustomerVO" Name="AllCountries1"      TargetIterator="${bindings.AllCustomersIterator}">      <AttrNames>        <Item Value="Id"/>        <Item Value="Name"/>     </AttrNames> </nodeDefinition></tree>Notice the DefName attribute on each node containing a reference to the actual View Object instance used to render a specific node. With this information you can now use EL to render the tree nodes differently. For example, the page source below renders the node as a command link if the node presents a customer. For Countries, the node is simply rendered as an output text. <af:tree value="#{bindings.AllCountries.treeModel}" var="node" ...>  <f:facet name="nodeStamp">    <af:group id="g1">      <af:commandLink id="cl4" text="#{node}"                                                                                              rendered="#{node.hierTypeBinding.viewDefName ==                                         'oracle.summit.model.views.CustomerVO'}"      .../>      <af:outputText id="ot4" value="#{node}"                                                                                              rendered="#{node.hierTypeBinding.viewDefName ==                                      'oracle.summit.model.views.CountryVO'}"/>    </af:group>  </f:facet></af:tree>       The EL expression  #{node.hierTypeBinding.viewDefName} returns the name of the node type, which in ADF is the absolute name of the collection instance rendering the node.

Creating an ADF tree in ADF produces an entry similar to this in the PageDef file of the view. <tree IterBinding="AllCountriesIterator" id="AllCountries"><nodeDefinition ...

ADFm

How-to invoke ADF bindings in page templates

ADF Faces page templates mayhave their own PageDef file defined to access the ADF binding layer or have ADFbound components added to the template. ADF Faces pages that use thetemplate will reference the template's PageDef file in the Executable section of their own PageDef file. In this sample, thetemplate binding reference in the the template consumer page PageDef file is ptb1. The code below invokes a method binding in the template's PageDef file from a command button on the page. The "trick" foraccessing the template's PageDef file is to know that it is another instance ofBindingContainer. public String cb1_action() {  BindingContext bctx = BindingContext.getCurrent();  DCBindingContainer bindings = (DCBindingContainer)bctx.getCurrentBindingsEntry();  //access the page template Pagedef file reference in the   //Executable section of the consumer page's Pagedef file  DCBindingContainer templateBinding = (DCBindingContainer)bindings.get("ptb1");  //get the MethodBinding   OperationBinding printMethod =         (OperationBinding)templateBinding .get("printThis"); //invoke the print method exposed on the template's PageDef file  printMethod.getParamsMap().put("message","Hello World");  printMethod.execute();  return null;}

ADF Faces page templates may have their own PageDef file defined to access the ADF binding layer or have ADF bound components added to the template. ADF Faces pages that use thetemplate will reference...

ADFm

Display selected table row number and total rows

A question on OTN was how to display the current row numberand the number of totally available rows in a formatted output string. In theexample used below, the format is row no. [<row index>] of max rows [<total numbers of rows>] For this example, I used an af:outputText component todisplay the information on the page. The value of the af:outputText component is calculated from expression language (EL)accessing the ADF binding layer as shown below. Note that for better readability the EL includes line breaks, which in your application you should not add.  row no. [ #{(bindings.allDepartmentsIterator.rangeStart< 0 ? 1 : bindings.allDepartmentsIterator.rangeStart+1) + (bindings.allDepartmentsIterator.currentRowIndexInRange == -1 ? 0 :bindings.allDepartmentsIterator.currentRowIndexInRange)}] of max rows[ #{bindings.allDepartmentsIterator.estimatedRowCount}] Notehow the expression uses the iterator binding in the ADF binding layer to determinethe maximum number of table rows. It then uses the same iterator to determinethe current row. Because iterators are zero based, the EL uses additional logicto compensate this. The af:outputText component needs to have its PartialTriggers property pointing the the af:table component ID to ensure the displayed information is refreshed when the table row currency changes. <af:outputText value="row no. [#{(bindings.allDepartmentsIterator.rangeStart &lt; 0 ? 1  :  bindings.allDepartmentsIterator.rangeStart+1) +( bindings.allDepartmentsIterator.currentRowIndexInRange ==  -1 ? 0 : bindings.allDepartmentsIterator.currentRowIndexInRange)}] of max rows [#{bindings.allDepartmentsIterator.estimatedRowCount}]"                id="ot1" partialTriggers="pc1:t1"/>

A question on OTN was how to display the current row number and the number of totally available rows in a formatted output string. In the example used below, the format is row no. [<row index>] of max...

ADFv

Using JSTL in ADF Faces

The JavaServer Pages Standard Tag Library (JSTL) providesexpressions for common web application functionalities. Though JavaServer Faces Expression Language (EL)is different from JSTL expressions, the two can be used in combination for functionalfor which it makes sense. For example, the table below lists JSTL expressionsthat operate on String values. Function Description fn:contains() Tests if an input string contains the specified substring. fn:containsIgnoreCase() Tests if an input string contains the specified substring in a case insensitive way. fn:endsWith() Tests if an input string ends with the specified suffix. fn:escapeXml() Escapes characters that could be interpreted as XML markup. fn:indexOf() Returns the index withing a string of the first occurrence of a specified substring. fn:length() Returns the number of items in a collection, or the number of characters in a string. fn:replace() Returns a string resulting from replacing in an input string all occurrences with a given string. fn:startsWith() Tests if an input string starts with the specified prefix. fn:substring() Returns a subset of a string. fn:substringAfter() Returns a subset of a string following a specific substring. fn:substringBefore() Returns a subset of a string before a specific substring. fn:toLowerCase() Converts all of the characters of a string to lower case. fn:toUpperCase() Converts all of the characters of a string to upper case. fn:trim() Removes white spaces from both ends of a string. Src: http://www.tutorialspoint.com/jsp/jsp_standard_tag_library.htm To use JSTL in Oracle ADF Faces component EL references, youneed to add the JSTL namespace of the tags you want to reference. For the JSTL functionsshown in the table above, you need to manually add the name space highlighted inred to the JSPX document or page fragment. <jsp:root   xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"          xmlns:f="http://java.sun.com/jsf/core"          xmlns:h="http://java.sun.com/jsf/html"          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"         xmlns:fn="http://java.sun.com/jsp/jstl/functions"> The value expression below, referenced in an af:outputTextcomponent, displays the substring (first, second and third character) for avalue read from the ADF binding layer. <af:outputText value="#{fn:substring(bindings.employeeName.inputValue,1,3)}"id="ot7"/>

The JavaServer Pages Standard Tag Library (JSTL) provides expressions for common web application functionalities. Though JavaServer Faces Expression Language (EL)is different from JSTL expressions,...

ADFv

Accessing the JSESSIONID from JSF

The following code attempts to access and print the usersession ID from ADF Faces, using the session cookie that is automatically setby the server and the Http Session object itself. FacesContext fctx = FacesContext.getCurrentInstance();ExternalContext ectx = fctx.getExternalContext();HttpSession session = (HttpSession) ectx.getSession(false); String sessionId = session.getId(); System.out.println("Session Id = "+ sessionId); Cookie[] cookies = ((HttpServletRequest)ectx.getRequest()).getCookies(); //reset session stringsessionId = null; if(cookies != null) {for (Cookie brezel : cookies) {    if (brezel.getName().equalsIgnoreCase("JSESSIONID")) {       sessionId = brezel.getValue();       break;     }  } } System.out.println("JSESSIONID cookie = "+sessionId); Though apparently both approaches to the same thing, theyare different in the value they return and the condition under which they work.The getId method, for example returns a session value as shown below grLFTNzJhhnQTqVwxHMGl0WDZPGhZFl2m0JS5SyYVmZqvrfghFxy!-1834097692!1322120041091 Reading the cookie, returns a value like this grLFTNzJhhnQTqVwxHMGl0WDZPGhZFl2m0JS5SyYVmZqvrfghFxy!-1834097692 Though both seem to be identical, the difference is within "!1322120041091" added to the idwhen reading it directly from the Http Session object. Dependent on the usecase the session Id is looked up for, the difference may not be important. Another difference however, is of importance. The cookie readingonly works if the session Id is added as a cookie to the request, which isconfigurable for applications in the weblogic-application.xml file. If cookies are disabled,then the server adds the session ID to the request URL (actually it appends itto the end of the URI, so right after the view Id reference). In this casehowever no cookie is set so that the lookup returns empty. In both caseshowever, the getId variant works.

The following code attempts to access and print the user session ID from ADF Faces, using the session cookie that is automatically set by the server and the Http Session object itself. FacesContext...

ADFv

Creating ADF Faces Comamnd Button at Runtime

In ADF Faces, the command button is an instance of RichCommandButton andcan be created at runtime. While creating the button is not difficult at all,adding behavior to it requires knowing about how to dynamically create and addan action listener reference. The examplecode below shows two methods: The first method, handleButtonPress is a public method exposed on a managed bean. public void handleButtonPress(ActionEvent event){  System.out.println("Event handled");  //optional: partially refresh changed components if command  //issued as a partial submit} The second method is called in response to a userinteraction or on page load and dynamically creates and adds a command button. Whenthe button is pressed, the managed bean method – the action handler – defined aboveis called. The action handler is referenced using EL in the created MethodExpression instance. If themanaged bean is in viewScope, backingBeanScope or pageFlowsScope, then you needto add these scopes as a prefix to the EL (as you would when configuring themanaged bean reference at design time) //Create command button and add it as a child to the parent component that is passed as an //argument to this methodprivate void reateCommandButton(UIComponent parent){  RichCommandButton edit = new RichCommandButton();  //make the request partial  edit.setPartialSubmit(true);  edit.setText("Edit");                             //compose the method expression to invoke the event handler  FacesContext fctx = FacesContext.getCurrentInstance();  Application application = fctx.getApplication();  ExpressionFactory elFactory = application.getExpressionFactory();  ELContext elContext = facesCtx.getELContext();  MethodExpression methodExpressio = null;  //Make sure the EL expression references a valid managed bean method. Ensure  //the bean scope is properly addressed   methodExpression =  elFactory.createMethodExpression(                             elContext,"#{myRequestScopeBean.handleButtonPress}",                             Object.class,new Class[] {ActionEvent.class});  //Create the command buttonaction listener reference  MethodExpressionActionListener al = null;          al= new MethodExpressionActionListener(methodExpression);   edit.addActionListener(al);    //add new command button to parent component and PPR the component for    //the button to show   parent.getChildren().add(edit);   AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();    adfFacesContext.addPartialTarget(parent); }

In ADF Faces, the command button is an instance of RichCommandButton and can be created at runtime. While creating the button is not difficult at all,adding behavior to it requires knowing about how...

ADFv

How-to read data from selected tree node

By default, the SelectionListenerproperty of an ADF bound tree points to the makeCurrent method of theFacesCtrlHierBinding class in ADF to synchronize the current row in the ADFbinding layer with the selected tree node. To customize the selection behavior,or just to read the selected node value in Java, you override the defaultconfiguration with an EL string pointing to a managed bean method property. Inthe following I show how you change the selection listener while preserving thedefault ADF selection behavior. To change the SelectionListener,select the tree component in the Structure Window and open the OracleJDeveloper Property Inspector. From the context menu, select the Edit option to create a new listener methodin a new or an existing managed bean. For this example, I created a new managed bean. On tree node select, the managed bean code prints the selectedtree node value(s) import java.util.List;import javax.el.ELContext;import javax.el.ExpressionFactory;import javax.el.MethodExpression;import javax.faces.application.Application;import javax.faces.context.FacesContext;import java.util.Iterator; import oracle.adf.view.rich.component.rich.data.RichTree;import oracle.jbo.Row;import oracle.jbo.uicli.binding.JUCtrlHierBinding;import oracle.jbo.uicli.binding.JUCtrlHierNodeBinding;import org.apache.myfaces.trinidad.event.SelectionEvent;import org.apache.myfaces.trinidad.model.CollectionModel;import org.apache.myfaces.trinidad.model.RowKeySet;import org.apache.myfaces.trinidad.model.TreeModel; public class TreeSampleBean {public TreeSampleBean() {} public void onTreeSelect(SelectionEvent selectionEvent) { //original selection listener set by ADF //#{bindings.allDepartments.treeModel.makeCurrent} String adfSelectionListener = "#{bindings.allDepartments.treeModel.makeCurrent}";   //make sure the default selection listener functionality is //preserved. you don't need to do this for multi select trees //as the ADF binding only supports single current row selection    /* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */ FacesContext fctx = FacesContext.getCurrentInstance(); Application application = fctx.getApplication(); ELContext elCtx = fctx.getELContext(); ExpressionFactory exprFactory = application.getExpressionFactory();   MethodExpression me = null;  me = exprFactory.createMethodExpression(elCtx, adfSelectionListener,                                           Object.class, newClass[]{SelectionEvent.class});   me.invoke(elCtx, new Object[] { selectionEvent });    /* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */  RichTree tree = (RichTree)selectionEvent.getSource(); TreeModel model = (TreeModel)tree.getValue();  //get selected nodes RowKeySet rowKeySet = selectionEvent.getAddedSet();   Iterator rksIterator = rowKeySet.iterator();   //for single select configurations,this only is called once   while (rksIterator.hasNext()) {    List key = (List)rksIterator.next();    JUCtrlHierBinding treeBinding = null;    CollectionModel collectionModel = (CollectionModel)tree.getValue();    treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();     JUCtrlHierNodeBinding nodeBinding = null;    nodeBinding = treeBinding.findNodeByKeyPath(key);    Row rw = nodeBinding.getRow();     //print first row attribute. Note that in a tree you have to     //determine the node type if you want to select node attributes     //by name and not index     String rowType = rw.getStructureDef().getDefName();      if(rowType.equalsIgnoreCase("DepartmentsView")){     System.out.println("This row is a department: " +                          rw.getAttribute("DepartmentId"));     }    else if(rowType.equalsIgnoreCase("EmployeesView")){     System.out.println("This row is an employee: " +                          rw.getAttribute("EmployeeId"));     }        else{      System.out.println("Huh????");     }     // ... do more useful stuff here   } }-------------------- Download JDeveloper 11.1.2.1 Sample Workspace

By default, the SelectionListener property of an ADF bound tree points to the makeCurrent method of the FacesCtrlHierBinding class in ADF to synchronize the current row in the ADFbinding layer with...

ADFc

Reading train stop display names from a resource bundle

In Oracle JDeveloper 11g R1, you set the display name of a trainstop of an ADF bounded task flow train model by using the Oracle JDeveloperStructure Window. To do so Double-clickonto the bounded task flow configuration file (XML) located in theApplication Navigator so the task flow diagram openIn the task flow diagram, select the view activitynode for which you want to define the display name. In the Structure Window., expand the viewactivity node and then the train-stop node thereinAdd the display name element by using theright-click context menu on the train-stop node, selecting Insert inside train-stop > Display NameEdit the Display Name value with the PropertyInspector Following the steps outlined above, you can define static displaynames – like "PF1" for page fragment 1 shown in the image below - fortrain stops to show at runtime. In the following, I explain how you can change the staticdisplay string to a dynamic string that reads the display label from a resourcebundle so train stop labels can be internationalized. There are different strategies available for managingmessage bundles within an Oracle JDeveloper project. In this blog entry, I decidedto build and configure the default properties file as indicated by the projectsproperties. To learn about the suggested file name and location, open the JDeveloper project properties (use a right mouse click onthe project node in the Application Navigator and choose Project Properties. Select the ResourceBundle node to see the suggested name and location for the default messagebundle. Note that this is the resource bundle that Oracle JDeveloperwould automatically create when you assign a text resource to an ADF Faces componentin a page. For the train stop display name, we need to create themessage bundle manually as there is no context menu help available in Oracle JDeveloper. For this, use a right mouse click on the JDeveloper projectand choose New |General | File from the menuand in the opened dialog. Specify the message bundle file name as the name looked upbefore in the project properties ResourceBundle option. Also, ensure that the file is saved in a directory structure that matches the package structure shown in the ResourceBundle dialog. For example, you would save the properties file in the ViewProject's src >adf > sample directory if the package structure was "adf.sample" (adf.sample.ViewControllerBundle). Edit the properties file and define key – values pairs forthe train stop component. In the sample, such key value pairs are TrainStop1=Train Stop 1TrainStop2=Train Stop 2TrainStop3=Train Stop 3 Next, double click the faces-config.xmlfile and switch the opened editor to the Overviewtab. Select the Application categoryand press the green plus icon next to the ResourceBundle section. Define the resource bundle Base Name as the package and properties file name, for example adf.sample.ViewControllerBundle Finally, define a variable name for the message bundle sothe bundle can be accessed from Expression Language. For this blog example, the nameis chosen as "messageBundle".<resource-bundle>  <base-name>adf.sample.ViewControllerBundle</base-name>  <var>messageBundle</var></resource-bundle> Next, select the display-nameelement in the train stop node (similar to when creating the display name) anduse the Property Inspector to change the static display string to an EL expressionreferencing the message bundle. For example: #{messageBundle.TrainStop1} At runtime, the train stopsnow show display names read from a message bundle (the properties file).

In Oracle JDeveloper 11g R1, you set the display name of a train stop of an ADF bounded task flow train model by using the Oracle JDeveloper Structure Window. To do so Double-click onto the bounded task...

ADFv

JSF 2.0 Preemptive Navigation in ADFc of JDeveloper 11.1.2

Preemptive navigation is a new feature in JavaServer Faces2.0 and allows runtime introspection of control flow cases for their targetview.The JSF API for this is the ConfigurableNavigationHandler class thatexposes the following methods getNavigationCase(FacesContext context,                   java.lang.String fromAction,                   java.lang.String outcome) getNavigationCases() – returns a Map<String, Set<NavigationCase>> thatlists all available navigation cases with the viewId as the map keys performNavigation(java.lang.String outcome) –Navigates to the next view based on the outcome. Developers using this methodmust ensure it is used during JSF InvokeApplication phase as it cannot be usedany later The NavigationCaseclass wraps the information defined for a navigation, including the condition(also a new feature in JSF 2.0) in which the navigation case is valid. Preemptive navigation can be used in an application topopulate redirect components, like the goLink shown below with a target view,or for redirects in a managed bean, for which developers need to know thetarget view. The sample below shows an ADF Faces goLink pointing to a managed bean. The managed bean returns theredirect URL for the link to follow when clicked on.  The managed bean accesses the NavigationHandler defined for the JSFinstance and verifies it to be an instance of ConfigurableNavigationHandler before it looksup the target viewId for the control flow case. Note that ADFc in Oracle JDeveloper 11g R2 alsosupports conditional navigation, in which case developers can define an ELexpression on the control flow case, using the Property Inspector, thatdetermines when a navigation case is valid and when it is not. Also note thatPreemptive navigation fails with a NullPointerexception if the referenced control flow case is conditionally set to disabled.To handle this, the managed bean code above needs to be surrounded with a try…catch block.

Preemptive navigation is a new feature in JavaServer Faces 2.0 and allows runtime introspection of control flow cases for their target view.The JSF API for this is the ConfigurableNavigationHandler cla...

ADFbc

Accessing View Object UI hints from EL

View Objects can have UI hints defined in their General category. For example, you may want to set the Display Name, Display Name (Plural) and Description on Employees View Object that is based on an Employees entity representing the Employees table in the HR database sample schema. The page snippet below shows how you can access the UI hints on a View Object to display them a header information on an page.  <af:panelGroupLayout id="pgl2"layout="horizontal"> <af:outputText value="#{bindings.allEmployeesIterator.hints['label']},"id="ot3"/> <af:spacer width="10"height="10" id="s1"/> <af:outputText value="#{bindings.allEmployeesIterator.hints['labelPlural']}," id="ot2"/> <af:spacer width="10"height="10" id="s2"/> <af:outputText value="#{bindings.allEmployeesIterator.hints['TOOLTIP']}" id="ot1"/></af:panelGroupLayout> So the Display Name property maps to UI hints"label", the Display Name (Plural) property to the UI hints"labelPlural" and the Description property to the "TOOLTIP"string. These strings are defined in the oracle.jbo.AttributeHints class. Forfuture-save programming you should consider reading the UI hint strings directlyfrom this class. To do so, expose the AttributeHints class to EL through a helper managedbean (put it to application scopefor best performance) that exposes JavaBean properties for each of the strings. Using such a helper bean, the above page snippets wouldlook similar to this <af:panelGroupLayoutid="pgl2" layout="horizontal"> <af:outputText value="#{bindings.allEmployeesIterator.hints[helperBean.label]},"id="ot3"/> <af:spacer width="10"height="10" id="s1"/> <af:outputText value="#{bindings.allEmployeesIterator.hints[helperBean.labelPlural]}," id="ot2"/> <af:spacer width="10"height="10" id="s2"/>    ….

View Objects can have UI hints defined in their General category. For example, you may want to set the Display Name, Display Name (Plural) and Description on Employees View Object that is based on an...

ADFbc

Using Groovy in Entity Validation

The use case for this sample has been posted on OTN asfollows: "How to define entity validation for the Salary attribute of the Employees table so that pay raises goingbeyond the cumulated salary budget for a departments throws an exception".The logic for this is as follows: AvailableBudget – (AllSalariesInDepartment + newEmployeeSalar)+ currentEmployeeSalary < 0 The available budget is compared to all salaries paid in adepartment. Chances are that some salaries have been changed for an entity butnot yet committed, which means thatyou need to read the salary from the entitycache to obtain the current budget. You then add the old employee salary beforesubtracted the new salary from the available budget to determine if the payraise is within budget. To implement the solution in Groovy, I assume you have anADF Business Component model built on the Departments and Employees table ofthe Oracle HR Schema. You should have two entities created with an associationdefined between. Select the associationand double click on it to show the visual editor. Click onto the Relationship menu item to see the Source and Destination accessor names (e.g. Departments1, Employees1). Usingaccessors, you can "walk" the entity relationship up and down (e.g. toaccess the Departments entity from the Employees entity), which is key to thislittle recipe. In the Employee entity editor, select the Salary attribute and click the green plus icon next to the Validation section to create a newvalidation rule. In the AddValidation Rule for Salary dialog, choose the Rule Type as ScriptExpression As the Rule Definition, add the following script: //perform validationif((100000 - (Departments1.Employees1.sum('Salary')+ newValue) +              oldValue) < 0){  adf.error.raise("SALARY_TOO_HIGH_ERROR")  return false}return true As you can see from the script, it uses the entityassociation accessors to get to the Departmentsentity to then compute the summary of salaries paid within. What you need toknow: The validation providesimplicit object to access information contained within. Two of theseinformation is oldValue and newValue, which gives you a handle tothe value as it was before (committed or uncommitted) and the new value theattribute is changed to. Another useful object, though not used here is source. The source object gives you access to the entity object itself. You canuse this e.g. to access public methods in an entity impl class (no need toexpose them on the client interface). A use case for this is if you wanted toaccess getPostedData which is thedata originally queried from the database. The getPostedData is a protected method, which is why you need a customentity impl class to expose it through a public method, just the need to usethe source object. Select the FailureHandling tab of the dialog to define the message to be shown whenvalidation fails. Add message string with variables. Variables are defined bycurly braces and a name, like {newsal} Themessage is added to a resource properties file. In the sample I used a messagekey of: SALARY_TOO_HIGH_ERROR. The message string associated to this in theproperties file is shown below: SALARY_TOO_HIGH_ERROR=Salaryraise to {newsal} is too high formoney {moneyAvailable} left in thebudget for this department. Thevariable names can then be configured in the Failure Handling tab, e.g. to reference the new value and thebudget. Youthen run the AM and add salaries so that the budget is existed and the messagewill show. UsingGroovy for this use case is straight forward though, as I admit, requires some betterknowledge of ADF Business Components and Java. Download: You can download a simple sample from here. Configure the database connect to point to a HR schema and run the Application Module in the tester. Browse the departments and edit employees for a department so the salary exceed the budget value of 100000. Before you ask: To make the budget generic, you can have an attribute added to the Departments table that holds the value, in which case it too becomes Groovy accessible

The use case for this sample has been posted on OTN as follows: "How to define entity validation for the Salary attribute of the Employees table so that pay raises goingbeyond the cumulated salary...

JDeveloper

November 10th 2011 - 30 Minutes ADF Mobile Online Session with Ted Farrell (VP and Chief Architect Oracle FMW, JDeveloper and ADF)

 The German ADF Partner community conducts ADF online session every other weeks for their members to learn from each other and join forces in evangelizing Oracle JDeveloper and ADF. For November 10th, the ADF Partner Community invited Ted Farrell, Oracle VP and Chief Architect of Oracle JDeveloper, ADF and FMW to speak about Oracle ADF Mobile and new Mobile Framework to be expected in 2012. Don't miss this opportunity. There is no need for you to be a member of the German Partner community. The session is conducted in English!--- From the Organizers Invitation ---+++ visit the Oracle Executive Biography page of Ted Farrell - speaker of the webcast +++please test prior to the webcast whether your technical environment meets the requirements (see below)   dial-in numbers conc. ADF News Session, Nov. 10 th we ask you to register for the webcast by Thursday noontime (we´d like to know who is going to participate in the News Session) (via mail to annegret.warnecke@oracle.com) - registered participants will receive the slides after the presentation will have taken placeYou are invited to join the next ADF News Session, that is going to take place November 10 th 2011speaker:  Ted Farrell / Oracletime:         6:00 PM (CET)duration:  30 minutestopic:        ADF Mobiledial-in webconf:http://stconference.oracle.comconf ID:     9197959confkey:    123456Please enter your name and an abbreviation of you company name when dialing in (please don´t use blanks and special characters). Please notice that this information will be visible to all participants of the webcast. Thank you.dial-in telco:          +49 (0)69 2222 16 106 or +49 (0)800 66 485 15          ConfCode: 208 503 9          SecurityPasscode: 112233Please test prior to the webcast whether your technical environment meets the requirements. Open http://stconference.oracle.com and press "Neuer Benutzer" ("New User"). Please note: Microsoft Internet Explorer is required.  ---Frank

 The German ADF Partner community conducts ADF online session every other weeks for their members to learn from each other and join forces in evangelizing Oracle JDeveloper and ADF. For November 10th,...

ADFv

How to render different node icons for different tree levels

 Nodes of the af:tree component are stamped, which means that upon rendering,the UI component defined in the nodeStampfacet is printed repeatedly with different data values. If the requirement isto icons differently on each node level, then EL and the af:switcher componenthelp as explained in the following. <af:tree value="#{bindings.LocationsView1.treeModel}" var="node" selectionListener="#{bindings.LocationsView1.treeModel.makeCurrent}" rowSelection="single" id="t1"> <f:facet name="nodeStamp"> <af:switcher id="s1" facetName="#{node.hierTypeBinding.viewDefName}"> <f:facet name="adf.bc.samples.model.vo.LocationsView"> <af:commandImageLink text="#{node}" icon="/images/l1.png" id="cil4" inlineStyle="height:16px; width:17px;" disabled="true"/> </f:facet> <f:facet name="adf.bc.samples.model.vo.DepartmentsView"> <af:commandImageLink text="#{node}" icon="/images/l2.png" id="cil6" inlineStyle="height:16px; width:17px;" disabled="true"/> </f:facet> <f:facet name="adf.bc.samples.model.vo.EmployeesView"> <af:commandImageLink text="#{node}" icon="/images/l3.png" id="cil8" inlineStyle="height:16px; width:17px;" disabled="true"/> </f:facet> </af:switcher> </f:facet></af:tree> The sample uses the Oracle HR sample schema Locations,Departments and Employees hierarchy. The tree nodes are printed as af:commandImageLinksbecause this gives me the option to print an icon and text within the samecomponent, avoiding the need for a surrounding container (the nodeStamp facet can only have a singlechild component) that messes with the tree layout. Because I have no use of thecommand link action, I set its disabledproperty to false. Note: The commandimage link labels are rendered in gray, which can be corrected to black color usingskinning. Alternatively you can look for finding a different UI component torender the node (as said command image link is what worked for me the best). The an af:switchercomponent is used to switch between different command link definitions. To distinguishthe tree node level, the view definition name of the View Object renderingthe node is used. You can read the node view definitions from the tree binding in thePageDef file.  <tree IterBinding="LocationsView1Iterator" id="LocationsView1">      <nodeDefinition DefName="adf.bc.samples.model.vo.LocationsView"                       Name="LocationsView10">        <AttrNames>          <Item Value="LocationId"/>          <Item Value="City"/>        </AttrNames>        <Accessors>          <Item Value="DepartmentsView"/>        </Accessors>      </nodeDefinition>      <nodeDefinition DefName="adf.bc.samples.model.vo.DepartmentsView"                       Name="LocationsView11">        <AttrNames>          <Item Value="DepartmentId"/>          <Item Value="DepartmentName"/>        </AttrNames>        <Accessors>          <Item Value="EmployeesView"/>        </Accessors>      </nodeDefinition>      <nodeDefinition DefName="adf.bc.samples.model.vo.EmployeesView"                       Name="LocationsView12">        <AttrNames>          <Item Value="EmployeeId"/>          <Item Value="FirstName"/>          <Item Value="LastName"/>        </AttrNames>      </nodeDefinition>    </tree> For this, select the PageDeffile in the Application navigator and open the Structure Window. Expand thetree node binding and select a nodeDefinition.The DefName of this node is shown inthe Property Inspector. You use the DefNameas a facet name in the af:switchercomponent, as shown in the page code snippet shown in the beginning. The af:switchercomponent uses the facetNameproperty to determine which of the contained facet to display upon rendering,using the following EL: #{node.hierTypeBinding.viewDefName} The facets defined in the switcher component are named afterthe View Object definition names they represent. In the sample that is based on the Oracle HR schema, these view object names are adf.bc.samples.model.vo.LocationsView adf.bc.samples.model.vo.DepartmentsView adf.bc.samples.model.vo.EmployeesView The EL expression used in the switcher facetName property returns one of these strings in which case thefacet renders, thus showing different icons. Note that this technique can be used for any use case requiring a difference in the tree node handling or behavior

 Nodes of the af:tree component are stamped, which means that upon rendering, the UI component defined in the nodeStamp facet is printed repeatedly with different data values. If the requirement isto...

JavaScript

How to programmatically set focus on an input component

The af:documentcomponent has a property InitialFocusIdthat allows you to define the Id of an input component that should take focuswhen a page initially loads. But how do you set the component focus for pagesthat are already rendered? A use case for this is a partial submit thatexecutes logic on the server, after which the cursor focus in the UI needs tobe set to a specific input component of a page or page fragment. The solutionto this use case is JavaScript that is generated on the server and executed onthe client. The simplified sample I wrote contains of three input textfields and three command buttons. Initially, using the af:document InitialFocusId property, the cursor focus is set to the first inputtext field. The command button send a partial submit to a managed beanon the server. The managed bean reads the component Id of the input text fieldto put the focus to from a client attribute that is defined on each commandbutton. Using the MyFaces Trinidad ExtendedRenderKitService class, the managed bean sends aJavaScript call to the client to change the current component focus. Important: Bydefault, ADF Faces does not render all its user interface components asJavaScript objects. It only renders those components as JavaScript objects thathave behavior, like a table that can have its columns moved. Input textcomponents, for example, are rendered in HTML only, which means that the ADFclient side JavaScript framework will not find a handle to the component unlessyou tell ADF Faces to create one. For this, you set the ClientComponent property of the input text fields to true. This also is required for the af:document InitialFocusId property to work. Below is the managed bean code that handles the commandbutton action and that composes and executes the JavaScript to set the client sideUI focus. import javax.faces.component.UIViewRoot;import javax.faces.context.FacesContext;import javax.faces.event.ActionEvent;import oracle.adf.view.rich.component.rich.input.RichInputText;import oracle.adf.view.rich.component.rich.nav.RichCommandButton;import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;import org.apache.myfaces.trinidad.util.Service; publicclass FocusBean { public FocusBean() { } public String onSetFocus(ActionEvent event) {   RichCommandButton rcb = (RichCommandButton)event.getSource();   String focusOn = (String)rcb.getAttributes().get("focusField");    FacesContext fctx = FacesContext.getCurrentInstance();   UIViewRoot viewRoot = fctx.getViewRoot();   //search can be improved to include naming containers RichInputText rit = RichInputText)viewRoot.findComponent(focusOn); if (rit != null) {  String clientId = rit.getClientId(fctx);   //compose JavaScript to be executed on the client   StringBuilder script = new StringBuilder();  //use client id to ensure component is found if located in //naming container    script.append("var textInput = ");  script.append("AdfPage.PAGE.findComponentByAbsoluteId");  script.append ("('"+clientId+"');");  script.append("if(textInput != null){");   script.append("textInput.focus();");  script.append("}");  //invoke JavaScript writeJavaScriptToClient(script.toString()); } }   //generic, reusable helper method to call JavaScript on a client private void writeJavaScriptToClient(String script) {    FacesContext fctx = FacesContext.getCurrentInstance();   ExtendedRenderKitService erks = null;    erks = Service.getRenderKitService(               fctx, ExtendedRenderKitService.class);  erks.addScript(fctx, script); }}  As mentioned, the command buttons in the sample have aclient attribute attached that I use to determine which input component shouldreceive focus. The managed bean calls the client attribute here: RichCommandButton rcb =(RichCommandButton)event.getSource();String focusOn = (String)rcb.getAttributes().get("focusField");  In the page definition, the client attribute is defined as <af:commandButton text="Focus Field 2" id="commandButton1"                   partialSubmit="true"                   actionListener="#{FocusBean.onSetFocus}"> <af:clientAttribute name="focusField" value="it2"/></af:commandButton><af:commandButton text="Focus Field 3" id="cb1"                  partialSubmit="true"actionListener="#{FocusBean.onSetFocus}"> <af:clientAttribute name="focusField" value="it3"/></af:commandButton> In your custom implementation of this use case, you for sure will have your ownway of determining the next focus target. The server side code however doesn'tchange much. You can DOWNLOAD the sample workspace from here: http://blogs.oracle.com/jdevotnharvest/resource/SetFocusToField.zip

The af:document component has a property InitialFocusId that allows you to define the Id of an input component that should take focuswhen a page initially loads. But how do you set the component...

Book Reviews

Book Review: Oracle WebCebter 11g PS3 Administration Cookbook

Packt Publishing (http://www.packtpub.com/)  asked me to review one of their new books: Oracle WebCenter 11g PS3 Administration Cookbook written by Yannick Ongena, a proven WebCenter community expert and founder of the WebCenter Methododlogy Group (http://sites.google.com/site/oracleemg/wc). The book basically holds on what it promises on the backside of it, which is that you learn: - to create and manage navigation models - about JSR 286 use in WebCenter - integrate content sing document services - build collaborate services - to build Wikis - etc. The book has 14 well structured chapters that don't have inter dependencies, allowing you to read topics in order of your interested. As you would expect from a cookbook, the content is hands-on driven. This however means you get things done, but you don't necessarily get enough background information teaching you the technology. I didn't follow the book on a WebCenter instance, but the accompanying screen shots made it easy to follow without. I liked the book ad read it almost in one go on my flight to SFO and back. The only thing I wanted to learn more about was in chapter 2 where Yannick discussed the writing of portlets using events. Here the chosen sample was too easy and I would have liked to see one that shows how to pass data from a portlets to another so that the model of the other portlet gets udated. In summary, if you start with WebCenter and have a deadline breathing down your neck that doesn't allow you to learn things properly, this book buys you the time you need. If you are experienced in WebCenter, still this book sis useful as it gives you a step-by-step checklist for various common and reoccurring tasks in WebCenter.  Just for completenes, here's the table of content for the book http://www.packtpub.com/oracle-webcenter-11g-ps3-administration-cookbook/book  : Chapter 1: Creating an Enterprise Portal with WebCenter Introduction Preparing JDeveloper for WebCenter Creating a WebCenter portal Managing pages Changing the look and feel of your portal Editing pages using the composer Chapter 2: Consuming Portlets Introduction Building JSR 286 portlets in JDeveloper Registering a portlet producer at design time Registering a portlet producer at runtime Consuming portlets at design time Consuming portlets at runtime Wiring two portlets together at design time Wiring two portlets together at runtime Contextual wiring of portlets using events Chapter 3: Navigation Models and Page Hierarchies Introduction Creating a navigation model at design time Creating a navigation model at runtime Adding a folder to a navigation model Adding a link to a navigation model Adding content query to a navigation model Adding a page hierarchy to a navigation model Referencing a navigation model Adding a component to a navigation model Adding a custom folder to a navigation model Adding custom content to a navigation model Changing the default start page of your portal Filtering navigation resources based upon business logic Exporting a navigation model Importing an existing navigation model Specifying the default navigation model Managing the page hierarchy Chapter 4: Managing the Resource Catalog Introduction Creating a resource catalog at design time Creating a resource catalog at runtime Adding a folder to a resource catalog Adding a link to a resource catalog Adding another resource catalog to a resource catalog Adding a component to a resource catalog Adding a custom folder to a resource catalog Adding custom content to a resource catalog Adding resources to a catalog at runtime Managing the Resource Library Securing resource catalogs Filtering resources based upon a role or other business logic Selecting a resource catalog based upon business logic Exporting a resource catalog Importing a resource catalog Chapter 5: Managing the Look and Feel of Your Portal Introduction Creating a new template at design time Creating a template at runtime Creating a tree navigation Enabling runtime editing of your template Creating a new page style Chapter 6: Integrating Content with Document Services Introduction Preparing UCM for a remote connection Creating a connection to a content server Creating a content driven navigation model Displaying a single content item with the content presenter Displaying multiple content items with the content presenter Creating a content presenter template for a single item Creating a content presenter template for multiple items Using the document service taskflows Chapter 7: Discussions and Wiki Services Introduction Creating a connection to the discussion service Adding discussion forums to your portal Creating forums Creating topics Adding announcements to your portal Creating an announcement Creating a wiki document Editing a wiki document Chapter 8: Organizing and Finding Content Introduction Creating a connection for the link and tagging services Enabling tagging functionality to pages Showing related content Showing a tag cloud Linking content Linking to a document Linking to a discussion Chapter 9: Using Polls and Surveys Introduction Creating a connection for the poll services Creating a poll Adding a poll to a page Managing sections Managing questions Scheduling a poll Analyzing the results Creating a poll template Applying a template to a poll Chapter 10: Integrating External Content and Applications Introduction Registering an external application in JDeveloper Register an external application at runtime Adding an external application to your portal Integrating external content with the WebClipping portlet Registering the Omniportlet Integrating external content with the Omniportlet Chapter 11: WebCenter Spaces Introduction Creating a discussion and announcement service connection Creating a document service connection Registering external Applications Registering a portlet producer Creating a group space Enabling additional pages Creating subspaces Creating lists Creating a space template Exporting group spaces Importing group spaces Chapter 12: Securing Your WebCenter Portal Introduction Securing pages with the page hierarchy Securing pages at runtime Using Oracle Identity Directory as an identity store Enabling SSL for a WebCenter portal application Securing taskflows Chapter 13: Managing WebCenter Portal Applications Introduction Creating a connection to an application server Deploying a WebCenter Portal Application Undeploying an application Managing connections in the Enterprise Manager Propagating changes from a staging environment to a production environment Viewing log messages in the Enterprise Manager Monitoring the performance of an application Chapter 14: WebCenter Analytics and Activity Graph Introduction Registering a WebCenter Portal application to the Analytics collector Manually running the Gathering Engine Scheduling the Gathering Engine Creating a connection to the activities schema in JDeveloper Using the WebCenter Analytics taskflows Creating your own analytics report Showing an activity stream on your portal

Packt Publishing (http://www.packtpub.com/)  asked me to review one of their new books: Oracle WebCenter 11g PS3 Administration Cookbook written by Yannick Ongena, a proven WebCenter community expert...

ADFv

How-to launch browser print dialog when showing printable page

The following code, when referenced from the beforePhase property of the f:view component, automatically opens the browser print dialog if a page is rendered as printable. I did write about this topic in the OTN Harvest summary of January 2011. To this time however I used an internal flag, which doesn't feel right. The code used in this post only uses public APIs and thus is a solution that lasts. public void beforePhaseMethod(PhaseEvent phaseEvent) {  if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE){   FacesContext fctx = FacesContext.getCurrentInstance();    AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();   if(adfFacesContext.getOutputMode()== OutputMode.PRINTABLE){     ExtendedRenderKitService erks = null;         erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class); erks.addScript(fctx, "window.print();");        }    } }The managed bean method is referenced from the f:view component as follows<f:view beforePhase="#{SampleBean.beforePhaseMethod}">  ...</f:view>With this listener and code, when the af:showPrintableBehavior tag is used on a command item to show a printable page, the browser print dialog is automatically opened. While the same code also works for page fragments, the f:view tag is only available for JSPX documents. In this case you either set the beforePhase method property on the JSPX document hosting the page fragment, or define a global phase listener (faces-config.xml) that then works for all pages in an application.

The following code, when referenced from the beforePhase property of the f:view component, automatically opens the browser print dialog if a page is rendered as printable. I did write about this topic...

ADFv

Adding a clientListener dynamically at runtime using JavaScript

In ADF Faces, the client listener component - af:clientListener - is added to ADF Faces components to listen for component events that should be handled in JavaScript on the client. The following JavaScript function allows you to add a client listener dynamically at runtime, which may become handy when working on client side integration, or use cases that cannot be implemented on the server: for example, adding custom behavior to a command button that is part of an existing ADF Faces component and not exposed in the property palette. /* * componentId - the client component of the ADF Faces component to add the                  client listener to. This componentId must reflect naming                  containers as the search is absolute * eventType   - ADFFaces component event type like 'action','click','select'  *               etc. Note that the chosen event type must be supported by the *               component as otherwise the ADF Faces assertion check fails.  *               E.g. an inputText field does not have an 'action' event type but *              'focus', 'blur', 'valueChange','mouseOver' etc. * newListener - a JavaScript function: function name(evt){} that must exist on the *               page that hosts the component to which the client listener is added. *               The newListener argument is not passed with quotes */function addComponentListener(componentId, eventType, newListener){  var component = AdfPage.PAGE.findComponentByAbsoluteId(componentId);  if(component != null){     component.addEventListener(eventType,newListener);                 }} To add a client listener to a command button 'cb1' that is located in the page (no naming containers) so that next time a users hits the button it shows a hello world alert, you use the following call addComponentListener('cb1','action',helloWorld); The hello world function looks as shown below: function helloWorld(evt){  alert(evt.getSource()+' says Hello World');} This prints the command button instance with an attached "helloe world" in a JavaScript alert.

In ADF Faces, the client listener component - af:clientListener - is added to ADF Faces components to listen for component events that should be handled in JavaScript on the client. The following...

ADFv

ADF Faces web crawler support in Oracle JDeveloper 11.1.1.5 and 11.1.2

Web crawler support, also known as search engineoptimization (SEO), has been added to ADF Faces in Oracle JDeveloper 11.1.1.5(PS4) and Oracle JDeveloper 11g R2 (11.1.2). "Search engineoptimization (SEO) is the process of improving the visibility of a website or aweb page in search engines via the "natural" or un-paid("organic" or "algorithmic") search results." - Wikipedia, http://en.wikipedia.org/wiki/Search_engine_optimization The difference between ADF Faces pages queried by a userand a web crawler is that the agent is different in that browsers know how torender and display dynamic JavaScript, whereas a crawler cannot. To index apage, crawlers need static links pointing to wherever site navigation goes tonext. In addition, the ADF Faces window and controller token prevented pagesfrom being indexed successfully. This has now been fixed for Oracle JDeveloper11.1.1.5 and 11.1.2. The documentation forthis new feature is in the Oracle Fusion Middleware Web User InterfaceDeveloper's Guide for Oracle Application Development Framework for the tworeleases: http://st-doc.us.oracle.com/review/rsb/html/B31973_09/ad_output.htm#CHDEIGJB (11.1.1.5) http://download.oracle.com/docs/cd/E16162_01/web.1112/e16181/ad_output.htm#CHDEIGJB (11.1.2) As documented, you can also use EL to "tune"pages for web indexing. A documentated sample shows how to enrich an ADF Facespage with a "goLink" to indicate navigation to another site. <c:if test="#{requestContext.agent.type == 'webcrawler'}"> <af:goLink text="This Link isrendered only for web crawlers" destination="http://www.newPage.com"/></c:if> Note that there is nothing developers need to configure ordo for the search engine optimization to work. More work on web crawler optimization is planned for ADFc in a future release of Oracle JDeveloper (no release dates and no further details available).

Web crawler support, also known as search engine optimization (SEO), has been added to ADF Faces in Oracle JDeveloper 11.1.1.5 (PS4) and Oracle JDeveloper 11g R2 (11.1.2). "Search engineoptimization...

JDeveloper

ADF Enterprise Methodology Group (EMG) Sunday during OOW

"TheADF EMG is where ADF users get down and dirty in discussing their FMWexperiences."                                                                                                                       –Chris MuirOne theme (ADF), one room (Moscone West - 2000), one community (ADF EMG) ! The ADF Enterprise Methodology Group (EMG) staffs a complete day of ADF developer talks on Sunday October 2nd. --------------------- AGENDA --------------------- 09:00 - Sten E. Vesterli   Session 32460 - Starting an Enterprise Oracle ADF Project- 10:15 - Frank Nimphius & Maiko Rocha    Session 32480 - Learn Oracle ADF Task Flows in Only 60 Minutes- 11:30 - Andrejus Baranovskis   Session 32481 - A+-Quality Oracle ADF Code- 12:45 - Wilfred van der Deijl   Session 32500 - Transitioning from Oracle Forms to Oracle ADF- 14:00 - Steven Davelaar    Session 32501 - Empower Multitasking with an Oracle ADF UI Powerhouse- 15:15 - Lucas Jellema    Session 32502 - Gold Nuggets in Oracle ADF Faces

"The ADF EMG is where ADF users get down and dirty in discussing their FMW experiences."                                                                                                                 ...

ADFv

Disabling the browser form auto-complete

As often, somebody's heaven is another one's hell. Thebrowser auto-complete functionality is one example for this. In Oracle ADF Faces, there is no property that switches autocomplete-off for input field components or the af:form component. Thanks to the ADF Facesclient side architecture switching off this browser functionality is easy toachieve: <af:form>   …  <af:clientListener  type="mouseOver"                      method="suppressAutoComplete"/></af:form> The mouse over event is issued one time when you enter a form.Given that you can only have a single form on a page, this means it fires onetime for the page. The JavaScript function referenced by the af:clientListener elementis shown below function suppressAutoComplete(evt){ var domElement =     AdfRichUIPeer.getDomContentElementForComponent(evt.getSource());domElement.setAttribute("autocomplete", "off" ); } If you put this into a JS library that you reference fromthe af:resourcetag then all you need to remember is add the af:clientListener tag to the af:form tag. Update May-2012: Switching off browser suggest functionality is now a native capability of the inputText component in Oracle JDeveloper 11.1.2+ Read about the "autoComplete" property in http://docs.oracle.com/cd/E16162_01/apirefs.1112/e17491/tagdoc/af_inputText.html

As often, somebody's heaven is another one's hell. The browser auto-complete functionality is one example for this. In Oracle ADF Faces, there is no property that switches autocomplete-off for input...

ADFv

Suggested skin editor workflow

Following the work flow outlined below helps you to createa custom skin for your AD Faces application using the integrated or stand aloneskin editor. Integrated Skin Editor The integrated skin editor is good to use for projects thatare migrated or newly created in Oracle JDeveloper 11g R2. 1. Create a skinproject. Skins are reusable components and as such should be created intheir own project or workspace. 2. Create anew skin by extending an existing skin. Oracle ADF Faces provides simplifieddefault skins, like fusionFx-simple-v2.desktop, that are specifically designed tobe extended by custom skins. Note that Fx-simple-v2 is not available for releasesbefore Oracle JDeveloper 11g R2. If you are on an 11.1.1.x version of OracleJDeveloper, use the stand-alone editor. The stand-alone editor helps with whichdefault skins are available for the target version you build the skin for. 3. Analyzethe application for the components to skin. Identify the components in apage that you want to skin and map them to skin selectors using the ADF Facesskin editor. 4. Identifyglobal alias selectors to skin first. Alias selectors are the 20% of workthat color 80% of the components in an application. 5. Definecustom :alias definitions: Custom :alias definitions simplify maintenanceof style definitions used on multiple components. Custom :alias definitions areapplied using the –tr-rule-refselector, 6. Generateimages and icons. Use the ADF Faces skin editor to generate custom coloredversions of ADF Faces component images and icons. 7. Edit theskin CSS file using the skin editor. Use the skin editor to discover skinselectors for the components and behavior you want to skin and apply thechanges using the Properties Inspector. 8. Deploythe skin in an ADF library. Skins can and should be reused. For this,create an ADF library deployment profile from the skin project and deploy the skinin a JAR file. 9. Frequentlytest your custom skin in a browser. Reference the skin JAR file from the ViewControllerproject of the target application. Set the custom skin family name in theskin-family element of the target application trinidad-config.xml file. 10. Deploythe skin as a shared library to WebLogic server. Optionally, if a customskin is shared across applications, deploy the skin ADF library JAR file as ashared library to Oracle WebLogic server and edit the applications' weblogic-application.xmlfile to reference it. Stand-alone Skin Editor The stand-alone skin editor allows you to build customskins for projects build with Oracle JDeveloper 11.1.2, 11.1.1.5 and 11.1.1.4. Ifyou build sins for JDeveloper versions prior to 11.1.1.4, just make sure youeither don't extend an existing skin or extend one that exists in the target JDeveloperversion. Note that the FusionFx simple skin is not available for all version ofJDeveloper. You could extend the "fusion" skin instead, whichhowever is more difficult to skin as it isn't reduced to using global aliasselectors as the simple skins do. The work flow to follow for the stand alone editor iscomparable to using the integrated editor 1. Create a skinproject. Skins are reusable components and as such should be created intheir own project or workspace. Never open a JDeveloper 11.1.1.x projectdirectly in the stand alone skin editor as it is JDeveloper 11.1.2 based andthus will migrate the project to JDeveloper 11.1.2 and JSF 2.0. 2. Create anew skin by extending an existing skin. Oracle ADF Faces provides simplifieddefault skins, like fusionFx-simple-v2.desktop, that are specifically designed tobe extended by custom skins. When creating a new skin project, select thetarget version of Oracle JDeveloper you build the skin for, which thenautomatically updates the list of available default skins for this platform. 3. Analyzethe application for the components to skin. Identify the components in apage that you want to skin and map them to skin selectors using the ADF Facesskin editor. 4. Identifyglobal alias selectors to skin first. Alias selectors are the 20% of workthat color 80% of the components in an application. 5. Definecustom :alias definitions: Custom :alias definitions simplify maintenanceof style definitions used on multiple components. Custom :alias definitions areapplied using the –tr-rule-refselector, 6. Generateimages and icons. Use the ADF Faces skin editor to generate custom coloredversions of ADF Faces component images and icons. 7. Edit theskin CSS file using the skin editor. Use the skin editor to discover skinselectors for the components and behavior you want to skin and apply thechanges using the Properties Inspector. 8. Deploythe skin in an ADF library. Skins can and should be reused. For this,create an ADF library deployment profile from the skin project and deploy the skinin a JAR file. 9. Frequentlytest your custom skin in a browser. Reference the skin JAR file from the ViewControllerproject of the target application. Set the custom skin family name in theskin-family element of the target application trinidad-config.xml file. 10. Deploythe skin as a shared library to WebLogic server. Optionally, if a customskin is shared across applications, deploy the skin ADF library JAR file as ashared library to Oracle WebLogic server and edit the applications' weblogic-application.xmlfile to reference it. You can take this work flow as a starting point to refine and build your own. I am sure there is a lot more to add, like skin debugging, before this laundry list can become an idiots-guide. Anyway, I am interested in hearing back from you of what you think would be a valuable addition to this work flow. I opened a thread on the JDeveloper forum on OTN for this:.http://forums.oracle.com/forums/thread.jspa?threadID=2262307&tstart=0 At the end of the month, I'll then put it all together in the monthly OTN harvest for August published on the ADF Code Corner Website: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html You can download the stand-alone ADF Faces Skin Editor from here: http://www.oracle.com/technetwork/developer-tools/adf/downloads/index.html

Following the work flow outlined below helps you to create a custom skin for your AD Faces application using the integrated or stand alone skin editor. Integrated Skin Editor The integrated skin editor...

ADFv

How-to access UI component that queued a custom client event

In ADF Faces, to invoke a server side method in a managedbean, you use the af:serverListenertag. The af:serverListenertag is added as a child to the component that owns the event and called fromJavaScript in a call to AdfCustomEvent.queue(… ) In this example, the af:serverListener is added to a tableto notify a manage bean method about a double-click action. <af:table ...> <af:column> ... </af:column> ... <af:clientListener method="handleTableDoubleClick"                   type="dblClick"/> <af:serverListener type="TableDoubleClickEvent"                                             method="#{myBean.handleTableDoubleClick}"/></af:table> The JavaScript function that is called by the af:clientListener is shownnext. function handleTableDoubleClick(evt){     var table = evt.getSource();  AdfCustomEvent.queue(table, "TableDoubleClickEvent",{}, true);           evt.cancel();} The first argument in the call to AdfCustomEvent.queue represents theevent owner, the table component. This information is passed to the managedbean method, which has the following signature. public void handleTableDoubleClick(ClientEvent ce){  RichTable richTable = (RichTable)ce.getComponent();   //... work with rich table component} As you can see, there is no need to look up the eventowning component by searching the JSF UIViewRoot with or without help of JSFUtils.

In ADF Faces, to invoke a server side method in a managed bean, you use the af:serverListener tag. The af:serverListener tag is added as a child to the component that owns the event and called fromJava...

ADFv

favicon and browser bookmark icons in JDeveloper 11.1.2

The favicon isthe little icon that displays in the Browser URL address field when a requestedpage loads. In Oracle JDeveloper 11.1.1.x releases, the favicon needed to be added to the page source. In JDeveloper 11.1.2a new attribute, smallIconSource hasbeen added to the af:documenttag to serve the favicon easily. See: http://download.oracle.com/docs/cd/E16162_01/apirefs.1112/e17491/tagdoc/af_document.html smallIconSource Specifies a smallicon that the browser may insert into the address bar (commonly known as a"favicon"). If this attribute is not specified, the browser maydefault to using a file named "favicon.ico" located at the root ofyour server. (This default behavior is not something provided by this frameworkand may vary between browsers.) This attribute supports a space-delimited listof files (each file may be wrapped in quotes or apostrophes if the file pathcontains a space). If the file path specifies a single leading slash, this meansthat the file is located inside of the web application's root folder (so"/small-icon.png" would resolve to something like"http://www.oracle.com/adf-faces/small-icon.png"). If the file pathspecifies 2 leading slashes, this means that the file is located inside of theserver's root folder (so "//small-icon.png" would resolve tosomething like "http://www.oracle.com/small-icon.png"). Browserstypically expect these files to be 16 pixels by 16 pixels. Typically, the firstlisted file will be the one used. Otherwise, if a browser only supports certainkinds of files, the first file in the list that uses a supported file extensionwill be the one that is used for that browser. Another new attribute is the largeIconSource that applies an image to bookmark entries inborwsers. largeIconSource Specifies a largeicon that the browser may use when bookmarking this page to your device's homescreen. If this attribute is not specified, the browser may default to using afile named "apple-touch-icon.png" located at the root of your server.(This default behavior is not something provided by this framework and may varybetween browsers.) This attribute supports a space-delimited list of files(each file may be wrapped in quotes or apostrophes if the file path contains aspace). If the file path specifies a single leading slash, this means that thefile is located inside of the web application's root folder (so"/large-icon.png" would resolve to something like"http://www.oracle.com/adf-faces/large-icon.png"). If the file pathspecifies 2 leading slashes, this means that the file is located inside of theserver's root folder (so "//large-icon.png" would resolve tosomething like "http://www.oracle.com/large-icon.png"). Browserstypically expect these files to be 57 pixels by 57 pixels but could be larger,e.g. 72 pixels by 72 pixels or 129 pixels by 129 pixels. Typically, the firstlisted file will be the one used. Otherwise, if a browser only supports certainkinds of files, the first file in the list that uses a supported file extensionwill be the one that is used for that browser. <af:document title="My Page"  smallIconSource="/favicon.png /favicon.ico"  largeIconSource="/touchicon.png">  <af:form> ... </af:form></af:document>

The favicon is the little icon that displays in the Browser URL address field when a requested page loads. In Oracle JDeveloper 11.1.1.x releases, the favicon needed to be added to the page source. In...

ADFc

Five hours of Task Flow Overview Recordings Available

In addition to the ADF Controller task flow documentation inOracle Fusion Middleware FusionDeveloper's Guide for Oracle Application Development Framework 11g Release 1 http://download.oracle.com/docs/cd/E21764_01/web.1111/b31974/partpage3.htm#BABHIIAI The ADF Insider website… http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adfinsider-093342.html … hosts five online videos that explain how to build andwork with ADF Controller task flows in Oracle ADF. ADF Task Flow -Overview (Part 1) This 90 minute recording introduces the concept of ADFunbounded and bounded task flows, as well as other ADF Controller features. Thesession starts with an overview of unbounded task flows, bounded task flows andthe different activities that exist for developers to build complex applicationflows. Exception handling and the Train navigation model is alsocovered in this first part of a two part series. By example of developing asample application, the recording guides viewers through building unbounded andbounded task flows. This session is continued in a second part. http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/taskflow-overview-p1/taskflow-overview-p1.html ADF Task Flow -Overview (Part 2) This 75 minute session continues where part 1 ended andcompletes the sample application that guides viewers through different aspectsof unbounded and bounded task flow development. In this recording, memoryscopes, save for later, task flow opening in dialogs and remote task flow callsare explained and demonstrated. If you are new to ADF Task Flow, then it isrecommended to first watch part 1 of this series to be able to follow theexplanation guided by the sample application. http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/taskflow-overview-p2/taskflow-overview-p2.html ADF Region Interaction- An Overview This session covers most of the options that exist forcommunicating between regions. It briefly discusses what it takes to buildregions from bounded task flows before going into details using slides andsamples. The following interaction is explained: contextual events, queueaction in region, input parameters and PPR, drag and drop, shared DataControls, parent action and region navigation listener. http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/adf-region-interaction/adf-region-interaction.html ADF RegionInteraction - Contextual Events Contextual event is used as a communication channel betweena parent view and its contained regions, as well as between regions. Byexample, this session explains how to set up contextual events, how to defineproducers and event listeners and how to define the payload message. http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/AdfInsiderContextualEvents/AdfInsiderContextualEvents.html

In addition to the ADF Controller task flow documentation inOracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1http://download.oracle.com/docs/c...

Oracle

Integrated Cloud Applications & Platform Services