How to invoke Application Module method from entity object methods

Hi,
We have an existing Application Module which provides some validation logic. We are using OperatingBinding or getting the Application Module instance from the bindings and then invoking the app module methods in the view controller project.
But in our current scenario, We need to invoke the application module method from the setAttribute method in the entity object when ever an entity attribute value is changed . I believe we can call createRootApplicationModule method to create application module instance. But this may lead to performance overhead.
Can you please suggest, if there is any alternative to invoke the application module method inside the business components.
What is the best way to create

We have a pricing service, which was developed as a separate application. We need to invoke the pricing service with the change in certain attributes of the entity object and update some of the attributes of the current entity object. At present we are handling these calls to the pricing service in the ui layer in the valueChangeListener.
But we would like to move this service call into setAttribute method as we are unable to prevent the call to the service if the model validations fail. I am looking for the best possible approach for invoking the service calls from the entity objects.
Thanks and Regards,
S R Prasad

Similar Messages

  • How to call Apps Module Custom Method from Entity Object / View Object ?

    Hi All,
    I create a custom method in AppsModuleImpl.java. How can I call that custom method from a setter method on Entity Object / View Object ?
    (I have tried to use Configuration.createRootApplicationModule(amDef,config); but it is not the correct way, is it? )
    Below is my code :
    The setter on MyEntityImpl.java :
    public void setKodeprd(String value) {
    setAttributeInternal(KODEPRD, value);
    if (getProduct() != null) {
    // CALL the getSalesPrice custom method from here, HOW ??
    The Application Module custom method :
    public Number getSalesPrice(String priceCode, String kodePrd) {
    Number price = new Number(0);
    String [] theKey = {priceCode, kodePrd};
    Key priceKey = new Key(theKey) ;
    ViewObject SalesPrice = getSalespricedView1();
    Row[] salesPriceRow = SalesPrice.findByKey(priceKey, 1);
    price = ((SalespricedViewRowImpl)salesPriceRow[0]).getPrice();
    SalesPrice.remove();
    return price;
    Thank you for your help,
    xtanto

    inside the EntityObjectImpl :
    YourAppModuleImpl am = (YourAppModuleImpl)getDBTransaction().getRootApplicationModule().findApplicationModule("YourAppModuleorServiceName");

  • How to get application module instance from java bundle?

    Hi!
    I would like to build an application that would get all translations from a database table.
    So I created application module for translations that contains a view object which is selecting translations for specific language from a database table. I exposed a method in application module as client interface which returns HashMap<String, String> for all translations for specific language. When I test my view and client interface method call they work fine.
    Then I created java bundle classes to get translations for specific language. Then I tried to override public Object[][] getContents() method.
    I tried to get my translations application module like this:
    SharedTranslationsAppModuleImpl am = new SharedTranslationsAppModuleImpl();
    Map<String, String> translationsMap = am.getTranslations(this.getLocaleCode); // Client interface method call
    In getTranslations(String LocaleCode) I try to get that view (which would select translations from database) but it returns NULL and I get NPE error message.
    So what is the right way to get application module from java bundle file? Now everytime application wants to get translations, application stops and displays NPE message.
    Regards, Marko
    I use JDeveloper 11.1.2.1.0

    Marko,
    you can't just instantiate an application module. An application module has to be set up, db connections and memory pools have to be initialized and ....
    Can you describe why and when you try to read the resource bundle from the db and where the resource bundle is used?
    This blog may be what you are looking for http://technology.amis.nl/2012/08/10/implement-resource-bundles-for-adf-applications-in-a-database-table/
    Timo

  • Help!! - Unable to use the Application Module Deployed as Corba Object in Oracle 8i

    I have been able to successfully deploy an Application Module in Oracle 8i but i am un able to get a reference to the Application Module from the database the code used by me is -
    package client;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.Hashtable;
    import oracle.jbo.*;
    import org.omg.CORBA.*;
    public class Corba8IClient{
    Hashtable env = new Hashtable();
    ApplicationModule appMod = null;
    String theAMDefName = "test/jd/freshJBO.FreshJBOModule";
    public Corba8IClient() {
    System.out.println("Started...");
    // Load the Application Module
    try{
    // Component deployed to Oracle8i CORBA Server.
    // Set up the 8i environment
    System.out.println("Setting up initial Context...");
    env.put(Context.INITIAL_CONTEXT_FACTORY, JboContext.JBO_CONTEXT_FACTORY);
    env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_ORACLE8I);
    env.put(Context.SECURITY_PRINCIPAL, "jd");
    env.put(Context.SECURITY_CREDENTIALS, "jd");
    env.put(JboContext.HOST_NAME, "Dev51");
    env.put(JboContext.CONNECTION_PORT, "2481");
    env.put(JboContext.ORACLE_SID, "ORA8I");
    // env.put(JboContext.APPLICATION_PATH, "test/jd/");
    System.out.println("Getting initial Context.");
    Context ic = new InitialContext(env);
    System.out.println("Doing Lookup...");
    ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup(theAMDefName);
    System.out.println("Calling create...");
    // home
    System.out.println("Home Class Name : "+home.getClass().getName());
    oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome am = (oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome)home;
    System.out.println("DefName "+am.getDefName());
    appMod = home.create();
    System.out.println("Setting up connetion from AppMod to database...");
    appMod.getTransaction().connect("jdbc:oracle:thin:jd/jd@dev51:1521:ORA8I");
    }catch(Exception e) {
    e.printStackTrace();
    System.out.println("AppMod full Name "+ appMod.getFullName());
    public ApplicationModule getAppMod(){
    return appMod;
    public static void main(String args[]){
    Corba8IClient c8c = new Corba8IClient();
    after running the output is -
    Started...
    Setting up initial Context...
    Getting initial Context.
    Doing Lookup...
    Diagnostics: Silencing all diagnostic output (use -Djbo.debugoutput=console to see it)
    Calling create...
    Home Class Name : oracle.jbo.client.remote.corba.aurora.AuroraApplicationModuleHome
    DefName null
    oracle.jbo.ApplicationModuleCreateException: JBO-25222: Unable to create application module.
    at oracle.jbo.client.remote.corba.CORBAApplicationModuleHomeImpl.create(CORBAApplicationModuleHomeImpl.java:63)
    at client.Corba8IClient.<init>(Corba8IClient.java:39)
    at client.Corba8IClient.main(Corba8IClient.java:53)
    java.lang.NullPointerException
    at client.Corba8IClient.<init>(Corba8IClient.java:45)
    at client.Corba8IClient.main(Corba8IClient.java:53)
    Corba Object is deployed as -
    ObjectName = /test/jd/freshJBOModule
    Server Class = freshJBO.server.o8.FreshJBOModuleServerO8
    Helper Class = oracle.jbo.common.remote.corba.RemoteApplicationModuleHomeHelper
    The Application Module conatians an entity object and a view object for Dept Table in schema jd(Username -jd, Password -jd).

    Moneesh,
    I believe there is a problem with the way you set the variable theAMDefName. It should be:
    String theAMDefName = freshJBO.FreshJBOModule";
    Then you need to reinstate the line you commented out, to set the application path (but remove the trailing / from the path, as shown):
    env.put(JboContext.APPLICATION_PATH, "test/jd");
    If that doesn't work, and for future reference, I suggest testing your deployed application module from the Business Component Browser (aka the tester) before trying your hand-coded client. Start the tester, select Oracle8i as the middle tier server type, make sure the other information in the connect window is correct, then click Connect.
    Good luck
    Blaise

  • Adobe Configurator - how to invoke action or script from html widget?

    How to invoke action or script from html wiget in Adobe Configurator?
    Please help! I tried to make it about 5 hours!
    I need something like that:
    I click link or image
    ...and it runs action.
    Thanks!

    If you click on the question mark ( as shown below) on the right of Configurator  2 window
    the user guide installed on your computer within Configurator 2  will open
    Anyway once you have your action or script button  in your panel you must select it and configure it in the  inspector palette

  • How to invoke a Java Program from Oracle 10g?(uRGENT)

    Hello.
    I've a query, that i have a program, that basically retreives the records from the
    oracle table and then parser this information and then insert the values in corresponding database base tables. I want that, whenever the new program is inserted, a Trigger should fire and pass the most recently entered record to the Parser Program, means
    1) Firing a Trigge
    2)Storing the most latest data and pass it to the Parser PROGRAM
    Can someone tell me how to do this? How to invoke a Java Program from within the database? Please if anyone has examples provide me. Its very urgent and tell me what is the basic mechanism.
    Thankyou.
    Ben

    With Java Stored Procedures Java may be caleed from a database.
    http://www.oracle.com/technology/tech/java/jsp/index.html

  • ADF Libary Issue - Application Module disappear from data control

    Hi All,
    I am facing an issue while adding an Application module to an ADF project as an ADF libray.
    I have two applications - ADF Application1 with Model1 project having an Application module AM1, ADF Application2 with Model2 project having an Application Module AM2
    I have created an ADF library jar file of Model1 project.
    When I add it to Model2 project, the Application Module AM2 of Model2 disappears and Application Module AM1 from the library appears in data control.
    Please suggest what could be wrong.
    Regards,
    Rekha

    Hi,
    verify that both application modules don't share the same ID in their databindings.cpx file. Which release version of JDeveloper 11g are you on ?
    Frank

  • How to uninstall applications I installed from Application store?

    Can anybody show me how to uninstall applications I installed from Application store?
    I mean I want to remove the applications completely from my iphone, not just hide the icons.

    Page 127 of the manual:
    "You can delete applications you’ve installed from the App Store. If you delete an
    application, data associated with the application will no longer be available to iPhone,
    even if you reinstall the application.
    You can reinstall any application and any associated data from your iTunes library
    as long as you backed up the application by syncing to your computer. If you try to
    delete an application that hasn’t been backed up to your computer, an alert appears.
    Delete an App Store application:
    1 Touch and hold any application icon on the Home screen until the icons start to
    wiggle.
    2 Tap the “x” in the corner of the application you want to delete.
    3 Tap Delete, then press the Home button to save your arrangement."
    http://manuals.info.apple.com/enUS/iPhone_UserGuide.pdf

  • HOWTO: Expose Entity Object Methods to Clients

    By design, clients cannot directly access entity objects. The view object layer provides an extra layer of security--you can choose exactly what data and methods you want clients to see.
    This HOWTO describes the process of exposing an entity object method to client programs.
    First, if you don't already have one, you must base a view object on your entity object and add the view object to your data model. For full details of how to do this, see the help topics under
    +Developing Business Components
    --Working with View Objects, View Links, Application Modules, and Clients
    +----Creating and Modifying View Objects, View Links, Application Modules, and Clients
    For the purposes of this HOWTO, we'll assume that you already have an entity object, Employees, with a method on it, calculateBonus(),
    and a view object EmployeesView based on Employees.
    First, you must generate a view row class. A view row represents one row of the view object's cache; it corresponds to a view of a particular entity object.
    To generate a view row class:
    1. Right-click EmployeesView and choose Edit.
    2. In the View Object Editor, select the Java page.
    3. Select Generate Java File and Generate Accessors for the view row class.
    4. Click Done. This creates a class called EmployeesViewRowImpl.
    Next, you should add a "delegator" method to the view row class--a public method with the exact same signature as the entity method, that simply calls the entity method. For example:
    public int calculateBonus(int rating) {
    return getEmployees().calculateBonus(rating);
    Next, you should export this method.
    1. Right-click EmployeesView and choose Edit.
    2. In the View Object Editor, select the Client Row Methods page.
    3. Shuttle the method you just created into the Selected list and click Done.
    This creates an interface called EmployeesViewRow that contains your method.
    Now you can call the method from your client. You should cast the row returned by EmployeesView.current(), the <jbo:Row> tag, or a similar method or data tag to EmployeesViewRow.
    For example,
    <jbo:Row id="myRow" datasource="ds" action=Current>
    <% out.println(((EmployeesViewRow) myRow).calculateBonus(3)); %>
    </jbo:Row>
    null

    Hi Lisa,
    There's a difference between exporting methods (on an application module, view object, and view row--this is done on the "Client Methods" tab of the view object and application module wizards and the "Client Row Methods" tab of the view object wizard) and making an application module remotable (which is done on the "remote" tab of the application module wizard).
    You should always export methods you want clients to use--and you only need to do this on the application module if you've written methods on your application module (which I didn't in this HOWTO). You can still use these methods in local mode--the interfaces will be present locally. The advantage of exporting methods is that it doesn't lock you into local mode--you'll be able to change to remote mode later (if you decide that's the way to go) with minimal changes--because the interfaces will be present locally even when the implementation classes aren't.
    By contrast, you should only make an application module remotable if you're planning on deploying in a non-local configuration. You can do this step right before deployment.
    Hope this helps,
    Avrom
    null

  • Calling database stored  function from Entity Object

    Hi,
    I want to call a database stored function from create() method of Entity Object.
    Database function returns some value.
    Can anybody suggest me some way to do it.

    You can try the following:
    make a String whit your function call, I dont know if this is the correct SQL syntax for a function, it should be for a stored procedure.
    String call = "begin; callyourfunction; end;"
    PreparedStatement ps = getDBTransaction().createPreparedStatement(call,0);
    ps.execute();
    ResultSet rs = ps.getResultSet();
    You can now read the data from the function from the rowset.
    Be sure to cleanup the PreparedStatement when your done whit it to avoid open database connections.
    ps.close();ps=null;

  • Accessing a method from within another method

    I am having trouble accessing a method from inside a method in the same class.
    here is my code:
    public String getAns(int ans){
    answer = ans;
    ranswer = number1 * number2;
    if(answer != ranswer){
    return "No. Please try again";
    }else{
    return "Very good!";
    genQues();
    when i run this i get an Unreachable code error pertaining to genQues();
    is this allowed in Java and is there a more practical way to go about this?
    Thank you in advance

    next time use the correct code tags to post your code.
    Think of your problem like this though.
    You write
    if( something )
    then return some value;
    else
    then return some other value.
    The returns end the method here, returning the value.
    So, if the method ended at one of these 2 statements, how do you think it'll reach genQues(); ?
    Hope this helps.

  • Calling a method from a static method

    hello all,
    I'm calling a non-static method from a static method (from the main method). To overcome this i can make the method i am calling static but is there another way to get this to work without making the method that is being called static?
    all replies welcome, thanks

    When you call a non-static method, you are saying you are calling a method on an object. The object is an instance of the class in which the method is defined. It is a non-static method, because the instance holds data in it's instance variables that is needed to perform the method. Therefore to call this kind of method, you need to get (or create an instance of the class. Assuming the two methods are in the same class, you could do
    public class Foo
         public static void main(String[] args)
                Foo f = new Foo();
                f.callNonStaticMethod();
    }for instance.

  • Calling view controller method from component controller method

    Hi,
    Is there any way to call view controller method from component controller method?
    Thanks,

    Hi Khandal.
    You should not make you component controller dependent from a view controller.
    But what you can do is to define an event in the component controller. The view
    controller can register for this event.
    In the stage where you currently want to call the view controller method just fire
    the event. In the event handler method in the view controller you can call the
    method then.
    Why do you need to call a view controller method? Can you give more details
    about the scenario?
    Cheers,
    Sascha

  • Calling stored procedures from entity object and application module

    Hello
    I've put in place an EntiyImpl base class containg helper methods to call stored procedures.
    I now need to call stored procedures from the application module.
    Apart from creating an application module base class and duplicating the helper method code is there a way
    to share the helper methods for calling stored procedures between the entity impl and application module impl ?
    Regards
    Paul

    Does the helper code depend on features of a particular entity object instance, beyond its database transaction?
    If so, I'm not sure I see how it could be used from an application module class.
    If not, here's what you do:
    Step 1:
    Parametrize the database transaction--you might even want to. So instead of
    protected myHelperMethod(Object someParam) {
    DBTransaction trans = getDBTransaction();
    change this to
    protected myHelperMethod(DBTransaction trans, Object someParam) {
    Step 2: make the method public and static--once you parameterize the DBTransaction, you should be able to do this.
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    Step 3: Remove the method from your EntityImpl base class into a utility class:
    public abstract class PlSqlUtils {
    private PlSqlUtils() {}
    public static myHelperMethod(DBTransaction trans, Object someParam) {
    When you want to call the method from an application module, entity object, or even view object class, call
    PlSqlUtils.myHelperMethod(getDBTransaction(), paramValue);
    Unlike Transaction.executeCommand(), this lets you provide functionality like setting procedure parameter values, retrieving OUT parameter values, etc.
    Hope this helps,
    Avrom

  • How to access application module from ActionForm Execute?

    I've got a very simple ADF/UIX/Struts application where I'm trying to create a simple Login function. I have a /loginAction data action pointing to a login.uix page forward. The login.uix page has a <struts:form> on it with a user and a password field. There is a LoginBean with the corresponding get/set values. I have an ADF model created with a boolean login(String username, String password) function exposed as a client method.
    Eventually, when I have this basic part working, then I'll actually be using an ActionForward mapping to dispatch to different home pages, based on the particular login account (the name of the forward will be stored in the authentication table).
    I've tried overriding Execute(), since that is where you can return the appropriate ActionForward mapping, but that does not have a DataActionContext passed in -- so I can't get to the application module.
    I've also looked at processComponentEvents, but that doesn't have any ActionForward results nor a way to pass back ActionErrors (in case the login fails).
    How do I call my login client method when a user has entered a username/password and pressed the Submit button?

    Here is another solution as provided by Oracle Support in response to a TAR that I opened:
    I had described my need to access a login() function defined in my Application Module, returning true/false if the login succeeds/fails. Here is the reply, posted with permission:
    I have gotten the following information back from one of the development folks pertaining to the question you asked.
    His suggestions are as follows:
    1) Expose the method as a client method on the App module
    2) On the pageflow create a new DataAction
    3) Drag and drop the logon method from the AppModule operations node and drop it onto the new data Action
    3) Edit the set-property values that are created in the Struts metadata for this new DataAction to use the correct expressions to get the logon info to pass to the middle tier.
    e.g.
    <action path="/authenticateUser" className="oracle.adf.controller.struts.actions.DataActionMapping" type="AuthenticateUserAction" name="DataForm"
    unknown="false">
    <set-property property="modelReference" value="authenticateUserUIModel"/>
    <set-property property="methodName" value="authenticateUserUIModel.authenticateUser"/>
    <set-property property="resultLocation" value="${requestScope.methodResult}"/>
    <set-property property="numParams" value="2"/>
    <set-property property="paramNames[0]" value="${param.logonUsername}"/>
    <set-property property="paramNames[1]" value="${param.logonPassword}"/>
    <forward name="fail" path="/logon.do"/>
    <forward name="success" path="/menu.do"/>
    </action>
    So in this case the values of the logonUsername and logonPassword fields in the form that submitted to this DataAction are passed as the two parameters that my authenticateUser method on the AppModule requires.
    I have also overriden the data action class to customise the findForward() method to route the user depending on if the method call worked or not.
    And here's the code for the customized FindForward in the DataAction:
    protected void findForward(DataActionContext actionContext) throws Exception
    HttpServletRequest request = actionContext.getHttpServletRequest();
    HttpSession session = request.getSession();
    String target = "fail";
    //Get the result of the Model Method call
    JUCtrlActionBinding method = actionContext.getCustomMethod();
    boolean successfulLogon = ((Boolean)method.getResult()).booleanValue();
    if (!successfulLogon)
    // If the logon fails we need to do the following
    // 1. Increament the counter once this exceeds 3 any logon will fail
    // 2. Create an error message to display on the logon screen
    // note this is a non specific error to prevent hackers from
    // knowing that they at least got the username right or from
    // knowing that there is a Max attempts value if they are trying
    // an automated attack
    Integer attempts = (Integer)session.getAttribute("logonAttempts");
    int intAttempts = 0;
    if (attempts != null)
    intAttempts = attempts.intValue();
    session.setAttribute("logonAttempts", new Integer(++intAttempts));
    //The error message comes out of the ApplicationResources.properties file.
    actionContext.getActionErrors().add("general",new ActionError("logon.error.logonFailed"));
    this.saveErrors(actionContext.getHttpServletRequest(),
    actionContext.getActionErrors());
    else
    //If connection was OK do we need to save the username in a cookie?
    String remember = (String)request.getParameter("logonRemember");
    int cookieLife = 0; //Expire
    if ( remember != null && remember.length()>0 )
    cookieLife = 2592000;
    String name = (String)request.getParameter("logonUsername");
    Cookie userCookie = new Cookie("CARA_USER_COOKIE",name);
    userCookie.setMaxAge(cookieLife);
    actionContext.getHttpServletResponse().addCookie(userCookie);
    target = "success";
    actionContext.setActionForward(target);
    I hope this helps anyone looking to implement something similar. It also illustrates the "preferred" way of executing a client method and working with the result.

Maybe you are looking for

  • Add section title to header/footer? Using Pages 5.2 (or later)

    I couldn't find a way to automatically have the title of the current section in the header or footer of a document. Potentially I am missing something, I haven't tried to do this before, but it seems like a basic function of having a TOC in the first

  • Cannot add itunes lib to remote app on iPad

    When trying to add an itunes lib using the Remote app on my iPad (2) a Passcode is displayed and the ipad2 appears under the Devices list in iTunes; entering the code there does not connect... checked all setups.  Any ideas why this does not work? Re

  • Urgent----In which table are portlet id and name stored?

    In which table are portlet-id and name stored?

  • Machine Authentication with PEAP on Wireless with ISE1.2

    Hi All, We are facing issues while doing machine authentication in ISE1.2 with wireless PEAP authentication. Without machine authentication normal PEAP works very fine but as soon as we enable machine authentication and create policy for machine auth

  • Help me with making photo fold

    I have already read the FAQ and I am still not "getting it" I want to combine all my photos into one folder and I am having problems doing that. I must need a better description than what the FAQ provides. If anyone is able to help me let me know. By