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.

public void action() throws MXException, RemoteException

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

  if (!currVal.equals(oldVal))

No comments:

Post a Comment