Helper Methods

The base classes KenaflowPluginV1 and KenaflowPluginV2 for custom plugin development offer some tools in form of methods and properties. They can be used within the plugin.

Properties

WFConfig WorkflowConfig { get; }

As soon as the current workflow is determined it's configuration is available in the plugin.

KenaflowPluginConfigurationV1 PluginConfig { get; } KenaflowPluginConfigurationV2 PluginConfig { get; }

The property returns the plugin configuration.

dynamic CustomData { get; }

This is a shortcut to WorkflowConfig.CustomDataDynamic.

Configuration Access Methods

T GetConfig<T>(string key, T Default)

Can be used to read settings from the global configuration of kenaflow.

By default it is not allowed to read the following settings:

  • ENCRYPTIONPASSPHRASE
  • LICENSINGMAILADDRESS
  • SERIAL
  • ACTIVATIONCODE
  • LASTACTIVATIONCODE
  • LASTOFFINEDEACTIVATIONCODE

Storage Methods

SetDBData(string key, object data) SetDBData(Guid workflowId, string key, object data)

Can be used to serialize objects to the SQLite database of kenaflow. - If the first syntax is used the Id of the currently processed workflow is used! - Using the second syntax with a workflow ID it's possible to access data written by another workflow!

object GetDBData( string key) object GetDBData(Guid workflowId, string key)

Can be used to read / deserialize objects from the SQLite database of kenaflow. - If the first syntax is used the Id of the currently processed workflow is used! - Using the second syntax with a workflow ID it's possible to access data written by another workflow!

void RemoveDBData( string key) void RemoveDBData(Guid workflowId, string key)

Can be used to remove objects from the SQLite database of kenaflow. - If the first syntax is used the Id of the currently processed workflow is used! - Using the second syntax with a workflow ID it's possible to access data written by another workflow!

void SetStorageData(bool sessionStorage, string key, byte[] data, bool encrypt, string additionalPassphrase="") void SetStorageData(bool sessionStorage, Guid workflowId, string key, byte[] data, bool encrypt, string additionalPassphrase="")

Can be used to write binary data to the permanenet storage or session storage of kenaflow. The data is written to disk. It can be encrypted. An additional passphrase can be provided. ("Additional" means that it's used in conjunction with the configured passphrase from the global configuration. The developer does not know the complete passphrase, only his/her "additional" part.) If the first syntax is used the Id of the currently processed workflow is used! - Using the second syntax with a workflow ID it's possible to access data written by another workflow!

(bool found, byte[] data) GetStorageData(bool sessionStorage, string key, string additionalPassphrase="") (bool found, byte[] data) GetStorageData(bool sessionStorage, Guid workflowId, string key, string additionalPassphrase="")

Used to read binary data from the permanent storage or session storage of kenaflow. If the data was encrypted with SetStorageData with an additional passphrase it must be specified here. If the first syntax is used the Id of the currently processed workflow is used! - Using the second syntax with a workflow ID it's possible to access data written by another workflow!

void SerializeStorageData(bool sessionStorage, string key, object data, bool encrypt, string additionalPassphrase="") void SerializeStorageData(bool sessionStorage, Guid workflowId, string key, object data, bool encrypt, string additionalPassphrase="")

Can be used to serialize data to the permanenet storage or session storage of kenaflow. The data is written to disk. It can be encrypted. An additional passphrase can be provided. ("Additional" means that it's used in conjunction with the configured passphrase from the global configuration. The developer does not know the complete passphrase, only his/her "additional" part.) If the first syntax is used the Id of the currently processed workflow is used! - Using the second syntax with a workflow ID it's possible to access data written by another workflow!

object DeserializeStorageData(bool sessionStorage, string key, string additionalPassphrase="") object DeserializeStorageData(bool sessionStorage, Guid workflowId, string key, string additionalPassphrase="")

Used to deserialize objects from the permanent storage or session storage of kenaflow. If the data was encrypted with SetStorageData with an additional passphrase it must be specified here. If the first syntax is used the Id of the currently processed workflow is used! - Using the second syntax with a workflow ID it's possible to access data written by another workflow!

void RemoveStorageData(bool sessionStorage, string key) void RemoveStorageData(bool sessionStorage, Guid workflowId, string key)

Can be used to remove binary data or serialized objects from the permanenet storage or session storage of kenaflow. If the first syntax is used the Id of the currently processed workflow is used! - Using the second syntax with a workflow ID it's possible to access data written by another workflow!

Logging

Log(LogLevel logLevel, string message)

Logging.

void LogNormal(string message)

Shortcut to log a "normal" message. This is the first "okay" log level.

void LogDebug(string message)

Shortcut to log a "debug" message. This is the lowest log level! By default messages of this type are not recorded. The log level for log files can be changed in the global configuration.

void LogVerbose(string message)

Shortcut to log a "verbose" message. This is the second log level.

void LogError(string message)

Shortcut to log an "error" message. This errors are "not critical".

void LogCritical(string message)

Shortcut to lot an "critical" error message. Errors of this type indicate an application failure. Administrators should react immediately.

void LogException(Exception exception)

Used to log exception objects.

Discussion