Writing a Custom Condition Class

One of the best improvements in Maximo 7.x is conditional user interfaces. You can create your conditions in Conditional Expression Manager application. But sometimes there are some issues that you can not write sql sentences. For these cases we can write our own condition class. We must extend psdi.common.condition.CustomCondition class to write the new class. And we need to override evaluateCondition(MboRemote mbo, Object arg1) method. Here is an basic example..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.custom.workorder;
 
import java.rmi.RemoteException;
import psdi.mbo.*;
import psdi.common.condition.CustomCondition;
import psdi.util.*;
 
public class TipCondition implements CustomCondition {
 
    public boolean evaluateCondition(MboRemote mbo, Object arg1) throws MXException, RemoteException {
        newWORemote wo = (newWORemote) mbo;
 if (wo.getString("ISSUETYPE").equalsIgnoreCase("PROBLEM")) {
            psdi.server.MXServer mxs = psdi.server.MXServer.getMXServer();
            MboSetRemote loc_set = mxs.getMboSet("LOCATIONS", wo.getUserInfo());
            loc_set.setWhere("location in('"+wo.getString("CENTER1")+"')");
            loc_set.reset();
            if (loc_set.count() > 0) {
                String kanal = loc_set.getMbo(0).getString("CAPACITY");
                if (kanal.startsWith("4")) {
                    return true;
                }
            }
            return false;
        } else {
            return false;
        }
    }
 
    public String toWhereClause(Object arg0, MboSetRemote arg1) throws MXException, RemoteException {
        return "";
    }
}

Have a good day…

Tags: ,

4 Responses

  1. Erika Says:

    Hi,

    I have a question, If i need that a service request be able to closed only when it has a solution this customization works?

  2. admin Says:

    Hello;
    I think you don’t have to write a class about it.. You can do it via user interface..

    Have a good day…

  3. Nausheel Says:

    I want to write a custom condition class which gets called when Move/Modify Select Action is fired from Asset application and the class will check h count of records to be moved is > 1000 provide an error message ?

    Please suggest.

    Thanks in advance !!

  4. admin Says:

    Hello;

    I think you should override bean class to achieve that… Find the bean class from Library.xml file… Then extend it… I am not sure if any other way to do this exists..

    Have a good day…

Leave a Reply


Switch to our mobile site