Monday 2 January 2017

Maximo 7.6 Developement Environment, EAR Deployment and Mbo Customization | IBM Maximo

Download Eclipse Kepler (64bit) from: http://www.eclipse.org/downloads/
run Eclipse.exe if java is already installed, or copy websphere/Appserver/jre c:\eclipse\ folder.
start Eclipse.exe and set java compiler settings, (Windows > Preferences > java > compiler > 1.7)

1. Create a new Java project Proj01, Finish
2. extract maximo.ear file into this workspace/Proj01/maximo folder (C:\IBM\SMP\maximo\deployment\default\maximo.ear)
3. Add JARS in Project Properties > Java Build Path > Add Jars(b)
    Add the following jars
        maximo/lib/*.jar
        maximo/businessobjects.jar
Done :)
thanks to Bruno Quick Setup Development Environment

To create a new custom class or extending a class:

1. Right click on Proj01/src in project explorer.
2. Click on package, name: custom.app.asset
3. Right click to create a new class AssetCust into custom.app.asset package.
    I copied this code from Bruno's Blog

package custom.app.asset;

import java.rmi.RemoteException;
import psdi.app.asset.Asset;
import psdi.app.asset.AssetRemote;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSet;
import psdi.mbo.MboSetRemote;
import psdi.util.MXException;
public class AssetCust extends Asset implements AssetRemote
{
    public AssetCust(MboSet ms) throws MXException, RemoteException
    {
        super(ms);
    }
    public void save()throws MXException, RemoteException
    {
        super.save();
        int id = getInt("ASSETID");
        String desc = getString("DESCRIPTION");
        System.out.println("Saving Asset ID=" + id + " desc=" + desc);
    }
}
4. Right click to create another new class AssetCustSet into custom.app.asset package.
package custom.app.asset;
import java.rmi.RemoteException;
import psdi.app.asset.AssetSet;
import psdi.app.asset.AssetSetRemote;
import psdi.mbo.Mbo;
import psdi.mbo.MboServerInterface;
import psdi.mbo.MboSet;
import psdi.util.MXException;
public class AssetCustSet extends AssetSet implements AssetSetRemote
{
    public AssetCustSet(MboServerInterface ms) throws MXException, RemoteException
    {
        super(ms);
    }
    protected Mbo getMboInstance(MboSet ms) throws MXException, RemoteException
    {
        return new AssetCust(ms);
    }
}
5. Now copy this folder from workspace, (Eclipse builds class and folders hierarchy automatically in by default)
    C:\Users\Administrator\workspace\Proj01\bin\custom to C:\IBM\SMP\maximo\applications\maximo\businessobjects\classes

6. Build n Deploy EAR file. (c:\ibm\smp\tools\configUI.exe)
    or a fast way by Bruno (http://maximodev.blogspot.com/2012/08/maximo-rapid-java-class-deploy-websphere.html)
    I personally use 5 minutes approach as recommend by Brunu:
        first time configuration:

Stop WebSphere App Server
(in C:\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\installedApps\ctgCell01\MAXIMO.ear\) folder
Unzip the businessobjects.jar file into a folder named businessobjects.jar.
Start WebSphere App Server
Next time, just copy class files restart app server like this: 
Stop Maximo WebSphere App Server
Copy java classes into businessobjects.jar in maximo.ear folder
Start Maximo WebSphere App Server

7. Update Class file in Asset Object in Database Configuration,
    Existing: psdi.plusg.app.asset.PlusGAssetSet
    Our custom class: custom.app.asset.AssetCustSet (packagename.classname)

8. Create a new Asset in Asset Application, and SystemOut.log (C:\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\logs\MXServer\systemOut.log)
    you will find "Saving Asset ID ...." in this file.

References:
http://maximodev.blogspot.com/2010/09/quick-maximo-development-environment.html
DOC file by IBM for Maximo 7.1
http://maximodev.blogspot.com/2012/05/maximo-extend-java-mbo.html
http://maximodev.blogspot.com/2012/08/maximo-rapid-java-class-deploy-websphere.html
http://sometimesiliketopretend.blogspot.com/2015/01/eclipse-java-programming-for-maximo-75.html
http://maximodev.blogspot.com/p/java-customization.html
   

No comments:

Post a Comment