Monday, April 13, 2015

Oracle BPM: Override Oracle BPM Operations (Approve, Reject, ....)

When you create new Oracle BPM Application and generate human task page with payload,  BPM automatically will generate human task operations like Approve, Reject, OK, ....

  Sometime developer need to execute some code before calling operation Approve or Reject so you need to override operation Approve or Reject. To do so follow these steps:

1- Bind approve button action to method in backbean

2- In the approval action back bean method write this:

be sure that the button in the page has actionListener="#{invokeActionBean.setOperation}" and has  attribute

You can do same steps in any other operations like Reject, Ok, ....

Wednesday, April 1, 2015

Oracle BPM: Set User as Administrator

How do you know if the user is admin user or normal user?

In Oracle BPM when the user login to workspace the administration link will appear if this user is Admin user

but if the login user is normal user this link will not appear

From the administration link admin user can assign users/groups to the application role or remove users/groups to the application role and user can do a lot of others administration functions.

To set user as administration follow these steps:

1- Login to em (http://serverIp:port/em) and login with weblogic user.
2- Expand SOA then right click on the soa-infra --> Security --> Application Roles

3- Press search icon and select "BPMWorkflowAdmin" then press Edit

4- Press Add icon to add and search for the user or group

5- The added user will be Admin user. If you add group the all users inside this group will be admin users

Wednesday, March 25, 2015

ADF table detail stamp set expanded row as a current row and close others expanded rows

I got a lot of questions about table detail stamp how user can set the expanded row to be the current row and closing any other expanded rows (one row will be expanded at a time).

To do that follow this steps:

1- In .jspx select the table and go to property and set RowDisclosureListener to a method in back bean (e.g method name will be rowDisclosureListener)

2- In back bean write this code

3- Run your application and expand any row you will find the expanded row become current row and close any other expanded row

Wednesday, March 11, 2015

Create Custom Converter

Sometimes when you develop application to the customer he want to see data in specific format although it stored in the database in other format for example:

Assume you have a table store mobile number in this format 3538xxxxxxxx but the user want to see this mobile number in this format 08xxxxxxxx.

It means when you read the mobile from database (in this format 3538xxxxxxxx) you should convert it (to 08xxxxxxxx) before displayed in the screen.
and vise versa when the user enter mobile number in this format 08xxxxxxxx it should store in the database in this format 3538xxxxxxxx

To make this follow this steps:

1- Create java class implements javax.faces.convert.Converter (e.g

2- Open faces-config.xml and go to Converters and create new converter

3- Go to inputText component and insert inside it f:converter then select your custom converter (MobileConverter)

You can make your own converter depending on your business need like making convert for dates sometimes customer need to enter date in specific format and store in database in other format.

Run ADF Application In IE11

In this post I will show how you can run ADF application developed by JDeveloper 11g in Internet Explorer 11 (IE11).

- In ADF application create new java class (e.g

- In web.xml add this

- Run the application using IE11.

Thursday, March 5, 2015

ADF Graphs Configurations

In this post I will show how you can make some configurations on ADF graphs.

1- Change Y-axis minimum vale

Sometimes you need to start Y-axis by specific value (by default it start by 0) but what if you need Y-axis start by 20 or 50 or .... you can do the following:


In the graph component insert dvt:y1Axis  and from property inspector set AxisMinValue by the the desire value or by expression and set AxisMinAutoScaled to false

The Result will be like this:

2- Remove decimal from pie slice label(display integer values) 



3- Change X-axis fonts and color



4- Change Y-axis fonts and color



5- Rotate X-axis text 



5- Pie display value 



6- Pie display percentage



7- Change Pie Slice label text fonts and colors



8 - Pie change Legend text fonts and colors



9- Pie select multiple slices



To read selected value you can use this code

10- Hide graph tooltip


Note: You can use MarkerTooltipType and SeriesTooltipLabelType properties to display/hide some information from graph tooltip


Tuesday, March 3, 2015

Oracle BPM: Initiate Oracle BPM Process Using Web Service

In this post I will explain how to initiate Oracle BPM process using Web Service. Sometimes you need to start process using non human action depending on business needs.
To do so follow the following steps:

1- Create a simple BPM process like this

2- In BPM project define business object (this will be the web service input parameter).

3- In Process Data Object define dataobject based on the created business object

4- In process Start event configure it like this 

5- Select Data Associations like this

6- Deploy BPM Application.

7- You can get Web Service WSDL URL from EM.

Sometimes you will receive error message like this

If you received this message then first you have to open Service Properties 

Then try to open Test Service again it should be open without errors

8- You can test web service from em as

9-  After invoke web service, BPM process will start and receive data from web service and fill process object data

Friday, February 27, 2015

Collection of ADF Programmatic Functions

In this post I write some functions you can use those functions in your ADF application.

Get Viewobject attribute datatype programmatic

This function accept 2 parameters (iterator name, attribute name) and will return the data type of this attribute

Get Viewobject attribute Database Column Name

This function accept 2 parameters (iterator name, attribute name) and will return the database column name which map to the viewobject attribute

Clear Table Filters

If you want to clear table filters programmatically sent table component to this function

Reset af:query fields

If you want to reset af:query sent query component to this function

Show error message on adf component

Sometime you need to remove required property from af:inputText because it may cause some problems and in the same time you need to display error message on the inputText component so you can use the following function just send the error message and the adf component

Sort Table Column Programmatically

If you want to sort column programmatic you can use the following function just send table component and attribute which you would like to sort and the boolean parameter (true for ascending sort and false for descending sort)

Reset Table Sort

After sorting in column and need to reset the sorting you can use the following function just send table component and the iterator name (which the table point to) 

Call database sequence

When you want to get next value from database sequence you can use the following function just send database sequence name and it will return the next value of the sequence

Set Focus to component

If you want to set focus to component( as set cursor to inputText) just send component id to this function (if inputText id =it1 and you use page template with id=pt1 so the id which you have to send to this function is pt1:it1)

Expand Table DetailStamp Programmatically

Monday, January 5, 2015

Oracle BPM: Display User BPM Tasks Inside ADF Application (Post2)

In my previous post we see how you can display user BPM worklist inside ADF application, but there is one question now, how the bpm worklist know the user which suppose to display his tasks?

You should generate object of IWorkflowContext  using login user information (username and password). To do this follow these steps:

1- In ViewController project add 2 libraries (oracle.bpm.bpm-services.client.jar and oracle.bpm.bpm-services.interface.jar) you can find these jars in (C:\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.bpm.client_11.1.1)

2- In you ADF application make new class ""

 ////////// ////////////

import java.util.HashMap;
import java.util.Map;
import oracle.bpm.client.BPMServiceClientFactory;

public class BPMContextClass
  private static String url = "t3://localhost:7001"; // BPM serverIp:port

  public static BPMServiceClientFactory getBPMServiceClientFactory()
    Map properties = new HashMap();
    properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.CLIENT_TYPE, WorkflowServiceClientFactory.REMOTE_CLIENT);
    properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, url);
    properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    return BPMServiceClientFactory.getInstance(properties, null, null);

  public static IBPMContext getIBPMContext(String username, String password) throws Exception
    return getBPMServiceClientFactory().getBPMUserAuthenticationService().authenticate(username, password.toCharArray(), null);

  public static IWorkflowServiceClient getIWorkflowServiceClient()
    return getBPMServiceClientFactory().getWorkflowServiceClient();

  public static IBPMServiceClient getBPMServiceClient()
    return getBPMServiceClientFactory().getBPMServiceClient();


3- Follow the previous post to make page display user worklist (e.x. userTasks.jspx).

4- From faces-config.xml make new global navigation rule and set  userTasks.jspx "From Outcome" to "userTasks"

5- Make new login page (login.jspx) as shown

6- In the login button action write this code

  public String loginAction()
    FacesContext ctx = FacesContext.getCurrentInstance();
    HttpServletRequest request = (HttpServletRequest)ctx.getExternalContext().getRequest();
    String usernameValue = null;
      usernameValue = usernameInputText.getValue().toString();
      String passwordValue = passwordInputText.getValue().toString();
      Subject subject = Authentication.login(new URLCallbackHandler(usernameValue, passwordValue));, request);
      IWorkflowContext workflowContext = initBPMContext(usernameValue, passwordValue);
      setManagedBeanValue("sessionScope.workflowContext", workflowContext);
      IBPMContext ibpmContext = BPMContextClass.getIBPMContext(usernameValue, passwordValue);
      setManagedBeanValue("sessionScope.ibpmContext", ibpmContext);
    catch (Exception e)
      // TODO: Add catch code
      return null;
    return "userTasks";

8- In the login backbean write this code (this code will be used by login button action "loginAction()")

  public IWorkflowContext initBPMContext(String userName, String password) throws WorkflowException
    IWorkflowServiceClient wfSvcClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT);
    ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();
    IWorkflowContext ctx = querySvc.authenticate(userName, password.toCharArray(), null);
    return ctx;

  public void setManagedBeanValue(String beanName, Object newValue)
    StringBuffer buff = new StringBuffer("#{");
    setExpressionValue(buff.toString(), newValue);

  public void setExpressionValue(String expression, Object newValue)
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    ValueExpression valueExp = elFactory.createValueExpression(elContext, expression, Object.class);
    Class bindClass = valueExp.getType(elContext);
    if (bindClass.isPrimitive() || bindClass.isInstance(newValue))
      valueExp.setValue(elContext, newValue);

7- deploy the application to SOA server and after login you will find user worklist.

You can download the sample application from here.

Tuesday, December 30, 2014

Oracle BPM: Display User BPM Tasks Inside ADF Application (Post 1)

If you need to display Oracle BPM worklist inside ADF page follow these steps:

1- Be sure ADF application is developed by JDev 11g R1.
2- In ADF project go to project properties --> Libraries and Classpath and add these libraries:

  * bpm-services.jar (\Middleware\jdeveloper\soa\modules\oracle.soa.workflow_11.1.1)
  * adflibTaskListTaskFlow.jar (\Middleware\jdeveloper\soa\modules\oracle.soa.worklist_11.1.1)
  * adflibWorklistComponents.jar (\Middleware\jdeveloper\soa\modules\oracle.soa.worklist_11.1.1)

  * WSRP Container
  * BPM Worklist Components
  * BPM Services

3- Make new .jspx page and from component palette select adflibTaskListTaskFlow.jar -->Regions.
4- Drag taskList-task-flow-definition from component palette and drop it in the .jspx page as region

5- From task flow parameters set these 2 parameters

6- In ADF application Add new deployment Descriptor weblogic-application.xml (in ADF project right click ---> new --> Deployment Descriptor -->  Weblogic Deployment Descriptor

7- From opening dialog select weblogic-application.xml

8- Open weblogic-application.xml and write 


9- Now you can run ADF application and after user login you have to generate IWorkflowContext with  username and password and the user will see his tasks. (In next post i will explain how to   generate IWorkflowContext).