pojo
module provides all basic functions for interacting with pojos
Function | Parameters | Return Value | Description |
---|---|---|---|
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 pojo | Create 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 None | Gets a POJO via UUID |
save_pojo(pojo) |
pojo: A pojo | True if the pojo could be saved |
Throws a PojoSaveFailedException when saving fails |
delete_pojo(pojo) |
pojo: A pojo | True if the pojo could be deleted |
Throws a PojoDeleteFailedException when deletion fails |
get_pojo_entity_name(pojo) |
pojo: A pojo object | entity name | Gets the entity name of the pojo |
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 pojo | True or False |
Checks if 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
makes setting values on a pojo easier by handling some of the tedious work for you: Column Type | Accepted types |
---|---|
UUID | uuid.UUID objects or a string as expected by java.util.UUID.fromString |
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 | datetime.datetime objects or a string in the format dd.mm.YYYY |
Uhrzeit | datetime.datetime objects or a string in the format HH:MM |
Zahl ohne NK, bis 4/9 Stellen | Everything that can be converted to int. Strings like '5.32' as well as '5,32' are both accepted |
Currency / Zahl mit NK | Everything that can be converted to float. Strings like '5.32' as well as '5,32' are both accepted |
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)