Die nachfolgenden Inhalte sind nur in englischer Sprache verfügbar.
The pojo module provides all basic functions for interacting with pojos
Basic POJO Functions
|
Function |
Parameters |
Return Value |
Description |
|---|---|---|---|
|
create_pojo |
entity_name: Entitätsbezeichnung
|
A pojo |
Create a new POJO with the given entity name |
|
get_pojo_by_uuid |
entity_name: Entitätsbezeichnung
|
A POJO or None |
Gets a POJO via UUID |
|
save_pojo |
pojo: A pojo |
|
Throws a PojoSaveFailedException when saving fails |
|
delete_pojo |
pojo: A pojo |
|
Throws a PojoDeleteFailedException when deletion fails |
Helper Functions
|
Function |
Parameters |
Return Value |
Description |
|
set_pojo_attributes |
pojo: A pojo
|
|
Sets the attributes of a pojo. See below for detailed description. |
|
is_valid_date |
pojo_attribute_date: A date read from a pojo |
|
Checks whether a date is valid, eg. not 01.01.1970 |
|
generate_auto_numbers |
pojo: A pojo |
|
Generates the autonumbers for a pojo |
set_pojo_attributes
set_pojo_attributes makes setting values on a pojo easier by handling some of the tedious work for you:
-
The function expects python ids and will automatically convert the python id to the correct attribute name
-
Values are converted according to the column type of the attribute:
|
Column Type |
Accepted types |
|---|---|
|
UUID |
|
|
Alpha / Alpha, E-Mail / Alpha, gross / Alpha, Telefonnummer / Clob |
Everything that can be converted to text |
|
Ja/Nein |
Everything that can be converted to bool |
|
Datum |
|
|
Uhrzeit |
|
|
Zahl ohne NK, bis 4/9 Stellen |
Everything that can be converted to int. Strings like |
|
Currency / Zahl mit NK |
Everything that can be converted to float. Strings like |
Examples
Creating a project and setting the pr_manager
from customizing import utilities
pojo = utilities.create_pojo(entity_name='Project')
attributes = {'pr_manager': 'R41'}
utilities.set_attributes(pojo=pojo, attributes=attributes)
utilities.save_pojo(pojo=pojo)