Monday, June 9, 2014

MBO Class Sample In Maximo

The important thing in here is extending the original class of the related object such as WORKORDER. I am going to extend the WO class and create new WOSet class. you may also create new interfaces by implementing WORemote and WOSetRemote if you want to.

Ok, let's start with creating newWOSet by extending the original WOSet.

?
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.workorder;
import java.rmi.RemoteException;
import psdi.app.workorder.WOSet;
import psdi.app.workorder.WOSetRemote;
import psdi.mbo.Mbo;
import psdi.mbo.MboServerInterface;
import psdi.mbo.MboSet;
import psdi.util.MXException;
public class newWOSet extends WOSet implements WOSetRemote {
public newWOSet(MboServerInterface mboServerInterface)
  throws RemoteException, MXException {
super(mboServerInterface);
}
protected Mbo getMboInstance(MboSet mboSet) throws MXException,
  RemoteException {
return new newWO(mboSet);
}
}

This code is enough for now. Well, it is time to create our own main WO 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
25
26
27
28
29
package custom.workorder;
import java.rmi.RemoteException;
import java.util.Date;
import psdi.util.MXException;
import psdi.app.workorder.WORemote;
import psdi.app.workorder.WO;
import psdi.mbo.MboSet;
public class newWO extends WO implements WORemote {
public newWO(MboSet ms) throws RemoteException, MXException {
super(ms);
}
public void changeStatus(String status, Date date, String memo, long l) throws MXException, RemoteException {
super.changeStatus(status, date, memo, l);
//You should put your custom code here
}
public void save() throws MXException, RemoteException {
super.save();
//You should put your custom code here
}
}

If you want maximo to do different things in save operation, you should put your code in save() method or if you want maximo to do an operation while changing status of a record, you have to use changestatus(String status, Date date, String memo, long l) method.

We also should give the classpath of our custom class in WORKORDER object.

Well, that's all up to you from now on. Don't forget you can extend any object you want. Just use your imagination

No comments:

Post a Comment

JMS Messaging - High availability, scalability and Maximo Integration Framework using a single Service Integration Bus

T he first is configuring the JMS resources for scalability and the second is configuring the messaging engines for highly availability. For...