• ADF代码运行和调试AM


    ADF自带了一个TestClient用来调试和运行AM的程序,但修改AM代码后要重新启动TestClient,效率不高。这里介绍一种使用代码运行AM的方法,代码如下:

    import model.common.AppModule;
    
    import model.queries.DeptVOImpl;
    import model.queries.EmpVOImpl;
    
    import model.queries.EmpVORowImpl;
    
    import oracle.jbo.Row;;
    import oracle.jbo.server.ApplicationModuleImpl;
    import oracle.jbo.client.Configuration;
    // ---------------------------------------------------------------------
    // ---    File generated by Oracle ADF Business Components Design Time.
    // ---    Sat Feb 15 15:46:55 CST 2014
    // ---    Custom code may be added to this class.
    // ---    Warning: Do not modify method signatures of generated methods.
    // ---------------------------------------------------------------------
    public class AppModuleImpl extends ApplicationModuleImpl implements AppModule {
        /**
         * This is the default constructor (do not remove).
         */
        public AppModuleImpl() {
        }
    
        /**
         * Container's getter for EmpVO1.
         * @return EmpVO1
         */
        public EmpVOImpl getEmpVO1() {
            return (EmpVOImpl)findViewObject("EmpVO1");
        }
    
        /**
         * Container's getter for DeptVO1.
         * @return DeptVO1
         */
        public DeptVOImpl getDeptVO1() {
            return (DeptVOImpl)findViewObject("DeptVO1");
        }
    
        public void test() {
            EmpVOImpl vo = this.getEmpVO1();
            vo.executeQuery();
            while (vo.hasNext()) {
                Row rt = (EmpVORowImpl)vo.next();
                String LastName = (String)rt.getAttribute("LastName");
                System.out.println("LastName:" + LastName);
            }
        }
        //添加main方法
        public static void main(String[] cmd) {
            String amDef = "model.AppModule";
            String config = "AppModuleLocal";
            AppModuleImpl am =
                (AppModuleImpl)Configuration.createRootApplicationModule(amDef,
                                                                         config);
            am.test();
            Configuration.releaseRootApplicationModule(am, true);
        }
    }

    其中amDef和config的值可以在bc4j.xcfg找到,分别是ApplicationName属性和name属性的值。

  • 相关阅读:
    尘埃里的路人甲
    尘埃里的路人辛
    尘埃里的路人庚
    尘埃里的路人己
    尘埃里的路人戊
    尘埃里的路人丁
    C语言II博客作业04
    C语言II博客作业03
    C语言II博客作业02
    C语言II博客作业01
  • 原文地址:https://www.cnblogs.com/weisuoc/p/3551670.html
Copyright © 2020-2023  润新知