public interface EbaseSystem
EbaseSystem
interface provides access to a number of system services.Modifier and Type | Method and Description |
---|---|
void |
addWrapFactoryExcludedClass(java.lang.String className)
Excludes the named class or interface from type conversion performed by the wrap factory for Java lists and maps.
|
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.
|
java.lang.String |
getDatabaseType(java.lang.String databaseConnectionName)
Returns a string describing the database type for the 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.
|
javax.servlet.ServletContext |
getServletContext()
Returns the servlet context which can be used to get/set global attributes.
|
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 . |
SystemTexts |
getTexts()
Returns the system texts object which provides access to all system texts.
|
TransactionManager |
getTransactionManager()
Returns the transaction manager object that supports commit and rollback
|
SystemVariables |
getVariables()
Returns the system variables object which provides access to all system variables.
|
Workflow |
getWorkflow()
Returns the workflow object, this provides access to all workflow functionality.
|
java.util.Properties |
loadPropertiesFromClasspath(java.lang.String propertiesFileName)
Loads a properties file from the WEB-INF/classes folder within the web application.
|
java.util.Properties |
loadPropertiesFromFile(java.lang.String propertiesFilePath)
Loads a properties file from the specified full file path.
|
boolean |
removeWrapFactoryExcludedClass(java.lang.String className)
Removes the named class or interface from the list of excluded classes used as an exclusion list by the wrap factory for Java lists and maps.
|
java.lang.String getSystemName()
Ufs.fileDirectoryName
parameter of UFSSetup.properties
.SystemPreferences getPreferences()
SystemVariables getVariables()
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.
SystemTexts getTexts()
System texts are used to provide standard texts to end users e.g. standard popup validation error messages, mouseover texts etc.
Examples:
var txt1 = system.texts.getText(21).text; system.texts.getText(21).text = "New list header text";
SecurityManager getSecurityManager()
Workflow getWorkflow()
TransactionManager getTransactionManager()
LockManager getLockManager()
SequenceManager getSequenceManager()
java.sql.Connection getDatabaseConnection(java.lang.String databaseConnectionName) throws com.ebasetech.xi.exceptions.FormRuntimeException
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(); }
databaseConnectionName
- the name of the Database Connection as configured in the Server Administration Applicationcom.ebasetech.xi.exceptions.FormRuntimeException
- if the connection cannot be obtained for any reasonjava.lang.String getDatabaseType(java.lang.String databaseConnectionName) throws com.ebasetech.xi.exceptions.FormRuntimeException
DatabaseMetadata.getDatabaseProductName()
method.
Examples of returned strings:
databaseConnectionName
- the name of the Database Connection as configured in the Server Administration Applicationcom.ebasetech.xi.exceptions.FormRuntimeException
- if the connection cannot be obtained for any reasonjava.lang.Object executeCustomFunction(java.lang.String functionName, java.lang.Object[] parameters) throws com.ebasetech.xi.exceptions.FormRuntimeException
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.
Javascript example:
var result = system.executeCustomFunction("getmessagetext", ["PR1", 1001, fields.CITY.value]);
functionName
- the name of the function (function names are always in lower case)parameters
- an array of input parameters for the functionString
or Double
com.ebasetech.xi.exceptions.FormRuntimeException
- when an exception is thrown by the custom functionjava.util.Properties loadPropertiesFromClasspath(java.lang.String propertiesFileName) throws java.io.IOException
Javascript example:
var props = system.loadPropertiesFromClasspath("foo.properties"); var x = props.property1;
propertiesFileName
- the name of the properties filejava.lang.IllegalArgumentException
- when the specified file cannot be loadedjava.io.IOException
java.util.Properties loadPropertiesFromFile(java.lang.String propertiesFilePath) throws java.io.IOException
Javascript example:
var props = system.loadPropertiesFromFile("c:/myApp/properties/foo.properties"); var x = props.property1;
propertiesFilePath
- the full file path of the properties filejava.lang.IllegalArgumentException
- if the file does not existjava.io.IOException
SnapshotManager getSnapshotManager()
javax.servlet.ServletContext getServletContext()
Javascript example:
var context = system.getServletContext(); context.setAttribute("attr1", myobj); var o = context.getAttribute("attr2");
void addWrapFactoryExcludedClass(java.lang.String className)
The scope of changes made via this method applies to the execution of an entire form, web service or workflow process.
Javascript example:
system.addWrapFactoryExcludedClass("java.util.Properties");
className
- the fully qualified name of a Java class or interfaceremoveWrapFactoryExcludedClass(String)
boolean removeWrapFactoryExcludedClass(java.lang.String className)
The scope of changes made via this method applies to the execution of an entire form, web service or workflow process.
Javascript example:
system.removeWrapFactoryExcludedClass("java.util.Properties");
className
- the fully qualified name of a Java class or interfaceaddWrapFactoryExcludedClass(String)