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

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;
}