This discussion is archived
3 Replies Latest reply: Feb 26, 2012 8:47 PM by Bilal RSS

ADFUtils / JSFUtils for Oracle JDeveloper 11gR2 Cookbook

Bilal Newbie
Currently Being Moderated
Hi All,

You might have heard about and most probably read yet another great book about Oracle ADF and JDeveloper. Now a days I am busy reading its recipes.

The author is asking about downloading latest version of FOD from here for the ADFUtils and JSFUtils classes located at SupplierModule\ViewController\src\oracle\fodemo\supplier\view\utils directory. I have downloaded latest FOD project and extracted the files but there is not SupplierModule inside the project. I searched the project and got these files loacted at StorefrontUI directory and added these classes to the recipe.

I thought that the recipe is done.... but it is not the case ....

While practising Using a generic backing bean actions framework recipe, the code contains a call to ADFUtils.hasChanges() is giving error and it seems that either I am using the wrong version of ADFUtils/JSFUtils or downloaded the wrong FOD project where no SupplierModule is present.

I am stuck right now and can't proceed...

Anyone having ADFUtils/JSFUtils with all the methods used through out the book?
...
Or link to right FOD project
...
Please help and it will be highly appreciated.

Thanks
Best Regards
Bilal
  • 1. Re: ADFUtils / JSFUtils for Oracle JDeveloper 11gR2 Cookbook
    Timo Hahn Oracle ACE
    Currently Being Moderated
    I couldn't find the code in the FOD demos I have on my disk. I checked Fod sample for 11.1.1.4.0, 11.1.1.5.0, 11.1.2.0.0 and 11.1.2.1.0

    Not sure if this code ever existed. the SupplierModule only exists in the SOA FOD samples (11.1.1.4.0, 11.1.1.5.0), but my versions don'T have the code either.

    You may drop the author a note...

    Timo
  • 2. Re: ADFUtils / JSFUtils for Oracle JDeveloper 11gR2 Cookbook
    773212 Pro
    Currently Being Moderated
    Hi Bilal,

    First of all thank you for your good remarks about the book :)

    Now as far as the problem you are having: hasChanges() is not part of the ADFUtils shipped with the Fusion Order Demo (FOD). It is a helper method that is implemented in the recipe "*Determining whether the current transaction has pending changes*" in chapter 8: Backing not Baking: Bean Recipes. As I have stated in the Using ADFUtils/JSFUtils recipe: "+The ADFUtils and JSFUtils utility classes, at the time of writing, are not part of any official JDeveloper release. You will have to locate them, configure them, and expand them as needed in your project+". So, throughout the book I have expanded ADFUtils by adding a number of new helper methods as the book was evolving. Since the book code gradually progresses from chapter 1 to chapter 12, you can find the complete book code in the last recipe (recipe 5) of chapter 12. If you open the SharedComponents workspace for that recipe, you will find the ADFUtils as it has evolved throughout the writing of the book. For your convenience, I am also reprinting the hasChanges() utility method below:
        /**
         * Recipe: Determining whether the current transaction has pending changes.
         * 
         * Determines whether there are changes done to the current record.
         *
         * @return true/false whether there are uncommited changes.
         */
        public static boolean hasChanges() {
            // check for dirty transaction in both the model and the controller.
            return isBCTransactionDirty() || isControllerTransactionDirty();
        }
    
        /**
         * Recipe: Determining whether the current transaction has pending changes.
         * 
         * @return true/false whether there are pending changes in the BC.
         */
        public static boolean isBCTransactionDirty() {
            // get application module and check for dirty transaction
            ApplicationModule am = ADFUtils.getDCBindingContainer().getDataControl().getApplicationModule();
            return am.getTransaction().isDirty();
        }
    
        /**
         * Recipe: Determining whether the current transaction has pending changes.
         * 
         * @return true/false whether there are pending changes in the controller.
         */
        public static boolean isControllerTransactionDirty() {
            // get data control and check for dirty transaction
            BindingContext bc = BindingContext.getCurrent();
            String currentDataControlFrame = bc.getCurrentDataControlFrame();
            return bc.findDataControlFrame(currentDataControlFrame).isTransactionDirty();
        }
    While working on the Using a generic backing bean actions framework recipe the hasChanges() method can simply be added to the ADFUtils and just return true, i.e. :
        public static boolean hasChanges() {
            // for now return true; see recipe "Determining whether the current transaction has pending changes" for more info
            return true;
        }
    Then, when you get to chapter 8 and read on the Determining whether the current transaction has pending changes recipe, you can update hasChanges().

    Hope this helps you continue with your "cooking" ;)

    Nick
  • 3. Re: ADFUtils / JSFUtils for Oracle JDeveloper 11gR2 Cookbook
    Bilal Newbie
    Currently Being Moderated
    Dear Nick,

    The problem has gone and I am now busy cooking with your cookbook.

    Thanks for the reply and sharing a great learning resource.

    Best Regards
    Bilal

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points