October 13, 2013

MBOs attribute current, previous, initial values

When implementing business logic in Java code it may be useful to compare the value of an attribute to it's previous or initial value.
This is particularly useful when overriding MboValueAdapter.action() method to validate the new value of an attribute as soon as it changes.

Look at how the three values are retrieved in the following example.

@Override
public void action() throws MXException, RemoteException
{
  super.action();

  String currVal = getMboValue().getString();
  String oldVal = getMboValue().getPreviousValue().asString();
  String initialVal = getMboValue().getInitialValue().asString();

  if (!currVal.equals(oldVal))
  {
    ...
  }
}

1 comment:

  1. I have to add the Attribute values in section Table on Custom App. By Checking one check box. For doing so value is defaulting from Domain however I have to click additionally on ADD button to display those value. How can I achieve that by only checking the check box.

    ReplyDelete