Accessing AppModuleImpl methods from Groovy expressions?

From a VO View Criteria bind variable I'm attempting to call an accessor (aka. getValue) in it's parent AppModuleImpl, via a Groovy expression. I thought I could do something like:
((model.AppModuleImpl)object.getApplicationModule()).getValue()
...but at runtime I'm getting an error that Groovy doesn't know model.AppModuleImpl.
I must be missing something here. Does anybody have the Groovy syntax for calling methods in the parent AppModuleImpl please? I've searched Grant Ronald's ADF Groovy whitepaper with no success, and I haven't found an example on these forums either.
With thanks,
CM.
PS. JDev 11.1.1.2.0, ADF BC + ADF Faces RC

Hi,
I am not sure but may be you found this post useful http://andrejusb.blogspot.com/2010/01/storingaccessing-objects-in-adf-bc.html
one more thing i did lately you can try if it works
I created Method in AppModuleImpl class and called it in VOImpl class with AM object and then assigned it as expression to the attribute value in VO it should work for Bind variable value as well
//Method in AM
  public String sayHello(){
    return "Hello World";
//Method in VOImpl
  public String getHelloFromAM(){
    AppModuleImpl am = new AppModuleImpl();
    return am.sayHello();
//Attribute "HelloTEXT" default value
adf.object.getHelloFromAM()Hope it the same thing you are looking for
Baig
Edited by: BaiG on Jul 12, 2010 1:02 PM

Similar Messages

  • Access native methods from an applet

    hi all
    I am developping a applet which has to access the native method which is c++ code. but it does not work at all, even though it can be compiled well.
    it returns
    java.lang.ExceptionInInitializerError
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.MemoInfo)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkLink(Unknown Source)
         at java.lang.Runtime.loadLibrary0(Unknown Source)
         at java.lang.System.loadLibrary(Unknown Source)
         at InfoShow.<clinit>(InfoShow.java:24)
         ... 11 more
    who can give me some suggestions on accessing native method from applet! thx
    regards
    beginner

    you don't have access to native code from an applet unless you've modified your policy file or you're using a signed applet.

  • 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.

  • Error while accessing EJB method from JSP

    Hi,
    I am trying to access a bean from a JSP and have the foll. code piece:
    String url = "t3://localhost:7001";
    public Context getInitialContext() throws Exception {
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, url);
    return new InitialContext(p);
    String getStackTraceAsString(Exception e)
    // Dump the stack trace to a buffered stream, then send it's contents
    // to the JSPWriter.
    ByteArrayOutputStream ostr = new ByteArrayOutputStream();
    e.printStackTrace(new PrintWriter(ostr));
    return(ostr.toString());
    %>
    <%
    String op="";
    try {
    // Contact the AccountBean container (the "AccountHome") through JNDI.
    Context ctx = getInitialContext();
    out.println("initial context got !!");
    DemoHome home = (DemoHome) ctx.lookup("demo.DemoHome");
    out.println("home got !!");
    %>
    <p>
    <%
    Demo ac = null;
    try {
    ac = (Demo) home.create();
    out.println("create called!!");
    if (ac==null)
    out.println("ac is null!");
    catch (Exception ee) {
    out.print("exception 1");
    %>
    <p>
    <%
    try {
    out.println("going to call method!");
    if (ac!= null)
    op = ac.demoSelect(); /* FAILURE POINT */
    else
    out.println("ac is null->error!!");
    out.println(ac.demoSelect());
    out.println("string got!!");
    out.println(op);
    catch (Exception e) {
    getStackTraceAsString(e);
    e.printStackTrace();
    out.println("error 2");
    catch(Exception e)
    out.println("error 3!");
    It gives an error on trying to access the method "demoSelect".
    e.printStackTrace gives the output:
    java.lang.RuntimeException: javax.ejb.EJBContext.getEnvironment is deprecated in EJB 1.1. EJB 1.1 compli
    ant containers are not required to implement this method. Use java:comp/env instead.
    <<no stack trace available>>
    JSP output is as foll.-->
    getting initial context initial context got !! home got !!
    create called!!
    going to call method! error 2
    What is wrong???
    pls help!

    Greetings,
    Hi,
    I am trying to access a bean from a JSP and have the
    foll. code piece:
    <%
    String op="";
    try {
    // Contact the AccountBean container (the "AccountHome") through JNDI.
    Context ctx = getInitialContext();
    out.println("initial context got !!");
    DemoHome home = (DemoHome) ctx.lookup("demo.DemoHome");
    out.println("home got !!");Though it doesn't seem to be the problem in this case, good EJB coding practices dictate that your code should be narrowing the home reference before calling any of it's methods (i.e. create(...) )... WebLogic may allow handling of its protocol objects in their native state, but other vendors do not... your application is not portable without narrowing.
    It gives an error on trying to access the method "demoSelect".
    e.printStackTrace gives the output:
    java.lang.RuntimeException: javax.ejb.EJBContext.getEnvironment is deprecated inThe error is not in your JSP, but in the bean... it seems your bean is attempting to acquire its "environment properties" in the pre-1.1 style, when...
    EJB 1.1. EJB 1.1 compliant containers are not required to implement this
    method. Use java:comp/env instead. ...instead, it should be looking them up in its JNDI namespace.
    What is wrong???
    pls help! Regards,
    Tony "Vee Schade" Cook

  • Accessing digital inputs from signal express (TEK MSO2024)

    Hi,
    i'm trying to access the digital inputs of an TEK MSO2024 from signal express, but no luck.
    I'm using SignalExpress2011, tkpdo2 ivi driver.
    Seems like this driver doesn't support digital input, anyone got a solution or another driver?
    *edit
    topic can be deleted
    on another system DI works...
    Regards
    alex

    Hello,
    The best to way drive digital outputs while acquiring analog inputs is to create two steps in Signal Express. Each step will execute relatively at the same time but there is no way to correlate or synchronize DIO with AI on a 6008 because DIO on that device is software timed while AI is hardware timed. Below is the 'Getting Started with Signal Express' manual which can aid in creating an AI and DIO step. Also, if you need additional examples later, they are located in the Help->Open Examples.
    Getting Started with LabVIEW SignalExpress
    http://www.ni.com/pdf/manuals/373873e.pdf
    Regards,
    Patricia B.
    National Instruments
    Applications Engineer

  • Access AM method from backing bean - best practice

    Hello,
    I need to call an appModule method from a backing bean. What is better?
    1. Resolve bindings.AMDataControl.dataProvider, get AM and invoke the method directly
    or
    2. Create method action in page definition, resolve OperationBinding from it's binding expression and execute the operationBinding
    I don't need to have a button on the page for this method.
    Rado

    Good question Rado.
    With a "flexible" framework like Oracle ADF, I also ask myself sometimes what would be the preferred approach to do things.
    See also these forum threads:
    - about "ADF Faces: Passing values from a managed bean to ADF BC module"
    http://forums.oracle.com/forums/thread.jspa?threadID=486742
    - about : "ADF Faces: getting selected row data in multi select table ..."
    http://forums.oracle.com/forums/thread.jspa?threadID=503248
    regards
    Jan Vervecken

  • Access page method from template

    Hi,
    I'm using JDev11/ADF and I need to implement this scenario : A have a page fragment based on a page template. This page has a backing bean with a class exteded from a generic class. I have some generic buttons in the page template. Theses buttons need to call a method in the base backing bean class through the page's backing bean. I read Frank's solution to access the page's binding from the template :
    [http://thepeninsulasedge.com/frank_nimphius/2007/11/23/adf-faces-rc-implementation-strategies-for-global-buttons-in-page-templates/]
    but is there a way to access a method in the page's bean from the template (A listener for instance ?)...
    tks.

    Hi,
    what is missing is a method attribute like in declarative components. This however does not exist for templates yet. So there is no other solution yet than to invent some kind of contract.
    Frank

  • No access to method from within the same class

    Hey there.
    First I have to excuse my English for I'm german and just learning...
    Ok, my problem is as follows. I have a class called JDBC_Wrapper it includes the method sendQuery(String query). When I call this method from within another class (where 'wrapper' is my instance of JDBC_Wrapper) it works fine. For example:
    wrapper.sendQuery("SELECT * FROM myDataBase");
    But then I have written a method called getNumRows() into my JDBC_Wrapper class.
    This method should send a query through sendQuery(Strin query) but when calling getNumRows() it says: "java.sql.SQLException: [FileMaker][ODBC FileMaker Pro driver][FileMaker Pro]Unbekannter Fehler." (Unbekannter Fehler -> Unknown Exception). What could that be?
    I'm using jdk2 sdk 1.4.2 with BlueJ. My database is Filemaker Pro 6. The ODBC/JDBC connector works fine.
    BerndZack

    This is within my JDBC_Wrapper class:
    public ResultSet sendQuery(String query)
            if(connected)
                try
                    Statement s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                    ResultSet rs = s.executeQuery(query);
                    return rs;
                catch(Exception e)
                    System.out.println(e);
            else
                //System.out.println("There is no connection to the datasource!");
            return null;
    public int getNumRows()
            try
                ResultSet r;
                r = this.sendQuery("SELECT COUNT(*) FROM " + table_name); // At this line the error occurs
                r.next();
                return (int)r.getInt(1);
            catch(Exception e)
                System.out.println(e.getMessage());
                return -1;
    }When I call sendQuery() from within another class it works, but calling getNumRows()
    throws an exception.

  • Accessing a method from an outside Class

    I am working on a program that will create an array list and hashmap of 3 shapes--squares,triangles and circles. I have created classes for each shape as well as a class that creates arrays of these shapes (called ShapeGenerator).
    Now I need to create a class that will call ShapeGenerator to create the shapes and then put them into an arraylist and hashmap. Right now I just can't get seem to call the methods from ShapeGenerator to create the arrays. What follows is the code I've written. Any guidance would be appreciated. Thanks in advance...
    public class ShapeMaker{
         public ShapeMaker(){
    public ShapeGenerator[] makeShapes(){
         ShapeGenerator[] myShapeGenerator = new ShapeGenerator();
         myShapeGenerator.createSquares(5);
         return createSquares;
    public static void main(String[] args){
         ShapeMaker mySM = new ShapeMaker();
         mySM.makeShapes();
         System.out.println("I made a Shape");
    }

    ShapeGenerator[] myShapeGenerator = new ShapeGenerator();
    new ShapeGenerator will return a single instance of ShapeGenerator - Not an array.
    to create a new ShapeGenerator:
    ShapeGenerator sg=new ShapeGenerator();
    then your method call:
    Object squares[]= sg.createSquares(5);
    or you could just do:
    Object squares[]=new ShapeGenerator().createSquares(5);
    makeShapes() should then return an array of Object (or even better do you have a base Shape class?)
    So we finally end up with something like:
    public class ShapeMaker{
    public ShapeMaker(){
    public Object[] makeShapes(){
    ShapeGenerator myShapeGenerator = new ShapeGenerator();
    return myShapeGenerator.createSquares(5);
    public static void main(String[] args){
    ShapeMaker mySM = new ShapeMaker();
    mySM.makeShapes();
    System.out.println("I made a Shape");
    Excuse any typos but I have not tried to compile this as I don't have a myShapeGenerator etc and I'm too tired (or lazy) to write one.
    Good luck.

  • I am not able access static methods from startup class

    I have a simple java class which queries the Database and holds some data. I am trying to access a static method of this class from the StartupClass and I am not able to do so. But I am able to access a static variable of the same class.
    Can someone help me here.

    Well, welcome to the world of "hacked" phones. If your purchase was from the US, you obviously purchased an iPhone that is locked to a US carrier. The iPhone must have been jailbroken and unlocked via software to accommodate your foreign SIM card. Now that you have updated the phone, it is locked back to the US carrier. Only the carrier can authorize Apple to unlock the iPhone and none of the US carriers will unlock the iPhones. Best suggestion is to sell the phone and obtain a factory unlocked version directly from the Apple store.
    To answer your other question, there is not a supported method to downgrade iOS.

  • Accessing a Method from an object in memory

    I have a class that is in another package with a method something like this:
    public void performOk(){
    OtherClass.refreshTable();
    I can't call it statically because the class isn't a static class, so this won't work. I can't figure out how to get ahold of the current instance of the class to run this command.
    I have tried things like
    FileFolderManagerV2 ffm = ffm.getInstance()
    Which won't work for circular reasons
    I also tried to create a constructor like this
    FileFolderManagerV2 = new FileFolderManagerV2(randomstring)
    public FileFolderManagerV2(String Random){
    this;
    How can I get this to fire correctly?
    Edited by: sarcasteak on Jul 10, 2009 7:04 AM

    JoachimSauer wrote:
    sarcasteak wrote:
    I was referring to what the other guy said:"the other guy" would be me.
    "Either pass it in as a parameter or make sure that the class containing performOk() has a property where you can set the object before performOk() is called."
    Foo foo = new Foo();
    Bar bar = new Bar();
    bar.setFoo(foo);
    bar.performOk();
    The problem is that the class is instantiated in another class. I have a FileFolderManager class that is created inside of FileManagerView and FileManagerPreferences which is in a seperate package, that hooks into the eclipse preferences menu. When I hit apply or ok in the preferences, I need a way to send back data to the FileFolderManager class that has been created, and tell it to refresh the data based on the new preferences. This is the architecture that is recommended when hooking into eclipse preferences, but they give no example on how to send the data back to the main class. I have figured out a way to grab the data from the preferences via
    IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
           String shortcuts = prefs.getString("Shortcuts");But I can't actively update data. My other option I guess would be to somehow listen for the data changing, which I may have to do.
    Edited by: sarcasteak on Jul 10, 2009 7:39 AM

  • Accessing application methods from EL

    Hi all,
    I do not consider myself a newbie but I wonder sometimes when I can't solve these problem; Tomcat can be such a bugger to configure, especially when they change the schemas on every release.
    Anyway. I have a couple custom tags in my header.jspf file. I use the <c:import> action to include it in all documents on that virtual host.
    This is how I originally achieve this task:
    <c:import url="http://home.localhost/templates/header.jspf">
         <c:param name="newsData" value="http://home.localhost/news/news_2004-06-27.xml" />
         <c:param name="menuData" value="<%= application.getRealPath("WEB-INF/home-menu.xml") %>" />
    </c:import>Now I have decided to make everything xHTML compliant i.e. I no longer want to use and can not use <% ... %> scriptlet tags any more.
    I do not know however, how to call methods such as application.getRealPath(...) from, EL for example?
    How can I accomplish this?
    I'm hoping for something like:
    <c:import url="http://home.localhost/templates/header.jspf">
         <c:param name="newsData" value="http://home.localhost/news/news_2004-06-27.xml" />
         <c:param name="menuData" value="${application.getRealPath("WEB-INF/home-menu.xml")}" />
    </c:import>I think instead of using application I have to use servletContext, but I do not know if a attribute key/value exists that represents the servlet-path.
    Any and all help appreciates.
    Kind Regards,
    Darren Bishop

    Hey evnafets,
    Thanks for your comback.
    I had actually exhaustively tried everything, including your suggestion
    ${pageContext.servletContext.realPath}I solved it in the end with the following:
    <jsp:scriptlet>
         pageContext.setAttribute("menuData", application.getRealPath("WEB-INF/home-menu.xml"));
    </jsp:scriptlet>
    <c:import url="http://home.localhost/templates/header.jspf">
         <c:param name="newsData" value="http://home.localhost/news/news_2004-06-27.xml" />
         <c:param name="menuData" value="${menuData}" />
    </c:import>I previously did not know that JSP scripting syntax had been changed to XML elements. It works fine but I do not like it at all... effectively Java code still remains in the page which I am not happy about; wanted clean XML code, I suppose with my definition of clean not beingthe above.
    I am familiar with JSTL functions, but I can be quite stubborn if it seems that the functionality should already exist; why does the application/servletContext not have an attribute REAL_PATH or something. Then you can concatenate anything you want on the end.
    Again, thanksfor reply.
    Regards,
    Darren B

  • Call static method from jsp expression

    Hi, I'm using adf/bc 10.1.3.4 I'm wanting to call a static method of a class when an af:commandLink is clicked. This action attribute value for this af:commandLink would be an el expression. As an example, let's say I want to call a new static method, named test(), I've added to ADFUtils.
    My af:commandLink looks like this:
    <af:commandLink action="#{ADFUtils.test}" />
    Obviously, this doesn't work. I can describe my actual use case if it would help. For now I'll just say that I don't want to use a managed/backing bean to house this method. How can I create a class to house this method w/o using a managed bean and adding that managed bean reference to the faces-config.xml?? Thanks, James

    thanks for the interest john. i'll explain what it is i'm trying to do. I have two web applications, appA and appB, both running in the same app server instance. The apps are related in the sense that once the user logs in thru an sso mechanism, they can 'bounce' back and forth between applications. Not sure if that info is relevant, but I wanted to include it anyhow.
    We've created a common banner/header jsp that we include in every page of appA and appB. Included in that header jsp is a logout link (af:commandLink), which will need to execute some code when clicked. Here is where the dilemma starts. We don't really want to have to write the code for the logout in a managed/backing bean because although both applications can use that same bean (we have it set up in the repository so that when a checkout/update is done on either appA or appB, each app, utilizing an svn external rule, would get both the banner jsp and the logout code that goes with it), making good use of the reusability concept, we would also have to add a reference to that backing/managed bean in the faces-config.xml of each application in order for it to be instantiated and used by each app. I was hoping to implement a solution which wouldn't require the developer to have to do any 'setup' on an application by application basis to use the header jsp and the code behind the Logout link. I've described a simple scenario, but in reality we'll have multiple applications, which means multiple places (faces-config.xml) where we'd need to add a reference to the managed bean which contains the logout code. It wouldn't be the end of the world for us if we ended up doing it this way, but I just have a feeling like there may be a better way to implement this so that each application's faces-config doesn't need to be touched. Hope my explanation is clear. thanks for any help you can offer.
    Edited by: kcjim on Feb 25, 2009 8:21 AM
    Edited by: kcjim on Feb 25, 2009 8:22 AM

  • Accessing a method from another class

    Ok, so this is a massively simplified version of what I need to do but using the following classes, what do I need to put in the second class to call the function from the first?
    This class contains what I want to call:
    package code
         public class myClass1
              public function myClass1()
                   trace("myClass1 constructed");
              public function whatIWantToCall(a,b)
                   trace(a + b);
    This is the second class:
    package code
         public class myClass2
              public function myClass2()
                   myClass1Instance.whatIWantToCall(3,4);
                   //this doesn't work as it can't find  //
                   //the function but it will work when  //
                   //I use this code outside of any class//

    What we need to know id the relationship between the two classes.
    If  class2 is the child of class one, you would call a function in class1 from class2 using
    parent.myFunction();
    if both are children of a common parent,  parent.class1.myFunction();
    Or you can pass class1's function into class2 as a variable.
    Assuming you have class2 instatiated
    like:
    package code
         public class myClass1
              public function myClass1()
                   myClass2.callFunction =whatIWantToCall;
              public function whatIWantToCall(a,b)
                   trace(a + b);
    This is the second class:
    package code
         public class myClass2
              public var callFunction:Function;
              public function myClass2():void
              private function handleCallback():void
                                  callFunction(3,4);
    HTH
    -Ted

  • J2ME Accessing File method appart from the StartApp() method

    I have been able to access File methods which read/write to file, only when methods are placed within the StartApp() method in the J2ME Midlet.
    I have tried placing them inside a command listener and accessing the specific File methods, however they could not execute any button either YES or NO when promted for reading or writting to files, however the process accessing the methods from StartApp certainly works fine.
    For an ease of maangement and less coding, I decided to put the methods into another class and access them seperatelly.
    I am just curious what would be the appropriate class layout for the methods.
    Ex: inside the parent Midlet commandListener I thought I would do something like
    if (command == Write) {
                FileClass f = new FileClass();
                 f.Write(); 
      } So what would be the correct or the best way to call the Write method from teh Midlet executing the Write method. as to how method should be structured inside the class.... eg my thought
    Do I need some sort of Thread ??? My compiler keeps telling me that
    public FileClass implement CommandListener {
       public FileClass {
        public void commandAction( ....  )  {
        public void Write()  {
    }cheers

    Hi NImesh,
    Thanks a lot. You are correct. Once I assigned to the same enhancement implementation, the enhanced parameters started appearing in the pre-method.
    Best regards,
    Amar

Maybe you are looking for