View source | Discuss this page | Page history | Printable version   

Modules:Java Extension Points/Technical Specification

Contents

Introduction

In this document are described all the developments needed to properly implement the Java Extension Points module.

Module Definition

Java Extension Points

Java Extension Points

New Window

Java Extension Points

This window can only be accessed with the System Administrator role. In this window is configured all the extension points that can be executed. Each module that fires an extension points must include a record in this window.

Header
JEXP_Extension_Point table. Includes all the extension point definitions as well as the description and the owner module.
Java Classes
JEXP_Extension_Point_Class table. Includes all the Java classes that must be executed when the extension is fired.

JavaExtensionPointBase abstract class

This class must be implemented by the modules that use any extension point.

Execute

This method is called when the extension point is fired. It only has one parameter. This parameter is an instance of the JavaExtensionPointParams class, which contains all the parameters given by the extension point.

For example: We want to add one unit to the unit price given by the extension point.

   public JavaExtensionPointParams execute(JavaExtensionPointParams params) {

    // Get the parameter value 
    BigDecimal unitPrice = params.getBigDecimalParameter("UnitPrice");
    
    // Do stuff with the parameter
    unitPrice = unitPrice.add(BigDecimal.ONE);
    
    // Update the parameter value
    params.addParameter("UnitPrice", unitPrice);

    return params;
  }

Bulbgraph.png   Note that if any change is made to a parameter, it may be used by the next extension point.

JavaExtensionPointParams class

This class contains all the parameters needed by a specific extension point.

To add a parameter the method addParameter should be called:

   final JavaExtensionPointParams params = new JavaExtensionPointParams();
   params.addParameter("UnitPrice", price);
   params.addParameter("Product", product);

There are several methods to obtain the value of a parameter. All methods return null if the parameter name given doesn't exists. The methods available are:

Retrieved from "http://wiki.openbravo.com/wiki/Modules:Java_Extension_Points/Technical_Specification"

This page has been accessed 1,242 times. This page was last modified on 22 January 2016, at 08:45. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.