Getting/Editing Data Control Values in ADF/BPM programmatically

Like mentioned in a previous post, I was new to ADF at the time so this one took me a while to figure out but now it looks really simple. Here are the Utility Methods I wrote to help with this.

Getting the Data Control Value:

public static String getDataControlFieldValue(String fieldValue) {
try {
BindingContainer attributeBindings = BindingContext.getCurrent().getCurrentBindingsEntry();
List<AttributeBinding> attributeBindingList = attributeBindings.getAttributeBindings();
for (AttributeBinding attributeBinding : attributeBindingList) {

//Checking if this Assessment is New or Saved, if Null this Assessment is New
if (attributeBinding.getName() == fieldValue) {
if (attributeBinding.getInputValue() != null &&
StringUtils.isBlank(attributeBinding.getInputValue().toString()) != true) {
return attributeBinding.getInputValue().toString();
} else {
return null;
}
}
}
} catch (Exception exception) {
System.out.println(“Nothing found in BPM to Load!”);
return null;
}
return null;
}

Setting the Data Control Value:

public static void setDataControlFieldValue(String fieldValue, String value) {
BindingContainer attributeBindings = BindingContext.getCurrent().getCurrentBindingsEntry();
List<AttributeBinding> attributeBindingList = attributeBindings.getAttributeBindings();
for (AttributeBinding attributeBinding : attributeBindingList) {

//Checking if this Assessment is New or Saved, if Null this Assessment is New
if (attributeBinding.getName() == fieldValue) {
attributeBinding.setInputValue(value);
}
}
}

 

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 )

Facebook photo

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

Connecting to %s