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

interface - Configurations

This topic discusses the configuration classes of the PLANTA link API.

Classes

config_class_diagram.png

Config

The Config class is the base class that wraps a record from table 560

  • It allows you to query almost all the attributes a configuration has
  • You can create new configurations by calling Config.create() and new mappings by calling Config.create_mapping()
  • If you don't know wheter your task requires a Config or a StaticConfig, then it's most likely you should use a StaticConfig for the better performance

Static variables

Variable Description
Config.DEFAULT_LOG_LEVEL This configures the default Log-Level when a new Config is created with Config.create() and no explicit log level is given. The default is PlantaLogLevel.INFO
Config.DEFAULT_LOG_TYPE This configures the default Log-Typ when a new Config is created with COnfig.create() and no explicit log type is given. The default is PlantaLogType.PLANTA_LOGGING

Methods

Function Parameters Return Value Description
Config.__enter__(self)   The Config instance Enters the context.
Config.__eq__(self, other) other: Another Config instance True or False Check if a Config is equal to another
Config.__exit__(self, *exc_details) exc_details: Exception details   Deletes the instance when the context is left
Config.__hash__(self)   Integer Returns a hash based on UUID
Config.__init__(self, config_id) config_id: UUID The Config instance or None if the config_id is not valid Initialize a new Config object
Config.copy(self, invoker_module, pass_on_config_hash=True) invoker_module: A module instance

pass_on_config_hash: True or False
The copied instance or None Makes a copy of a configuration. The class of the child is based on the class of the invoking config instance. When pass_on_config_hash is True, the parent will be sanity checked before copying and the hash only passed on if the parent was valid.
Config.create_mapping(self, type, **creation_parameters) type: ppms.interface.MappingType
creation_parameters: Any python id from table 562 that should have a custom value
The newly created mapping Create a new mapping that belongs to this configuration
Config.delete(self)     Deletes the configuration and all child objects
Config.delete_logging(self)     Deletes all logging records that belong to this configuration as well as the physical log file, if it exists
Config.delete_mappings(self)     Deletes all mappings that belong to this configuration
Config.delete_parameters(self)     Deletes all parameters that belong to this configuration
Config.generate_and_clean_up_parameters(self)     Populates the parameter table with the parameters defined by the source/pool/target module of this configuration. Superfluous parameters are removed. Note that this has no effect on a finished configuration.
Config.generate_export_mapping(self)     Generate a mapping based on the customizing of the source module
Config.generate_import_mapping(self)     Generate a mapping based on the customizing of the target module
Config.generate_mapping_by_position(self)     Generate a mapping based on the positions of the dataitems in the source and target module
Config.generate_mapping_from_python_ids(self)     Generate a mapping based on matching python ids in the source and target module
Config.get_all_mappings(self)   A list of mappings Get a list of all mappings that belong to this config.
Config.get_function_mapping(self)   A list of mappings Get a list of all enrichers, converters and validators that belong to this config.
Config.get_invalid_mappings(self)   A list of mappings Get a list of all mappings the sanity check defines as invalid.
Config.get_mapping(self)   A list of mappings Get a list of all top level mappings, sorted by position.
Config.get_pool_mapping(self)   A list of mappings Get a list of all pool mappings.
Config.get_source_mapping(self)   A list of mappings Get a list of all source mappings.
Config.get_specific_mappings(self, mapping_type) mapping_type: ppms.interface.MappingType A list of mappings Get a list of mappings of a specific type
Config.get_step_one_mapping(self)   A list of mappings Get all the source mappings that are relevant for the source -> pool transfer step. The mappings returned by this function are a copy of the internal data structure with children that are not relevant for step one removed.
Config.get_step_two_mapping(self)   A list of mappings Get all the source and pool mappings that are relevant for the source/pool -> target transfer step. The mappings returned by this function are not a copy of the internal data structure.
Config.get_target_mapping(self)   A list of mappings Get a list of all target mappings
Config.get_validation_hash(self)   UUID Calculate a hash over all parts of a interface that can be modified by the user and sanity checked by PLANTA link.
Config.modify_parameter(self, source, key, value, system_id=None) source: MOD of the module which defines the parameter
key: The name of the parameter
value: The value that it should be set to

system_id: UUID
  Modify a parameter of a configuration. When system_id is None the parameter is changed in the currently active system.

Classmethods

Function Parameters Return Value Description
Config.create(cls, **creation_parameters) creation_parameters: Any python id from table 560 that should have a custom value A instance of the newly created configuration. The class is based on the class that create() is called from. Create a new configuration record. If the configuration could not be created a ValueError is raised.

Properties

Property Getter Setter Description
Config.amount_of_log_records Checked Unchecked Returns the amount of log records associated with this config
Config.cancel_threshold_percent Checked Checked Abbruchgrenze (%)
Config.cancel_threshold_seconds Checked Checked Abbruchgrenze (Sekunden)
Config.config_hash Checked Checked Konfigurations-Hash
Config.copy_of Checked Unchecked Kopie von
Config.description Checked Checked Bezeichnung
Config.finished Checked Checked Erledigt
Config.has_log_records Checked Unchecked True when there are log records associated with this config. Only makes sense when the Config.log_type is configured as PlantaLogType.PLANTA_LOGGING
Config.has_pool_step Checked Unchecked True when the configuration has a pool step in its mapping
Config.hidden Checked Checked Versteckt
Config.is_valid Checked Unchecked True when the configuration passes all sanity checks.
Config.last_run_as_number Checked Checked Ergebnis letzer Lauf als Zahl
Config.locked Checked Checked Gesperrt
Config.log_content Checked Unchecked Returns all the logging associated with this configuration as one string. The rows are prefixed with a timestamp.
Config.log_content_without_prefix Checked Unchecked Returns all the logging associated with this configuration as one string, but without a timestamp prefix
Config.log_level Checked Checked Log-Level
Config.log_type Checked Checked Log-Typ
Config.logfile_path Checked Unchecked Returns the path where all the logging of this configuration is written to. Only makes sense when the Config.log_type is set to PlantaLogType.FILE_LOGGING
Config.mapping_generator_type Checked Unchecked Mapping-Typ
Config.parameters Checked Unchecked Returns all module parameters for this configuration, depending on the active system
Config.parent Checked Unchecked Returns a instance of the configuration this configuration was copied from. If the config has no parent, None is returned. The class of the parent instance will be the same as the class of the calling instance.
Config.pool_mod_class_name Checked Unchecked Pool-Modul-Unterklassenname
Config.pool_module Checked Checked Pool-Modul
Config.pool_table Checked Unchecked Pool-Tabelle
Config.source_mod_class_name Checked Unchecked Quellmodul-Unterklassenname
Config.source_module Checked Checked Quellmodul
Config.target_mod_class_name Checked Unchecked Zielmodul-Unterklassenname
Config.target_module Checked Checked Zielmodul
Config.template Checked Unchecked Vorlage
Config.transaction_type Checked Checked Transaktionsart
Config.transferred_on Checked Unchecked Erledigt am
Config.validated_parameters Checked Unchecked Returns only the module parameters for this configuration that have a ParameterValidator attached to them.

StaticConfig

The StaticConfig class is a more performant version of the Config class

  • Instead of lazy loading the mapping when it's requested the StaticConfig class fetches all mappings when initializing the class
  • This means if you modify something about the mapping of the interface the StaticConfig instance won't know about the changes until you call StaticConfig.refresh()
  • This class is much faster for executing and sanity checking interfaces, but worse when you're creating interfaces programmatically

Methods

Function Parameters Return Value DescriptionSorted ascending
StaticConfig.refresh(self)     Calling refresh() will make the instance fetch all its mappings again and update the internal state

RegtestConfig

The RegtestConfig class is used for unittesting PLANTA link

  • By default it doesn't write its log data to the database or filesystem but instead just keeps it in RAM
  • Instead of logging errors it raises a ValueError when RegtestConfig.error() is called

Static variables

Variable Description
RegtestConfig.DEFAULT_LOG_LEVEL This configures the default Log-Level when a new RegtestConfig is created with RegtestConfig.create() and no explicit log level is given. The default is PlantaLogLevel.DEBUG
RegtestConfig.DEFAULT_LOG_TYPE This configures the default Log-Typ when a new RegtestConfig is created with RegtestConfig.create() and no explicit log type is given. The default is PlantaLogType.STREAM_LOGGING
Topic attachments
I Attachment History Size Date Comment
Pngpng config_class_diagram.png r1 4.9 K 2017-10-06 - 14:32  

         PLANTA project









 
  • Suche in Topic-Namen

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