Maximo custom cron

If you need to create a custom cron task for IBM Maximo using Java here is some code to get you started.

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
36
37
38
import psdi.server.SimpleCronTask;
import psdi.server.CrontaskParamInfo;
import psdi.util.MXException;
import java.rmi.RemoteException

public class MyCustomCron extends SimpleCronTask {

// You must extend SimpleCronTask and must override
// cronAction()

// Your main processing goes in cronAction()

@Override
public void cronAction(){
// Do stuff here

// How to access a parameter if you are using them
String param = super.getParamAsString("Param 1);
}

// If you want to use parameters you override getParameters()

@Override
public CronTaskParamInfo[] getParameters() throws MXException, RemoteException {
CrontakParamInfo parameters[] = new CronTaskParamInfo[2];
parameters[0] = new CrontaskParamInfo();
parameters[0].setName("Param 1");
parameters[0].setDefault("Default Value");
parameters[1].setName("Param 2");
parameters[1].setDefault("Default Value");

return parameters;
}

}