General usage and file structure of Java Backend
The Java Backend project provides functionality to the business logic, data processing and security. It expose a series of limited REST API and in the background can access the database and other REST API, to retrieve additional information.
The code
The main group id is tech.renovus.solarec and the logic is divided in the following artifacts:
- solarec.interfaces: define the main interfaces of the solution and contains a series of generic util classes that can be use by any o the other artifacts.
- solarec.vo: defines a series of value objects that represent the main entities of the system and database. For the VO of the database the package base contains autogenerated classes that represents each one of the tables in the database. The relation package, contains information of how the different tables (by the FK) are linked and how the different objects interact with each other. The data package, contains the additional information of the VO, which is required for the business layer.
- solarec.db: contains all the required code to interact with the different VO and the database it self. The different interfaces are defined and contains basic autogenerated methods and the methods requires by the business layer. The base package contains all the autogenerated codes for the basic CRUD operations on each one of the tables. The wrapper package contains all the required classes that know how to read a record in the database and map it to the corresponding property of the VO, and also from the VO to the database record.
- solarec.implementations: contains all the basic implementations for the business and database. It also defines the configuration layer of the solution.
- solarec.inverters: contains all the required definitions and interfaces, to reach the different inverters and their data.
- solarec.schedule: designed to be completely behind the firewall, it contains all the scheduled code that needs to be executed (data retrieval, emails, etc.).
- solarec.core: contains all REST API controllers and logic. It can interact within the frontend layer and the business layer (implemented by the different artifacts). Is the code exposed to the Internet by the REST API.
All the code is done with Maven
and using Spring boot
.