Creating a Field Class

Hello;

Another basic java functionality is to create a field class. Assume that you have a field. And if it is filled you have to make it readonly to prevent anyone changing the field. I’ll assume this field is WORKORDER.ASSETNUM… To do this we have to extend psdi.app.workorder.FldWOAssetnum class which is default class for this field. Here is the basic code..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package custom.workorder;
import psdi.mbo.*;
import psdi.util.*;
import psdi.app.workorder.FldWOAssetnum;
import java.util.*;
import java.rmi.*;
 
 
public class newFldWOAssetnum extends psdi.app.workorder.FldWOAssetnum
{
public newFldWOAssetnum (MboValue mbovalue) throws MXException, RemoteException
    {
        super(mbovalue);
    }
public void init() throws MXException {
        super.init();
        if(!getMboValue().isNull()) //If the value is not null
        {
            getMboValue().setReadOnly(true); //make it readonly
        }
    }
}

After this you have to write ‘custom.workorder.newFldWOAssetnum’ to the class field of WORKORDER.ASSET in database configuration.

Run configdb
Build maximo.ear
Redeploy maximo.ear

Have a good day…

read comments here

Creating a New Mbo Class

Hello;

One of the basic java functionality is to create new mbo’s and changing its default behaviour. For example we can create a new mbo as the child of Workorder. And assume there is a relationship between workorder and newMbo as wonum=:wonum. When we add a new record from the user interface, new record’s wonum is not populated automatically. So we have to extend psdi.mbo.Mbo to automate this. Here is how it is done….
File :custom.newMbo.newMbo

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
package custom.newMbo;
 
import psdi.util.*;
import java.util.*;
import psdi.mbo.*;
import java.rmi.*;
import psdi.server.MXServer;
 
 
public class newMbo extends Mbo
        implements newMboRemote {
 
    /**
     * Constructor
     */
    public newMbo(MboSet ms) throws MXException, RemoteException {
        super(ms);
    }
 
    public void add() throws MXException, RemoteException {
        super.add();        
        MboRemote mboremote = getOwner();
        setValue("WONUM", mboremote.getString("WONUM"), 2L);
 
 
    }
 
}

File :custom.newMbo.newMboSet

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
package custom.newMbo;
import psdi.mbo.*;
import psdi.util.*;
import java.util.*;
import java.rmi.*;
 
public class newMboSet extends MboSet
implements newMboSetRemote
{
/**
* Constructor
*/
 
public newMboSet(MboServerInterface ms)
throws MXException, RemoteException
{
super(ms);
}
 
 
 
protected Mbo getMboInstance(MboSet ms)
throws MXException, RemoteException
{
return new newMbo(ms); // this is the key line ...
}
}

File :custom.newMbo.newMboRemote

1
2
3
4
5
6
7
8
9
package custom.newMbo;
import psdi.mbo.*;
import psdi.util.*;
import java.rmi.*;
 
public interface newMboRemote extends MboRemote
{
 
}

File :custom.newMbo.newMboSetRemote

1
2
3
4
5
6
7
8
9
package custom.newMbo;
import psdi.mbo.*;
import psdi.util.*;
import java.rmi.*;
 
public interface newMboSetRemote
extends MboSetRemote
{
}

Then you have to compile and rmic these files. Then Go to the database configuration find your object. Enter ‘custom.newMbo.newMboSet’ to the class…

Configure DB
Build Maximo.ear
Deploy Maximo.ear

Tip: It is better to make Wonum field readonly on user interface. Users must not change the field from the user interface

Then you’re good to go….

Have a good day…

read comments here

Database Export Utility

Hello;

There is a little known utility that helps us to export maximo database. This utility helps us to export database in any db type. For example assume that we are using oracle but we want to export database to use it in DB2. We can use this utility. It supplies us a maximo.db2 file which is like we use in maxinst.bat. You can find it in %MAXIMOROOT%\tools\maximo\internal\Unlcvt.bat

Here are the parameters that you can use with this tool:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Runs psdi.configure.Unlcvt.
The default name of the output file is Unlcvt.ora (Oracle), Unlcvt.sqs (SqlServer), or Unlcvt.ddl (DB2).
The default database is defined in the maximo.properties file.
The commandline parameters for overriding the defaults are listed below.
Also see javadocs for psdi.configure.Unlcvt.
-a (db alias)    Database alias. If not specified, uses mxe.db.url property.
-f (filename)    Filename for properties file.  If not specified, uses maximo.properties.
(Also see -k parameter for propfile directory.)
-k (propfile dir)    Directory for properties file.
(Also see -f parameter for propfile filename.)
-o (filename)    Filename of output file (without path or extension).
-p (password)    Password for database connection.
If not specified, uses mxe.db.password property, or "maximo".
-u (username)    Username for database connection.
If not specified, uses mxe.db.user property, or "maximo".
-x (db platform)    Output to a different db platform that the one being used for input.
(The default is to output to the same platform.)
Values for platform are: 1=Oracle, 2=SqlServer, 3=DB2.

Example Usage:

1
Unlcvt.bat -x3 

  exports database as db2 file….

Have a good day…

read comments here

Maximo Debug Window

Hello;

If you enter these to the address bar of your browser in any application of Maximo a new window appears which shows info about the client moves.. It is very useful for developers..

First enter..

javascript:eval(document.getElementById('debug_eventwindow').style.visibility='');

And Then

javascript:eval(document.getElementById('commframe').style.display='');

Then you will see a little window pop up on the left of the screen..

Have a good day…

read comments here


Switch to our mobile site