Decision process execution
Last updated
Last updated
timveroOS allows the creation, configuration, and execution of an unlimited number of verification trees at any time from different parts of the system. timveroOS offers a ready-to-use module named flowable
which includes a service for testing and launching verification trees named DecisionProcessStarter
. This is a Java class that provides a public method start(DecisionProcessType<A extends ProcessEntity> processType, UUID entityId)
. This method accepts two parameters:
DecisionProcessType<A extends ProcessEntity> processType
- the type of the verification tree being launched.
UUID entityId
- the identification number of the entity being verified.
The Java class DecisionProcessType<A extends ProcessEntity>
is an instance that represents the type of a specific tree.
A
- the verified entity.
The DecisionProcessType
class provides the following methods:
public DecisionProcessType(String name, Class<A> entityClass)
- constructor, where the first parameter is the system name of the type in the form of a String, and the second parameter is the Java class of the verified entity.
The Java interface ProcessEntity
should be inherited by the entity for which the verification trees need to be launched.
The ProcessEntity
interface provides the following ready methods:
Map<UUID, ProcessExecution> getProcessExecutions()
- a method that returns all ProcessExecution
of the process entity.
Stream<ProcessExecution> getRealExecutions(DecisionProcessType<?> processType)
- a method that allows getting a stream of all ProcessExecution
of a specific type.
Optional<ProcessExecution> getLastRealExecution(DecisionProcessType<?> processType)
- a method that allows getting an Optional
of the last ProcessExecution
of a specific type.
boolean isLastRealExecutionFailed(DecisionProcessType<?> processType)
- a method that checks if the last launched tree of a specific type has failed. The result is true/false.
boolean isLastRealExecutionCompleted(DecisionProcessType<?> processType)
- a method that checks if the last launched tree of a specific type has completed without errors. The result is true/false.
boolean hasRunningExecution(DecisionProcessType<?> processType)
- a method that checks if the process entity has an execution of a specific type having execution status CREATED
or STARTED
.
*Stream
- A sequence of elements supporting sequential and parallel aggregate operations()
**ProcessExecution
- a Java object of the Flowable module that gathers all the information about the execution of a specific verification tree, including the type of tree, execution status, execution result, etc. The abstract Java class DecisionProcessPostProcessor<A extends ProcessEntity<?>>
is intended for checking and processing data from the results of the verification trees. It provides the following methods:
public DecisionProcessPostProcessor(DecisionProcessType<?> processType)
- a constructor that requires passing the DecisionProcessType
, the type of a specific tree for which post-processing is needed.
abstract void postProcess
- an abstract method that needs to be implemented according to the requirements of a specific project.
The auxiliary Java class DecisionFactValue
allows setting up custom criteria-characteristics of the verified entity, analyzing which can help make one decision or another in the post-processing of the executed tree. To launch specific checks, it's necessary to configure the verified entity, configure the types of verification trees, set up criteria/characteristics of the verified entity, implement post-processings, and call the method to launch the tree. For illustration, let's consider an example of setting up a preliminary verification tree, Soft Hit, for a loan application participant. The first step is to configure the verified entity (participant), implementing the ProcessEntity
interface:
The Participant
Java class inherits the ProcessEntity
interface specifying the type of identification number, in this example, it's java.util.Long. The second step is to configure the type of verification tree, in our case, Soft Hit:
The third step of the setup requires specifying the system criteria-characteristics of the verified entity. For our example, three criteria are sufficient:
WARNING
- the participant needs to be sent for additional (manual) review.
ALERT
- the participant has failed the check.
This mechanism allows flexible configuration of the decision-making tree by saving warnings and alerts with custom details, based on which the reasons for specific events can be determined. The fourth and final setup step is to implement the logic for post-processing the executed verification tree. The Soft Hit tree post-processor:
After that, decision process can be launched by calling the start
method of the DecisionProcessStarter
service with process type and ID of the entity to verify:
In this example, a state tracking tool for the participant is used to launch the verification tree.