IBM Support

FAQ: Is there a method to call java API from the extended rules in a map? (SCI92964) *|* -002275BD395500B185257918002C991

Question & Answer


Question

FAQ: Is there a method to call java API from the extended rules in a map? (SCI92964) *|* -002275BD395500B185257918002C9912- *|*

Answer

Technote (FAQ)


Question

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

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


Historical Number

PRI7797

Product Alias/Synonym

Gentran Integration Suite All Releases
SCI92964

[{"Business Unit":{"code":"BU055","label":"Cognitive Applications"},"Product":{"code":"SS73G6","label":"Sterling Total Payments for Financial Services"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
12 October 2021

UID

ibm10762929