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.


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

    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:


      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);


      bye salman
      ciao Bruno

  2. could you tell me if this code is ok or not .
    i want to initiate bill batch from work order application so i create a new custom class as

    * To change this license header, choose License Headers in Project Properties.
    * To change this template file, choose Tools | Templates
    * and open the template in the editor.
    package cust.actions;

    import java.rmi.RemoteException;
    import java.util.Date;
    import java.util.Vector;
    import psdi.common.action.ActionCustomClass;
    import psdi.mbo.*;
    import psdi.util.MXException;
    import psdi.util.MaxType;

    public class SampleAction implements ActionCustomClass {

    public void applyCustomAction(MboRemote mr, Object[] os) throws MXException, RemoteException{
    //MaxType n= mr.getInitialValue("plusbillbatch");
    //MboSetIterator msr=null;
    int a;
    MboSetRemote mr2= mr.getMboSet("plusbillbatch");
    MboRemote bill= mr2.getMbo(0);
    String billno = bill.getString("billno");
    MaxType n= mr.getInitialValue("plusbillbatch");
    int b =Integer.getInteger("n");
    int c =Integer.getInteger("billno");
    MboSetRemote wo= mr.getMboSet("workorder");
    // mr2.setValue(string, 0);
    MboRemote won1 =wo.getMbo(0);
    String wno1 = won1.getString("WONUM");
    mr2.setValue("WONUM", a);