IBM MDM PIM tool is a middleware software component provides robust solutions for Product Information Management. It is designed and implemented based on rich set of MDM technologies and concepts. It enables enterprises to manage single source of reliable and most trusted information. It provides a repository of product information that is accurate, non-redundant, synchronized and most updated. The basic functionality of the MDM PIM objects can be experienced by the UI interface. In today’s business world to meet enterprises goals and provide much more user friendly interface we need to have an environment where we can provide the solutions in dynamic fashion. In MDM PIM we can use scripting mechanism to extend the basic functionality of the MDM PIM objects towards business requirements and needs. Customization and dynamic functionality can be achieved by the Scripting concepts.
IBM MDM PIM scripting can be used for “Calculating, Cleansing, Transforming and Validating” business entities and correspond values. MDM PIM application has rich set of objects to perform varies business functions. All these Objects functionalities can be extended further by means of scripting. In MDM PIM environment we can use scripts for Imports and Exports, Workflows, Business Rules, Pre and Post processing on Catalogs and Hierarchies, Mass Updates, Custom Tools etc… Scripts may be used in many different locations in order to enhance the functionality and flexibility of MDM PIM system. Based on the objects functionalities in PIM system, we can further categorize the scripts into the following four families.
Script Expressions:- Small scripts which use at spec level or attribute level. These include Validation Rule scripts, Value Rule scripts, Default Value Rule scripts, Enumeration scripts, Import and Export Mapping Expression scripts, etc.
Utility Scripts:- These are typical reusable scripts. These include Imports scripts, Export scripts, Trigger scripts, and Report scripts.
Container Processing Scripts:- In MDM PIM the major containers that we use for scripting are Catalogs and Hierarchies. These Container Processing scripts include Entry Preview scripts, Entry Macro scripts, Entry Build scripts, Pre Processing scripts, Post Processing scripts, Post Save scripts, etc.
Presentation Scripts:- These scripts include ASP, JSP style scripts for custom screens and tools.
MDM PIM develop environment supports both Trigo and Java type scripting styles. Since the release of Infosphere PIM version 6.0 onwards, we can script in Java style. MDM PIM system has rich set Java API designed and implemented for its Trigo version. We can write a script either in PIM environment using script editor or Workbench from third party vendor that supports both PIM and Java API plug-ins. IBM provides highly sophisticated editors RAD( Rational Application Developer) and RSA( Rational Software Architect) for PIM scripting.
In MDM PIM application, on Script Console screen generally termed as Script Sandbox, we can see all the functionalities for each object in an alphabetical order. Each function provides both its prototype and description.
Every script that you write must be complied prior to run. All the scripts will be saved in the database that is associated with the PIM system. During the compilation we may encounter many issues related to syntax and semantic errors. When saving a script some basic validations will be done. Some of these include “Matching parenthesis, brackets, and quotes”, “Semi-Colons present”, “All Operations and Signatures”, etc. If there is an error it will be flagged as an error.
Troubleshooting Scripts
Whenever we encounter errors in scripts, we need to troubleshoot them. Typically error messages are generated when an invalid script is running. Depending on the error, error message will help you find what and where the error is. We must test scripts before placing them in production environment to avoid unexpected results or errors. Writing to a log is useful for troubleshooting. In MDM PIM system we can use several ways to write logs. Typical scenarios are writing into a file in the docstore, and using a logger or logger class. The files that we write into the docstore typically contain data and time stamping and so provide good mechanism to troubleshoot the problems. All the Logs using Logger class should be configured and defined in the file “log.xml”. These logs are written to the system log directory. These logs generally contain status indicators as part of them. These include Debug, Info, Warning, Error, and Fatal.
Sample script which was written into the docstore path:
Var filename = “document store path”;
Var fileWriter = createOtherOut(filename, “UTF-8”);
…….
fileWriter.writeln(“Sample Debug message”);
……..
fileWriter.save(filename);
fileWriter.close();
Sample scripting using Logger:
var importLogger = getLogger(“ImportsExports”);
importLogger.loggerDebug(“debugging message”);
importLogger.loggerError(“error message”);
importLogger.loggerFatal(“fatal error message”);
importLogger.loggerInfo(“information message”);
importLogger.loggerWarn(“warning message”);
We can use comments in the scripts to enable problem determination. Commenting code is critical for effective debugging. In MDM PIM scripting, only single line comments are supported and multi line comments are not supported. We can include informative comments while writing scripts for other users. Typical script header contains information about “Author, Date Stamp, Short Description of what script does, List of assumptions, inputs, and outputs, Description of how the script should be used, Audit trail of modifications to the script”. We can add contextual comments within the body.
Scripting is very powerful tool and mechanism in MDM PIM to provide dynamic solutions to the business. Developer should have proper attention while writing a script as it directly affects the database. Poor scripting leads to the poor performance. So one should be clear and have a proper understanding of given business requirement prior to write a script.