August 11, 2012

Flags for setValue methods

This entry is part of the Maximo Java Development series.

The Mbo class exposes a lot of setValue methods but we can categorize them in two big groups. The first group accepts only two arguments that are the name of the attribute to be set and its value. The second group of methods have three arguments that allows to pass an additional accessModifier flag.
The values that can be passed into this flag are defined in the MboConstants interface and Mbo class. The most important values are the following:
  • NOVALIDATION (1) - Suppress validation
  • NOACCESSCHECK (2) - Suppress access control checks
  • NOACTION (8) - Suppress action
  • NOVALIDATION_AND_NOACTION (9) - Suppress validation and action

Those values can be 'merged' using the Java bitwise OR operator "|". For example, if you want to suppress the validation and action you can use the NOVALIDATION|NOACTION constant.

2 comments:

  1. Can you explain an example for set sample value.

    ReplyDelete
    Replies
    1. If you have an Mbo that you want to set a field value without invoke validation method or action method you can use the follow code:

      [code]

      String value="descriptionvalue";
      Mbo currentMbo = (Mbo) mboSet.getMbo();

      -- currentMbo.setValue("DESCRIPTION", value, Mbo.NOVALIDATION);
      -- currentMbo.setValue("DESCRIPTION", value, Mbo.NOACTION);
      -- currentMbo.setValue("DESCRIPTION", value, Mbo.NOACCESSCHECK|Mbo.NOVALIDATION);
      -- currentMbo.setValue("DESCRIPTION", value, 8L);

      [/code]

      bye salman
      ciao Bruno

      Delete