Field Flags for setValue methods

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

In the following example I’m setting the description to a constant value without checking if the field is readonly.

from psdi.mbo import MboConstants
mbo.setValue("DESCRIPTION", "Hello World!", MboConstants.NOACCESSCHECK)

Those values can be ‘merged’ using the Java bitwise OR operator “|”.

from psdi.mbo import MboConstants
mbo.setValue("DESCRIPTION", "Hello World!",  MboConstants.NOACCESSCHECK | MboConstants.NOACTION)
Field Flags for setValue methods

3 thoughts on “Field Flags for setValue methods

  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

  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 {

    @Override
    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");
    c=b;
    MboSetRemote wo= mr.getMboSet("workorder");
    // mr2.setValue(string, 0);
    MboRemote won1 =wo.getMbo(0);
    String wno1 = won1.getString("WONUM");
    a=Integer.getInteger("won1");
    mr2.setValue("WONUM", a);

    }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top