How to call a method of the Module of the Application of a class of ViewObjectImpl?

Howdy,

With the help of Studio Edition Version 11.1.1.3.0.

I have a setup where a user between an element and a price. When the item and the price is committed, I want this event to then influence the price of his parents. My idea is to do a ViewRowImpl class and then call an AppModuleImpl class that is her parents and it affects their attributes.

Question:

(1) how to call a method on the Module of the Application of a class of ViewObjectImpl?
  public void setPrice(Number value)
  {
    setAttributeInternal(PRICE, value);
    
    DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    BindingContext bctx = bindings.getBindingContext();
    DCDataControl control = bctx.findDataControl("AppModuleDataControl");
    ApplicationModule am = (ApplicationModule ) control.getDataProvider();
    //uh now what??
    // am.getProperty("method call(getTipsNum())") ?
  }
(2) when I set an attribute on a view through the AppModuleImpl object, I'll make an infinite loop in this way? that is the AppModuleImpl calls the ViewRowImpl class on a setAttribue (< name >, < value >)?

Thank you guys.

It's an interesting problem, I'll take a stab to solve here.

First let's see I understand the data model:

(a) there is a table called BOM with a self referencing FK creating a hierarchy of data
(b) each record BOM is usually a child to another record BOM, so using your example, a van is composed of frames and tires - Let's say that this amounts to 3 records in the Schedule table.
(c) check parent, truck, is the root of the hierarchy, and so the FK relationship sucks.
(d) the price of a truck consists of its children. So if the frame costs $1,000 and tires $500, the pickup truck costs total $1,500.
(e) a change in the price of any folder BOM, upwards or downwards must be propagated to its parent folder BOM. As an example, if the tires up to $600, the pickup truck is now $1600 ($1000 frame + tires $600).

Does this sound right?

Well, that I understand the data model, here's what I'd do build in what concerns objects ADF BC:

(1) an entity BOM (EO) object - let's call this Bom
(2) a BOM BOM EO association (representing the self referencing FK)-Let's call it BomBomFkAssoc
(3) an object to view BOM (VO) based on the EO - let's call it BomView
(4) BOM VO view link BOM VO based on EO of #2 association - call BomBomFkLink

Next, we create the Java constructs:

(5) #1 ensures that the EntityImpl has been created
(6) #4 guarantees for the EO association that it generates the required Java accessors

Now the additional code:

(7) for the EntityImpl # 5, in the field of setter setPrice() something like the following:

public Number setPrice(Number value) {
  Number diffPrice = value.minus(getPrice()); 

  setAttributeInternal(PRICE, value);

  BomImpl parentBom = getBom(); // from step #6, the EntityImpl should have an accessor method to it's parent BomImpl record
  Number parentDiffPrice = parentBom.getPrice().add(diffPrice);
  parentBom.setPrice(parentDiffPrice);
}

From a point of view JSF, now when I change a specific record of the Nomenclature in an edit form, a change for the price of registration for the Bill to submit time will automatically propagated to the top of the hierarchy of the BOM because the method setPrice() of the current OS of BOM will walk to the top of the hierarchy of the BOM to the parent following the call it is setPrice() method , which will be then walk to the next BOM record and so forth. At the time all BOM records with changes should be committed to the database.

You don't need to test this in JSF, but simply the browser component of company on the Application template project Module.

.... Of course... If I misunderstood your data model, it will be of no help whatsoever.

CM.

Tags: Java

Similar Questions

  • How to call a method of the AM with parameters of Bean managed?

    Hello world

    I have a situation where I need to call the Managed bean (setDefaultSubInv) AM, under value changes Listner method. Here's what I do, I added the AM method on page links, and then at the bean call it

    Class [] paramTypes = {};
    Object [] params = {};
    invokeEL ("#{bindings.setDefaultSubInv.execute}", paramTypes, params);

    It works and be able to call this method, if there are no parameters. Say that I pass a parameter to setDefaultSubInv(String a) method AM, I tried to call it bean but raise an error

    The string available = 'test ';
    Class [] paramTypes = {String.class};
    Object [] params = {DISP};
    invokeEL ("#{bindings.setDefaultSubInv.execute}", paramTypes, params);

    I'm not sure this is the right way to call the method with parameters. Can anyone tell how to call a method of the AM with bean to manage settings

    Thank you
    San.

    Just do the following

    1. your method in the Client Interface.
    2 - Add to Page Def.
    3 - Customize your Script like below one to reach your goal.

    BindingContainer links = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("GetUserRoles");
    operationBinding.getParamsMap () .put ("username", "oracle");
    operationBinding.getParamsMap () .put ("role", "F1211");
    operationBinding.getParamsMap () .put ("Connection", "JDBC");
    Object result = operationBinding.execute ();
    If (! operationBinding.getErrors () .isEmpty ()) {}
    Returns a null value.
    }
    Returns a null value.
    }

    I hope it helps you
    Thank you

  • How to call a method defined in AM when I select a value in LOV

    Lets say there is a LOV. The scenario is as soon as I select a value in LOV, a method should be called I wrote in the AM. And the output of the method in an output text area.

    I am not able to understand how to call a method when the user selects a value from the LOV.


    This is wht I did. I had created the connection for the method. One replaced the property autosubmit to the LOV for real and in the properties of the output area, in partial submission trigger property, the ID of the LOV. But I don't have any place where I need to call the method. I'm also not able to remove a listener for action on the LOV
  • question on "How to call a method once when starting the application"

    Hello everyone.

    I'm trying to implement that article "How to call a method once when you start the application" by Frank suggests.
    https://blogs.Oracle.com/jdevotnharvest/entry/how_to_invoke_a_method


    Suppose I want to have a single entry point, so in my login.jpsx I have the below:
    <f:view beforePhase="#{login.onBeforePhase}">
    In the 'onBeforePhase' method, I have to pass the phaseEvent, since the signature is as follows:
    public void onBeforePhase(PhaseEvent phaseEvent)
    But how do I know the phaseEvent during the call to the login.onBeforePhase? How the call should be?

    Thank you very much!


    PS. I use jDev 11.1.2.1.0

    You must not pass something to this method, this method is called before each Phase except view restoration
    Just write logic as Frank suggested to the phase in which you want the code to run. You can get the PhaseId analogues

    PhaseId.RENDER_RESPONSE

    public void onBeforePhase(PhaseEvent phaseEvent) {// from Frank's doc
     //render response is called on an initial page request
      if(phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE){
    ... etc
    
  • How to call a method defined in AppmoduleImpl using a groovy expression?

    Hi experts,

    With the help of jdev 11.1.1.5.0 - adfbc battery.

    I followed this post as the blogger says.
    How to call a method defined in AppmoduleImpl using a groovy expression?
    https://blogs.Oracle.com/ADF/entry/how_to_call_a_method

    While a button insert hit

    Suite error survey.
    java.sql.SQLException: ORA-20483: ADM-
    ORA-06512: at "RMSTD.FUNC_FIND_PLNT_DESC", line 22
    ORA-06512: at line 1
    
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
    It is my code for the function.
    CREATE OR REPLACE FUNCTION func_find_plnt_desc (
       p_bu        VARCHAR2,
       p_plnt_id   VARCHAR2,
       p_lang      NUMBER
    )
       RETURN VARCHAR2
    IS
       CURSOR cur_find_plant
       IS
          SELECT bup_name1, bup_name2
            FROM bus_unit_plants
           WHERE bup_bu = p_bu AND bup_plant_id = p_plnt_id;
    
       rec_find_plant   cur_find_plant%ROWTYPE;
    BEGIN
       OPEN cur_find_plant;
       FETCH cur_find_plant INTO rec_find_plant;
    --RAISE_APPLICATION_ERROR(-20999,P_BU||P_PLNT_ID);
       IF cur_find_plant%NOTFOUND
       THEN
    
          raise_application_error (-20483, 'ADM' || P_PLNT_ID ||'-'||P_BU);
          --NULL;
       END IF;
    
       CLOSE cur_find_plant;
    
       IF p_lang = 1 THEN
          RETURN (rec_find_plant.bup_name1);
       ELSIF p_lang = 2 THEN
          RETURN (rec_find_plant.bup_name2);
       END IF;
    END;
    /
    Reason behind:
    while hitting the insert means null from the value of the survey so error function.

    If am not hitting doesn't mean no problem. the function works correctly return description.

    can someone help me how to override?

    Published by: ADF7 on April 10, 2012 23:51

    ADF7,
    the subject of the post has nothing to do with the question (for as far as I see it).
    As you can see the error message clearly comes from the procedure pl/sql you call the application module, works of groovy appeal method.

    We cannot decide what makes your service if you pass null as a parameter. You can check the settings before you proceed to the procedure or write the procedure in how it treats null parameters.

    Timo

  • Calling a method in the Parent of window title component

    Hi all

    I have a parent component that opens a window of title when I click on a button. Now, I want to call a method in the parent of the title window component. How do I do this in Flex? Could someone give me a tip please.

    Thanks in advance for the help

    This is a good start:
    http://weblogs.Macromedia.com/pent/archives/2007/11/popup_can_you_h.html

  • How to call other functions within the ScriptableFunction class

    I am trying to create an extension of javascript class which will record audio, but the problem is that I can't call other methods in the class.

    clear explanation about my problem:

    It's my Scriptable class

    public final class OCNUtilsNamespace extends Scriptable
    {
        VoiceRecord vr;
    
        public OCNUtilsNamespace()
        {
            this.vr = new VoiceRecord();
        }
        public Object getField(String name) throws Exception
        {
            else if(name.equals("VoiceRecorder")){
                return this.vr;
            }
    
            else if (name.equals("stopRecording"))
            {
                this.vr.stopRecording();
                return new String("Stopped Recording");
            }
            else if (name.equals("startRecording"))
            {
                this.vr.startRecording();
                return new String("Started Recording");
            }
            return super.getField(name);
        }
    }
    

    and here's my ScriptableFunction class:

    public class VoiceRecord extends ScriptableFunction {
    
        String status = "start";
        public Object invoke(Object obj, Object[] args) throws Exception{
            if(status.equals("start"))
                return new String("Started Recording");
            if(status.equals("stop"))
                return new String("Stopped Recording");
            return new String("nothing");
        }
    
        public void stopRecording(){
            status = "stop";
            return;
        }
        public void startRecording(){
            status = "start";
            return;
        }
    }
    

    in my javascript every time I call

    alert(OCN.OCNUtils.VoiceRecorder());
    

    I get the response as "recording started"

    but whenever I tried to call

    alert(OCN.OCNUtils.startRecording());
    

    I don't get all respose and the script will stop working at that time here.

    Why is happening like that?

    I'm doing something wrong?

    I did not understand this concept of scriptablefunction anyone please explain what is happening?

    have to apply Runnble to the future because I have to record the sound of the microphone

    I suggest that you simply pass an argument of your javascript in your extension like this:

    public final class OCNUtilsNamespace extends Scriptable
    {
        VoiceRecord vr;
    
        public OCNUtilsNamespace()
        {
            this.vr = new VoiceRecord();
        }
        public Object getField(String name) throws Exception
        {
            if(name.equals("VoiceRecorder")){
                return this.vr;
            }
            return super.getField(name);
        }
    }
    

    and on your class that extends a ScriptableFunction,.

    public Object invoke(Object obj, Object[] args) throws Exception{
    
                   String param = args[0].toString(); // Cast a parameter from your js to a string
    
            if(param.equals("start"))
                return startRecording();
            if(status.equals("stop"))
                return stopRecording();
            return new String("nothing");
        }
    
        public String stopRecording(){
            status = "stop";
            return status;
        }
        public String startRecording(){
            status = "start";
            return status;
        }
    

    Finally, call your extension via javascript like this:

    alert(OCN.OCNUtils.VoiceRecord("start")); // Call the startRecording() on your VoiceRecord class
    alert(OCN.OCNUtils.VoiceRecord("stop")); // Call the stopRecording() on your VoiceRecord class
    

    Hope this helps

  • How to call a method of itemRenderer

    Hello

    I need to call a method when the click on an HBox in DataGrid. However, when I try to call the method on click Control HBox property, an error appears stating "call to a goToAlertTab possibly undefined method." I duly defined this method within the tag < mx:Script >. Here is the code example. Is someone can you please tell me what is the problem?

    < mx:DataGridColumn headerText = "Alerts" dataField = "alert" >
    < mx:itemRenderer >
    < mx:Component >
    < mx:HBox horizontalGap = "2" horizontalAlign = "center" click = "goToAlertTab ()" >
    < mx:Canvas height = "100%" backgroundColor = "Red" alpha = "0.8".
    Width = "{Data.Alert.Critical}" toolTip = "{" criticism:'+ data.alert.critical "}" > "
    < mx:Label text = "" / >
    < / mx:Canvas >
    < mx:Canvas height = "100%" backgroundColor = "0xff6600" width = "{data.alert.error}" toolTip = "{'Error:'+ data .alert .error}" > "
    < mx:Label text = "" / >
    < / mx:Canvas >

    < mx:Canvas height = "100%" backgroundColor = "Yellow" alpha = "0.8".
    Width = "{Data.Alert.Warning}" toolTip = "{'Warning:'+ data .alert .warning}" > "
    < mx:Label text = "" / >
    < / mx:Canvas >

    < / mx:HBox >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:DataGridColumn >

    It is obvious that it is very difficult to go throw your hierarhy to change tab, event dispatching easier.

    It http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html is a good example on the distribution of the itemRenderer events handling them.

    Can be also useful that you can use to navigate through the application. Read the docs to learn more about them.

  • What is the difference in verses apps for each of the programs to purchase and download it?  They are the same thing and they are simply called "apps"?  Are the applications of complete programs?

    What is the difference in verses apps for each of the programs to purchase and download it?  They are the same thing and they are simply called "apps"?  Are the applications of complete programs?

    Yes.

    Adobe uses confusion of terminology in their efforts to explain things.

    Cloud desktop applications are the same as the purchase of the software on disk in the days avant-nuage. for example, the Photoshop Cloud desktop application is the full version of Photoshop CC 2015.

  • How can I extract images of the application "Photos of Macintosh" in the Lightroom?

    How can I extract images of the application "Photos of Macintosh" in the Lightroom?

    I know, but it must be on the hard disk, to retrieve an individual photo appears

    be a daunting task... Need help...

    See you soon

    In Photos, select all the photos you want to put in LR; Select "Export" in the file menu and export to a new folder on your hard drive.  Finally in Lightroom, import pictures into this new folder.

  • After the purchase, how much time have we download the application?

    After the purchase, how much time have we download the application?

    Hi Peggy,

    Download the product can be done immediately, however if you bought the subscription, you must wait to activate the product until the payment goes through, and the same goes for a perpetual license product once the payment goes through you will receive your serial number to activate the product.

    Kind regards

    Bani

  • How an applet instance can call a method in the context of the proceeding one another?

    Consider an applet Java Classic Card with multiple instances that need to share data in a variable byte [] (e.g. persistent mutable, i.e. EEPROM/Flash), containing information common to all instances.

    Variable static ubyte [] would be perfect, but these happen to be prohibited by the validation rules imposed on me (I am told: as a way to tote to show that UN-instantiating an instance releases this she distributed on instantiation).

    This would be solved if an instance of the slave could call one of the method of the applet in the context of an instance of master (perhaps initially identified by AID, or/and/then in another way). How is that possible? Any example?

    Hello

    So I think that you don't need other assistance,
    The link you provide, has a useful example

    Kind regards
    Hana

  • How to call a method to support bean when change the af:panelTabbed tab?

    I use component af:panelTabbed and want to call a method of bean support when change tab. I tried to use itemListener on af:showDetailItem, but it's not working. and use clientListener / serverListener to call the backup method does not work either.

    Hello

    use the earpiece of the disclosure on the detail element

    http://download.Oracle.com/docs/CD/E15523_01/apirefs.1111/e12419/tagdoc/af_showDetail.html

    Frank

  • How to pass the value calculated with the method of the Application Module?

    I am a newbie to ADF. IThink I'm missing something very basic:



    In JDeveloper 10.1.3.3 ADF, I'm trying to pass the session ID to a method in my App Mod, but the method receives a null value. I think I have a session ID getting too late in the process, but don't know where else to get it.



    Here are the details:



    I'm passing 3 argument to a method called ProcessReport:



    public String ProcessReport (Number reportNumber, Double caratWeight, String sessionID)



    In my PageDef I have:



    < p >
    & lt; executables & gt;

    & lt; variableIterator id = 'variables' & gt;

    & lt; Type = "oracle.jbo.domain.Number" variable

    Name = "ProcessReport_reportNumber" IsQueriable = "false" / & gt;

    & lt; Type = "variable java.lang.Double" name = "ProcessReport_caratWeight" "

    IsQueriable = "false" / & gt;

    & lt; Type = "java.lang.String variable" name = "ProcessReport_sessionID" "

    IsQueriable = "false" / & gt;

    & lt; / variableIterator & gt;

    & lt; / executables & gt;



    & lt; links & gt;
    < /p >
    < p >
    & lt; methodAction id = "ProcessReport" MethodName = "ProcessReport."

    RequiresUpdateModel = "true" Action = "999".

    IsViewObjectMethod = 'false' DataControl = "RC2DataControl."

    InstanceName = "RC2DataControl.dataProvider"

    ReturnName = "RC2DataControl.methodResults.RC2DataControl_dataProvider_ProcessReport_result" & gt;

    & lt; NamedData NDName = "reportNumber" NDType = "oracle.jbo.domain.Number"

    NDValue = "${bindings." ProcessReport_reportNumber} "/ & gt;

    & lt; NamedData NDName = "caratWeight" NDType = "java.lang.Double"

    NDValue = "${bindings." ProcessReport_caratWeight} "/ & gt;

    & lt; NamedData NDName = "sessionID" NDType = "java.lang.String"

    NDValue = "${bindings." ProcessReport_sessionID} "/ & gt;

    & lt; / methodAction & gt;



    & lt; attributeValues id = "reportNumber' IterBinding = 'variables' & gt;

    & lt; AttrNames & gt;

    & lt; Item Value = "ProcessReport_reportNumber" / & gt;

    & lt; / AttrNames & gt;

    & lt; / attributeValues & gt;

    & lt; attributeValues id = 'caratWeight' IterBinding = 'variables' & gt;

    & lt; AttrNames & gt;

    & lt; Item Value = "ProcessReport_caratWeight" / & gt;

    & lt; / AttrNames & gt;

    & lt; / attributeValues & gt;

    & lt; attributeValues id = 'sessionID' IterBinding = 'variables' & gt;

    & lt; AttrNames & gt;

    & lt; Item Value = "ProcessReport_sessionID" / & gt;

    & lt; / AttrNames & gt;

    & lt; / attributeValues & gt;



    & lt; / links & gt;
    < /p >




    On my page, I added an outputText control called sessionID to contain the session ID.

    In my command button submit the page I have and the action to invoke a method in my grain of support:



    The code is:



    FacesContext ctx = FacesContext.getCurrentInstance ();

    ExternalContext ectx = ctx.getExternalContext ();

    HttpSession mySession = ectx.getSession (false) (HttpSession);

    String theSessionID = mySession.getId ();



    sessionID.setValue (theSessoinID) / / I hope she fills the outputText control and is added to the binding must be passed to the ProcessReport method



    BindingContainer links = getBindings();

    OperationBinding operationBinding = bindings.getOperationBinding("ProcessReport");

    Object result = operationBinding.execute ();

    If (! operationBinding.getErrors () .isEmpty ()) {}

    Returns a null value.

    }



    String resultStr = (String) result;

    Return resultStr;



    No chance! I think I should get the sesson ID earlier, during the loading of the page, but I don't know where to put the code.



    Any suggestion would be appreciated.



    John

    Hello

    Here's what I'd do

    1. create a bean managed as follows

    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    
    import javax.servlet.http.HttpSession;
    
    public class HTTPSessionAccessBean {
    
        public HTTPSessionAccessBean() {
        }
    
        public void setHttpSessionId(String httpSessionId) {
        }
    
        public String getHttpSessionId() {
    
            FacesContext ctx = FacesContext.getCurrentInstance();
            ExternalContext ectx = ctx.getExternalContext();
            HttpSession mySession = (HttpSession) ectx.getSession(false);
            String sessionId = mySession.getId();
            return sessionId;
        }
    }
    

    2. in the ApplicationModule Impl class to create the following method and expose it as a clientInterface

        public void setSession(String sessionId){
           ((SessionImpl)this.getSession()).getEnvironment().put("http_session",sessionId);
        }
    

    (3) in the file for pageDef create method as binding

     
          
    

    (4) in the same file for pageDef create an invokeAction

        
    

    The session ID is now accessible from the ApplicationModule as

            Hashtable env = ((SessionImpl)this.getSession()).getEnvironment();
            String sessonId =(String) env.get("session);
    
            }
    

    This keeps the layer of model/view separation

    Frank

  • Calling a method in a Module sharing application

    I have a shared application module that has a custom method that uses data from the AM shared decision.

    The method will be put to the criteria (in code) to the results of the different 3 objects in view filter.

    If all users access the same method is the custom method must be synchronized?
    Since it is a single method, will be accessible to all users there be a performance problem?

    The answers are YES and YES according to how often access you the service method.
    If you call it frequently, you are better off putting the service method in a module of the normal application.

    Timo

Maybe you are looking for