Modules:Java Extension Points/How to create new Extension Point
Contents |
Objective
The objective of this How to article is to describe how to develop a new Java Extension Point and integrate it in your module and let other modules extend the functionality.
Creating the Extension Point
Application Dictionary
To let your module execute an extension point, a record must be created in the Java Extension Point window. This record will be exported in the src-db folder.
Call the Extension Point from Java
All the extension points can be called in every Java file. In order to call the Java Extension Point we have already created, we need first to create the params object, add the parameters needed and execute it.
This can be done with those few lines of code:
// Create the params Object final JavaExtensionPointParams params = new JavaExtensionPointParams(); // Add the parameters params.addParameter("PickingList", pl); params.addParameter("Packing", packing); params.addParameter("Shipment", shipment); // Execute the extension point JavaExtensionPointExecutor.call("PRPP_PostPackingGeneration", params);
Parameters
First we create the JavaExtensionPointParams object where all the parameters will be saved.
We can add every kind of Object, but take into account that only a few methods are available to get the parameter values in his correct type.
// Create the params Object final JavaExtensionPointParams params = new JavaExtensionPointParams(); // Add the parameters params.addParameter("PickingList", pl); params.addParameter("Packing", packing); params.addParameter("Shipment", shipment);
![]() | Available methods can be found here |
Execute the Extension Point
Once we have all the parameters, we can execute the extension point. Calling the function call from the JavaExtensionPointExecutor class with the identifier and the params as arguments will do all the job. The extension point classes will be executed following the sequence given.
Note that if a parameter value is updated within a class, the next classes can throw an error or malfunction.
// Execute the extension point JavaExtensionPointExecutor.call("PRPP_PickingGeneration", params);
The call method returns a JavaExtensionPointParams Object that will contain the parameters (updated or not) that have been executed in every class.