📜 ⬆️ ⬇️

Oracle Form Study with Java Development API (JDAPI)

To search for form dependencies on database objects, I needed to disassemble an Oracle Form file (hereinafter, the fmb file).
Fmb is a pseudo-text file, if you really need it, PL / SQL code can be seen and searched for how database objects are used there, but it is still difficult to understand the type of trigger or program and to which element of the form it belongs. 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 provides.
Especially since the rest of my program was written in Java Swing, it was more logical to use JDAPI, which allows you to parse the forms on the shelves and see all the PL / SQL code and properties that interested me.

In fact, everything turned out to be simple. You have installed Oracle Forms, it means everything is in place. The jar archive that needs to be connected 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 ).
Opening fmb
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 suited me a lot, a browser was written along the way.
The form in it looks something like this .
Unfortunately, Oracle Report just didn’t work out that way. But in Oracle, it seems that forms and reports seemed to be written by two different teams that didn’t like each other.
For some reason, the Oracle API did not give 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 using org.xml.sax, but that’s another story.

')

Source: https://habr.com/ru/post/263675/


All Articles