Back to Home

Exploring Oracle Form with the Java Development API (JDAPI)

use of tables in pl / sql · jdapi · Oracle of forms · dependencies of objects in forms

Exploring Oracle Form with the Java Development API (JDAPI)

    To find the dependence of the form on the database objects, I needed to parse the Oracle Form file (hereinafter - the fmb file).
    Fmb is a pseudo-text file, if you really need it, you can see the PL / SQL code and look for how the database objects are used there, but it's still difficult to understand the type of trigger or program and what form element it refers to. You can use the conversion to FMT, but I do not think that parsing the fmt file is easier than using the API that Oracle gives.
    Moreover, the rest of my program was written in Java Swing, it was more logical to use JDAPI, which allows me to parse forms on shelves and see all the PL / SQL code and properties that interested me.

    In fact, everything turned out to be simple. You have Oracle Forms installed, so everything is in place. The jar archive that you need to connect to your java application is called frmjdapi.jar, you can search it in the directory tree under ORACLE_HOME, most likely it is% ORACLE_HOME% \ jlib \ (Oracle Middleware) or% ORACLE_HOME% \ forms \ java \ (Forms 10 )
    Fmb opening
    	JdapiModule module = null;
            File theFile = new File(path);
           module = JdapiModule.openModule(theFile);
    


    Getting a list of options
    for (JdapiIterator params = ((FormModule)module).getModuleParameters(); params.hasNext();){
      ModuleParameter param = (ModuleParameter) params.next();
      System.out.println(param.getName());
             			}
    


    Block list
    for (JdapiIterator blocks = ((FormModule)module).getBlocks(); blocks.hasNext();){
      Block block = (Block) blocks.next();
      System.out.println(block .getName());
             			}
    

    Block properties
    if (!block.getWhereClause().equals(""))
           	System.out.println("Where Clause: "+ block.getWhereClause());
    if (!block.getOrderByClause().equals(""))
    	System.out.println("Order by Clause: "+ block.getOrderByClause());
    if (!block.getParentName().equals(""))
    	System.out.println("Reference Object: "+ block.getParentName();
    if (block.isInsertAllowed())
    	System.out.println("Insert Allowed: Yes");
    else
    	System.out.println("Insert Allowed: No");
    if (block.isDeleteAllowed())
    	System.out.println("Delete Allowed: Yes");
    else
    	System.out.println("Delete Allowed: No");
    if (block.isUpdateAllowed())
    	System.out.println("Update Allowed: Yes");
    else
    	System.out.println("Update Allowed: No");
    


    The logic is clear. My Eclipse just told me everything I needed. So you can get any information about the form.
    For my purposes, JDAPI was very suitable for me, along the way the browser forms were written.
    The forms in it look something like this .
    Unfortunately, with Oracle Report it just didn’t work out that way. But in Oracle, the impression was that forms and reports seemed to write two different teams that also did not like each other.
    For some reason, the API did not give for reports. I had to convert the rdf file in batch to XML with the command
    rwconverter stype = rdffile source = "+ f.getAbsoluteFile () +" dtype = xmlfile dest = "+ xmlFileName +" batch = yes
    and then parse this XML with org.xml.sax, but this is another story.

    Read Next