In this chapter we are going to create business logic layer for already implemented database entities, repositories, and queries. We are going to prepare transfer-objects together with use-cases and proper component tests.
In the dataaccess exercise you have created the dataaccess layer.
Now, for the logic layer we create the entity interfaces and transfer-objects in the package org.example.app.task.common.
For each entity we extract interface and create ETO:
-
for
TaskListEntityextract interfaceTaskListand create classTaskListEto. -
for
TaskItemEntityextract interfaceTaskItemand create classTaskItemEto.
Ensure you have all properties (getters and setters) from Entity in the entity interface except for relations.
Now that we have created ETOs we create use-cases for CRUD functionality on our business-objects:
-
UcFindTaskList -
UcFindTaskItem -
UcSaveTaskList -
UcSaveTaskItem -
UcDeleteTaskList -
UcDeleteTaskItem
Each of use-case implementation shall be annotated as following:
@ApplicationScoped
@Named
@Transactional