Writing a Custom Condition Class
Author: admin Post Date: March 2 2009One 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…