![CLA assistant](https://cla-assistant.io/readme/badge/Renovus-Tech/solarec-java)
![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=Renovus-Tech_solarec-java&metric=ncloc)
Solarec Java
The Solarec Java repository is parte of the Solarec solution of Renovus. Incombination with the other repositories Ract, Python and Database generates the Solarec solution.
The Java code main objective is to work as backend for all logica and data storage of the solutions. Is responsable for the solution, retrieve of data, validation, consolidation and acts as proxy when the information is available in other code (Python for example).
The Java code main requeriments are:
The modules
The Java code is divided in a series of modules each of one has its objective.
- 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.
The solarec.schedule has been design to work independently from the solarec.core, allowing to have different type of resources for each, allowing a more reboust architecture.
Configuration
In order to correctly execute the code the application.properties need to have a series of properfies defined. Check the application.properties.sample file to see a list of all the required properties.
Take in consideration that if a module (for example an services) requires configuration, is possible that the properties are requierd to be defined in the application.properties file.
Execution
To execute the solution, you only need to execute tech.renovus.solarec.RenovusSolarecApplication of the solarec.core module. Currently the solarec.core module is configure to also execute the schedule module. But if required the solarec.schedule module can be executed independently with the correct configuration.
Database
Currently the project supports only PostgreSQL 15 as primary base as defined in project solarec-db.