JDAPI, java library to work on Oracle Forms (. FMB)Filed Under: Oracle
Here is a simple package that I made in Java to proceed to a “search and replace” in the blocks of FMB files. Warning, the following code modifies all FMBs in the specified directory. I give you the JAR file and the code. It’s very useful when needed.
It come with absolutly NO WARRANTY .. be careful. I am not responsible if it causes problems with your files. It may be used for personnal and commercial purpose.. and bla bla bla …
Have been tested under Micro$soft Windows only.
You must have Java 1.6.0_12 or later and frmjdapi.jar have to be in the “CLASSPATH”.
You can run it the following way :
java -jar findAndReplace.jar c:\fmb\ old_word new_wordpackage findandreplace; /** * * @author guroot * http://www.guroot.com */ import oracle.forms.jdapi.*; import java.io.*; class FmbFilter implements FilenameFilter { public boolean accept(File dir, String name) { return (name.endsWith(".fmb")); } } public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here FormModule fmb; String plsql; FilenameFilter filter = new FmbFilter(); File dir = new File(args[0]); String[] list = dir.list(filter); for(int i = 0; i< list.length;i++) { System.out.print(list[i]); fmb = FormModule.open(args[0]+"\\"+list[i]); JdapiIterator blocks = fmb.getBlocks(); while(blocks.hasNext()) { Block block = (Block)blocks.next(); // Triggers JdapiIterator triggers = block.getTriggers(); while(triggers.hasNext()) { Trigger trigger = (Trigger)triggers.next(); plsql = trigger.getTriggerText(); plsql = plsql.replace(args[1], args[2]); trigger.setTriggerText(plsql); } } fmb.destroy(); } // end for } }
- Permalien
- guroot
- 05:22 PM
- Comments(0)