November 13, 2015

Avoiding Java classes conflicts using a_customer.xml file

Consider this scenario (which I came across). You have extended psdi.app.workorder.WO out of the box MBO class with your own cust.app.workorder.WO class to implement you own business logic for work orders. After a while you install the Maximo Scheduler extension and you soon discover that all your custom logic has gone because the WORKORDER object handler in Database Configuration is now psdi.skd.app.workorder.SKDWOSet instead of your custom cust.app.workorder.WOSet class. This is because the Maximo Scheduler installation has overwritten your custom handler.

Lesson learned: If you have custom classes and extend the same classes which other products also are extending, then those classes will get overwritten when other products are installed and your customizations will be lost.

In order to maintain the customizations, you must define a_customer.xml file in the applications\maximo\properties\product folder. The following example shows a sample a_customer.xml file.

<?xml version="1.0" encoding="UTF-8" ?>
<product>
  <name>My custom classes</name>
  <version>
  <major>7</major>
  <minor>5</minor>
  <patch>0</patch>
  <build>BUILD</build>
  </version>
  <dbmaxvarname>ACUSTOMER</dbmaxvarname>
  <dbscripts>a_customer</dbscripts>
  <dbversion>V750-0</dbversion>
  <lastdbversion>V750-0</lastdbversion>
  <extensions>
    <mbo objectname='WORKORDER' extends='psdi.app.workorder.WO'>custom.app.workorder.WO</mbo>
    <mboset objectname='WORKORDER' extends='psdi.app.workorder.WOSet'>custom.app.workorder.WOSet</mboset>
  </extensions>
</product>

Also, you need to create a directory called "a_customer" inside your tools\maximo\en directory. This directory can be left empty.

This will tell the Maximo installer to merge your custom code with the add-ons code.

For more details refer to the following articles:


5 comments:

  1. What does it mean it will merge custom code?

    ReplyDelete
    Replies
    1. Merge what?
      It will update the object's mbo class with your custom class in the db, that was overwritten by the new product installation.
      The same works for field classes.

      Delete
    2. This comment has been removed by the author.

      Delete
    3. This comment has been removed by the author.

      Delete
  2. As far as I know, the "merge" concept does not exist in Java. Am I wrong ?
    What I do (since Maximo 5.0...) :
    I edit my sources (import section and extend key word) :
    cust.app.workorder.WO.java:extend psdi.skd.app.workorder.SKDWO
    cust.app.workorder.WOSet.java:extend psdi.skd.app.workorder.SKDWOSet
    Then I compile them
    Then I rebuild EAR and redeploy
    Then I check the ClassName in MaxObject, MaxObjectCfg, MaxAttribute, MaxAttributeCfg tables (and update them if something was going wrong).
    Then I restart MXServer.

    I would be VERY interested in the way to install SEVERAL industry solution (i.e Oil a Gas plus Transportation plus Nuclear). How to do in such case ? What to do in a_customer.xml? In what way should I edit the respective XML of Oil and Gas, Transportation ant Nuclear products ?

    ReplyDelete