Is it possible to call a custom method in App Module from a backing bean?

I would like to know if a custom method in App Module can be called from inside a backing bean.
I am not sure if it is logically right to call, from a backing bean, a custom method in App Module. But would like to know if that makes sense or if it is possible.

Hi..
Yes it is possible.You have to add that method for client interface of AppModule.Now you can see that method in Data Controls(Refresh the data control). To call this method using bean it should add as method action to bindings(Click Bindings>+>methodAction>and Create action binding).
Now you can call this method in bean class.
Check following example use this concept to execute view criteria
http://adf-lk.blogspot.com/2011/05/oracle-adf-create-view-criteria-and_4727.html

Similar Messages

  • The difference in calling an application module from a backing bean

    Hello everybody!
    I don't understand exactly, where is the difference in calling an application module from a backing bean in the following ways.
    Example 1
    FacesContext context = FacesContext.getCurrentInstance();
    ValueBinding vb = context.getApplication().createValueBinding("#{data}");
    BindingContext bc = (BindingContext)vb.getValue(context);
    DCDataControl dc = bc.findDataControl("AppModuleDataControl");
    AppModuleImpl appModule = (AppModuleImpl)dc.getDataProvider();Example 2
    String amDef = "model.services.AppModule";
    String config = "AppModuleLocal";
    AppModuleImpl appModule = (AppModuleImpl)Configuration.createRootApplicationModule(amDef, config);Example 3 (the same like Example 1???)
    String EL = "#{data.AppModuleDataControl.dataProvider}";
    FacesContext fc = FacesContext.getCurrentInstance();
    ValueBinding vb = fc.getApplication().createValueBinding(EL);
    AppModuleImpl appModule = (AppModuleImpl)vb.getValue(fc);Please can anybody explain, what the three examples do? Which example is preferred to call an application-module-method from a backing bean?
    Thanks and regards
    Majo
    Edit: I am using ADF BC 10g in JDev10 :)

    Hi :)
    >
    This could work, but can you describe the use case for which you need to get the ApplicationModule?
    Maybe we can find a better way to implement your functionality.
    >
    Sure, i know a lot of better ways to implement the same functionality too but its a huge project, its not my code and we have no time to reimplement this functions ;)
    Frank, i don't understand the first line of your code.
    DCBindingContainer bindings = ... resolve #{bindings}Where do i get the bindingContainer, if I don't have the "JSFUtils"- or "ADFUtils"-classes?
    Regards
    Majo
    Edit:
    Sorry, i have answer, before i think about it ;)
    FacesContext context = FacesContext.getCurrentInstance();
    Application app = context.getApplication();
    DCBindingContainer bindings = (DCBindingContainer)app.getVariableResolver().resolveVariable(context, "bindings");
    BindingContext bctx = bindings.getBindingContext();
    DCDataControl dc = bctx.findDataControl("AppModuleDataControl");
    AppModuleImpl am = (AppModuleImpl)dc.getDataProvider();or in my backing bean, when i add the property to the faces-config.xml
    DCBindingContainer bindings = this.getBindings();
    BindingContext bctx = bindings.getBindingContext();
    DCDataControl dc = bctx.findDataControl("AppModuleDataControl");
    AppModuleImpl am = (AppModuleImpl)dc.getDataProvider();Is this right?

  • Is it possible to call a class method using pattern in ABAP editor.

    Hi,
         Is it possible to call a class method using pattern in ABAP editor.
    Thank U for Ur time.
    Cheers,
    Sam

    Yes,
    Click patterns.
    Then choose Abap objects patterns.
    Click on the Tick
    It will give a new screen
    Here Give the name of the class first.
    Then the object (instance of the calss)
    And finally the method ..
    it will give you the pattern
    Hope this helps.

  • Error when I call a method of AppModule from a backing bean.

    I use Jdeveloper 10.1.3.0.3 EA.
    In my application I have created ApplModule and UsrView(for my table USR).
    I have a login page (login.jsp and the backing login.java) with 2 fields userName and password and an ADF Faces Core command button (cmdCheckPass) and the method cmdCheckPass _action() for the click event .
    The problem is that I can’t call method testPassword(userName, password) which is written in AppModule. (I get error:
    javax.faces.FacesException: #{backing_login.cmdCheckPass_action}: javax.faces.el.EvaluationException: java.lang.NullPointerException) from line:
    answer = app.testPass(st1,st2);
    The code is as follows:
    public String cmdCheckPass_action() {
    String answer="";
    String mes = "";
    String st1=this.getInputText1().getValue().toString();
    String st2=this.getInputText2().getValue().toString();
    AppModuleImpl app = new AppModuleImpl();
    answer = app.testPass(st1,st2);
    if (answer == "OK") {
    return "toMain";
    } else {
    answer = "";
    mes="Invalid username, password !!!";
    FacesContext.getCurrentInstance().addMessage(null,new FacesMessage(mes));
    return answer;}
    I don’t know if theoretically is right to call, from a backing bean, a custom method of AppModule.
    Can I have any help on this?
    Thanks in advance,
    Panos

    Some quick ideas:
    Is the clip the same NTSC/PAL standard as the project you are importing it to?
    Have you tried to rename the offending clip (do NOT rename any clips inside the iMovie /Media folder!!).
    How much free space do you have on the iMovie project volume -- what is the size of the imported clip?

  • Is it possible to call a class in a jar file from JNI environment?

    Hi
    Is it possible to call a class in a jar file from JNI environment?
    Thanks in advance.

    Could you explain a bit more what you are trying to do? (In other words, your question is vague.)
    o If your main program is written in C, you can use JNI to start a JVM, load classes from the jar of your choice, and call constructors and methods of the objects defined in the jar.
    o If your main program is java, and has been laoded from a jar, a JNI routine can call back into java to use the constructors and methods of classes defined in the jar(s).

  • Invoking custom methods in application modules

    Hi,
    I am absolutely new to oracle ADF.I was recently working with application module.My question is how do I call a custom method(say myCustomMeth(String str) ) residing inside my application module from my Managed bean?I saw one example where the operation(i.e. the method) was directly dragged and dropped onto the jspx page from the data control.Is it the right way of doing it?I also saw one example where operation binding was used to invoke a method inside the application module although I didn't understand the code fully.I am really confused now.Please help.
    Thanks in advance.

    user11930797 wrote:
    My question is how do I call a custom method(say myCustomMeth(String str) ) residing inside my application module from my Managed bean?You write the custom Application Module method and you expose it to the AM's client interface. By doing so, the custom operation becomes available in the AM Data Control and can be bound to your jspx page.
    I saw one example where the operation(i.e. the method) was directly dragged and dropped onto the jspx page from the data control.Is it the right way of doing it?I also saw one example where operation binding was used to invoke a method inside the application module although I didn't understand the code fully.Both of the methods that you are mentioning above are used:
    1. You can drag the custom method from the data control in JDeveloper and drop it in your page as a command button or link to create a method binding declaratively this way. The method binding is executed via some command button or link and your custom AM method is called, or
    2. You can create the method binding yourself in the bindings tab of you jspx page, add the command button in your page and define an action listener for it in your backing bean. In your backing bean action listener you can write the necessary code to execute the method binding, which will call your custom AM method.
    Hope it is clear.
    Nick

  • Calling servlet from a backing bean

    hi guys i need to call a servlet from a backing bean in JSF. how do i do that ?
    The scenario is i have to call servlet on a different machine from my backing bean . I also need to pass an object to the servlet .
    This object contains data which must be manipulated and inserted in the database by the calling servlet.
    I also want that after insertion in the db the control must be passed to the backing bean .
    Is this all possible???
    Please help

    You may want to investigate the built in java.net.URL class. For advanced needs, Apache has a Java HTTP client library.

  • Accessing a JSF element from a back bean method

    Hi,
    short question, can I access the JSF element from a back bean method?
    So, for example, if I have the following JSF code:
    <h:panelGroup id="test1" rendered="#{bean.someMethod}">...</h:panelGroup>
    <h:panelGroup id="test2" rendered="#{bean.someMethod}">...</h:panelGroup>
    <h:panelGroup id="test3" rendered="#{bean.someMethod}">...</h:panelGroup>
    Can I found out in some way, which element (esp. which ID) calls the someMethod-method?
    Kind regards
    Matthias

    There are more possibilities as well. If you depend it on for example the User's rights/groups, then you can also do for example:
    rendered="#{user.admin}" // getter = public boolean isAdmin()
    rendered="#{user.groupName == 'admin'}" // getter = public String getGroupName()
    rendered="#{user.groupId > 1}" // getter = public int getGroupId()
    rendered="#{fn:contains(user.groups, 'admin')}" // getter = public String[] getGroups() or public List<String> getGroups()
    etc..I think it's after all just a matter of learning about the capabilities of EL a bit more.

  • Call a Function From a Backing Bean

    Hello,
    I am trying to call a PL/SQL function from a Backing Bean but i am getting a getDBTransaction error. Here is the example i was trying to do in a backing bean.
    I Am getting the employee ID , sending it to a function that calculates the annual salary and then through a button whose code is in the backing bean, showing a message on the screen with the annual salary.
    I am getting the JBO-25301 error.
    Can't i use getDBTransaction in my backing bean.

    Please have a look at the following thread:
    Stored Procedure

  • How to call a custom method in a parent container.

    I have an MXML component that defines the method:
    public function showAllGlyphs(spots:Array):void { ... }
    There is a child component of this MXML componet called
    DataClip, which has
    a method that needs to call the parent method:
    parent.showAllGlyphs(pushPins);
    I get a 1061 error when compiling. I understand the problem.
    The compiler
    thinks the paret is a static class, and does not know about
    the extention.
    My question is how to I cast or otherwise reference this
    method in the
    PARENT?
    Severity Description Resource In Folder Location Creation
    Time Id
    2 1061: Call to a possibly undefined method showAllGlyphs
    through a
    reference with static type
    flash.display:DisplayObjectContainer.
    DataClip.mxml Transitions line 32 August 21, 2006 3:07:28 PM
    169

    I understand why what you say is the correct design pattern
    (much more
    modularity and the potential for re-use).
    In my case, it still might make sense to use .parentDocument
    (my problem was
    not understanding the difference between .parent and
    .parentDocument)
    Although I still don't understand why .parentDocument does
    work.
    I have a bunch of purely GUI oriented subComponents of a
    .parentApplication.
    The parentApplication has a custom AS-only module that does
    the "business
    logic, network connections, etc).
    Basically, I want a module (Singleton Class) that is
    accessible from all GUI
    subcomponents that provides general utility functions. It
    can't be
    instatiatiated multiple times. So there needs to be one
    global place for it.
    It does not really make things clear if everything is done
    via an event
    paradigm. (Well, maybe to me, but I have a Ph.D. in CS so I
    am tainted) I
    want this clear to the average programmer.
    ===============================
    Dr. Yechezkal Gutfreund
    Team ACE for Mobile Devices
    ===============================
    "peterent" <[email protected]> wrote in
    message
    news:[email protected]...
    > As a rule of thumb, a child should never call functions
    in its parent. It
    > is
    > possible, it just not a very good programming practice.
    > If a child needs the parent to do something, the child
    should dispatch an
    > event. In your child, declare an event using Metadata:
    >
    > <mx:Metadata>
    > [Event("showGlyphs")]
    > </mx:Metadata>
    >
    > The child should have a public property that the parent
    can access to
    > handle
    > the event:
    >
    > public var pushPins:Array;
    >
    > When the child needs the parent to do this, have the
    child set the
    > pushPins
    > array, then dispatchEvent( new Event("showGlyphs") );
    >
    > In the parent, on the child's tag, have it listen for
    the event and
    > execute it:
    >
    > <MyChild
    showGlyphs="showAllGlyphs(event.target.pushPins)" />
    >
    > I know this seems like a lot more work, but it is a much
    better strategy
    > than
    > having children reach up and into the parent's code.
    >

  • Calling a particular Method of all subclass from a super class

    hi
    I have a class 'A' which is a super class for 'B' ,'C' , 'D'
    my main method is in the class Main and while on the run i am calling methods of B,C,D form this main class.
    but as the first step of execution i need to call a init method which has been defined in all the sub-classes. and there can be any no of sub-classes and all will have the init method and i have to call the init method for all classes. is this possible to do that in runtime. ie i wil not be knowing the names of sub-classes.
    thanks
    zeta

    Sorry if i had mislead you all.
    I am not instantiating from my super class.
    as mjparme i wanted one controller class to do the
    init method calls
    so i got it working from the link you gave.
    URL url = Launcher.class.getResource(name);
    File directory = new File(url.getFile());
    This way i can get all the classes in that
    in that package
    and from reflection i can get whether it is
    her it is a sub class of the particular super class
    and i can call the init methods by making the init
    methods static
    thanks for the help
    zetaThis is a rather fragile solution.
    If the problem is one of knowing which subclasses exist, I would suggest specifying them explicitly via configuration (system property or properties file or whatever).
    One thing that's not entirely clear to me: Is the init going to be called once for each subclass, or once for each instance of each subclass? It sounds to me like it's once per class, but I want to make sure.

  • Calling a custom tcode using abap class from workflow

    Hi Experts,
    I have a requirement of calling a custom tcode from my workflow.
    For this i have created a class zcl_test ( has if_workflow ) .
    I created a method ztest which will call the tcode.
    CALL TRANSACTION 'ZTX'.  ( My tcode just has 1 input field, for testing purpose )
    Then i created a task in whichi hv used this abap class and method.
    But the tcode does not run when i execute the workflow.
    Please help.
    Thank You,
    Radhika Vadher.

    Radhika Vadher 
    use the sample code to get the data from the task container into the ABAP class
    DATA :
             w_ref        TYPE  REF TO      if_swf_run_wim_internal,
             w_ref_cnt  TYPE  REF TO      if_wapi_workitem_context,
              w_wi_ref   TYPE  REF TO      if_swf_ifs_parameter_container.
    TRY.
        CALL METHOD cl_swf_run_wim_factory=>find_by_wiid
          EXPORTING
            im_wiid     = w_wiid
          RECEIVING
            re_instance = w_ref.
      CATCH cx_swf_run_wim_enq_failed .
      CATCH cx_swf_run_wim_read_failed .
      CATCH cx_swf_run_wim .
    ENDTRY.
    CALL METHOD w_ref->get_workitem_context
      RECEIVING
        re_ctx = w_ref_cnt.
    CALL METHOD w_ref_cnt->get_wi_container
      RECEIVING
        re_container = w_wi_ref.
    and the w_wi_ref is having a method GET use that method to get the values of the task container into the ABAP class.

  • Is it possible to call the members of the CFMapping dimension from a EVDRE?

    Hello experts,
    I am working with the application Cashflow. This application uses the dimension CFMapping to match the dimension CFAccount with the dimension Account, when the package "Cash Flow Recalculation" is run. I would like to know how could I call the members of the CFMapping dimension from a report. When I try to do this,the EVDRE shows the following error message: #ERR: Invalid  CFMAPPING, col# 1.
    Thanks in advance,
    Álvaro

    Hi Mehul,
    I have already checked this but it still doesn't work. The dimension CFMapping is not contained in any application,  in BPC administration I checked this in the application folders. I think that the CFMapping dimension is only used to support the execution of the package I mentioned in the first message, and that is why I have problems to call it's members from a report using the normal procedure.
    Regards,
    Álvaro

  • How to call a query from the backing bean ?

    Hi all,
    Another question for you guys :
    I made a jspx page with an input form and a submit button.
    When I click the submit button, the action my_action in my backing bean is executed.
    This is the code :
    public BindingContainer getBindings() {
    return BindingContext.getCurrent().getCurrentBindingsEntry();
    public String my_action() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("EmployeesView");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    I hoped that the query 'EmployeesView' was executed in this way, but I get the following exception :
    java.lang.ClassCastException: oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding cannot be cast to oracle.binding.OperationBinding
    So how should I execute the query EmployeesView ?
    Second part of the question : What if I typed the name an employee in my form, and I want to
    execute a query that selects all the Employees with that name ?
    How do I make a query with a variable as input in the WHERE clause ?
    Thanks in advance.
    Edited by: Facehugger on 7-apr-2010 11:15

    I'm still trying all the stuff you guys says, but still no result.
    This is my backing bean :
    +// the button action+
    +public String my_action()  {+ 
    +// get the selected rows from the multiselect table and store the objectid's in an String array+
    RowKeySet rks = graph_table.getSelectedRowKeys();
    Iterator itr = rks.iterator();
    Object key;
    int nbr_objects = 0 , i = 0;
    if (rks.size()>0)  nbr_objects = rks.size();
    +String[] objectid = new String[nbr_objects];+
    while(itr.hasNext())
    +{+
    key = itr.next();
    graph_table.setRowKey(key);
    Object o = graph_table.getRowData();
    JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding) o;
    Row row = rowData.getRow();
    +objectid[i] = row.getAttribute("Objectid").toString();+
    i+;+
    +}+
    +// now get all the x and y values for these objectid's from the database out of the table history.+
    BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();
    for (int j=0 ; j<nbr_objects; j+){+
    +// get X and Y values for object number j+
    DataPoints history = new DataPoints();
    OperationBinding operationBinding = bc.getOperationBinding("retrieveHistory");   ===> operationBinding stays NULL ???+
    +operationBinding.getParamsMap().put("OBJECTID", objectid[j]);+
    Object retVal = operationBinding.execute();
    +// ==> retVal should contain a List of all X and Y values for the provided objectid.+
    +// while (retVal has values)+
    +// {+
    +// List_of_x_values.add(retVal.valueX);+
    +// List_of_y_values.add(retVal.valueY);+
    +// }+
    history.add(List_of_x_values);
    history.add(List_of_y_values):
    +// call the soap method to do some calculations+
    methodname.forecast(history);
    +}+
    +}+
    In my application module :
    public void retrieveHistory(String objectid) {
    getHistory().setWhereClause("OBJECTID = '" + objectid + "'");
    System.out.println("current query : "+getHistory().getQuery());
    getHistory().executeQuery();
    public ViewObjectImpl getHistory() {+
    return (ViewObjectImpl)findViewObject("History");+
    The query for the VO History : SELECT * FROM HISTORY
    Please anyone ?
    Edited by: Facehugger on 9-apr-2010 14:19

  • How to call an App Module from another App Module?

    Here are the settings for my project.
    MyApplication (Application)
    Model1 (Project) : Has connection settings to connect to schema1
    Model2 (Project) : Has connection settings to connect to schema2
    ViewController (Project) : View project
    How do I call Model2 from Model1 ? I tried calling findApplicationModule but that did not work.
    Can I get access to the AppModule from JNDI tree? How else can I get access to Model2 from Model1?
    Thanks

    This is the code that is getting called from App Module 1. The first method, test1, throws an error where as test2 is successful. Do you see any obvious errors in the code?
    public String test1() {
    System.out.println("This is test1");
    String amDef = "org.model.service.HrService";
    String config = "HrServiceLocal";
    ApplicationModule am2 = (ApplicationModule ) Configuration.createRootApplicationModule(amDef,config);
    HrServiceImpl am3 = (HrServiceImpl)am2;
    am3.test123();
    Configuration.releaseRootApplicationModule(am2, true);
    //return am2;
    return "test1";
    Error:
    Internal Server Error (Caught exception while handling request: oracle.jbo.ConfigException: JBO-33005: Configuration HrServiceLocal not found)
    public String test2() {
    String AMDefName = "org.model.service.HrService";
    Hashtable env = new Hashtable(2);
    env.put(JboContext.INITIAL_CONTEXT_FACTORY,JboContext.JBO_CONTEXT_FACTORY);
    env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
    HrService am = null;
    try { 
    InitialContext ic = new InitialContext(env);
    ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup(AMDefName);
    am = (HrService)home.create();
    String retString = am.test123();
    System.out.println("Value from the first application module=" + retString);
    catch (NamingException nex) {  /* Handle the error here if you don't find it */
    System.out.println("Naming exception " + nex);
    Configuration.releaseRootApplicationModule(am, true);
    return "test2";
    successful
    Thanks
    Mike

Maybe you are looking for

  • Photoshop Elements 10 from the app store crashes every time I run it

    I bought Photoshop Elements 10 from the app store. When I try to run it, it crashes. My macbook is brand new (bought it March, 2012), with 8GB ram and a 256SSD. Here's the report: Process:         Adobe Photoshop Elements 10 Editor [247] Path:       

  • How to dictate the word comma in Mountain Lion

    I have scoured the Internet trying to find out how to get Mountain Lion's Dictation to actually dictate a word that it normally produces as punctuation.  For example, how would I have it say the following? "Insert a comma instead of a period." In oth

  • The connect function in the socket class has problems

    when i call this function connect(SocketAddress endpoint, int timeout) the timeout variable doesnt wait for the specific time that i tell it example connect(endpoint, 10000); this call should wait for this amount of time but it doesnt wait that amoun

  • Solaris 10 gconftool-2

    I installed Solaris 10 11/06 and all went well. I loaded all available patches using updatemanager but each time I start updatemanager it last about 2-3hours the GUI coming up. I mentioned that the process gconftool-2 is running during this time on 2

  • Oracle Enterprise Edition Licensing - Core metrics

    Oracle: 10G (10.2.0.4) 64-bit, Enterprise Edition Running on Xeon Intel chips, of which I believe have a core factor multiple of 0.5 We have 540 NUP licenses on our site. We obviously have a Live box, and a few test boxes. One of our test boxes has 4