Workflow customization
timveroOS provides extensive customization options for the application process, from its creation in the system to the issuance of loans.
Action Button: A button that performs an action displayed on an entity.
Let’s consider several scenarios using the familiar Application.java
class.
The first and simplest way to track the progress of an application through the flow is by using application statuses in the form of an enum
.
Example implementation of statuses as an enum (this example is provided strictly for informational purposes):
NEW
- Right after creation, the application enters this status.
DECLINED
- The application moves to this status immediately after being declined by the system/underwriter.
APPROVED
- The application moves to this status immediately after being approved by the system/underwriter.
SERVICING
- The application moves to this status immediately after the contract is signed.
After implementing the enum statuses and adding the corresponding ApplicationStatus status
field to the Application.java
class, our class looks as follows:
Once the application enters the system, it is in the NEW
status. By process, we mean that an application can move from the NEW
status either to the DECLINED
or APPROVED
status. To facilitate this, we need to implement two actions: DeclineAction.java
and ApproveAction.java
.
The timveroOS provides ready-to-use tools for working with actions on entities. In this part of the documentation, we will touch upon two abstract classes provided by the system: SimpleActionController.java
and EntityActionController.java
.
To make a certain action available at a specific stage of the application, it is necessary to implement these abstract classes.
SimpleActionController.java
is a ready class, implementing which will display a specific action on the application. The class is parameterized by the type of identifier and the class of the entity to which the specific action is applicable.
This implementation is a Java class annotated with @Controller
and @RequestMapping
*, parameterized by the identifier type Long and the Application
class to which the action applies.
In the DeclineAction.java
class, only one method action()
is implemented, which includes both the condition under which this action will be available on the application and the logic that will be executed after clicking on this action on the application.
In this case, the Decline
action will be displayed on the application only if the condition when(app → app.getStatus() == ApplicationStatus.NEW)
is met, which means ``the application is in the New status.''
Upon clicking this action, the logic thenapp, form, user) → app.setStatus(ApplicationStatus.DECLINED
will be executed, meaning ``transition the application from the New status to the Declined status.''
This action is notable because the action is executed immediately after clicking the button.
Example of how the above-implemented DeclineAction.java action appears in the application:
The following example is the ApproveAction.java
action, which implements the abstract class EntityActionController.java
. This abstract class includes all the functionality described above in SimpleActionController.java
and adds the ability for additional confirmation of action execution from the user who clicked the Approve action. The additional confirmation is implemented through a dialog box displaying a custom message to the user, asking whether they really confirm the action execution, with the option to confirm (execute) or decline (cancel) the action.
In this example, besides the already known action()
method, it is necessary to implement the method getActionTemplate(Long id, Model model, String actionPath)
. This method allows configuring the data model, view, and display of an additional dialog box for confirming or canceling the action execution. Here, we utilized the ready-to-use functionality of the OS Timvero by passing the title
and message
values into the data model, which will be displayed to the user in the dialog box. However, this method allows for full customization of the content and display according to specific requirements.
The Approve action will only be displayed on the application if the condition when(app → app.getStatus() ==
ApplicationStatus.NEW
)
is met, meaning the application is in the New status.'' Clicking on this action executes thenapp, form, user) → app.setStatus(ApplicationStatus.APPROVED, meaning
changing the application’s status from New to Approved.''
/common/action/yes-no
- a ready-made HTML page for simple dialog boxes based on the Yes/No action principle.
Keys and their human-readable values are stored in the messages_en.properties
file.
Example of how the above-implemented ApproveAction.java
action appears in the application:
An example of a confirmation dialog box that appears after clicking the ``Approve'':
Besides the functionality of actions, timveroOS offers auxiliary label functionality.
A label is a tag with brief text displayed on the entity page. It can be shown at any time, under custom conditions, including signaling the system user about the need to perform certain actions with the entity.
timveroOS provides a ready-to-use EntityLabel.java
interface, parameterized by the class of the entity to which the specific label is applied. This interface mandates the implementation of two methods:
isEntityMarked()
, where the logic (condition) for displaying the label is implemented, and getName()
, which returns the custom name of the label.
In our example, once an application has been approved (APPROVED
status), the client needs to sign a contract for the loan issuance.
To notify the system user of this requirement, the label functionality can be utilized by implementing the PendingSignContactLabel.java
class.
The condition application.getStatus() == ApplicationStatus.APPROVED && !isContractSigned(application)
indicates that the label will be displayed only if the application is in the APPROVED
status and the contract has not been signed on the application.
Example of the implemented label display:
Label classes can also be used as conditions for the availability of actions. To conclude our example logically, let’s implement a contract signing action based on the already implemented label PendingSignContactLabel.java
.
Example implementation of SignContractAction.java
:
The condition when(application → label.isEntityMarked(application))
indicates that the Sign action will only be displayed if the application has the Pending contract signature
label attached.
/common/action/yes-no
is a ready-made HTML page for simple Yes/No dialogue actions. The keys and their human-readable values are stored in the messages_en.properties
file:
application.dialog.sign.title=Sign contract
application.dialog.sign.message=Sign this contract?
This section completes the logical flow of utilizing labels as a precondition for enabling specific actions within the timveroOS, illustrating a practical application of integrating advanced functionalities to streamline the application processing flow.
*enum - https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
**@Controller - https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Controller.html
Last updated