Wednesday 22 October 2014

RowInconsistentException: JBO-25014: Another user has changed the row with primary key

Caused by: oracle.jbo.RowInconsistentException: JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[25544 ]. Sol: when we try to commit or executeQuery on a row which is already modified and comitted by another vo/am, this issue occurs. so if you know that there are chanses of updating by another vo, then better to commit or rollback the existing changes then do EO clear chache.
 service.getDBTransaction().commit();
 service.getDBTransaction().clearEntityCache("oracle.apps.msc.ascp.itemsimulation.model.entity.ItemAttributesEO");
 mscItemAttributesVO.executeQuery();

How to load external javascript or css files in jsff?

Guys, if you want to use external javascript or css, you can use af:resource tag in jsff page.
<source>
  <af:resource source="/customStyles.css" type="css"></af:resource>
</source>
In-line CSS content:
<source>
  <af:resource type="css">
    DIV.customStyle { color: red; }
  </af:resource>
</source>
Include an external JS file:
<source><  af:resource source="/customCode.js" type="javascript"></af:resource></source>
In-line JavaScript code:
<source>
  <af:resource type="javascript">
    function clientListenerFunction(event)
    {
       // content ...
    }
  </af:resource>
</source>

Wednesday 27 August 2014

How to Get Application module object programmatically


You can use any of the below methods to get the application module programmatically.
>> private EmployeeAMImpl getAm() {

        FacesContext fctx = FacesContext.getCurrentInstance();
        DCBindingContainer dc =
            (DCBindingContainer)fctx.getApplication().getExpressionFactory().createValueExpression(fctx.getELContext(),
                                                                                                   DCBindingContainer.class).getValue(fctx.getELContext());
        return (WorkbenchAMImpl)dc.findDataControl("EmployeeAMDataControl").getApplicationModule();
    }
    

>> private EmployeeAMImpl getAm() {
        
        FacesContext fc = FacesContext.getCurrentInstance();
        Application app = fc.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = fc.getELContext();
        ValueExpression valueExp =
            elFactory.createValueExpression(elContext, "#{data.EmployeeAMDataControl.dataProvider}",
                                            Object.class);
        return (WorkbenchAMImpl)valueExp.getValue(elContext);
    }
 

Missing IN and OUT parameters

If you are using bind variables as part of the VO query, then

Make sure that, Required property is enabled for the bind variables which are used in the query.

Programmatic validation UI side

1.Class implements Validator{
2.    @Override
    public void validate(FacesContext facesContext, UIComponent uIComponent,Object newValue) throws ValidatorException {
       String val = String.valueOf(newValue);     
        if (val != null) {
            if (!getMethodResult(val)) {
                throw new ValidatorException(new FacesMessage("Name " + val + " already exists."));
            }
        }
    }

    public boolean getMethodResult(String name) {
        ViewObjectImpl vo = this.getAm().getVo1();
        RowQualifier rowQualifier = new RowQualifier(vo);
                rowQualifier.setWhereClause("Name='"+name+"'");
                Row[] rowsList = vo.getFilteredRows(rowQualifier);
                if(rowsList.length>0){
                        return false;
                    }
                return true;
    }

3. in jsff validator="#{backingBeanScope.myManagedBean.validate}"