Passing params to the AMImp method from backing bean

Hello. I am an ADF/Jdeveloper Noob and i have a requirement where I have created an AM method below and exposed it to my View Controller.
I am using Jdeveloper 11..1.1.4 to doe this.
//In AM
public boolean createSRTask(String sourceName, Number sourceRow)
//insert new row in the Entity Object.
EntityDefImpl SRTaskDef = MassSrImportEOImpl.getDefinitionObject();
MassSrImportEOImpl newSRTask = (MassSrImportEOImpl)SRTaskDef.createInstance2(getDBTransaction(), null);
newSRTask.setSourceName(sourceName);
newSRTask.setSourceRow(sourceRow);
return(true);
I have a text file i am reading and I get the parameters from processing that file when the user presses the upload button... I can loop thru the file contents etc. with no issues but i have yet
to figure out how to code the backing bean to call the AMImp method with the parameters I have read in.
Thank you in advance for any help.
Edited by: 832187 on Jan 16, 2012 6:51 AM
Edited by: 832187 on Jan 16, 2012 7:01 AM

In this case you should build a VO which is build on EO, add it to the data model of the application module. The you can either implement the service method in the VO or the application module. Let's assume you put it in the am (application module) like you already did. the method there would look like
//In AM
    public boolean createSRTask(String sourceName, Number sourceRow) {
        ViewObjectImpl massView = (ViewObjectImpl)findViewObject("MassSrImportView1");
        Row row =  massView.createRow();
        row.setAttribute("Source", sourceName);
        row.setAttribute("SRCNR", sourceRow);
        massView.insertRow(row);
        return true;
    }Some note on this:
1. the rows are not inserted in the db as long as you don't commit the transaction
2. It look like your view does not have a PK. The framework works better if you have one
3. If you always return true, you can omit the return value totally
4. If you plan to insert multiple rows you should consider passing hte file to the am method and do a bulk insert in there as this would minimize round trips.
I strongly recommend the you read the http://docs.oracle.com/cd/E25054_01/web.1111/b31974/bcintro.htm to get more knowledge about the business layer.
Timo

Similar Messages

  • How can i call a taskflow methode from backing bean ??

    Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660
    i like to call a Methode (taskflow) from backing bean!
    my bean code :
        public void imageLinkActionListner(ActionEvent actionEvent) {
            String              id      = actionEvent.getComponent().getId();
            int                 linkID  = Integer.parseInt(id.substring(4));
            DCBindingContainer  bc      = (DCBindingContainer)ADFUtils.getBindingContainer();
            DCTaskFlowBinding   tf      = null;
            System.out.println("Region Change...."+id+" INT "+linkID);
            switch (linkID) {
                case LINK_CALENDAR_REGION:
                    tf = (DCTaskFlowBinding)bc.findExecutableBinding("calendartaskflowPage");                   
                break;
                case LINK_MAIL_REGION:
                    tf = (DCTaskFlowBinding)bc.findExecutableBinding("mailtaskflowPage");                   
                break;
              case LINK_ADDRESS_REGION:
                  tf = (DCTaskFlowBinding)bc.findExecutableBinding("addresstaskflowPage");                   
              break;
              case LINK_BLOGS_REGION:
                  tf = (DCTaskFlowBinding)bc.findExecutableBinding("blogstaskflowPage");                   
              break;
              case LINK_MAPS_REGION:
                  tf = (DCTaskFlowBinding)bc.findExecutableBinding("mapstaskflowPage");                   
              break;
            default:
                return;
            if (tf != null){
                uiMainRegion.setRegionModel(tf.getRegionModel());
                uiMainRegion.setValue(tf.getRegionModel());
                tf.getExecutableBindings();
                AdfFacesContext.getCurrentInstance().addPartialTarget(uiMainRegion);
        }i like to call *#{backingBeanScope.mapBean.initMap}*
    my taskflow source
    <?xml version="1.0" encoding="windows-1252" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
      <task-flow-definition id="map-task-flow">
        <default-activity id="__1">map</default-activity>
        <view id="map">
          <page>/map/map.jsff</page>
        </view>
        <method-call id="initMap">
          <method>#{backingBeanScope.mapBean.initMap}</method>
          <outcome id="__7">
            <fixed-outcome>init</fixed-outcome>
          </outcome>
        </method-call>
        <control-flow-rule id="__2">
          <from-activity-id id="__3">initMap</from-activity-id>
          <control-flow-case id="__5">
            <from-outcome id="__6">init</from-outcome>
            <to-activity-id id="__4">map</to-activity-id>
          </control-flow-case>
        </control-flow-rule>
        <use-page-fragments/>
      </task-flow-definition>
    </adfc-config>

    Hi,
    to call the bean, use the EL in Java and reference #{backingBeanScope.mapBean.initMap} as a method expression. If you try and access the bean directly then chances are that the instance is not available. Using EL from Java always guarantees this
    Frank

  • 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

  • How to assign a value to the viewcriteria attribute from backing bean ?

    Hi,
    I have a readonly VO with the following query
    select attr1,attr2, attr3, attr4
    from sometable
    I have a view criteria in the above VO something like
    attr1=
    and attr2=
    I have dragged and dropped this criteria on a Status.jsff page as query panel with table. So the user can search the records by manually entering the values in the query panel. Also, there is another page Main.jsff where, if the user clicks on a button, it redirects him to Status.jsff page carrying a numeric value from the Main.jsff page. Now I have to assign this numeric value to "attr1" of the view criteria and execute this VO and show the updated results in the Status.jsff page.
    I used the below code :
    ViewObject vo = appModule.findViewObject("VOName");
    ViewCriteria criteria = vo.getViewCriteriaManager().getViewCriteria("CriteriaName");
    criteria.getVariableManager().setVariableValue("attr1", numericValue);
    vo.applyViewCriteria(criteria);
    vo.executeQuery();
    For the above code, i got an error saying that Variable "attr1" not defined in "VOName"
    Then i tried setting simple where clause
    vo.setWhereClause("attr1="+numericValue);
    vo.executeQuery();
    For this code, i got an error saying that SQL error during statement preparation.Statement: SELECT * FROM (select attr1 ,attr2,attr3,attr4,from VOName) QRSLT WHERE (attr1=1234)
    Please let me know the solution to this problem.

    Thank you all for the suggestions.
    The idea of Bind Variable works to query the criteria. But I have a Status.jsff page where User can even manually enter the attr1 value and query the results. When I added a bind variable to my VO, one extra input text field with the Bind variable name got added to the query panel in Status.jsff page. Also the table in the page did not show any results even after performing the executeQuery() on the VO(as per the steps explained in the Andrejus blog link that Navneeth has provided)
    Please suggest

  • Clarification on application method calls from backing bean.

    Hi Experts ,
    In our application we are using two different ways to call application module methods from backing bean.
    allication module method name : addRowValidUnitInfo
    it has 2 parameters serialNumber,modelNumber
    1.
    BindingContainer bindings1 =
    BindingContext.getCurrent().getCurrentBindingsEntry();
    OperationBinding serialModelDetails =
    bindings1.getOperationBinding("addRowValidUnitInfo");
    serialModelDetails.getParamsMap().put("serialNumber",
    serialNumber.getValue().toString());
    serialModelDetails.getParamsMap().put("modelNumber",
    modelNumber.getValue().toString());
    serialModelDetails.execute();
    String result =serialModelDetails.getResult().toString();
    2.
    EWarrantyAdminModule appModule =(EWarrantyAdminModule)
    Configuration.createRootApplicationModule(amDef,config);
    try {
    String result = appModule.addRowValidUnitInfo(serialNumber.getValue().toString(), modelNumber.getValue().toString());
    } catch (Exception e) {
    finally {
    Configuration.releaseRootApplicationModule(appModule,true);
    Can any one tell me which one gives best performance and which one should be used in which situations.
    For me both are working fine but just want to know whcih is the best practice and which gives best performance.
    Regards
    Gayaz

    The approach 1 is the right way.
    Reasons:
    1) With Approach 2 - you are creating new ApplicationModule on the fly and release it at the end of the request. If you are invoking multiple method calls, you need to the same for each & every call.
    This is not reusing the existing application module.
    2) If the use cases which does calls for maintaining state across requests from the same client - across the application flow, Approach 2 cannot be used.
    Read this blog post from Jobinesh (which indirectly distinguishes both these approaches).
    http://jobinesh.blogspot.com/2010/04/invoking-applicationmodule-from-servlet.html
    Thanks,
    Navaneeth

  • Everytime i link my iphone up to my laptop the message 'welcome to your new iphone' with the option restore from back up or new iphone. i once did restore from back up and it deleted all my recent pictures, music etc. how can i get pass this stage?

    everytime i link my iphone up to my laptop the message 'welcome to your new iphone' with the option restore from back up or new iphone. i once did restore from back up and it deleted all my recent pictures, music etc. how can i get pass this stage?

    Hi Khuram1981 - thank you thank you thank you!  All sorted!  dont suppose you know how to fix another problem I have??? for weeks now, since updating to ios5 I think, for some reason every time I have tried to log onto app store it says CANNOT CONNECT TO ITUNES STORE.  It's nothing to do with my computer, and I've been to the Geniius bar but they couldnt help and nothing I seem to do lets me update my Apps and even worse, I cant even buy any more.  Any suggestions?
    Again thank you SO much for helping with other problem = a real relief.
    Chatterwind xx

  • How can I set the value to a session bean from backing bean

    Hi Experts,
    How can I set the value to a session bean from backing bean where I have created getter and setter
    methods for that variable.
    Basically I am using ADFUtils class where I am able to get the value from session bean
    using following expression
    String claimType =
    (String)ADFUtil.invokeEL("#{ClaimValueObj.getClaimType}");
    Thanks
    Gayaz

    Gayaz,
    Wrong Post !!
    Post in JDeveloper and ADF
    Thanks
    --Anil                                                                                                                                                                                                                               

  • How to reset RichSelectOneChoice in JSF form from backing bean method?

    resetValue() is not working in this case. So any other method to reset from backing bean?

    Did you store the component instance on a bean by selecting a “Binding” property of the “RichSelectOneChoice” component?
    yourPage.jspx:
       <af:selectOneChoice
    binding="#{myBean._selectOneChoice}">
      </af:selectOneChoice>myBean.java:
        private RichSelectOneChoice _selectOneChoice;
        public void set_selectOneChoice(RichSelectOneChoice _selectOneChoice) {
            this._selectOneChoice = _selectOneChoice;
        public RichSelectOneChoice get_selectOneChoice() {
            return _selectOneChoice;
        private void rerenderSelectOneChoice() {
            AdfFacesContext.getCurrentInstance().addPartialTarget(this._selectOneChoice);
    }

  • Using saxparser in the suite method from junit

    Hi, i have a problem using SAXParser in the suite method of junit.
    My little test class 'myParser' works fine but when I call the method 'doIt' from the 'suite' method from a class that implements TestCase (junit) I get a java.lang.ClassCastException: org.apache.xerces.parsers.StandardParserConfiguration
    in line 7.
    Does anyone have an idea what I made wrong??
    1) public class myParser {
    2)   
    3)   public myParser() {}
    4)   
    5)   public void doIt() {
    6)     try {
    7)       org.xml.sax.XMLReader parser = new org.apache.xerces.parsers.SAXParser();
    8)       parser.parse("anyFile.xml");
    9)     } catch (java.io.IOException IOe) {
    10)       System.out.println(IOe.getMessage());
    11)     } catch (org.xml.sax.SAXException SAXe) {
    12)       System.out.println(SAXe.getMessage());
    13)     }
    14)   }
    15) }

    Hi JPilot,
    I�ve this problem, too.
    greez ZB

  • Best way to retreive an attributeValue from the bindings in a backing bean?

    What is the best way to retreive a value from an interator in your data bindings inside a backing bean?
    I can come up with a way were i resolve the value of an expression like #{bindings.myAttribute.value}
    Is this the best way or is there an easier?
    I can also place a hidden inputField were i bind the value to the attribute in my bindings and set the bindings of the input field to my backing so i can just call the .getValue in my backing bean...

    Yannick
    What is the best way to retreive a value from an interator in your data bindings inside a backing bean? Using JDeveloper 11.1.1.3.0 I created an example application
    at http://www.consideringred.com/files/oracle/2010/Thread1665841AttributeValuesApp-v0.01.zip
    It illustrates the behaviour for 3 different approaches to get an attribute value in a managed bean:
    public class WithAttributeValues
      public int getMyIdFromEL()
        return (Integer)ELHelper.get("#{bindings.myId.inputValue}");
      public int getMyIdFromAttributeBinding()
        BindingContainer vBindingContainer =
           BindingContext.getCurrent().getCurrentBindingsEntry();
        ControlBinding vControlBinding = vBindingContainer.getControlBinding("myId");
        AttributeBinding vAttributeBinding = (AttributeBinding)vControlBinding;
        return (Integer)vAttributeBinding.getInputValue();
      public int getMyIdFromIterator()
        BindingContainer vBindingContainer =
           BindingContext.getCurrent().getCurrentBindingsEntry();
        DCBindingContainer vDCBindingContainer = (DCBindingContainer)vBindingContainer;
        DCIteratorBinding vDCIteratorBinding =
           vDCBindingContainer.findIteratorBinding("findSomeMyRowsIterator");
        Row vRow = vDCIteratorBinding.getCurrentRow();
        return (Integer)vRow.getAttribute("myId");
    }For some reason the approach using getMyIdFromIterator() does not behave as intended when navigating the current row.
    see screencast at http://www.screencast.com/t/nIJ3DpsNE9Y
    Maybe John Stegeman can explain why that is because it is basically the same approach as he suggested in this forum thread.
    But if you don't have an attribute binding because you only use the iterator... Is it an option to create an attributeValue and bind it to the iterator so you can use it in your backing bean that way? Based on my findings above, using attributeValues bindings seems to be preferable.
    or is it only possible when you realy have an inputField bound to the attributeValue? The example application in Thread1665841AttributeValuesApp-v0.01.zip does not have any af:inputText components.
    Your question about "the best way" made me wonder if that wouldn't require JSR 227 API, so I posted that question in another forum thread, "How to get an attribute value using JSR 227 API ?"
    at How to get an attribute value using JSR 227 API ?
    regards
    Jan Vervecken

  • [svn] 4059: The measure() and updateDisplayList() methods of TextBox and TextGraphic now return early if the inheritingStyles and nonInheritingStyles proto chains haven 't been initialized, to avoid RTEs in the compose() method from invalid styles values.

    Revision: 4059
    Author: [email protected]
    Date: 2008-11-10 11:56:38 -0800 (Mon, 10 Nov 2008)
    Log Message:
    The measure() and updateDisplayList() methods of TextBox and TextGraphic now return early if the inheritingStyles and nonInheritingStyles proto chains haven't been initialized, to avoid RTEs in the compose() method from invalid styles values.
    QE Notes: None
    Doc Notes: None
    Bugs: SDK-17975
    Reviewer: Jason
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17975
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/TextBox.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/TextGraphic.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/TextGraphicEleme nt.as

    FYI - This regression has been filed here: http://bugs.adobe.com/jira/browse/SDK-31989

  • Using the ContactInsertOrUpdate method from the ContactWS but error msg rcv

    [This thread was migrated from the On Demand Developer Forum in the old Siebel Community]
    Corsa
    Contributor
    I am getting the following error I do not know why or how to work around
    it.
    Method 'SetFieldValue' of business component 'Contact' (integration
    component 'Contact') for record with search specification '[External <br/>
          System Id] = "123456"' returned the following error:"Access <br/>
    denied.(SBL-DAT-00542)"(SBL-EAI-04375)
    Does any out there have any ideas?
    Previously when I tried to do the same action I got the following message:
    Multiple matches found for instance of integration component 'Contact'
    using search specification '[External System Id] = "123456"' in the
    business component 'Contact', based on user key 'Contact User
    Key:3'.(SBL-EAI-04390)
    Both messages are baffling me. Please, please help
    Product: CRM OnDemand
    06-16-2006 04:35 AM
    Re: Using the ContactInsertOrUpdate method from the ContactWS but error
    msg rcvd
    BigSlick
    Valued Contributor
    Hi Corsa,
    Can you access the record in the online application. Perhaps someone has
    changed the access rights for this Contact on the Contact Team ?
    -BigSlick
    06-20-2006 12:33 PM
    Re: Using the ContactInsertOrUpdate method from the ContactWS but error
    msg rcvd
    Corsa
    Contributor
    I realise now that the field AccountID is readonly and cannot be assigned.
    I was attempting to assign contactsList[count].AccountId to a value . I
    believe, this is the reason I was getting the access denied error.
    06-23-2006 11:10 AM
    ==============================================================================
    Click on the board or message subject at the top to return.

    Ok, so I hit a bump in the road. Just when I think I understand something It doesn't work correctly.
    I implemented it I thought correctly. I looked up something on the sun website (core java) I used advice from here, and my professor finaly responded to me with almost identical instructions. So I did it
    my RationalNumber.java no looks like this.
    public class RationalNumber implements Comparable
    //.....Break to new section
      public  float compute ()
           float value = getNumerator() / getDenominator();
         return value;
       public int compareTo(RationalNumber op2)
           if (Math.abs(compute() - op2.compute()) < .0001)
              return 0; //Equal
          if (compute() > op2.compute())
            return + 1; //Rational Number bigger
          if (compute() < op2.compute())
               return - 1; //Rational Number Smaller
         }I thought that would work fine, but it gives me an error when I compile it:
    RationalNumber.java:8: RationalNumber is not abstract and does not override abstract method compareTo(java.lang.Object) in java.lang.Comparable
    public class RationalNumber implements Comparable
           ^So now what, making it abstract only creates more errors....
    Also, thanks ChuckBing, I'm glad you like the screen name, I've been using it for years.

  • This static method cannot hide the instance method from...

    What means the error message "This static method cannot hide the instance method from Referee"?
    Referee.java is a interface. I implemented it in the class RefereeMyName.java and made a method in that class to be static. Thats why I received that error message.
    But can't I use static methods when I have implemented a interface in that class? I want to have a Player.java class which I want to access RefereeMyName.getTarget(). I cannot use a instance instead because I wouldn't receive a valid return value then (RefereeMyName is the client class).
    What is the solution?

    Hi,
    Well i do not think that you can do that b'cos that way you are not giving the same signature for the method as that exists in the interface. I do not know how other way it can be done but if something urgent for you then you can remove that method from that interface and only define in the class.
    Regards,
    Shishank

  • How to call a method in backing bean on hitting 'Enter' key on a page.

    Hi all,
    I would be obliged if any one can provide me solution for the below given problem.
    My requirement is to call a method in backing bean when i hit 'Enter' key on a JSP page.
    I am trying this by using a script given below.
    *function fnChangeFocus(){*
    *if(window.event.keyCode==13){*
    * document.getElementById("mainform:submitForm:commandbutton").focus();*
    The JSP has the textbox as given below.
    *<h:inputText id="inputtxtboxid" disabled="false" value="#{Bean.inputvalue}"*
    onkeypress="fnChangeFocus()" size="24" />
    Using this I could not acheive the required functionality. Please suggest some alternative.
    Thanks,
    Jagadeesh Pala

    Only a form element supports the submit() function. Make sure that the getElementById returns the appropriate form. Or rather pass the element as the 'this' reference to the function and get the parent form from it.
    After all this is just basic DHTML / Javascript+DOM knowledge and in fact this has nothing to do with JSF. For future basic DHTML / JS+DOM questions you may take a look at the appropriate forums, e.g. dhtmlcentral.com, dynamicdrive.com, etcetera.

  • Calling init method on backing bean when JSP loads

    Hi All,
    My problem seems simple, but I'm not having much luck finding a solution.
    I have a JSF page that shows the details of an employee. So I have an employee.jsp with a backing bean EmployeeController which works fine.
    The change I need to make is this: pass in an employeeId to the URL and let my controller read it.
    I've tried the following in my faces-config.xml:
    <managed-bean>
      <managed-bean-name>exmployeeBean</managed-bean-name>
      <managed-bean-class>
        com.acme.EmployeeController
      </managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
        <property-name>employeeId</property-name>
        <value>#{requestScope.employeeId}</value>
      </managed-property>
    </managed-bean>And the following in my backing bean:
    public void setEmployeeId(String employeeId) {
      logger.info("METHOD CALLED");
      this.refreshValuesForEmployee(employeeId);
    }But I'm not having any luck (ie - this method is not being called).

    it's ok. i found out why it wasn't working.
    my scope was set to "session", but had to be "request" so that i could use the params syntax.
    thanks anyway.

Maybe you are looking for

  • Fingerprint login not working when resumning from sleep

    Hello, I changed HDD to SSD and did *fresh* install, not from rescue discs. Everything is working as expected except except fingerprint login -- instead of logging I got an error: The computer is locked. Only logged user can unlock it. Picture I got

  • Communicating USB using Labview VISA

    I have a USB RAW device that I am trying to communicate with using labview VISA. I have had success with setting up the driver and I am able to get information from the device such as serial number, etc. When I try to use the VISA read and write comm

  • Custom Icons Disappear in Cover Flow Above Certain Size

    I've been trying to create custom icons for certain folders and I've been having no luck when viewing them in cover flow. I've downloaded a PNG file, 512x512 pixels. Open it in Preview, copy to the clipboard, do a 'get info' on the folder I wish to c

  • Payroll run process is not showing any results

    We have Oracle Applications 11.5.10.2 with vision demo database with US legislation. After completing all the required setups for Payroll and defining a new payroll and all the requirements for the payroll, when we submit the request Payroll Process

  • Query Cost vs SQL statistics

    I have a query and when I execute it it gives a cost of 4000+, however after I optimized it came down to about 300 or so. My problem is that after discussing the query with my manager he showed me that the statistics of the first query version where