A simple way to avoid 100+ if statements and very performant is this:
You will still need a single change-activity for each separate attribute change, but it is fast and mainly Mendix.
My extra wide entity contains attributes of five types: string, long, boolean, date, decimal. I can put logic telling the data type inside the microflow and then built 5 Java actions along the following lines:
public class SetDateValue extends CustomJavaAction<java.lang.String>
{
private IMendixObject EntityObject;
private java.lang.String AttributeName;
private java.util.Date AttributeValue;
public SetDateValue(IContext context, IMendixObject EntityObject, java.lang.String AttributeName, java.util.Date AttributeValue)
{
super(context);
this.EntityObject = EntityObject;
this.AttributeName = AttributeName;
this.AttributeValue = AttributeValue;
}
@java.lang.Override
public java.lang.String executeAction() throws Exception
{
// BEGIN USER CODE
EntityObject.setValue(getContext(), AttributeName, AttributeValue);
return "Success";
// END USER CODE
}
/**
* Returns a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
{
return "SetDateValue";
}
// BEGIN EXTRA CODE
// END EXTRA CODE
}