Search This Blog

Monday, June 9, 2014

Condition Class Sample In Maximo

Condition classes are defined in Conditional Expression Manager and can be attached to both application securityor conditional properties in application designer.


Here is the sample code for you.

?
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
33
34
35
package custom.common.CustomCondition;
import java.rmi.RemoteException;
import psdi.app.workorder.WOChangeRemote;
import psdi.common.condition.CustomCondition;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.util.MXException;
public class newCustomCondition implements CustomCondition {
public boolean evaluateCondition(MboRemote mbo, Object arg1)
       throws MXException, RemoteException {
   WOChangeRemote wo = (WOChangeRemote) mbo;
   System.out.println("CONDITION Girdi.");
   if (wo.getString("VFTYPEINDICATOR").equalsIgnoreCase("Standard")||wo.getString("VFTYPEINDICATOR").equalsIgnoreCase("Already Deployed")) {
       System.out.println("CONDITION SET.");
       wo.setValueNull("VFRISK");
       wo.setValueNull("VFIMPACT");
       System.out.println("VALUE SET TO NULL.");
       return true;
   } else
       System.out.println("VALUE NOT SET.");
   return false;
}
public String toWhereClause(Object arg0, MboSetRemote arg1)
       throws MXException, RemoteException {
   return "";
}
}
You can give your sql condition and your custom code can do the rest.

Field Class Sample In Maximo

So here is a sample code of a field class.
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package custom.code;
import java.rmi.RemoteException;
import psdi.mbo.MboValue;
import psdi.mbo.MboValueAdapter;
import psdi.util.MXApplicationException;
import psdi.util.MXException;
public class newFieldClass extends MboValueAdapter {
public newFieldClass(MboValue mbo)
throws MXException, MXApplicationException {
super(mbo);
}
public void action() throws MXException, RemoteException {
super.action();
//Put Your Java Codes here
}
}
If you want the code to do something when you give an input to the related field, you should override the action()method. For instance, think that we attached this code to the field 'PHONE' of WORKORDER object.

getMboValue("PRIMARYSMS").setValue(getMboValue().getString());Adding this code in action() method will print the input, that you will enter into the PHONE field, to thePRIMARYSMS field of workorder.

After you build your code, you have to navigate to the Database Configuration and find the attribute PHONE in WORKORDER object.

Then you have to give the path of class.

Rebuild and Deploy. Voila :) I hope this post will be helpful.

MAS and Manage custom resources are not reconciled

  After a change was applied to IBM Maximo Application Suite (MAS) or IBM Maximo Manage, the custom resources are not reconciled. For exampl...