Refactoring code in ADF

Hi All,
I have written an ADF application to help users browse through database records in a friendly manner. However, the underlying database has been tweaked by the DBA recently to remove a referential key. This has a significant impact on my application. How do I go about refactoring it with minimial effort and get it working.
Thanks

Does your application need to maintain the referential integrity? If yes, you should be able to get away with no or minimal changes.
A good starting point for refactoring would be the "Synchronise with Database" option in the BC.

Similar Messages

  • How to get source code of ADF demo page.

    I have used oracle ADF demo site for demo work related to graphs.
    I want to download the source code of this demo. I mean jspx file, backing bean and style classes.
    Is there any way I can download this source code?I believe there is no sense to use it without downloading it's code.
    I want to download "Area graph Animation" from below link:
    http://jdevadf.oracle.com/adf-richclient-demo/faces/feature/graph/animation.jspx?_afrRedirect=2611981845492287
    Please help!
    Thanks,
    Jaykishan

    This does NOT have .JWS file as
    The demo WAR is a JDeveloper Project packaged into a WAR file.
    So creating a dummy application or open an existing application.
    Select 'File' ----> 'New' --> 'Projects' and select Project from WAR.
    Thanks,
    Navaneeth

  • Login Box example and source code on adf struts and JSP

    Dear all..
    I want to make application using ADF struts and JSP using oracle 10g Jdeveloper.
    The user should login into the login box and verify everyone who has right to enter the home.jsp.
    Anybody could help me with the source code as well as the step by step explanation...
    I'm looking forward the help...

    http://www.oracle.com/technology/products/jdev/collateral/papers/10g/reviewer/viewlets/reviewer_struts_viewlet_swf.html

  • Access ViewObject from Java code in ADF

    Hello everyone,
    I've got one problem with ADF, which I can't deal with on my own.
    I've created web application that consists of two UI components:
    - table that displays data from database (i've created entity object/view object/application module and drag onto JSF page)
    - button that can refresh table / change data in it (i've got java bean method, that do some logic on view object, which is added as a action to a button)
    My problem is, that i've got SQL query, for example: "select * from dept" and I want to my view object (which I've created before) displays result of this query. How can I do it?
    I don't know how from a java code (in my java bean method) access a view object and execute a sql query on it? I've got some code:
    ViewObject dynamicVO = this.findViewObject("VO1");
    dynamicVO.remove();
    dynamicVO = this.createViewObjectFromQueryStmt("VO1", "SELECT * FROM dept");
    dynamicVO.executeQuery();
    but the dynamicVO is always null.
    Thanks for any help.

    Ok, my jdev version is: Studio Edition Version 11.1.2.2.0.
    I've got some problems which i can't deal with, access ViewObject in my Java class.
    I will show you my project file tree:
    http://i46.tinypic.com/2myxkwz.png
    and
    my TestClass.java:
    package model;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.ViewObject;
    import oracle.jbo.client.Configuration;
    import oracle.jbo.domain.Number;
    public class TestClass {
        public TestClass() {
            super();
        public static void main(String[] args) {
            String amDef = "models";
            String config = "AppModule";
            Configuration.createRootApplicationModule(amDef, config);
    }which causes error:
    Error Configuration File bc4j.xcfg is not found in the classpath
    cle.jbo.client.Configuration.loadFromClassPath(Configuration.java:471)
    at oracle.jbo.common.ampool.PoolMgr.loadConfiguration(PoolMgr.java:600)
    at oracle.jbo.common.ampool.PoolMgr.findPool(PoolMgr.java:526)
    at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1513)
    at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1490)
    at model.TestClass.main(TestClass.java:16)I found some similar topics to my, but none of them can help to solve my problem.

  • How to find custom converter code in ADF?

    Hi,
    I am trying to understand/debug a code which has a input text in page fragment(.jsff) in ViewController project  with the following converter
    <af:convertDateTime pattern="#{userPrefs.timeFormatPattern}"
                                                timeZone="#{userPrefs.UPTZ}"
                                                 timeStyle="short" type="time"
                                                hintTime="#{userPrefs.timeFormatPattern}"/>
    I want to see the code of userPrefs.Where can I find the corresponding java code?
    I have checked out faces-config file but I can't find it.Googling about the location of converter also did not help me.
    Thanks

    The userPrefs is most likely a managed bean defined in some configuration file in your application. It is not a "framework bean".
    If not in faces-config.xml you can look in adfc-config.xml or other adf task flow defintion files, where it is possible to define managed beans.
    JDeveloper has a search function that can search in all source files for a project. Using that you should be able to find where userPrefs is defined... unless it is included from another ADF application as an ADF library.
    Another option is that the userPrefs object (POJO/managed bean) is added to application-, session- or request scope programmatically... in that case you must search through the projects source code.

  • Include HTML code and ADF COMPONENTS

    I used Corel PHOTO-PAINT 12.0 for generate a web menu and i want to include in my project into a jspx page.
    When i paste the code of <table>.........</table> into tags <af:form></af:form> the page appears a mess in the browser.
    But if i use html only the page appears fine. I need tu use the html code for menu and i need use adf compont tu for display other data.
    my version of JV is 11.1.1.6.0

    Hi,
    try putting your html inside cdata tag like this
    <![CDATA[
    <a href="www.google.com">Google</a>
    ]]>Regards,

  • How to apply html css code in ADF pages

    I have the css code for all html components like buttons , text box, tabs etcc.. I want same look and feel in adf, I want to apply same css in ADF pages without/with minimal changes,
    I need very urgently,
    plz do needful ASAP.
    Thanks & Regards,
    Ram.

    Hi..
    Also this will helpful
    http://technology.amis.nl/blog/5722/using-adf-faces-11g-skinning-for-setting-the-styles-of-specific-component-instances-or-groups-of-instances

  • Refactor code styles

    Hi is there a program
    to read a java source
    code file and make a
    new java source file with
    a different coding style.
    for example:
    from
    public class Main {
              public static void main(String[] args) {
                           System.out.println("Hello world!");
    }to
    public class Main
              public static void main(String[] args)
                        System.out.println("Hello world!");
    }Your help would be appreciated. Thanks.
    PS I do not care which coding
    style is better ie no flame wars please.

    I made a refactor due
    to not like any of them.
    import java.io.*;
    import java.util.*;
    public class Main
         private static LinkedList<String> list = new LinkedList<String>();
         public static void main(String[] args) throws Exception
              BufferedReader in = new BufferedReader(new FileReader("whatever.java"));
              while(true)
                   String line = in.readLine();
                   if(line == null) break;
                   String replacedline = line.replace("\\s","");
                   if(replacedline.endsWith("{"))
                        list.add(replacedline.replace("{",""));
                        if(replacedline.startsWith("\t")) // collections / comparable a good solution? To count how many tabs?
                             int b = replacedline.replaceAll("[^\t]+","").length();
                             String tabs = "";
                             for(int count = 0; count < b; count++)
                                  tabs = tabs + "\t";
                             list.add(tabs + "{");
                        else //easier to read
                             list.add("{");
                   else //easier to read
                        list.add(line);
              in.close();
              PrintWriter pw  = new Printer(FileWriter fw = new FileWriter("new.java"));
              if(list.size() > 0)
                   for(String madeUp : list)
                        pw.println(madeUp);
              pw.close();
    }sample
    public class Whatever{
         public static void main(String[] args){
              fkjlflksdflldjf {
                   sdfsdfdsf
         public jfkjsdf  {
    }Meh for coding other way around.
    Message was edited by:
    throk

  • Code Review:: ADF BC applications

    Hi,
    We would like to know if there's any open source software available for code reviews of ADF applications and how to effectively use to for ADF BC applications?
    1) Am I moving in right direction while exploring PMD and Checkstyle? Are these the right candidates for setting automated code reviews for ADF applications?
    Is there a specific software recommendation by the forum members which can help me achieve this goal.
    2) Can CodeCoach and Audit features available in JDeveloper help me in this?
    3) Will I have to necessary create 'Custom Rules' for tasks like validating EO classes are not directly referred in the Controller? Are there some pre-built rule-sets available on this front?
    4) Any other suggestions for ensuring better/faster code reviews not necessarily replacing the manual peer review process but reducing the unnecessary headaches that can be fixed by freely available software
    Sid

    I started using ADFLogger and added some log statements. When I ran my application in JDeveloper in Embeded OC4J server, these log statements are appearing in JDeveloper server log window. After I deployed this application to Oracle Application Server, these statements are not appearing in the application.log file and also not in any file. Am I missing any configuration setting? The log current level is INFO and I do have few INFO statements, SEVERE statements in my code. Thanks in advance.

  • Inserting custom JQUERY inside in-built AJAX code of ADF

    Hello,
    I am using a JQUERY plugin for fancy select boxes in ADF. Once we perform any AJAX calls in the page, the JQUERY plugin does not work. So we need to add our JQUERY methods inside the AJAX codes to make it work. Can someone tell us where can we locate the AJAX files used in ADF.
    Any help on this would be highly appreciated.
    Thanks!
    Ank

    Hello,
    Thanks for the help but it did not help me. Let me explain you what I am trying to do:
    I am using a JQUERY plugin for <select> boxes which we call as "selectOneChoice" components. The JQUERY plugin converts normal selectOneChoice to an image based stylized selectOneChoice one.
    So I am using the JQUERY method as:
    $(document).ready(function() {
    $('select').selectbox();
    Problems that I am facing:
    This does not work on the first load of the page.
    If I click any Search button or reset link or any other buttons, the plugin goes off from the selectOneChoice boxes.
    The plugin also does not work for modal pop up which we call as af:popup.
    Please help me with the resolution.
    Thanks,
    Ank

  • How can i use ADF code in Trinidad

    Hi,
    I'm having an small Application which is Implemented to some extent using oracle ADF faces components But now, as the Trinidad is an open source i would like to do it in trinidad.
    If i replace the libraries to trinidad does my implement code in ADF Faces components needs to be Change,
    Please Suggest me how can use my ADF code in Trinidad.
    Thanks.

    Hi,
    Thanks for the Information a lot,it will helps me a lot.
    i am unable to navigate to down load the libraries given in oracle site in "How-to configure Apache Trinidad components in Oracle JDeveloper " can u help me,
    how can i get libraries to use in Oracle Jdeveloper for Trinidad.
    Can i use the libraries given on the Apache MyFaces Trinidad site (http://myfaces.apache.org/trinidad/download.html) but the libraries are different than the oracle given.
    Please Help me what libraries to used in Oracle jdeveloper 10g for trinidad.
    Thank You.

  • Create dynamic code on a JSF with ADF Faces

    Hi,
    the next is just sample, nothing to production system, but if I can do the sample I can do something to production system.
    Fine.
    let's suppose that I want to create a html link
    in run-time over a JSF page with ADF Faces component.
    I can do that, I did using javascript and Custom tag,
    but the html link is placed out of the body of the page instead of put it over the place that I put it in development-time
    so, now my question is:
    how I can generate dynamic code using ADF FACES component commandButton or any others.
    any suggestion??
    P.D. if you need more info ask me.

    Hello Jeanne.
    You are right, I used <f:verbatim> element to wrap all my non-JSF elements and it work. :)
    so good so far.
    but, dynamic code mean generate code in this case HTML in run-time.
    That is to say: write code HTML just in time I invoke a page.
    That is posible through Custom Tags.
    You create a Custom Tags this tag generate HTML code after to process any Business Logic. then you put the tag in the page that you want to use it
    someting like this:
    <afh:rowLayout halign="center">
    <afh:cellFormat halign="center">
    <ESE-utilities:populateMenu/>
    </afh:cellFormat>
    </afh:rowLayout>
    the just above bold line is my Custom Tag that generate HTML code
    and not work.
    but, if I replace the tag directly using HTML code in the page, for example:
    <afh:rowLayout halign="center">
    <afh:cellFormat halign="center">
    <f:verbatim>
    prueba
    </f:verbatim>
    </afh:cellFormat>
    </afh:rowLayout>
    it work
    so, now my new question is:
    ¿How can I use a Custom Tagthat generate HTML code, and that code have been written inside of my body page?
    Thanks in advantage for your reply.
    Mauricio

  • Code refactoring

    Hell code refactoring!
    I inhirite a Java application that was written 15 years ago with millions lines of code
    The code has many problems, including some very basic stuff like comparing object using ==. But somehow, it works and the company keeps using it
    The problem we are facing is the code doesn't support debugging. ALL of the methods have very limited number of variables. The coders writting something like this all over places
    if(getA().getB().getC().getD().getE().getM().equals(getA().getB().getC().getD().getE().getN()){
         getA().getB().getC().getD().getE().getM().setZ(getA().getB().getC().getD().getE().getN().getZ());
    int num = getA().getB().getC().getD().getE().getM().getList().size();
    for(int i = 0; i<num; i++){
        getA().getB().getC().getD().getE().getM().getList().get(i).setSomething();;
    It is unbelievable but it is real. Some of them have more than 10 get() on the same line
    I try to refactor it, adding local variables into the methods, so we can resuse the objects instead of using lines of get()
    It also help debugging the code possible because there are many recursive calls plus the above style make it almost impossible now. Whenever something happens, it took me days to figure out what is wrong
    I am going to break the get() chains but since the code base is huge, I don't know if we have some tools availble.
    If someone has solved similar problem, please give me some advice.
    Thank you very much

    2/ The code has many problems, not a single one. but I feel most important is debuggable.
    Well so far you haven't mentioned a single problem with the code. Further, the code sample you posted is 'debuggable'. But, again, you don't need to 'debug' code that works correctly.
    The below is a real function of the code that I renamed all the terms
    What is it about that code that makes you think it is not 'debuggable'?
    You have to pick your battles. You can't try to rewrite/refactor code just because you don't like the way it was written. That is NOT productive.
    Assuming you even have a need to refactor anything the first step is to identify the CRITICAL code sections/elements/classes/methods. Critical either because they are performance issues or critical because they are what keeps breaking.
    There are almost no comments in the code,
    Then, as I already mentioned, the FIRST step is to analyze the code and DOCUMENT IT. You posted a code snippet and said ABSOLUTELY NOTHING about what that method is supposed to be doing. Why not? Why didn't you post a comment? Have you 'analyzed' that code you posted? If not, why not?
    Your analysis should START with the method signature; the parameters and return type. Have you look at that for the sample you posted? If not, why not?
    Do you see anything unusual about it? I do.
    private Double returnCRValue(TsTRatingOperation aetnRatingOperation, String id) throws Exception {  
    Throws Exception? Almost any coded might throw an exception so why does this method just mention a generic exception instead of a specific one.
    The signature declares that the method returns an instance of Double. Does it actually do that?
    BigDecimal dbvalue = null;
    return dbvalue == null ? null : new Double(dbvalue.doubleValue());  
    Why does the method use BigDecimal in the body but then convert the value to a Double for the return? What if that BigDecimal value can't be converted properly to a Double without losing precision? Why isn't the method returning a BigDecimal? Then the caller can perform any conversions that might be necessary.
    The SECOND place to look for issues is the logic flow of the method. Does every IF statement have an ELSE? If not then why not. A common source of bugs is missing ELSE statements that cause code to fall through and work wrong when the IF condition isn't met. Same with CASE/SWITCH statements; big problem with fall through execution if a BREAK statement is missing when it is needed.
    Do you see any logic issues with that code you posted? I do.
            int nPolModTotal = 0;  
            if (aetnRatingOperation.getTsTRatingPASOperationTerm().get(0).getOperationCRs() != null) {  
                nPolModTotal = aetnRatingOperation.getTsTRatingPASOperationTerm().get(0).getOperationCRs().size();  
            //loop CRs  
            for (int n = 0; n < nPolModTotal; n++) {  
                String sid = aetnRatingOperation.getTsTRatingPASOperationTerm().get(0).getOperationCRs().get(n).getCRTypeReferenceCode().trim();  
                if (sid.equals(id.trim())) {  
                    dbvalue = aetnRatingOperation.getTsTRatingPASOperationTerm().get(0).getOperationCRs().get(n).getModFactorValue();  
    .. even more, possibly disastrous processing follows
    The value of 'nPolModTotal' is set to zero.
    Then there is an IF statement that MIGHT SET it to a real non-zero value.
    But WHAT IF IT DOESN'T? The rest of the code in the method will still execute. That for loop will escape ok because of its initialization statements but the next FOR loop will still execute. Is that the correct behaviour? I have no way of knowing. But it is certainly suspicious code for the second part to execute and compute a return value when the first part failed to execute.
    I would want to know why the code works that way and if it is correct or a bug waiting to happen.
    Loops of all kinds are also problematic: wrong initialization, wrong termination, unnecessary code within the loop instead of before the loop. Do you see any of the problems in the method you posted? I do.
    //loop CRs    
            for (int n = 0; n < nPolModTotal; n++) {  
                String sid = aetnRatingOperation.getTsTRatingPASOperationTerm().get(0).getOperationCRs().get(n).getCRTypeReferenceCode().trim();  
                if (sid.equals(id.trim())) {  
                    dbvalue = aetnRatingOperation.getTsTRatingPASOperationTerm().get(0).getOperationCRs().get(n).getModFactorValue();  
    Why does EVERY iteration potentially set (and overwrite) the value of 'dbvalue'?
    If the code is looking for a single match then it should EXIT the loop when it finds it. Why iterate through hundreds or thousands of entries (depending on the value of 'nPolModTotal') if you found your 'sid' on the very first match?
    What if there are two matches for that IF statement above? The value of 'dbvalue' will be set to the LAST ONE found. Is that the correct behaviour?
    There is nothing inherently wrong with those concatenated 'get' operations.  I'm assuming by your comments that you want to 'refactor' this line of code
    aetnRatingOperation.getTsTRatingPASOperationTerm().get(0).getOperationCRs()
    by creating an instance variable and capturing that value and then using that instance variable in the following loop?
    myOperationsCRs = aetnRatingOperation.getTsTRatingPASOperationTerm().get(0).getOperationCRs() ;
    for (int n = 0; n < nPolModTotal; n++) {    
                String sid = myOperationsCRs.get(n).getCRTypeReferenceCode().trim();
      Why? Why do you think you should 'refactor' that code and use an instance variable for the intermediate result?
    As I said before if I were you I would forget refactoring the code and focus on:
    1. analyzing what it does
    2. adding appropriate comments and annotations (e.g. for the parameters and return type
    3. identifying any logic issues (as I did above)
    4. researching those logic issues with a possible plan to fix them

  • Who can have ADF 11g Source Code?

    Hi all,
    Can I have the source code of ADF 11g when I buy ADF license and support for ONE user?

    You need a support contract, open a SR, ask for the source and then sign some agreements on how to use the source code.
    Timo

  • Should I do this with Java Code or Stored Procs ? (for best performance)

    Hi All,
    I need to decide where should I implement my business logic, in Java code or Stored procs.
    Here is the requirement :
    - One Order has 70 products (Order_Table )
    - Can be duplicate products, so I have to do summarize / grouping by product
    - For every product, I have to check, if it is entitled for a Bonus product, then I have to Insert one to Bonus_Table.
    - This is done when/after the transaction is SAVED (COMMIT)
    The question is, which one has better PERFORMANCE :
    (1) Create a rowsetIterator on the Order details (70 products) and call a stored procedure to do the logic for every single product (so that the Insert to Bonus_Table done in stored proc). means the stored proc will be called 70 times.
    OR
    (2) After the transaction is COMMITted, call the stored procs ONCE to do the logic for all the products at once.
    OR
    (3) I do all the logic with Java Code within ADF
    Given the requirement above, which approach is most efficient / best performance ?
    Thank you very much,
    xtanto

    Problem with this is that you ask 100 people and you probably get 100 different answers. ;o)
    Many would say that you push as much business logic into the database with your data; others might say you only put data in your database and your business logic is kept on the application server.
    In reality your would probably have a mix of both and your decision would probably be influenced by your own background ...
    Can't be more precise than that.
    Grant

Maybe you are looking for