Custom method in EOImpl

Hi,
I have a custom method to call in the EOImpl. This method just creates rows for another entity. What would be the best place to put this custom code. Is it the validateEntity or the postChanges method of the EOImpl.
thanks.

Hi,
Thanks for your response.
I have to call this custom logic irrespective of the DML operation type.
The scenario is that when an attribute in the EO is set, and the EO changes are saved, call this custom logic which creates entity rows behind the scenes.
I am unsure if it is wise to put it in the setter of the attribute. hence I was debating on validateEntity or postChanges.
Do you still think it should go into the doDML.
TIA

Similar Messages

  • Not able to save bindings when calling bindings.getOperationBinding("update") in customized method.

    Hi All,
    I'm new to ADF and trying to learn it.
    I'm using JDev version 11.1.1.6.0.
    My use case is mention below :
    1. I've created 2 Bounded task flows and calling one task flow from another task flow using task flow call activity.
    2. In child task flow, i've created view activities with Train component. View activities have text fields, radios buttons, tables etc which can be filled by user.
    3. I want to save the page data to payload if I move to next view activity using Next button or by train bar.
    To accomplish this scenario, I'm calling a customized actionListener on click of Next button/Train Stop Bar in which I'm using below mention code :
    BindingContext bindingContext = BindingContext.getCurrent();
    BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
    OperationBinding obj = bindings.getOperationBinding("update");
    if(obj != null){
         obj.execute();
         if(!obj.getErrors().isEmpty()){
              System.out.println("Not able to save data......");
         else{
              System.out.println("able to save data......");
    But I'm not able to save page data to payload/bindings. If i close the window using browser close button and move back to previous train stop in which i've filled the data, the data get lost and all the text fields/Radio button become empty.
    If I use Save button provided by Oracle BPM, then I'm able to save it. and data reflected even after if i close the window using browser close button.
    So I also try to use the below acode but did not get any success :
    FacesContext fctx = FacesContext.getCurrentInstance();
    Application app = fctx.getApplication();
    ELContext elContext = FacesContext.getCurrentInstance().getELContext();
    InvokeActionBean invokeActionBean = (InvokeActionBean)app.getELResolver().getValue(elContext, null,  "invokeActionBean");
    invokeActionBean.setAction(actionEvent);
    invokeActionBean.action();
    Can somebody please let me know, what am I doing wrong here or if I'm missing anything.
    Any pointers/suggestions for its resolution are welcome.
    Thanks in advance.

    Hi Timo,
    Yes, it is the same binding which is called from BPM Save button.
    I did not use the debugger but i tried to print the OperationBinding object which was showing me proper binding for update.
    Even when i tried to print the return value of invokeActionBean.action(); method, it print the proper string "closeTaskFlow".
    So if I see it logically, then I'm just trying to call the methods of InvokeActionBean from my customized method.
    If methods of InvokeActionBean not being accessed, or if it was not getting called, then it should not print the "closeTaskFlow" as return value.
    I only want to save page data into bindings once I'll move away from page precisely on moving next.
    If there is any other work around for this issue, please let me know.
    I've also tried to use Explicit/Implicit save points provided by ADF but that did not work too.

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

  • View event does not trigger custom method

    This is something that should be straightforward and easy...... but it is not working as expected!
    I have a main window with a tab bar and two additional views. One view has text boxes and a method to change a label when an event on the text box is triggered. Using the interface builder, I have created the text boxes and associated them with the custom method through the events. The method and text box is defined in the view controller files (the header file and the interface file).
    When the view is shown and the event occurs, the method is not triggered. This is really weird as I have gone through several tutorials and all set up the view the same way I have it set up.
    When I run it in debug, nothing breaks at the break points -- even the init methods....
    Any ideas?

    Please describe the event you're looking for and the method expected to catch it. By "custom method", do you mean a UITextField delegate method? You mentioned a tab bar and two other content views. Is your question confined to only one view controller->view, or do we need to know about any of the other content views? Are all the objects we need to know about in one .xib file?

  • How to detect if a user has changed a record using a custom method?

    I am in the process of developing a test case application using ADF JSF and a collection of Java objects that are not populated by a database.
    Details of what I have developed so far can be found on this post:
    how to create a new record using a custom method?
    Is it possible to detect if a user has changed the value(s) of a record?
    I have set the edit page up (as described in the other post) and this works fine, but how could I tell if the user has changed something on that record. This is what I would like to do, but am not sure how to achieve it or whether it is possible....
    when the user puts a record in edit mode, take a copy of that record
    then when the user presses save or exit to navigate away from the edit page do a comparison between the original values and the potentially changed ones
    then depending on the outcome of the comparison call an appropriate action
    Thanks in advance for your help
    David

    If you just want to know if the value has changed you can put it in a while loop and use shift registers to see if the value has changed.
    Brian
    Attachments:
    Changed.vi ‏22 KB

  • 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

  • Using a Custom Method to Set the Bind Parameters in a View Object

    Hi all:
    i tried to follow the tutorial in oracle jdeveloper 10.1.2 documentation about creating a simple search page but i'm receiving this error when i tried to test the application module after i added a where clause to my view object(i.e where dept_id= :1) and define a custom method to bind variables in the appmodule class
    i keep getting this error
    JBO-27122: SQL error during statement preparation. Statement: SELECT Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.SALARY, Employees.DEPARTMENT_ID Employees.DEPARTMENT_ID = :1
    ????? IN ?? OUT ????? ?? ??????:: 1
    when i used the setwhere metohd it works
    i'll apprciate ur answer
    regards

    I have the same problem:
    Just like in Toystore Demo I am calling the following method in my VO:
       * Find an account by username and password, leaving the account
       * as the current row in the rowset if found. BUT EVEN IF WE FIND ACCOUNT BY
       * USERNAME AND PASSWORD, IT WILL RETURN FALSE IF THE ACCOUNT IS DISABLED!!!!
       * @param username the username
       * @param password the user's password
       * @return whether the user account exists or not
      public boolean findAccountByUsernamePassword(String username, String password) {
         * We're expecting either zero or 1 row here, so indicate that
         * by setting the max fetch size to 1.
        setMaxFetchSize(1);
        setWhereClause("staff_id = :0 and passw = :1");
        setWhereClauseParam(0, username);
        setWhereClauseParam(1, password);
        executeQuery();
        RowSet rs = this.getRowSet();
        String userEnabled = new String("N");  // Default setting
        if (rs != null){
          int currentSlot = rs.getCurrentRowSlot();
          Row r = rs.getCurrentRow();
          if (r == null){
             r=rs.first();
             currentSlot = rs.getCurrentRowSlot();
          //check if we found the user
          if (currentSlot == SLOT_VALID){
            Object[] av = r.getAttributeValues();
            LoginUtils.userLoggedIn    = av[0].toString();  // '0' is username
            LoginUtils.userFirstName   = av[1].toString();  // '1' is user first name
            LoginUtils.userAccessLevel = av[6].toString();  // '6' is user level
            LoginUtils.userEnabled     = av[7].toString();  // '7' is user level
            userEnabled = av[7].toString();
        boolean found = (first() != null) & userEnabled.equals("Y");
        setWhereClause(null);
        setWhereClauseParams(null);
        setMaxFetchSize(0);
        return found;
      }It gives the same exception...
    JBO-27122: SQL error during statement preparation. Statement: SELECT Staff.STAFF_ID, Staff.FIRST_NAME, Staff.MIDDLE_NAME, Staff.LAST_NAME, Staff.POSITION, Staff.PASSW, Staff.USER_LEVEL, Staff.ENABLED, Staff.PHONE, Staff.EMAIL FROM STAFF Staff WHERE (Staff.STAFF_ID = :0 and Staff.PASSW = :1)
    This worked in 10.0.1.2 but now it does not work in 10.0.1.3!!!

  • Custom method and Backing Bean

    Hi,
    I have created a custom method in my application for creating a record in table "TEST".
    I then dragged the method on a jspx page and created a parameter form.
    The method has some parameters, for example parameter1, parameter2,....parameter10.
    One of the parameters i have specified it as a selectOneRadio. Based on what the user selectes, i want to hide/show some parameters.
    What i would like to do is to be able to access the selectOneRadio from a bean, and then access the other parameters so to set render option to true/false based on the selection.
    Thanks
    Antonis

    Hi,
    works for me
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <f:view>
      <afh:html>
        <afh:head title="SelectBooleanTest">
          <meta http-equiv="Content-Type"
                content="text/html; charset=windows-1252"/>
        </afh:head>
        <afh:body>
          <af:form partialTriggers="booleanSelectBox">
            <af:selectOneRadio label="Choose"
                               valueChangeListener="#{SelectBooleanTest.onChange}"
                               autoSubmit="true" id="booleanSelectBox"
                               value="#{SelectBooleanTest.booleanValue}">
              <af:selectItem label="Option A" value="1"/>
              <af:selectItem label="Option B" value="2"/>
            </af:selectOneRadio>
            <af:panelGroup>
              <af:inputText label="Label 1"
                            rendered="#{SelectBooleanTest.renderComponent}"
                            value="Hello World" partialTriggers="booleanSelectBox"/>
            </af:panelGroup>
          </af:form>
        </afh:body>
      </afh:html>
    </f:view>
    import javax.faces.event.ValueChangeEvent;
    public class SelectBooleanTest {
        int booleanValue = 1;
        boolean renderComponent = true;
        public SelectBooleanTest() {
        public void onChange(ValueChangeEvent valueChangeEvent) {
            booleanValue = ((Integer)valueChangeEvent.getNewValue()).intValue();
        public void setBooleanValue(int booleanValue) {
            this.booleanValue = booleanValue;
        public int getBooleanValue() {
            return booleanValue;
        public void setRenderComponent(boolean renderComponent) {
            this.renderComponent = renderComponent;
        public boolean isRenderComponent() {
             switch (booleanValue){
                case 1: renderComponent = true;
                        break;
                case 2: renderComponent = false;
                        break;
            return renderComponent;
    }Note that the bean is in session scope to keep the selected state
    Frank

  • How to use ApplicationModule custom methods in JSP?

    I have an ApplicationModule for which I have defined several custom methods (in the ApplicationModuleImpl class). I wish to invoke these methods from a JSP. I'm having trouble getting a scriptable reference to the application module object in the JSP. I can get data from the view objects using the jbo:xxx data tags, but I can't get any sort of reference to the application module object that would allow me to invoke the methods. I have tried editing the application module to expose the methods as client methods, but still can't get a reference to them.
    My main questions:
    1. Is there a way to invoke the custom methods somewhere between the jbo:ApplicationModule tag and the jbo:ReleasePageResources tag?
    2. Is there a way to declare and use the application module without using the jbo:ApplicationModule tag? Would I ever benefit from doing this?

    Alan, here's how to call a custom method String getSomeInfo() that I've created on my application module, MyModule in this example. Also, in this example the id parameter in the ApplicationModule tag is "am" (<jbo:ApplicationModule id="am"...):
    First, edit your application module. In the app module editor, go to the Client Methods tab and move getSomeInfo into the selected list.
    Next, edit your JSP to call your custom method.
    <% MyModule myAm = (MyModule)am.useApplicationModule(); String someInfo = myAm.getSomeInfo(); %>
    You also have to add the correct import statements to the page tag in your JSP:
    <%@ page contentType="text/html;charset=windows-1252" import="oracle.jbo.*, MyModule.common.*"%>
    Hope this helps
    Blaise

  • Terminating Event for BUS2017 Custom Method

    Dear Experts,
    I have an issue with the Terminating Event of the Workflow for BO : BUS2017. The event is getting triggered but receiver is not being picked.
    I have created two events GR_103 and POST_105 in the Custom BO ZBUS2017 by delegating it to BUS2017. GR_103 is the triggering event for my workflow which I have triggered in the POST_DOCUMENT Method of the Implmentation for BADI : MB_MIGO_BADI.
    GR_103 is triggered while doing MIGO (Goods Receipt) for Movement Type 103. My Workflow is triggered perfectly and then I have used a Dialog Asynchronous Task in which I have called the MIGO Transaction for Releasing the GR Blokced Stock using the Movement Type 105. I have created a Custom Method POST in the BO ZBUS2017 and I have used the FM: MIGO_DIALOG to call the MIGO. I am trying to raise the POST_105 event in the Method MB_DOCUMENT_BEFORE_UPDATE of the Interface IF_EX_MB_DOCUMENT_BADI.  I have defined the Terminating Event for the asynchronous Task as POST_105.
    Now the event POST_105 is triggered, but SWEL says 'No receiver entered'. Even the SWEINST shows the object data as the current Work Item along with Object Key, but still receiver not picked. When I try to trigger the same event in a test report by using call transaction, then the event triggers and work item gets completed without any issues.
    Please advise.
    Below is my terminating event code.
      READ TABLE xmseg INTO wa_mseg INDEX 1.
      CONCATENATE wa_mseg-mblnr wa_mseg-mjahr INTO l_objkey.
      IF wa_mseg-bwart = '105' .
        CALL FUNCTION 'SWE_EVENT_CREATE'
          EXPORTING
            objtype           = 'BUS2017'
            objkey            = l_objkey
            event             = 'POST_105'
          EXCEPTIONS
            objtype_not_found = 1
            OTHERS            = 2.
      ENDIF.
    Regards,
    Raju.

    Have a COMMIT WORK after the function call. (At least test it - I am not sure if it will have some effects in your BADI - at least you will know whether the issue is about missing commit).
    And please use SAP_WAPI_CREATE_EVENT instead of the old function you are using.
    Also, make sure that the events will look exactly the same in event monitor SWEL when triggered from your code and when using test tool. Maybe there is some minor difference/mistake (object key, etc.) that you haven't noticed.
    Regards,
    Karri
    Edited by: Karri Kemppi on Feb 7, 2012 8:14 AM

  • How to get currentRow in an Application Module custom method?

    I have written a custom method in the BC4J AppModule. In that custom method I want to update a row. But I do not know how to getCurrentRow in my custom method.

    this is probably better since nobody is giving other solutions:
    Repost: Simple question but no one answers

  • JSF: Problems adding rows to table with custom method

    Since this being my first post, I find it only appropriate to thank the development team for such a huge addition to the application development world. You guys rock. You have cured my Java identity crisis. That being said...
    I have been stumped for days. I'm making a simple web cart. I am trying to get two string values (name and price) passed through a custom exposed application module method ran on a backing bean. What I want the exposed VO module to do is, upon receiving the two strings, create a new row on the empty data controlled table I have built to store them. Basically I just need to add rows to a table with my custom managed bean. Most recent version.
    I have written a test method to make sure my backing bean and exposed app module impl were working. This test works:
    //WORKS
    //CartInfo.java   
        public String cb1_action() {
            AppModuleImpl am = new AppModuleImpl();
            am.testMethod();
            return null;       
    //AppModuleImp.java
        public void testMethod() {
            System.out.println("WORKS");      
        }I found some code on how to add rows and unfortunately it isn't working out for some reason. Here is what is producing the error "Caused By: java.lang.NullPointerException" :
    //DOESN'T WORK IN CUSTOM METHOD BUT WORKS WHEN DRAGGED ON TO THE PAGE AS A COMMAND BUTTON
    //CartInfo.java
        public String cb1_action() {
            AppModuleImpl am = new AppModuleImpl();
            am.testMethod("test", "test");
            return null;
    //AppModuleImp.java
           public void testMethod(String pName,String pPrice) {
            ViewObjectImpl vo = this.getCartVO1();
            Row r = vo.createRow();
            r.setAttribute("NAME", pName);
            r.setAttribute("PRICE", pPrice);
            vo.insertRow(r);
    //The VO attributes for the DC are:
    // Name : Type : Alias Name : Entity Usage : Info
    NAME : String : NAME : (blank) : Transient
    PRICE : String : PRICE : (blank) : TransientSo what I have so far is a table linked to my database. A user can select and click on a product on the row's individual Add button and using a modified selection listener, it returns the values to the backing_bean.
    Then what I want it to do is have those variables passed to the other table. I just can't put it together.
    Please if there is anyone that could send me in the right direction I would greatly appreciate it!
    Thank you,
    Jack

    if i understand you, you want to call application module method when user clicks on add button on the UI and your table is from VO
    so what i can come up for now is:
    1) create variable binding from the iterator for both name and price.
    2) on your UI action button :
    <af:commandButton actionListener="yourbean.addToCart">
    <f:attribute name="pName" value ="binding.<created name bind variable>"
    <f:attribute name="pPrice" value = "binding.<created price bind variable>"
    </af:commandButton>
    3) custom Managed Bean:
    //yourBean.java
    public void addToCart(ActionEvent e){
    // get binding here
    // use executeWitParams method to send parameter to the function "testMethod" and execute
    //AppModuleImp.java
    public void testMethod(String pName,String pPrice) {
    CardVOImpl vo = this.getCartVO1();
    CardVORowImpl r = (CardVORowImpl)vo.createRow();
    r.setAttribute("NAME", pName);
    r.setAttribute("PRICE", pPrice);
    vo.insertRow(r);
    Hope this helps...
    Let me know if not..
    Thanks
    Edited by: MavenDev on Oct 30, 2011 8:08 PM

  • Binding data to custom method in DataAction

    hi!
    I am using adf uix and struts.
    I am confronted with the following problem: I created a DataAction for calling a custom method of an ApplicationModule. How do I bind data from the DataContainer in the struts-config?
    All how-tos figure out only the binding through ${param.<paramName>}.
    Isn't it possible to address the DataContainer through ${data.<UIModelName>.<BindingName>}? My intention is to bind a column value from an uix edit form to a custom method!
    I attached an excerpt for the illustration of my problem:
    <action name="DataForm" path="/RolleZuordnen" className="oracle.adf.controller.struts.actions.DataActionMapping" type="oracle.adf.controller.struts.actions.DataAction">
    <set-property property="modelReference" value="RolleZuordnenUIModel"/>
    <set-property property="methodName" value="RolleZuordnenUIModel.addRolleToBenutzer"/>
    <set-property property="resultLocation" value="${requestScope.methodResult}"/>
    <set-property property="numParams" value="2"/>
    <set-property property="paramNames[0]" value="${data.editMitarbeiterUIXUIModel.Login}"/>
    <set-property property="paramNames[1]" value="${data.editMitarbeiterUIXUIModel.DrId}"/>
    <forward name="success" path="/editMitarbeiterUIX.do"/>
    </action>
    with regards
    roland

    Have you reviewed the ADF Binding Primer whitepaper...
    http://www.oracle.com/technology/products/jdev/collateral/papers/10g/ADFBindingPrimer/index.html
    It has a section on binding to method return values.

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

  • 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

Maybe you are looking for