Two different ways to execute a custom method in an Application Module

I have a custom method exposed in an Application Module's Client Interface, and i know two different ways of executing it from my ADF Faces project (both works fine):
1) Calls the method directly through the Data Control:
MyModule service = (MyModule)JSFUtils.resolveExpression("#{data.MyModuleDataControl.dataProvider}");
service.myMethod();
2) Adding a Method Action in the PageDef's file:
<methodAction id="myMethod" InstanceName="MyModuleDataControl.dataProvider"
DataControl="MyModuleDataControl" MethodName="myMethod"
RequiresUpdateModel="true" Action="999"
IsViewObjectMethod="false"/>
//Call the method from the binding container
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("myMethod");
operationBinding.execute();
Basically i want to know: what are the differences (pros & cons) of each approach ??

Hi,
In my opinion the second way have a advantage, which its method could be invoke automatically using a invokeAction on pageDef, if necessary.
regards

Similar Messages

  • Calling custom methods from Nested Application Modules

    We are having a problem with passing parameters to our nested App Modules.
    We have a custom method in our nested app module and when we drag that method from our data control palette in our page everything seems to work just fine. We are binding our NamedData values to #{requestScope.<field>} where the fields are inputText controls. When we run it will execute the function but the parameters are null.
    It seems to me that the Nested App Module can not evaluate the EL expression, or in other words when it gets evaluated it returns a null.
    Can anyone help with this?
    Thanks,
    Peter

    If you use an EL expression of some hard-coded value instead of #{requestScope.XXX} does that value correctly get passed to the function?
    In other words, are you 100% sure that EL expression is not evaluating to null ?
    If you drop an AM method as a parameter form on a page, you'll see that by default it's NamedData elements use EL expressions that reference attribute bindings that are bound to local page-def variables, rather than to #{requestScope.something}

  • Adding and Calling custom method to the application module or view object

    My project uses jheadstart 10.1.2.
    I want to run "oracle reports" from my uix page. I have coded a method which takes "VOParameter view object" as a parameter to run report.
    I have generated the input page (parameter page) which based on VOParameter view object, by using jheadstart for using jheadstart lov, date etc. advantages. But I dont know how can I add custom method on application module or view object implementation class and custom button on uix page to call from uix page.
    THANKS for your help

    Yes, method binding has been added to the page UI model.
    I have find some clue that When I darg and drop metod as a submitButton, the code "
    <SubmitButton text="runReport" model="${bindings.runReport}" id="runReport0" event="action" />"
    is added to the uix page code. I change this code like this;
    <button text="runReport" model="${bindings.runReport}" id="runReport0" event="action" onClick="submitForm('dataForm',1,{'event':'action','source':'runReport0'});return false"/>
    by adding onClick method and changed submitButton to button tag..
    Then button action is triggered. But I can not pass to the design part of the uix page. It gives me the message like that "The document is not a valid state" But it works. I dont know why?

  • Create bid invit. from template in two different ways has different consequ

    Hi everybody
    "Create bid invit. from template in two different ways has different consequuences"
    When I create a bid invitation from a previous template, from the template search results (Icon_create SAPLBBP_BID_INV 1010) my bid is published but then stay in the model search and the status is wating for approval. But no workflow started in BBP_PD.
    If I use the same template for creating a new bid from the detail using the create bid invitation button, the bid invitation is created correctly.
    I have configured the two events for the BUS2200 object and both of them have an initial condition.
    It seems that the two actions trigger different events or something like that
    Does anybody why it is occurring this and how I could link the workflow without approval for this case.
    Thanks

    Hi
    What SRM version are you using ?
    <b>Please see these SAP OSS notes / links, which might help -></b>
    <u>Note 976752 - Bidding Worklfows are not triggered correctly
    Note 941417 - Creating a bid invitation from template in the background
    Note 971752 - Incorrect approval preview in bid approval
    Note 741372 - Separating template search from bid invitation search
    Note 764028 - New bid invitation items not visible in bid
    Note 996907 No approval preview for bid after note 976752
    Note 765771 Workflow error when creating a purchase order from bid
    Note 790930 No warning message in case of jump from bid</u>
    Regards
    - Atul

  • Default Code Generation for a Custom Class for an Application Module

    hi all
    Oracle® Fusion Middleware
    Fusion Developer’s Guide for Oracle Application Development
    Framework
    11g Release 1 (11.1.1)
    with Jdeveloper TP3 ,
    By default, the application module Java class will look similar to what you see in
    Example below when you've first enabled it. Of interest, it contains:
    ■ Getter methods for each view object instance in the data model
    ■ A main() method allowing you to debug the application module using the
    Business Components Browser
    [package devguide.model;
    import devguide.model.common.StoreServiceAM;
    import oracle.jbo.server.ApplicationModuleImpl;
    import oracle.jbo.server.ViewLinkImpl;
    import oracle.jbo.server.ViewObjectImpl;
    // --- File generated by Oracle ADF Business Components Design Time.
    // --- Custom code may be added to this class.
    // --- Warning: Do not modify method signatures of generated methods.
    public class StoreServiceAMImpl extends ApplicationModuleImpl {
    /** This is the default constructor (do not remove) */
    public SRServiceImpl() { }
    /** Sample main for debugging Business Components code using the tester */
    public static void main(String[] args) {
    launchTester("devguide.model", /* package name */
    "SRServiceLocal" /* Configuration Name */);
    /** Container's getter for YourViewObjectInstance1 */
    public ViewObjectImpl getYourViewObjectInstance1() {
    return (ViewObjectImpl)findViewObject("YourViewObjectInstance1");
    // ... Additional ViewObjectImpl getters for each view object instance
    // ... ViewLink getters for view link instances here
    when i try this i didn't find the default generation for main method
    have i do something before enable custom java file for Application module
    hope to hear from you soon

    hi nonStop
    Since you are using Jdeveloper TP3, this might be a better place to ask your question:
    "JDeveloper and OC4J 11g Technology Preview"
    JDeveloper and OC4J 11g Technology Preview
    success
    Jan Vervecken

  • 9.7.3 Default Code Generation for a Custom Class for an Application Module

    hi all
    Oracle® Fusion Middleware
    Fusion Developer’s Guide for Oracle Application Development
    Framework
    11g Release 1 (11.1.1)
    with Jdeveloper TP3 ,
    By default, the application module Java class will look similar to what you see in
    Example below when you've first enabled it. Of interest, it contains:
    ■ Getter methods for each view object instance in the data model
    ■ A main() method allowing you to debug the application module using the
    Business Components Browser
    [package devguide.model;
    import devguide.model.common.StoreServiceAM;
    import oracle.jbo.server.ApplicationModuleImpl;
    import oracle.jbo.server.ViewLinkImpl;
    import oracle.jbo.server.ViewObjectImpl;
    // --- File generated by Oracle ADF Business Components Design Time.
    // --- Custom code may be added to this class.
    // --- Warning: Do not modify method signatures of generated methods.
    public class StoreServiceAMImpl extends ApplicationModuleImpl {
    /** This is the default constructor (do not remove) */
    public SRServiceImpl() { }
    /** Sample main for debugging Business Components code using the tester */
    public static void main(String[] args) {
    launchTester("devguide.model", /* package name */
    "SRServiceLocal" /* Configuration Name */);
    /** Container's getter for YourViewObjectInstance1 */
    public ViewObjectImpl getYourViewObjectInstance1() {
    return (ViewObjectImpl)findViewObject("YourViewObjectInstance1");
    // ... Additional ViewObjectImpl getters for each view object instance
    // ... ViewLink getters for view link instances here
    when i try this i didn't find the default generation for main method
    have i do something before enable custom java file for Application module
    hope to hear from you soon

    hi nonStop
    Since you are using Jdeveloper TP3, this might be a better place to ask your question:
    "JDeveloper and OC4J 11g Technology Preview"
    JDeveloper and OC4J 11g Technology Preview
    success
    Jan Vervecken

  • How can I align two different text row in the same table in two different way (one centered and the other one on the left)?

    Hi,
    I want to center two different text row that are in the same table but one on the center and the other one on the left. I put a <span> tag hoping that it has been overwhelmed the table's class properties The .bottomsel's font-family and the .Cig84's font-family and colour work but the text-align don't: they're both on the left.
    These are my source and CSS codes:
    Source:
    <table width="600" border="0">
      <tr>
        <td class="bottomref"><p><span class="bottomsel">| <a href="index.html" target="_self">Main</a> | <a href="about.html" target="_self">About</a> | <a href="clients.html" target="_self">Clients</a> | <a href="contact.html" target="_self">Contact</a> |</span><br />
          <span class="credits">Credits: <span class="Cig84">Cig84</span></span></p></td>
      </tr>
    </table>
    CSS:
    .bottomsel {
      text-align: center;
      font-family: Georgia, "Times New Roman", Times, serif;
    .credits {
      text-align: left;
    .Cig84 {
      color: #F00;
      font-family: "Comic Sans MS", cursive;

    Use paragraph tags with CSS classes.
    CSS:
         .center {text-align:center}
         .left {text-align:left}
    HTML:
    <table width="600" border="0">
      <tr>
        <td class="bottomref">
              <p class="center">This text is center aligned</p>
              <p class="left">This text is left aligned</p>
        </td>
      </tr>
    </table>
    Nancy O.

  • Is there any way to execute a custom script after JPA created tables?

    Hi
    I am looking for a way to execute some scripts right after JPA created the tables. I want the script to be executed once and not every time my application start.
    I though maybe Toplink has some extensions for this.
    Thanks.

    In general the auto-generated DDL is more for rapid prototyping, than production. If you have got to the point of defining your own DDL extensions, you may be better off outputting the auto-generated DDL to a file, and using ant or some other tool to define the schema including your extensions.
    You could do it using EclipseLink as well using a SessionCustomizer (which is an event class set in your persistence.xml). The SessionCustomizer is executed before the DDL is generated however, so you would need to remove the DDL properties from your persistence.xml and generate the DDL using an EclipseLink SchemaManager (SchemaManager.replaceDefaultTables(true, true)).
    James : http://www.eclipselink.org

  • Binding Methods Exposed From Application Module

    Hi All,
    I am using JDeveloper 11.0.2. I have a method exposed on the Application Module that when invoked, it creates a row. I exposed AppModADImpl as a client interface. After doing this, I am now able to see the method under data control section. On my page, I when to bindings and tried to create a bind to this method, I am able to see the method but the OPERATIONS list is disabled, because of this, I am unable to create the bind to the page.
    The method I'm trying to bind is below
    public Row createSystemTypes() {
    ViewObjectImpl vo = getAdSystemTypes1();
    Row row = vo.createRow();
    vo.insertRow(row);
    return row;
    Because the Operations List if disabled, when I click OK, I get the Error "No Actiond defined for the selected Item"
    I would appreciate help to know why Im unable to bind the method to the page.

    As the method has been added to the client interface of the application module, you have to select the application module in the dialog, not a view object. After selecting the application module (or the data control or root node) you should see all methods which are part of the client interface.
    Still, I wold do like Joonas outlined: use drag and drop and if you don't like the button you get this way on the page, switch to source mode and remove it. This will keep hte generated binding in the page def. Removing the button in design view will remove both, button and binding.
    Timo

  • Making LOV off of an exposed method from second application module

    Hello,
    I am on JDev 11.1.1.4.0.
    My ADF project worked fine until the spec changed on how Lookups are going to be handled. Previuosly, all the lookup tables were in the same database as other tables. Change is that FND Lookups will be created in the "Oracle" and my ADF project should connect to "Oracle" to get appropriate lookup values to build LOVs while maintaining the main database connection intact.
    After some research, I now have 2 Application Modules, one my project and the other for Lookups to create LOVs. I went to Application Module configuration wizard to edit JDBC setting to point to "Oracle" database and created a read only view with the following SQL:
    SELECT LOOKUP_CODE, MEANING, DESCRIPTION FROM FND_LOOKUP_VALUES  
    WHERE LOOKUP_TYPE = 'MY_LOOKUP'
    AND ENABLED_FLAG = 'Y'
    AND LANGUAGE = 'US'I can run both AMs via "Oracle Business Component Browser" fine. However, I somehow have to set the lookup view object as data source to create LOV on the main updatable view object's attribute. If I set it the way I used to do treating the lookup view as a view object residing in the same AM I am getting "table or view does not exist" error. I guess it is something to do with the lookup view object, but I cannot seem to make any kind of progress on this.
    Any help would be greatly appreciated.
    Thank you
    Bones Jones
    Edited by: Bones Jones on May 19, 2011 10:40 AM

    Well, I think I have found a solution which I didn't have to write a single line of code. My mistake was to think that I have to write code to achieve this.
    Here is what I did:
    *I already have the main AM and View Objects created for my project.  The following steps are done on top of that to bring LOV to life
    1. Create a new, pretty empty AM, named LovAM.
    1.1 Right click on the newly created AM and select 'Configurations'
    1.2 Click JDBC Name value and click 'Edit'
    1.3 Select the second database source where Lookup is defined. If not listed, go back out and create a new Database connection and come back.
    2. Create a View Object with the following SQL:
    SELECT
        TO_NUMBER(LOOKUP_CODE) ID,
        MEANING NAME,
        DESCRIPTION
    FROM
        FND_LOOKUP_VALUES
    WHERE
        LOOKUP_TYPE = 'MY_LOOKUP' AND ENABLED_FLAG = 'Y' AND LANGUAGE = 'US'3. Notice you now have LovAMDataControl
    4. Create a jspx page and create a table with the main data control's binding (This was a part of the requirements).
    5. I create a read-only table with LovAMDataControl.LovLookUp1 binding (I think this creates/exposes correct binding in the pageDef).
    6. Now I drag-and-drop an attribute that I have been wanting to display LOV from the main binding.
    7. Selected single select listbox. You will be presented with 'Edit zlist Binding' screen.
    8. Base Data Source is the main data control binding.
    9. Select Dynamic List
    10. Select LovAM data control binding as List Data Source.
    11. (optional) Selected 'Name' as Display Attribute.
    11.1. (optional) I don't want to see the table created in step 5. On the jspx page, go to Source tab and delete the table from there. I think this keeps binding in pageDef while the UI component is deleted from the page.
    12. Save and Run
    Now, I didn't have to create Root Application Module in the code, but still achieved what I wanted.
    Thanks
    Bones Jones

  • Two  different ways of closing Input/Ouput streams

    OK, the Sun tutorial on Exceptions [http://java.sun.com/docs/books/tutorial/essential/exceptions/putItTogether.html] shows an example where a PrintWriter is closed within a finally block.
    Now, the tutorial on bute streams [http://java.sun.com/docs/books/tutorial/essential/io/bytestreams.html] shows another example which is different from the first in that the method which contains all the code has throws IOException in the method header, and no catch blocks.
    As an experiment, I tried altering the second example by removing the throws IOException from the method header, and adding a catch block within the method. The code is shown below. This code does not compile, due to unreported exception errors on the close statements in the finally block.
    My question is, why in the first example can we close a PrintWriter in the finally block without having the method throw IOException, but in the second example we cannot close FileInputStream in a finally block unless we throw the exception in the method header?
    ok, here is my modified code from the second example...
    import java.io.*;
    public class CopyBytes {
         public static void main( String[] args ) {
              FileInputStream inStream = null;
              FileOutputStream outStream = null;
              try {
                   inStream = new FileInputStream("xanadu.txt");
                   outStream = new FileOutputStream("outfile.txt");
                   int c;
                   while( (c = inStream.read()) != -1 ) {
                        outStream.write(c);
              catch( IOException e ) {}
              finally {
                   if( inStream != null ) inStream.close();
                   if( outStream != null ) outStream.close();
    }

    endasil wrote:
    Fguy wrote:
    My question is, why in the first example can we close a PrintWriter in the finally block without having the method throw IOException, but in the second example we cannot close FileInputStream in a finally block unless we throw the exception in the method header?
    Short answer?  Because FileOutputStream/FileInputStream.close are declared to throw an IOException.  PrintWriter.close() is not.
    ...Thanks, that helps. I just checked the API docs and of course they confirm what you say, So I can live with that for my current purposes.
    I did notice that PrintWriter is like a wrapper for FileWriter, and close() for the FIleWriter class is inherited from OutputStreamWriter, and that close() does throw IOException. So it seems logical that there would be an exception "behind the scenes" which needs to be reported, but I guess this is not the case. Anyways, I have a direction for further investigation. Thanks again.

  • Two different ways to show a JPopupMenu - the differene

    Hi!
    I am wondering what the difference between these lines are:
    myTable.setComponentPopupMenu(tablePopupMenu);and
    tablePopupMenu.show(myTable, evt.getX(), evt.getY());I have noticed that if I use setComponentPopupMenu(Component c) in a MouseListener for a JTable, I can just select a row once. I´m sure there are solutions for that, but stComponentPopupMenu must be harder to work with than a JPopupMenu.show() method. Am I right?

    Again, have you read the API. This method was added to make it easier. Well, the API says if you set a popup menu to a component, then it will pop up (depending on the bindings).
    If I use the JPopupMenu.show() method in a mouseListener, it will also pop up. I can not see the difference. It is still the same amount of code, just one row.
    I just discovered when I was trying with my NetBeans application (almost generated code) and my own written code, that in my own code I was using a mousePressed method and in the NetBeans application a mouseClicked. The functionality of both the codes are now the same after I have changed to mousePressed in my NetBeans application.

  • Iphone 4s freezing at start up then shuts off and keeps restarting then repeating that process over and over. I have tried to reset the phone two different ways and still this problem occurs after I update it or turn off the phone.

    yes the title says most of what is going on.
    I recently reset my phone, losing all contacts and pictures. It was working fine, then after I updated it, it will not turn on completely.
    It starts up with the apple logo
    -goes to the ios 6 (please slide to open) screen
    -then shuts off
    -and repeats the process unless I shut the phone off manually
    I have tried to hold the lock and the home button down to manually reset the phone
    I have also tried reseting the phone completely previously, and I still have this problem.
    Any ideas?
    Thank you!!

    I really don't have an answer for that one. I guess that while trying to get things working correctly, I would use the most basic monitor I had which in your case would be the Eizon using the Thunderbolt port and adaptor.
    When you boot into Safe Mode the startup is quite slow, but you should get the Apple logo and then the spinning gear below it (release the SHIFT key when it appears.) Then after a little more time you should see a gray progress bar appear below the spinning gear. When that disappears the computer will startup to a login screen.

  • Non-Serializable Parameter in client methods on an Application Module

    Hello,
    I want to create a client method which expects an java.io.InputStream as input parameter. Unfortunately all method parameters must be of a data type that implements the Serializable Interface. This might be good and reasonably for remote deployments as EJBs, but I want to use them local.
    Is there any solution for this problem?
    Thanks,
    Christian

    The use of our interface-based approach is for guaranteeing that your client layer is always separable from your middle-tier layer.
    If you are implementing a project where you are making the assumption that you won't be separating the two, then you can:
    (1) Make sure you're using Immediate sync mode, and
    (2) Have your client downcast to your *Impl class to call your method with non-serializable parameter.
    This isn't best practice in general, but given your constraints, it's the way to solve this problem.

  • How to create the custom method and make it available to clients:

    Hello, Can any one help me with this problem ASAP??
    I am trying to work on an example of "Customizing the Query and Creating an Associated Custom Method"
    from http://helponline.oracle.com/jdeveloper/help/topics/jdeveloper/developing_mvc_applications/adf_pviewcustommethod.html?tp=true#method. To do that, the first task is to create the custom method and make it available to clients.
    Following instructions in the helponline documentation, I completed the three steps: (1) "Specify a custom query for the View Object definition for EmployeesView", (2) "Add the custom method to the application module Java class", and (3) "Make the method available to clients".
    The following is the error message I got to test the application module. Can anyone tell me what the message really means and what I should do. I am wondering if there is any mistakes in the document.
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.EMAIL, Employees.PHONE_NUMBER, Employees.HIRE_DATE, Employees.JOB_ID, Employees.SALARY, Employees.COMMISSION_PCT, Employees.MANAGER_ID, Employees.DEPARTMENT_ID FROM EMPLOYEES Employees WHERE Employees.SALARY > :1 and Employees.DEPARTMENT_ID = :2
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) ORA-01008: not all variables bound

    You need to set values for the parameters in your query before you try to execute the query in the view object.
    So you need to call the setBindVars method before the query.

Maybe you are looking for