OAF Sample Code

目录(?)[-]

  1. Get the VO from the AM
  2. Getting Setting ValueCapturing the value from VO and setting Explictiy in EO
  3. voinitQuery
  4. Simple查询
  5. 设置窗口的title 和 message的使用
  6. 调用页面代码
  7. 处理back button
  8. 检查主键的唯一性同时在缓存和数据进行检查在EO中进行数据验证检查
  9. 进行数据的初始化应该在EO的create函数中进行
  10. 日期验证
  11. VO循环迭代
  12. 删除确认窗口
  13. 删除调用及显示删除信息

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. }  
请使用浏览器的分享功能分享到微信等