Skip to content

k1729p/Study09

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Study09 README Contents

Research the Spring Web MVC with JavaScript libraries AngularJS and jQuery


The flowchart with SpringBoot application.

The Sample Dataset stores the data in the Java object 'List<Department>'.

This is the Spring Web MVC and Spring HATEOAS application with HAL representations of each resource.
The HATEOAS RESTful web service controllers: DepartmentController and EmployeeController.

The sections of this project:

  1. SpringBoot Server
  2. Web Browser Client
  3. Curl Client

Java source code. Packages:

application sources :  kp
test sources :  kp


The domain objects class diagram.

The DepartmentAssembler converts the Department into an 'org.springframework.hateoas.RepresentationModel'.
The EmployeeAssembler converts the Employee into an 'org.springframework.hateoas.RepresentationModel'.
The link to Representation Models page (from the Spring HATEOAS Reference Documentation) with the RepresentationModel class hierarchy diagram.


Java API Documentation ●  Java Test API Documentation


❶ SpringBoot Server

Action:

1. With batch file "01 MVN clean install run.bat" build and start the SpringBoot Server.

1.1. Application tests

Back to the top of the page


❷ Web Browser Client

Action:

1. With the URL http://localhost:8080 open in the web browser the 'home page'.
2. On this 'home page' select 'Load sample dataset'

2.1. The 'home page' file index.html: HTML code, HTML preview


The screenshot of the home page.

2.2. The DepartmentController endpoints.

2.2.1. Get all departments: /company/departments
The controller GET method: kp.company.controller.DepartmentController::findAllDepartments.


The result from the endpoint 'Get all departments'.

2.2.2. Get the department by id: /company/departments/1
The controller GET method: kp.company.controller.DepartmentController::findDepartmentById.


The result from the endpoint 'Get the department by id'.

2.3. The EmployeeController endpoints

2.3.1. Get the employees: /company/employees
The controller GET method: kp.company.controller.EmployeeController::findAllEmployees.


The result from the endpoint 'Get the employees'.

2.3.2. Get the employees by id: /company/employees/101
The controller GET method: kp.company.controller.EmployeeController::findEmployeeById.


The result from the endpoint 'Get the employees by id'.

2.4. Consuming REST with JavaScript

2.4.1. Get the department by id: using the 'AngularJS' JavaScript framework. File index.html.


The result from the endpoint 'Using 'AngularJS' JavaScript framework'.

2.4.2. Get the department by id: using the 'jQuery' JavaScript library. File index.html.


The result from the endpoint 'Using 'jQuery' JavaScript library'

2.5. The Spring Boot Actuator creates the endpoints for monitoring and managing the application.
The screenshot of the link 'List of actuator endpoints'.

Back to the top of the page


❸ Curl Client

Action:

1. With batch file "02 CURL CRUD.bat" create, read, update, and delete departments and employees.
2. With batch file "03 CURL load and read.bat" load the sample dataset and get departments and employees.

3.1. The console log screenshots from the run of the batch file "02 CURL CRUD.bat".

3.1.1. The screenshot of "CREATE" and "READ by id - after CREATE" steps.
The controller POST method for 'CREATE':
kp.company.controller.DepartmentController::createDepartment.
kp.company.controller.EmployeeController::createEmployee.

3.1.2. The screenshot of "UPDATE by id" and "READ by id - after UPDATE" steps.
The controller PATCH method for 'UPDATE by id':
kp.company.controller.DepartmentController::updateDepartment.
kp.company.controller.EmployeeController::updateEmployee.

3.1.3. The screenshot of "DELETE by id" and "READ by id - after DELETE" steps.
The controller DELETE method for 'DELETE by id':
kp.company.controller.DepartmentController::deleteDepartment.
kp.company.controller.EmployeeController::deleteEmployee.

3.2. The console log screenshots from the run of the batch file "03 CURL load and read.bat".

3.2.1. The screenshot of the "Load sample dataset" step.

3.2.2. The screenshot of the "GET one department" and the "GET one employee" steps.

3.2.3. The screenshot of the "GET all departments" and the "GET all employees" steps.

Back to the top of the page


Dictionary

HALHypertext Application Language
HATEOASHypermedia As The Engine Of Application State
RESTRepresentational State Transfer
Back to the top of the page