This task consists in analysing the core logic and propose in the wiki a REST API useful for any frontend application (e.g. AngularJS application, mobile app, etc).
This task is completed when a wiki document describes all the REST API, with detailed informations (e.g. parameters, return values, etc).
each OpenHospital Module will have an API REST module (org.isf.<module> packages)
each OpenHospital Model will have a DTO1 model (org.isf.<module>.dto packages)
each OpenHospital Model will have a Mapper3 class (org.isf.<module>.mapper packages)
each OpenHospital Manager will have a REST Controller (org.isf.<module>.rest) that maps each URL to the correct Manager
common package org.isf.security: it contains classes for Login and tokens' management
common package org.isf.shared.exception: it contains classes for exceptions handling
common package org.isf.shared.responsebodyadvice: it contains classes for DTO handling
common package org.isf.config: it contains classes for Swagger2 configuration
1 DTO = Data Transfer Object, to be used by the User Interface and between processes; it differs from the business logic model defined in the ‘core’, but the two mostly overlap in our case
2 Swagger API: is an open-source software framework backed by a large ecosystem of tools that helps developers design, build, document, and consume RESTfulweb services.
3Mapper = Helper to map Model to DTO and viceversa
The discussion is meant to propose a third (final) pattern, if needed, in which we could have both “automatic mapping” and “manual mapping” depending on the module complexity.
The pattern below has been modified by https://openhospital.atlassian.net/browse/OP-118 so at the moment on the ‘master’ branch we no longer have the responsebodyadvice class (commented) but a discussion is in progress on the final pattern to be used for https://openhospital.atlassian.net/browse/OP-6 and related subtasks.
This task consists in analysing the core logic and propose in the wiki a REST API useful for any frontend application (e.g. AngularJS application, mobile app, etc).
This task is completed when a wiki document describes all the REST API, with detailed informations (e.g. parameters, return values, etc).
Proposal (implemented in OP-6):
each OpenHospital Module will have an API REST module (org.isf.<module> packages)
each OpenHospital Model will have a DTO1 model (org.isf.<module>.dto packages)
each OpenHospital Model will have a Mapper3 class (org.isf.<module>.mapper packages)
each OpenHospital Manager will have a REST Controller (org.isf.<module>.rest) that maps each URL to the correct Manager
common package org.isf.security: it contains classes for Login and tokens' management
common package org.isf.shared.exception: it contains classes for exceptions handling
common package org.isf.shared.responsebodyadvice: it contains classes for DTO handling
common package org.isf.config: it contains classes for Swagger2 configuration
1 DTO = Data Transfer Object, to be used by the User Interface and between processes; it differs from the business logic model defined in the ‘core’, but the two mostly overlap in our case
2 Swagger API: is an open-source software framework backed by a large ecosystem of tools that helps developers design, build, document, and consume RESTful web services.
3 Mapper = Helper to map Model to DTO and viceversa
‘core' packages org.isf.<module>: OpenHospital 'core’ module
‘core’ packages org.isf.<module>.model.*: OpenHospital ‘core’ module’s models
‘core’ packages org.isf.<module>.manager.*: OpenHospital ‘core’ module’s managers
‘api’ packages org.isf.<module>: OpenHospital ‘api’ module
‘api’ packages org.isf.<module>.dto.*: OpenHospital ‘api’ module’s models
‘api’ packages org.isf.<module>.rest.*: OpenHospital ‘controller’ module’s controllers
Testing:
Once compiled with command ‘mvn clean install’ (it needs openhospital-core component) run it with:
path\to\target\folder> java -jar openhospital-api-0.0.1.jar
you will see:
path\to\target\folder> java -jar openhospital-api-0.0.1.jar ... . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.1.3.RELEASE)
then access at http://localhost:8080/oh-api/auth/login
//TODO
Swagger at http://localhost:8080/oh-api/swagger-ui.html