Monday, 12 December 2011

Calling Methods in AM from CO

PFR

//method 1
    OAApplicationModule am1 = (OAApplicationModule)pageContext.getApplicationModule(webBean);
    am1.invokeMethod("addNewOverride");
//method 2
    OverridesAMImpl am2 = (OverridesAMImpl)am1;
    am2.addNewOverride();
//method 3
    OverridesAMImpl am3 = (OverridesAMImpl)pageContext.getApplicationModule(webBean);
    am3.addNewOverride();

Ways VO can be called from CO
---------------------------------------
    OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("OverridesFullVO1");
    if(vo!=null)
    {
     vo.clearCache();
     vo.executeQuery();
    }


Ways VO can be called from AM
----------------------------------------
    OAViewObject vo = (OAViewObject)getOverridesFullVO1();
    OAViewObject vo1 = getOverridesFullVO1();
    OAViewObject vo2 = getOverridesFullVO1();
    vo.setAssociationConsistent(); // standard method in vo

    //once you class cast into Impl, you would be able to invoke the custom methods in VOImpl directly
    OverridesFullVOImpl vo3 = (OverridesFullVOImpl)vo2;
    vo3.getCurrentMetroGroup();    // Custom Method in OverridesFullVOImpl   
   
    //another way is do not cast with OAViewObject
    getOverridesFullVO1().setTravelFlag();


Ways VO can be called from VO
----------------------------------------

// Call any getter/setter methods listed there

No comments:

Post a Comment