Skip to main content
Skip table of contents

utilities - pojo

The pojo module provides all basic functions for interacting with pojos

Basic POJO Functions

FunctionParametersReturn ValueDescription
create_pojo(entity_name, attributes=None, set_object_protection=True, _generate_auto_numbers=True)entity_name: Entity name

attributes: Optional attributes that will be passed to set_pojo_attributes
set_object_protection: When True the object protection fields are set automatically.
_generate_auto_numbers: When True, all autonumber fields get a generated autonumber
A pojoCreate a new POJO with the given entity name
get_pojo_by_uuid(entity_name, uuid)entity_name: Entity name
uuid: The UUID of the POJO
A POJO or NoneGets a POJO via UUID
save_pojo(pojo)pojo: A pojoTrue if the pojo could be savedThrows a PojoSaveFailedException when saving fails
delete_pojo(pojo)pojo: A pojoTrue if the pojo could be deletedThrows a PojoDeleteFailedException when deletion fails

Helper Functions


FunctionParametersReturn ValueDescription
set_pojo_attributes(pojo, attributes, set_object_protection=True)pojo: A pojo
attributes: A dictionary of {python_id: value}

set_object_protection: When True, the object protection fields are updated automatically

Sets the attributes of a pojo. See below for detailed description.
is_valid_date(pojo_attribute_date)pojo_attribute_date: A date read from a pojoTrue or FalseChecks whether a date is valid, eg. not 01.01.1970
generate_auto_numbers(pojo)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 TypeAccepted types
UUIDuuid.UUID objects or a string as expected by java.util.UUID.fromString
Alpha / Alpha, E-mail / Alpha, gross / Alpha, phone number / ClobEverything that can be converted to text
Ja/NoEverything that can be converted to bool
Datedatetime.datetime objects or a string in the format dd.mm.YYYY
Timedatetime.datetime objects or a string in the format HH:MM
Number without DP, up to 4/9 digitsEverything that can be converted to int. Strings like '5.32' as well as '5,32' are both accepted
Currency / number with DPEverything that can be converted to float. Strings like '5.32' as well as '5,32' are both accepted

Examples

Creating a project and setting the pr_manager

PY
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)

JavaScript errors detected

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

If this problem persists, please contact our support.