ITPub博客

首页 > 数据库 > Oracle > OAF Sample Code

OAF Sample Code

Oracle 作者:贾三灌汤包 时间:2014-04-04 15:57:09 0 删除 编辑

Get the VO from the AM

OAViewObject objAssessmentVO = (OAViewObject)yourAM.findViewObject("yourVO");

  1. MtlLotNumbersVOImpl vo= (MtlLotNumbersVOImpl)findViewObject("MtlLotNumbersVO1");  
  2. MtlLotNumbersVORowImpl voi=(MtlLotNumbersVORowImpl)(vo.getCurrentRow());  
  3.   
  4. mLotDetailValuesHT.put("StatusId",voi.getStatusId());  


First get the AM where your VO is attached, then get the VO from that AM.Get the RootAM and get all the VOs under that AM, using


  1. writeLog(pageContext, "Room AM"+ pageContext.getRootApplicationModule());  
  2. String[] rootViewNames = pageContext.getRootApplicationModule().getViewObjectNames();  
  3. writeLog(pageContext," Length of the VOs from Rootm AM "+rootViewNames.length);  
  4. for (int j =0 ;j
  5. {  
  6. pageContext.writeDiagnostics(this, j +" Value "+rootViewNames[j]);  
  7. }  
  8.   
  9. If your VO is not available in that AM, get the nested AM and then check for your VO inside that AM,  
  10.   
  11. Use the below code to get the AM if your AM is not root AM,  
  12. public OAApplicationModule getRequestedAM(OAPageContext pageContext, String requestedAMName)  
  13. {  
  14. writeLog(pageContext,"Requested AM called to check the AM "+requestedAMName );  
  15. String amName = "";  
  16. String objectivesAMName = requestedAMName;//"ObjectivesAM";   
  17. String nestedAMArray[] = pageContext.getRootApplicationModule().getApplicationModuleNames();  
  18. pageContext.writeDiagnostics(this,"Root AM=>"+pageContext.getRootApplicationModule().getName() + " Child AMs=>"+ nestedAMArray.length,1);  
  19. OAApplicationModule currentAM = null;  
  20. currentAM = (OAApplicationModule)pageContext.getRootApplicationModule();  
  21. for(int i = 0; i < nestedAMArray.length; i++)  
  22. {  
  23. amName = nestedAMArray;  
  24. pageContext.writeDiagnostics(this,"Nested AM Name=>"+amName + "and amName.indexOf(objectivesAMName) "+amName.indexOf(objectivesAMName),1);  
  25. currentAM = (OAApplicationModule)pageContext.getRootApplicationModule().findApplicationModule(amName);  
  26. //Get the view names   
  27. String[] viewNames = currentAM.getViewObjectNames();  
  28. for (int i =0 ;i
  29. {  
  30. writeLog(pageContext,i +" Value "+viewNames);  
  31. }  
  32. if(!(amName.indexOf(objectivesAMName)==-1))  
  33. {  
  34. pageContext.writeDiagnostics(this,"Found Handle to My Nested AM " + amName ,1);  
  35. break;  
  36. }  
  37. }  
  38. return currentAM;  
  39. }  

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22816976/viewspace-1136172/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-11-03

  • 博文量
    128
  • 访问量
    294236