Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:16:00 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

January 2005
Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Dec   Feb

Get Firefox!

Friday, January 28, 2005

Lucas writes in to ask a question about my undocumented example application number 20, where I show an example of using the built-in writeXML() method of the ADF business components framework to produce an XML document for Department and its nested Employees and JobHistory information. He asked whether it would be possible to create a transient attribute of the Department view object and have that transient attribute return the XML document. His attempts to achieve this were running into ClassCastExceptions.

The thought is perfectly valid, but I am going to guess that the ClassCastExceptions are a result of trying to refer to the value of the attribute using an EL expression in the page that returns a binding object instead of just the raw attribute value.

I downloaded the sample in question, and added a transient attribute named DepartmentXML of type org.w3c.dom.Document to its Departments view object. I checked the box to generate the view row class, and in the DepartmentsViewRowImpl.java class, I implemented the getDepartmentXML() getter method like this:

  public Document getDepartmentXML()
  {
    HashMap h = new HashMap();
    h.put("test.model.DepartmentsView",
new String[]{"DepartmentId",
"DepartmentName",
"EmployeesView",
"JobHistoryView"});
    h.put("test.model.EmployeesView",
new String[]{"EmployeeId",
"FirstName",
"LastName",
"Email",
"EmployeesView"});
    h.put("test.model.JobHistoryView",
new String[]{"StartDate","StartDate"});
    Node n = writeXML(XMLInterface.XML_OPT_LIMIT_RANGE,h);
    Document d = n.getOwnerDocument();
    n = ((XMLDocument)d).adoptNode(n);
    d.appendChild(n);   
    return (Document)d;
  }

With this in place, calling getDepartmentXML() on any row in the Departments view will return an XML document that has a structure like this:

<DepartmentsViewRow>
   <DepartmentId>80</DepartmentId>
   <DepartmentName>Sales</DepartmentName>
   <EmployeesView>
      <EmployeesViewRow>
         <EmployeeId>145</EmployeeId>
         <FirstName>John</FirstName>
         <LastName>Russell</LastName>
         <Email>JRUSSEL</Email>
         <EmployeesView>
            <EmployeesViewRow>
               <EmployeeId>150</EmployeeId>
               <FirstName>Peter</FirstName>
               <LastName>Tucker</LastName>
               <Email>PTUCKER</Email>
            </EmployeesViewRow>
         </EmployeesView>
      </EmployeesViewRow>
   </EmployeesView>
   <JobHistoryView>
      <JobHistoryViewRow>
         <StartDate>1998-03-24</StartDate>
         <StartDate>1998-03-24</StartDate>
      </JobHistoryViewRow>
   </JobHistoryView>
</DepartmentsViewRow>

Then, I dropped the "DepartmentXML" attribute to a JSP page from the Data Control palette to create a value binding for it in my JSP page. After adding in the taglib directive for the JSTL XML tag library, I was able to refer to iterate over the XML document using the <x:forEach> tag by doing the following two things:

  1. Get the document into a page-scope variable
     <c:set var="voxml" value="${bindings.DepartmentXML.attributeValue}"/>
  2. Iterate the document in the voxml variable like this:
    <x:forEach select="$voxml/DepartmentsViewRow">

The thing to notice is the use of the attributeValue property of the binding. An EL expression like ${bindings.DepartmentXML} would be valid and legal, but it refers to the Control Value binding object, and not to its value (in this case, the XMLDocument).


2:46:18 PM    



We're in the thick of coding for our ADF 10.1.3 major release and I need to focus a lot of my attention over the next several months on guiding, experimenting with, giving feedback on, and polishing our 10.1.3 ADF feature set, as well as already working on planning for what's beyond the 10.1.3 release. After a quick trip back home from Amsterdam last night, it's "touch and go" as I'm off to Oracle HQ tomorrow morning to spend all of next week helping finalize our 10.1.3 ADF features with the rest of the ADF development team who are the real hands that make things happen. I hope to demo what I've learned about JHeadstart to the rest of the ADF team as well, which should be fun for the team to see it in practice. 

I was glad as a part of this week's JHeadstart training get a chance to "hang out" with a lot of the support team that works on JDeveloper and ADF, most of whom I've worked with for years but only through email or instant-messenger. My increased internal focus over the coming months means I honestly won't have the time to be particpating as actively in the online JDeveloper OTN Discussion Forum, so I urge customers using JDeveloper and ADF to leverage our Worldwide Support team via Metalink to get any important questions or issues resolved. It's great that I see more and more customers helping themselves in the OTN forum -- a real developer community emerging -- but for important issues that are time-critical, Metalink is the place. Log a TAR.

Our support team for JDeveloper and ADF is top-notch, so you'll be in good hands. Having a "paper trail" of JDeveloper and ADF-related questions and issues logged as TAR's in the Metalink system gives us a better feedback loop on what are the key problems customers are running into, and the most frequently asked questions that are coming up, so going through Metalink is a win-win for both customers and our development team.


12:41:17 PM    


On the fourth and final day of the JHeadstart course, we learned how you can customize the web applications that the JHeadstart Application Generator produces. Everything about the various page layout styles that it supports generating, like...

  • Form (Single-record page)
  • Table (Single page in multi-record table format)
  • Table-Form (Table Page + single-record Details page)
  • Select-Form (Select-a-Record Page + a single-record page)
  • Tree (Empty page tree control in side navigation)
  • Tree-Form (Single-record page with tree control in side navigation)
  • Parent-Shuttle (Shuttle for adding children to a parent group)
  • Intersection-Shuttle (Shuttle for adding many-to-many links between two groups

...is driven from templates that give you a nice default result, but which can be easily customized. You can change how pages are generated across the board this way, or produce just a customized treatment for a single set of pages for the generated application.

This flexibility combined well with the ADF UIX "Skins" feature (HowTo doc here) to have your pages take on the runtime look and feel that matched your company's personality better than the two supplied "BLAF" and "Minimal" skins. Steven demoed some skins that Oracle Consulting had produced for consulting engagements in Oracle Netherlands that really made the generated web application look radically different from the default ADF UIX look and feels. All without touching the pages themselves, which was an eye opener.

I wanted to thank the folks in our Oracle EMEA Java/XML Professional Community for working with the JHeadstart team to organize this workshop. I personally found it super-useful to be in a room for four days working with folks who are supporting ADF, folks who are out in the field helping customers build real sytems with ADF, and the clever folks on the JHeadstart team who have plowed their years of real-world consulting project experience back into a tool for trimming the time it takes to flesh out the ADF view/controller layer.

Questions you might have about JHeadstart might already be answered in the JHeadstart FAQ on OTN. If not, post a question in the JHeadstart OTN Discussion Forum and the team will answer your questions there.


12:08:37 PM    


© Copyright 2008 Steve Muench.