IBM Support

Is there a method to call java API from the extended rules in a map? (SCI92964)

Question & Answer


Question

Is there a method to call java API from the extended rules in a map? (SCI92964)

Cause

Answer

The language used in Extended rules does not implement all Java capabilities. However, they can be invoked from customised external Java classes.

Example:-
In the java file:
public class CustClassName {
public CustClassName() {
}
public long getCurrentTimeMillis() {
return System.currentTimeMillis();
}
}

and in the user exit:
------
object ob;
integer result;
ob = new ("CustClassName");
result = ob.getCurrentTimeMillis();
ntoa(result, #something);

Here is the procedure to follow, with an example :

You first need to install the Java class you created by going under the GIS_installDirectory\bin

From there you can run a script install3rdParty.cmd VendorName Version -j javaclass.jar

Once this has been done, you will need to restart GIS, and the new java class will be loaded in GIS.

From there, here is a sample Extended Rule that uses a customer Jar file to execute a query on a database. This jar file returns a value of 0 or 1.


// Begin user exit //

Object connector;

Object connection;

Object statement;

Object resultset;

String[256] query;

connector = new("com.stercomm.emea.pg.userexit.Connector");

connection = connector.connect("TABLE_NAME"); // This must match a JDBC connection declared in the jdbc_customer.properties file

statement = connection.createStatement();

query = "select * from TAB_DETAIL_COMMANDE_TEMP where NCDE = " + NumeroCommande + " and NSOCDEPOT = " + SocieteDepot + " and NCODIC = " + codic + " and NEAN = " + #7140 + " and DSEMAINE = " + SemaineDarty;

resultset = statement.executeQuery(query); // this function allows to check if data in DB matches data in File if OK then 1, if not OK then 0.

if connector.select(resultset) = 1 then

begin

#POSTAL_CODE = rs.getString("CITY_NAME"); // this function allows to retrieve data from DB columns

end

[{"Product":{"code":"SS3JSW","label":"IBM Sterling B2B Integrator"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Mapping and Translation","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

PRI7797

Product Synonym

Gentran Integration Suite All Releases;SCI92964

Document Information

Modified date:
02 December 2019

UID

swg21520396