Thursday, December 14, 2017

OAF - Code Snippet to get list of AM's Loaded in the page

             OAApplicationModule parentAM = pageContext.getRootApplicationModule() ;
             String[] nestedAMNames = parentAM.getApplicationModuleNames();
           
             // If you want to retrieve all currently loaded nested Application Modules
             ApplicationModule[] nestedAMs = new ApplicationModule[nestedAMNames.length];

             // oracle.apps.ar.hz.components.account.customer.server.HzPuiCustActAMImpl hzCustAccountAM = null;
             oracle.apps.ar.hz.components.account.contact.server.HzPuiActContRoleAMImpl  HzPuiActContRoleAM  = null;
             for (int i = 0; i < nestedAMNames.length && temp==0; i++)
             {
             nestedAMs[i] = parentAM.findApplicationModule(nestedAMNames[i]);
                 pageContext.writeDiagnostics(this,"nestedAMs["+i+"]" + nestedAMs[i],OAFwkConstants.STATEMENT);
              if(nestedAMs[i] instanceof HzPuiActContRoleAMImpl)
               {
                   temp = 1;
                   HzPuiActContRoleAM = (HzPuiActContRoleAMImpl)nestedAMs[i];
                   pageContext.writeDiagnostics(this,"Matching AM Found ; nestedAMs["+i+"]" + nestedAMs[i],OAFwkConstants.STATEMENT);
               }
             }

No comments: