How to initialize a row of a ViewObject in adf?

1k Views Asked by At

I am pretty new to ADF and I am trying to add a row to an existing VO in my little ADF Fusion Web Application. I have used the Java class of my AppModule to achieve this.

So basically I have a method call in my task flow where I call the below mentioned method of my AM java class as you can see below:

    public void assetReturnInitialization(){

        System.out.println("Yellow!");

        getAstAssetReturnsVO().clearCache();
        System.out.println("clearCache Done!");        

        Row row = getAstAssetReturnsVO().createRow(); 
        row.setAttribute("Stat", "test");
        getAstAssetReturnsVO().insertRow(row);
        System.out.println("getAstAssetReturnsVO Done!");                    

        getAstAssetReturnsVO().setCurrentRow(row);
        System.out.println("setCurrentRow Done!");        

        getAstAssetReturnsVO().executeQuery();         
        System.out.println("executeQuery Done!");        

        return ;
    }

It seems to be working just fine in other words the page starts as if CreateInsert method has been invoked which exactly what I want but the initial values are not the set in the Components I have bound to the VO.

I even tried calling the setCurrent method but no luck.

Any help is much appreciate it.

Thank you,

M

1

There are 1 best solutions below

1
On

First try to update component you've bound to the VO, by executing

AdfFacesContext.getCurrentInstance().addPartialTarget(component)

And instead of using VO methods - you could also try to call operations binded to your page, e.g.:

dc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
if (dc != null) {
    OperationBinding ob = dc.getOperationBinding("CreateInsertMyTable");
    if (ob != null)
      ob.execute();

ps This should be done from ViewController project