LogoLogo
timvero.comMaven Repository
  • timveroOS SDK guide
  • timveroOS how-to
  • timveroOS admin-side setup
  • How to use Maven credentials
  • timveroOS SDKs
    • v. 7.11
      • Ubuntu environment setup
      • Data model setup
      • New data source connection, with Bud Financial example
      • Flow customization
      • Decision process execution
      • Participant/ assets dynamic profile setup
      • Documents flow integration setup
      • Application form setup
      • Application API Integration Guide
      • UI/ UX components
        • Collapsing blocks
    • v. 7.10
      • Ubuntu environment setup
      • Data model setup
      • New data source connection, with Bud Financial example
      • Flow customization
      • Participant/ assets dynamic profile setup
      • Documents flow integration setup
      • Application form setup
      • Application API Integration Guide
      • UI/ UX components
        • Collapsing blocks
Powered by GitBook
On this page

Was this helpful?

  1. timveroOS SDKs
  2. v. 7.11

Flow 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):

public enum ApplicationStatus {
    NEW,
    DECLINED,
    APPROVED,
    SERVICING;
}
  • 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:

@Entity
@Table
public class Application extends BaseEntity<Long> {

    @Column(name = "principal", nullable = false)
    private BigDecimal principal;

    @Column(name = "term", nullable = false)
    private Integer term;

    @Column(name = "status", nullable = false)
    private ApplicationStatus status = ApplicationStatus.NEW;

    ...

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 @Controllerand @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.

@Controller
@RequestMapping("/decline")
public class DeclienAction extends SimpleActionController<Long, Application> {

    @Override
    protected EntityAction<Application, Object> action() {
        return when(app-> application.getStatus() == ApplicationStatus.NEW)
            .then((app, form, user) -> app.setStatus(ApplicationStatus.DECLINED));
    }
}

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.

@Controller
@RequestMapping("/approve")
public class ApproveAction extends EntityActionController<Long, Application, Object> {

    @Override
    protected EntityAction<Application, Object> action() {
        return when(application -> application.getStatus() == ApplicationStatus.NEW)
            .then((application, form, user) -> {
                application.setStatus(ApplicationStatus.APPROVED)
            });
    }

    @Override
    protected String getActionTemplate(Long id, Model model, String actionPath) {
        model.addAttribute("title", "application.dialog.approve.title");
        model.addAttribute("message", "application.dialog.approve.message");
        return "/common/action/yes-no";
    }
}

/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.

application.dialog.approve.title=Approve application
application.dialog.approve.message=Approve this application?

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.

@Component
public class PendingSignContactLabel implements EntityLabel<Application> {

    @Override
    public boolean isEntityMarked(Application application) {
        return application.getStatus() == ApplicationStatus.APPROVED
                && !isContractSigned(application);
    }

    @Override
    public String getName() {
        return "Pending сontact signature";
    }

    private boolean isContractSigned(Application application) {
        return ...; // логика проверки подписан ли контракт
    }
}

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:

@Controller
@RequestMapping("/sign")
public class SignContractAction extends EntityActionController<Long, Application, Object> {

    // label indicating the need to sign the contract implemented above
    @Autowired
    private PendingSignContactLabel label;

    @Override
    protected EntityAction<Application, Object> action() {
        return when(application -> label.isEntityMarked(application))
            .then((application, form, user) -> {
                // logic for signing the document
                application.setStatus(ApplicationStatus.SERVICING)
            });
    }

    @Override
    protected String getActionTemplate(Long id, Model model, String actionPath) {
        model.addAttribute("title", "application.dialog.sign.title");
        model.addAttribute("message", "application.dialog.sign.message");
        return "/common/action/yes-no";
    }
}

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.

PreviousNew data source connection, with Bud Financial exampleNextDecision process execution

Last updated 4 months ago

Was this helpful?

Example of how the above-implemented action appears in the application:

The following example is the action, which implements the abstract class . This abstract class includes all the functionality described above in 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.

The Approve action will only be displayed on the application if the condition when(app → app.getStatus() == ) 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.''

*enum -

**@Controller -

DeclineAction.java
ApproveAction.java
EntityActionController.java
SimpleActionController.java
ApplicationStatus.NEW
https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/stereotype/Controller.html