Skip to content

MikeKirillov/gym-box-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using the Maven Plugin uml-data-model-processor

Goal and Project Overview

This project demonstrates the use of the uml-data-model-processor-maven-plugin for automatic generation of DDL scripts and POJO classes based on a UML diagram representing the domain information model.

We'll consider a hypothetical gym named 'The Gym Box' as an example. The sample application performs simple operations such as client and training record creation in the database, forming lists of clients, trainers, workouts, and reference elements (locations, types of trainings, etc.).

The project uses Spring Data JDBC because, at present, the plugin supports exactly this technology. In the future, we plan to expand the plugin’s functionality and provide similar examples for different technologies.

Database: MySQL.

Data Model

👮‍♀️the presented data model serves purely educational purposes and illustrates the functioning of the plugin

During the domain analysis, the following information model was developed:

db_schema.png

This model was designed using PlantUML and is stored separately in the project (see db_schema.puml), serving as the primary input for the plugin.

The database structure is formed as follows:

  • The DDL script (schema.sql) is auto-generated by the plugin and placed in the folder {project}/target/generated-sources/.
  • Initial data population is performed by another script (data.sql), located in the project resources ( src/main/resources/data.sql). This script is executed only upon first launch of the application against an empty database.

The creation of database tables and their initialization is handled automatically by Spring Data JDBC upon application startup. Note that the database itself and its schema must be prepared manually prior to running the application.

curl calls

Coaches:

List coaches:

curl -v http://localhost:8080/coach/list

Coach profile:

curl -v http://localhost:8080/coach/profile/1

Clients:

Create a new client:

curl -v -X POST http://localhost:8080/client/create 
-H "Content-Type: application/json" 
-d '{"lastName": "Cooper","firstName": "Ivan","middleName": "JJ","fullName": "Cooper Ivan JJ","genderId": "1","phoneNumber": "+7 916 834 26 89"}'

List clients:

curl -v http://localhost:8080/client/list

Client profile:

curl -v http://localhost:8080/client/profile/1

Dictionaries:

List genders:

curl -v http://localhost:8080/dictionary/genders

List locations (or halls) for conducting trainings:

curl -v http://localhost:8080/dictionary/locations

Training statuses:

curl -v http://localhost:8080/dictionary/states

Discipline catalog:

curl -v http://localhost:8080/dictionary/disciplines

Types of trainings (group or personal):

curl -v http://localhost:8080/dictionary/types

Trainings:

List trainings:

curl -v http://localhost:8080/training/list

Create a training:

curl -v -X POST http://localhost:8080/training/personal/create 
-H "Content-Type: application/json" 
-d '{"clientId": "1","coachId": "1","disciplineId": "2","locationId": "1","plannedDateTime": "2024-01-01'T'22:00:00"}'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages