Extend a standard Oracle MSCA/MWA page

source:http://apps2fusion.com/at/43-ss/293-extend-a-standard-oracle-mscamwa-page

In this Article, we will see how to extend a standard Oracle MSCA/MWA pages.
It is a common requirement by most of the customers to do some modifications to standard Mobile forms to suit their requirements better. Most common requirements include:

 

 

 

 

  •  Add a field to a page
  •  Hide a field
  •  Make a field Read only.
  •  Change a LOV to Text and Vice versa.
  •  Change the Labels
  •  Default some values to a field. etc

 

I assume that the readers of this article have already gone through my previous articles as they need basic understanding of the MSCA/MWA Architecture.

 

As MSCA/MWA is based on Java, we can easily achieve this by the OOPS Concept "Inheritance". We create a new Java Class which inherits the Standard Oracle Java Class. In the new extended Java class, we have freedom to change the standard page behaviour without touching the Oracle Standard Java Source Code.

 

 

The Normal flow in MSCA Applications is described in the following diagram:

 

 

 After we do the extension, the flow in the application will be like 

Hence we need to perform the following steps in order to do a extension in MSCA.
  1. Extend the MWA Function Class and make it point to the Extended page.
  2. Extend the MWA Page Class.
  3. Extend the MWA Listener Class.
  4. Modify the Function Name in AOL to point to the New extended Function Class name.
We will now look each step in detail by taking an example. Lets assume that the customer want to add a new Text Field in standard Ship LPN page.
Navigation to the ShipLPN page in Mobile Applications:
Warehouse Management -> Outbound -> Shipping -> LPN Ship
Oracle Standard page before extension:
Step 1: Extend the Function Class:
package xxx.oracle.apps.inv.wshtxn.server;
import oracle.apps.inv.wshtxn.server.ShipLPNFunction;
public class XXShipLPNFunction extends ShipLPNFunction {
    public XXShipLPNFunction() {
   
        super();
       
        //Setting the page name to new custom page
        setFirstPageName("xxx.oracle.apps.inv.wshtxn.server.XXShipLPNPage");
       
    }
}
Step 2: Extend the Page Class:
package xxx.oracle.apps.inv.wshtxn.server;
import oracle.apps.inv.wshtxn.server.ShipLPNPage;
import oracle.apps.mwa.beans.ButtonFieldBean;
import oracle.apps.mwa.beans.TextFieldBean;
import oracle.apps.mwa.container.Session;
import oracle.apps.mwa.eventmodel.AbortHandlerException;
import oracle.apps.mwa.eventmodel.DefaultOnlyHandlerException;
import oracle.apps.mwa.eventmodel.InterruptedHandlerException;
import oracle.apps.mwa.eventmodel.MWAEvent;
import oracle.apps.mwa.eventmodel.MWAListener;

public class XXShipLPNPage extends ShipLPNPage {

    public XXShipLPNPage(Session s) {
        super(s);
        //Add a new button and set the properties.
        mTxtField = new TextFieldBean();
        mTxtField.setName("XX_TEXT");
        mTxtField.setPrompt("New Text");
        mTxtField.addListener(xxListener);
        mTxtField.setValue("Initial Text");
        this.addFieldBean(3, mTxtField);
    }

    public void pageEntered(MWAEvent e) throws AbortHandlerException,
                                               InterruptedHandlerException,
                                               DefaultOnlyHandlerException {
        super.pageEntered(e);
        //Initialize Extended page.
        initCustomPage(e);
    }
    //This method is needed to make LOVs and some Submit buttons to work properly after extension
    //The purpose of this method will be explained in later articles.
   
    public void initCustomPage(MWAEvent e) {
       
        //Doc Door LOV initialization
        String[] inputs =
        { " ", "TXN.DOCK", "ORGID", "xxx.oracle.apps.inv.wshtxn.server.XXShipLPNPage.ShipLPN.DockDoor" };
        getDockDoorFld().setInputParameters(inputs);
       
        //LPN Lov initialization
        String[] lpnInputs =
        { " ", "ORGID", "LOCATORID", "TRIPID", "TRIPSTOPID",
          "xxx.oracle.apps.inv.wshtxn.server.XXShipLPNPage.ShipLPN.LPN" };
        getLpnFld().setInputParameters(lpnInputs);
       
        Session session = e.getSession();
      
       //Continue button initialization
        ButtonFieldBean continueButton =
            (ButtonFieldBean)session.getFieldFromCurrentPage("ShipLPN.Ship");
        continueButton.removeListener((MWAListener)continueButton.getListeners().firstElement());
        continueButton.addListener(xxListener);
    }
    TextFieldBean mTxtField;
    //set new Listener to the page
    XXShipLPNFListener xxListener = new XXShipLPNFListener(new Session());
}
Step 3: Extending the Listener Class:
package xxx.oracle.apps.inv.wshtxn.server;
import oracle.apps.inv.wshtxn.server.ShipLPNFListener;
import oracle.apps.mwa.container.Session;
public class XXShipLPNFListener extends ShipLPNFListener {
    public XXShipLPNFListener(Session s) {
    super(s);
    }
}
*****After extending all three Java files deploy the class files into the Apps Instance
Step 4: Modify the Function Name in AOL to point to the New extended Function Class name.
 
And here we go the new look of the extended page.
There is a little bit tweaking needed to make LOVs and some other submit button to work properly after extension.You can see this piece of code in our Extended Page Class. This is actually a flaw in MSCA/MWA . We will discuss more about this in next articles.

For MSCA/OAF consulting kindly contact us at  senthilkumar.s.shanmugam@gmail.com

posted @ 2013-04-08 17:33  PPTNotes  阅读(1646)  评论(0编辑  收藏  举报