Die Dokumentation ab Version 39.5.17 von PLANTA project finden Sie in der neuen PLANTA Online-Hilfe.

Jython Server API

This topic describes functions that the server provides for Jython.

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

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 those wrap the following functions and make them easier to work with.

Method Parameter(s) Return Value Comment
getPojo entity: 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
createPojo entity: String, the entity name of the Pojo class that is created returns a new Pojo-Object (subclass of de.planta.server.hibernate.pojo.HibernatePojoClass) Creates a new Pojo-object of the desired class
savePojo pojo: HibernatePojoClass which is to be modified returns boolean indicating if save-operation was successful
can raise de.planta.server.exception.PlantaEventException for errors happening 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 it into the database.
deletePojo pojo: HibernatePojoClass which is to be deleted returns boolean indicating if delete-operation was successful
can raise de.planta.server.exception.PlantaEventException for errors happening inside Events, or general Exception for other exceptions in Java/Native code
Deletes the given Pojo from the database.

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.

Method Parameter(s) Return Value Comment
hqlQuery hql: String, a HQL-statement returns as a list of objects in the form of a list of sublists Is intended for Select-statements returning data from the database.
hqlModify hql: String, a HQL-statement returns the number of modified records as integer Is intended for Insert/Update/Delete-Statements into the database.

Generic functions

setJythonUser NEW user: String, User-Name   Remembers this user name for this Jython-session
getJythonUser NEW   String: A User-name Returns User-name that was remembered by setJythonUser
uiMessageBox NEW caption: 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.SessionNotFoundException This displays a message, identical to ppms.ui_message_box, with the exception that the 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. If not, a SessionNotFoundException is raised.
uiMessageBoxId NEW id: String, the ID of the dialog message can raise de.planta.server.exception.SessionNotFoundException This 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. If not, a SessionNotFoundException is raised.
getAutoID NEW diId: 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
openModule NEW thread: 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 if 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 the openModule will finish before the module is actually opened. That's why the return value does not indicate whether opening of the module was successful, just whether a module & a thread with 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 type Boolean, String, Integer, Float, or lists thereof
Should be used through the Jython function jython.server.module.open_module

         PLANTA project









 
  • Suche in Topic-Namen

  • Suche in Topic-Inhalten
This site is powered by the TWiki collaboration platform Powered by Perl