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:


2 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