Interface EbaseSystem
public interface EbaseSystem
EbaseSystem
interface provides access to a number of system services.- Since:
- V4.4
-
Method Summary
Modifier and Type Method 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 objectsSystemPreferences
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 theUfs.fileDirectoryName
parameter ofUFSSetup.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 rollbackSystemVariables
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.boolean
isDebugging()
Returns true if a Javascript debugging session is active on this server.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.
-
Method Details
-
getSystemName
java.lang.String getSystemName()Returns the system name as configured in theUfs.fileDirectoryName
parameter ofUFSSetup.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 which provides 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.
- Since:
- V4.4
-
getTexts
SystemTexts getTexts()Returns the system texts object which provides access to all system texts.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";
- Since:
- V5.0
-
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.FormRuntimeExceptionReturns 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 afinally
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 Server Administration Application- Returns:
- database connection
- Throws:
com.ebasetech.xi.exceptions.FormRuntimeException
- if the connection cannot be obtained for any reason- Since:
- V4.4
-
getDatabaseType
java.lang.String getDatabaseType(java.lang.String databaseConnectionName) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionReturns a string describing the database type for the database connection. This is obtained using theDatabaseMetadata.getDatabaseProductName()
method. Examples of returned strings:- Apache Derby
- MySQL
- Microsoft SQL Server
- Oracle
- PostgreSQL
- Parameters:
databaseConnectionName
- the name of the Database Connection as configured in the Server Administration Application- Returns:
- database type
- Throws:
com.ebasetech.xi.exceptions.FormRuntimeException
- if the connection cannot be obtained for any reason- Since:
- V5.1.1
-
executeCustomFunction
java.lang.Object executeCustomFunction(java.lang.String functionName, java.lang.Object[] parameters) throws com.ebasetech.xi.exceptions.FormRuntimeExceptionExecutes 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.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
orDouble
- Throws:
com.ebasetech.xi.exceptions.FormRuntimeException
- when an exception is thrown by the custom function- Since:
- V4.4
-
loadPropertiesFromClasspath
java.util.Properties loadPropertiesFromClasspath(java.lang.String propertiesFileName) throws java.io.IOExceptionLoads a properties file from the WEB-INF/classes folder within the web application. Individual properties can then be extracted by referring directly to the property name.Javascript example:
var props = system.loadPropertiesFromClasspath("foo.properties"); var x = props.property1;
- Parameters:
propertiesFileName
- the name of the properties file- Returns:
- properties object
- Throws:
java.lang.IllegalArgumentException
- when the specified file cannot be loadedjava.io.IOException
- Since:
- V5.2
-
loadPropertiesFromFile
java.util.Properties loadPropertiesFromFile(java.lang.String propertiesFilePath) throws java.io.IOExceptionLoads a properties file from the specified full file path. Individual properties can then be extracted by referring directly to the property name.Javascript example:
var props = system.loadPropertiesFromFile("c:/myApp/properties/foo.properties"); var x = props.property1;
- Parameters:
propertiesFilePath
- the full file path of the properties file- Returns:
- properties object
- Throws:
java.lang.IllegalArgumentException
- if the file does not existjava.io.IOException
- Since:
- V5.2
-
getSnapshotManager
SnapshotManager getSnapshotManager()Returns snapshot manager that allows the user to take a snapshot of the form state data.- Since:
- 4.4
-
getServletContext
javax.servlet.ServletContext getServletContext()Returns the servlet context which can be used to get/set global attributes. This method can be used in all cases including the execution of scheduled forms.Javascript example:
var context = system.getServletContext(); context.setAttribute("attr1", myobj); var o = context.getAttribute("attr2");
- Returns:
- the servlet context
- Since:
- V5.0.2
-
addWrapFactoryExcludedClass
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. By default all Java classes passed to Javascript are passed through a wrap factory which converts them into equivalent Javascript types. Adding a class (or interface) name to the exclusion list ensures that the class will be returned without conversion. This is only applicable for instances of Java maps (java.util.Map) and lists (java.util.List) which by default are converted to Javascript objects and Javascript arrays respectively. Note that adding "java.util.Map" or "java.util.List" as an excluded class will stop all conversion of maps or lists.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");
- Parameters:
className
- the fully qualified name of a Java class or interface- Since:
- V5.3.0
- See Also:
removeWrapFactoryExcludedClass(String)
-
removeWrapFactoryExcludedClass
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. This method can only be used to remove classes or interfaces added using addWrapFactoryExcludedClass(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");
- Parameters:
className
- the fully qualified name of a Java class or interface- Returns:
- true if the named class was in the exclusion list and has been removed, otherwise false
- Since:
- V5.3.0
- See Also:
addWrapFactoryExcludedClass(String)
-
isDebugging
boolean isDebugging()Returns true if a Javascript debugging session is active on this server.- Since:
- V5.9
-