This document describes how to get started with development using the access provider for Java. For clarity, code that is not necessary for the purpose of this document have been omitted. The full source code for this example is available here.
To make the coding easier you can add a number of import statements at the top of the code file. This means that you can use classes in these packages without having to prefix the class with package name.
import
ifs.fnd.ap.Record;import
ifs.fnd.ap.RecordAttribute;import
ifs.fnd.ap.PlsqlCommand;import
ifs.fnd.ap.PlsqlSelectCommand;import
ifs.fnd.ap.PlsqlBaseMethodCommand;import
ifs.fnd.ap.PlsqlBaseMethodAction;import
ifs.fnd.ap.PlsqlBaseMethodType;import
ifs.fnd.ap.RecordCollection;import
ifs.fnd.ap.Server;import
ifs.fnd.ap.APException;
Before the server operation can be invoked, a Server object must be created:
Server srv = new Server();
Sets the connection string to use for server communication:
srv.setConnectionString("connection string");
For a server to allow a client application to access an operation, the client must have the right credentials set:
srv.setCredentials("username",
"password");
Define your SELECT command PlsqlSelectCommand cmd = new PlsqlSelectCommand(srv, "SELECT * FROM FND_USER WHERE DESCRIPTION LIKE :DESC"); cmd.getBindVariables().add("DESC", "A%");
RecordCollection result = cmd.executeQuery(); if(result!=null){ System.out.println("Users"); System.out.println("======"); for(int i = 0; i < result.size(); i++){ System.out.println((String)result.get(i).findValue("DESCRIPTION")); } }
This is the basic way to fetch information from components built with the Extended Server platform. Please look at the full source code for this example to get the whole picture
To compile an application that uses the Java Access Provider, the files ifs-fnd-ap.jar and ifs-fnd-common.jar must be in the class path. For example (assuming Extended Server is installed in the folder c:\ifs):
javac -classpath C:\ifs\javaruntime\ifs-fnd-ap.jar;C:\ifs\javaruntime\ifs-fnd-common.jar
PLSQLQueries.java
When running the application, the files ifs-fnd-ap.jar and ifs-fnd-common.jar must be in the class path. Some system properties must also be set when running applications that uses the Java Access Provider. For more information see Installation of the Java Access Provider.
java -classpath .;C:\ifs\javaruntime\ifs-fnd-ap.jar;C:\ifs\javaruntime\ifs-fnd-common.jar
PLSQLQueries [connectstring] [identity] [password]
Note. To be able to run this example, the user must be granted a permission set that has access to the AccessPlsql (in IFS Base Functionality) activity.
The output should be something as follows:
Users ====== Alexander Danielsson Andy Jefferson Andre Hezzel Aretha Franklin Ann Pettersson Alan Newman - SM B2B User Alain Prost Annette Carlsson Ann-Cathrine Poopuu Achinee Walpita Adam Kosiorek Annika Fransson Anna Hofling Anders Jansson Ann-Katrin Johansson Anders Lif Alexander Schilling Albin Skinnars Anette Lundblad Anna-Maria Belin Anna-Maria Ljungblad Anders Bosenius Anna Brand Andreas Lund Annika Eriksson Andreas Foung Annika Gabrielsson Anna Holmsten Anders Jansson Annika Johansson Ann Larsson Anne NikkilΣ Anna Lundmark