Skip to main content
Skip table of contents

Java Server API

Die nachfolgenden Inhalte sind nur in englischer Sprache verfügbar.

This topic describes functions that the java server provides for Jython.

 All of the functions defined in the Java-class de.planta.server.webservice.WebHqlQueryHandler (name is for historic reasons) are used like this:

PY
from de.planta.server.webservice import WebHqlQueryHandler

dbhandler = WebHqlQueryHandler()
dbhandler.setJythonUser('R41')

Pojo Interface

For regular customizing, you should use the functions described in the  JythonUtilitiesPojoApi topic, as they wrap the following functions and make them easier to work with.


MethodParameter(s)Return ValueComment
getPojoentity: String, the entity name of the Pojo class that is queried
uuid:  String, the uuid of the queried object
Returns a Pojo-Object (subclass of de.planta.server.hibernate.pojo.HibernatePojoClass)Returns the Pojo-object identified by entity name & UUID, or None if not found
createPojoentity: String, the entity name of the Pojo class that is createdReturns a new Pojo-Object (subclass of de.planta.server.hibernate.pojo.HibernatePojoClass)Creates a new Pojo-object of the desired class
savePojopojo: HibernatePojoClass which is to be modifiedReturns boolean indicating whether save-operation was successful
can raise de.planta.server.exception.PlantaEventException for errors occurring inside Events, or general Exception for other exceptions in Java/Native code
Updates all properties of the given Pojo that have been changed, and saves them in the database.
deletePojopojo: HibernatePojoClass which is to be deletedReturns boolean indicating whether delete-operation was successful
can raise de.planta.server.exception.PlantaEventException for errors occurring inside Events, or general Exception for other exceptions in Java/Native code
Deletes the given Pojo from the database.

Pojo Class

Method

ParametersReturn Value

Comment

pojoOriginalValues


Returns a Java map which contains a string which identifies the DI (entityname) and original values as an object

Identical to DtpRecord.get_changed_dis

  • The functions that refer to a DI have a string parameter which identifies the corresponding DI. This is an entity name from DT412, not the DI number.

hasPropertyBeenUpdated 

String: propertyNamebool: True if DI has changed its value, but has not been saved yet, false otherwise

Identical to Dataitem.has_been_updated

pojoOriginalPropertyValue

String: propertyNameOriginal value of the DI (from database, before it was changed), data type differs based on the DIs DB typeIdentical to Dataitem.get_original_value


HQL Interface

For regular customizing you should use the functions described in the  JythonUtilitiesDatabaseApi  topic, as those wrap the following functions and make them easier to work with.


MethodParameter(s)Return ValueComment
hqlQueryhql:  String, a HQL-statementReturns as a list of objects in the form of a list of sublistsIs intended for Select-statements returning data from the database.
hqlModifyhql:  String, a HQL-statementReturns the number of modified records as an integerIs intended for Insert/Update/Delete-Statements to the database.


Generic functions

FunctionParameter(s)Return ValueComment
setJythonUseruser: String, User-Name
Remembers this user name for this Jython-session
getJythonUser
String: A user nameReturns User-name that was remembered by setJythonUser
uiMessageBoxcaption: String, caption of Message Box
message  String, text of Message Box
icon:  String, OLE-id of Message Icon
buttons:  List of Strings which name the buttons in Message Box)
input_no  Int, number of text fields in Message Box
Can raise de.planta.server.exception.SessionNotFoundExceptionThis displays a message, identical to ppms.ui_message_box, with the exception that parameter blocking does not exist as message boxes that are displayed by Jython are NEVER blocking.
The first 2 parameters are mandatory, the rest can be omitted.
 This only works if the Jython-session is associated to a client-session. Otherwise, a SessionNotFoundException is raised.
uiMessageBoxIdid:  String, the ID of the dialog messageCan raise de.planta.server.exception.SessionNotFoundExceptionThis displays a message, identical to ppms.ui_message_id, which is never blocking in this case.
This only works if the Jython-session is associated to a client-session. Otherwise, a SessionNotFoundException is raised.
getAutoIDdiId:  String, id of a DI with Auto-Ids (e.g. "001400")

String: The next auto-number for this DI (with current license)


Can raise ClassNotFoundException, AutoIdOverflowException

Returns the next auto-number for this DI, or None if di_id does not denote a di using auto-numbers
openModulethread:  Long, ID for a currently running session
module:  String, ID of the module to open
dictionary:  Hashmap<String, Object>, a dictionary containing variables for the module

Returns boolean indicating whether the module could be found and prepared


Can raise

de.planta.server.exception.SessionNotFoundException, de.planta.server.exception.ModuleNotFoundException, de.planta.server.exception.ModuleDictionaryException

Prepares the module identified by module ID to be opened in the Client-session identified by thread-id (if existing).
Note: This is an asynchronous call, which means that openModule will finish before the module is actually opened. That is why the return value does not indicate whether the module was opened successfully but only whether a module & a thread with the requested IDs exist
After the module is opened, the new Python-callback-function on_web_load(Dictionary) is called with the parameters given to openModule.
The parameter-dictionary supports parameters of the Boolean, String, Integer, Float type or lists thereof.
Should be used via the jython.server.module.open_module Jython function
getSessionUserthreadId: Long, ID of a session
To get the user that started a specific Client session
getSessionInfo threadId: Long, ID of a session
SessionInfo is a Java-class that holds various information about a session, including:
SessionInfo.getUser()) <- This is identical to WebHqlQueryHandler.getSessionUser
SessionInfo.getTimeStamp() <- Future functionality that is not really implemented yet; currently, always start time
SessionInfo.getSessionUUID() <- A unique UUID for each SessionInfo, used to identify a record in DT 443.
SessionInfo.getStartTime()
SessionInfo.getEndTime() <- Always NULL if the session is still active; is the end-time of a historical session. Can be identified by its UUID.
SessionInfo.getReason()  <- Why a historical session was terminated: Error or clean shutdown. Can be identified by its UUID

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.