Apr 8, 2016

Programmatically get and set Iterator Key value from Managed Bean

Sometimes we need to set current row after performing some action like Rollback or Execute.

BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding) bindings.get("EmployeesIterator");
oracle.jbo.Key empKey = null;

// get key value of current row

                if (iter.getEstimatedRowCount() > 1) {
                    if (iter.getCurrentRow() != null) {
                        empKey = iter.getCurrentRow().getKey();

// Perform action you want to do here

// set ket value of current row

            if (empKey != null) {

Programmatically Call and execute Iterator from Managed Bean

Below code is use to get Iterator and Execute Iterator:-

BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter= (DCIteratorBinding) bindings.get("EmployeeIterator");

Mar 2, 2016

Call Stored Database Function in ADF

Sometimes we need to call stored database function in ADF application.

Note :- Try to call stored database function in ApplicationModuleImpl Class or in ViewObjectImpl.

Use below method to call stored function.

import java.sql.CallableStatement;
import java.sql.SQLException;
import java.sql.Types;
import oracle.jbo.JboException;

/**Method to call Database function
     * @param sqlReturnType (Return type of Function)
     * @param stmt (Function Name with Parameters)
     * @param bindVars (Parameter's Value)
     * @return

    protected Object callStoredFunction(int sqlReturnType, String stmt, Object[] bindVars) {

        CallableStatement st = null;
        try {
      //Creating sql statement
            st = this.getDBTransaction().createCallableStatement("begin ? := " + stmt + ";end;", 0);

      //Register dataType for return value
            st.registerOutParameter(1, sqlReturnType);
     //Pass input parameters value
            if (bindVars != null) {

                for (int z = 0; z < bindVars.length; z++) {

                    st.setObject(z + 2, bindVars[z]);


      //Finally get returned value
            return st.getObject(1);
        } catch (SQLException e) {
            throw new JboException(e.getMessage());
        } finally {
            if (st != null) {
                try {
                } catch (SQLException e) {

Use above callStoredFunction method in a method in Impl class and pass parameter.

public String callFunction(Integer EmployeeId){

    String EmpNm =null;

    Object obj = callStoredFunction(Types.VARCHAR, "fn_getEmpNm(?)", new Object[] {  EmployeeId     });

    if(obj!= null) {
      EmpNm =obj.toString();

    return EmpNm ;

Feb 27, 2016

Passing parameter in dynamic region using managed bean

For Demo Purpose I have created 2 application having same Input parameter.

1.)  First Application :-


I have created a Taskflow with Input Parameter name Parameter1.

I have used page show value the input parameter of

2.) Same as first application I have created second application with same input parameter.

Now create ADF jar file of both application and call this two application in Master application.

3.) Create Master App

  •  Create a jspx page in Master Application to call above applications.

  • Now drag and drop task flow of Demo app 1

    Select Dynamic Region

    Now Select a Managed bean or create new.

  • Now drag and drop taskflow of another application as link and then first one also.

  • Now next step is to set parameter of taskflow using Hash Map.

    For same we have to declare a Map type variable in bean.

    private Map<String, Object> parameterMap = new HashMap<String, Object>();

    and create its Accessors.
  • Now set its value using below code.

  • Now pass hash map value to parameter.

    import java.io.Serializable;
    import java.util.HashMap;
    import java.util.Map;
    import oracle.adf.controller.TaskFlowId;
    public class DRBean implements Serializable {
        private String taskFlowId = "/WEB-INF/task-flow-definition1.xml#task-flow-definition1";
        private Map<String, Object> parameterMap = new HashMap<String, Object>();
        public void setParameterMap(Map<String, Object> parameterMap) {
           this.parameterMap = parameterMap;
        String srt = "Default First App";
        public Map<String, Object> getParameterMap() {
            return parameterMap;
        public DRBean() {
        public TaskFlowId getDynamicTaskFlowId() {      
            return TaskFlowId.parse(taskFlowId);
        public void setDynamicTaskFlowId(String taskFlowId) {
            this.taskFlowId = taskFlowId;
        public String taskflowdefinition2() {
            srt = "Call Application 2";
            return null;
        public String taskflowdefinition1() {
            srt = "Call Application 1";
            return null;
        private void setParameterVal() {
            parameterMap.put("Parameter1", srt);

    Goto Page Binding and edit taskflow binding .

    select hash map from expression builder.

    Now run application.

    When we run application

    After Clicking on Call Application 1 Link

    And after clicking on Call Application 2 Link

    We have passed value of input parameter of Task flow using managed bean.

Sep 20, 2015

Using html in jasper ireport

Sometimes we required to use html tag in jasper ireport.

we can use html in jasper using two methods.

  •  Using Html component 

            You can use Html component to get required output of html script.

            Drag and drop Html component and select HTML Content Exp.  property.

            Provide appropriate Expression and click on Preview to run the report.

  • Using Markup property of a Text Field

           You can also use Markup Property of Text Field to show text in html scipt.

           Select a Text Field and goto Markup Property 

           Select html from the list 

           Provide appropriate html Scipt in Text Field Expression of Text Field.

           Click on Preview to run the report.