How to capture programmatically (Java – Adf Faces) an attribute from payload task (Human Task Form)

Hi Guys,

This is an useful code that capture the value of an attribute inside of payload from Human Task generated automatically from bpel.

Here is a list of attributes that exists in your human task form.

With this code, you can capture the value of any attribute.

You can to call this method this way: getValueAttributeFromHumanTask(“numeroPedido”)


import oracle.adf.model.BindingContext;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.binding.AttributeBinding;
import oracle.binding.BindingContainer;
import oracle.bpel.services.datacontrol.data.DataObject;

public String getValueAttributeFromHumanTask(String attributeName){
    String response = "";
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    AttributeBinding attr = (AttributeBinding)bindings.getControlBinding(attributeName);
    DataObject data = null;
    if(attr != null){
        data = (DataObject)attr.getInputValue();
    }
    if(data != null){
        response = data.getValue();
    }
    return response;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s