com.ebasetech.xi.api
Interface EbaseSystem


public interface EbaseSystem

The EbaseSystem interface provides access to a number of system services.

Since:
V4.4

Method Summary
 java.lang.Object executeCustomFunction(java.lang.String functionName, java.lang.Object[] parameters)
          Executes a custom function.
 java.sql.Connection getDatabaseConnection(java.lang.String databaseConnectionName)
          Returns a database connection.
 LockManager getLockManager()
          Returns the lock manager object that supports locking/unlocking of in memory objects
 SystemPreferences getPreferences()
          Returns the system preferences object.
 SecurityManager getSecurityManager()
          Returns the security manager object that provides access to all security functions: logon(), logoff(), hasRole() etc.
 SequenceManager getSequenceManager()
          Returns the sequence manager object that provides a new sequence number for a defined sequence.
 SnapshotManager getSnapshotManager()
          Returns snapshot manager that allows the user to take a snapshot of the form state data
 java.lang.String getSystemName()
          Returns the system name as configured in the Ufs.fileDirectoryName parameter of UFSSetup.properties.
 TransactionManager getTransactionManager()
          Returns the transaction manager object that supports commit and rollback
 SystemVariables getVariables()
          Returns the system variables object giving access to all system variables.
 Workflow getWorkflow()
          Returns the workflow object, this provides access to all workflow functionality.
 

Method Detail

getSystemName

java.lang.String getSystemName()
Returns the system name as configured in the Ufs.fileDirectoryName parameter of UFSSetup.properties.

Returns:
system name
Since:
V4.4

getPreferences

SystemPreferences getPreferences()
Returns the system preferences object.

Since:
V4.4

getVariables

SystemVariables getVariables()
Returns the system variables object giving access to all system variables.

These system variables were originally intended to be used with the FPL programming language, but they can also be used by any programming language via this method. Please note that most of the functionality provided by system variables is available more easily via other methods on the API.

Further documentation.

Since:
V4.4

getSecurityManager

SecurityManager getSecurityManager()
Returns the security manager object that provides access to all security functions: logon(), logoff(), hasRole() etc.

Since:
V4.4

getWorkflow

Workflow getWorkflow()
Returns the workflow object, this provides access to all workflow functionality.

Since:
V4.4

getTransactionManager

TransactionManager getTransactionManager()
Returns the transaction manager object that supports commit and rollback

Since:
V4.4

getLockManager

LockManager getLockManager()
Returns the lock manager object that supports locking/unlocking of in memory objects

Since:
V4.4

getSequenceManager

SequenceManager getSequenceManager()
Returns the sequence manager object that provides a new sequence number for a defined sequence.

Since:
V4.4

getDatabaseConnection

java.sql.Connection getDatabaseConnection(java.lang.String databaseConnectionName)
                                          throws com.ebasetech.xi.exceptions.FormRuntimeException
Returns a database connection.

Note that code should be enclosed in a try block, and that all database connections, result sets, and statements must be closed in a finally block, as shown in the example below. Failure to do this correctly can lead to connection pool leaks and eventually a hung system.

Javascript example:

 var con = system.getDatabaseConnection("CONN1");
 var stmt;
 var rs;
 try {
   stmt = con.prepareStatement("select * from tab1");
   rs = stmt.executeQuery();
   while (rs.next()) {
      var xx = rs.getString("col_name");
   }
 }
 finally {
   if (rs) rs.close();
   if (stmt) stmt.close();
   if (con) con.close();
 }
 

Parameters:
databaseConnectionName - the name of the Database Connection as configured in the Ebase Xi Designer
Returns:
database connection
Throws:
com.ebasetech.xi.exceptions.FormRuntimeException - if the connection cannot be obtained for any reason
Since:
V4.4

executeCustomFunction

java.lang.Object executeCustomFunction(java.lang.String functionName,
                                       java.lang.Object[] parameters)
                                       throws com.ebasetech.xi.exceptions.FormRuntimeException
Executes a custom function.

Custom functions are Java classes that extend UFSCustomFunction and have been added to the server classpath. These were originally intended to be used with the FPL programming language, but they can also be used by any programming language via this method. Please note that most of the functionality provided by the custom functions installed with Ebase Xi is available more easily via other methods on the API.

Further documentation.

Javascript example:

 var result = system.executeCustomFunction("getmessagetext", ["PR1", 1001, fields.CITY.value]);
 

Parameters:
functionName - the name of the function (function names are always in lower case)
parameters - an array of input parameters for the function
Returns:
the object returned by the function, this will be of type String or Double
Throws:
com.ebasetech.xi.exceptions.FormRuntimeException - when an exception is thrown by the custom function
Since:
V4.4

getSnapshotManager

SnapshotManager getSnapshotManager()
Returns snapshot manager that allows the user to take a snapshot of the form state data

Since:
4.4