From 97c630e97fe901fcbdb800157a3f507e085d746b Mon Sep 17 00:00:00 2001
From: BEAUVAIS ANTOINE <antoine.beauvais@etu.unistra.fr>
Date: Fri, 24 Sep 2021 21:57:35 +0200
Subject: [PATCH] Updated Javadoc.

---
 gradlew                                               |  0
 .../java/fr/unistra/sil/erp/back/DatabaseSystem.java  |  2 +-
 .../erp/back/controller/IRetrieveInfoController.java  |  6 +++---
 .../controller/api/ApiRetrieveItemsController.java    |  4 ++--
 .../erp/back/controller/api/ApiRetrieveStocks.java    |  2 +-
 .../fr/unistra/sil/erp/back/db/DatabaseInterface.java |  3 ++-
 .../interceptor/api/ApiAuthenticationInterceptor.java | 11 +++++++++++
 7 files changed, 20 insertions(+), 8 deletions(-)
 mode change 100644 => 100755 gradlew

diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
diff --git a/src/main/java/fr/unistra/sil/erp/back/DatabaseSystem.java b/src/main/java/fr/unistra/sil/erp/back/DatabaseSystem.java
index e32e6a8..854d434 100644
--- a/src/main/java/fr/unistra/sil/erp/back/DatabaseSystem.java
+++ b/src/main/java/fr/unistra/sil/erp/back/DatabaseSystem.java
@@ -25,7 +25,7 @@ public class DatabaseSystem {
      * to the desired one.
      * 
      * @return the instance of the database implementation.
-     * @throws fr.unistra.sil.erp.back.db.DatabaseConnectionException
+     * @throws DatabaseConnectionException if the connection to the DB failed.
      */
     public static DatabaseInterface getInstance() throws DatabaseConnectionException
     {
diff --git a/src/main/java/fr/unistra/sil/erp/back/controller/IRetrieveInfoController.java b/src/main/java/fr/unistra/sil/erp/back/controller/IRetrieveInfoController.java
index 8ca93af..90871b0 100644
--- a/src/main/java/fr/unistra/sil/erp/back/controller/IRetrieveInfoController.java
+++ b/src/main/java/fr/unistra/sil/erp/back/controller/IRetrieveInfoController.java
@@ -15,9 +15,9 @@ public interface IRetrieveInfoController {
     
     /**
      * Retrieves the list of items.
-     * @param cat
-     * @return
-     * @throws Exception 
+     * @param cat the optional category to filter.
+     * @return the list of items as a JSON response/
+     * @throws Exception if the request cannot be served.
      */
     public ResponseEntity<Object> retrieveInfo(
             @RequestParam(value = "category", defaultValue = "") String cat
diff --git a/src/main/java/fr/unistra/sil/erp/back/controller/api/ApiRetrieveItemsController.java b/src/main/java/fr/unistra/sil/erp/back/controller/api/ApiRetrieveItemsController.java
index 9801bef..9ff740b 100644
--- a/src/main/java/fr/unistra/sil/erp/back/controller/api/ApiRetrieveItemsController.java
+++ b/src/main/java/fr/unistra/sil/erp/back/controller/api/ApiRetrieveItemsController.java
@@ -30,8 +30,8 @@ public class ApiRetrieveItemsController implements IRetrieveInfoController {
      * Returns all products as a JSON response.
      * @param cat an optional category.
      * @return a JSON response.
-     * @throws fr.unistra.sil.erp.back.controller.api.ApiServerErrorException
-     * @throws fr.unistra.sil.erp.back.controller.api.ApiBadRequestException
+     * @throws ApiServerErrorException if the request could not be served.
+     * @throws ApiBadRequestException if the category parameter is invalid.
      */
     @GetMapping(MAPPING_RETRIEVEALL)
     public ResponseEntity<Object> retrieveInfo(
diff --git a/src/main/java/fr/unistra/sil/erp/back/controller/api/ApiRetrieveStocks.java b/src/main/java/fr/unistra/sil/erp/back/controller/api/ApiRetrieveStocks.java
index 251034e..44f89c3 100644
--- a/src/main/java/fr/unistra/sil/erp/back/controller/api/ApiRetrieveStocks.java
+++ b/src/main/java/fr/unistra/sil/erp/back/controller/api/ApiRetrieveStocks.java
@@ -32,7 +32,7 @@ public class ApiRetrieveStocks implements IRetrieveStocks {
      * @param request the HTTP request.
      * @param response the HTTP response.
      * @return the response. 
-     * @throws fr.unistra.sil.erp.back.controller.api.ApiServerErrorException 
+     * @throws ApiServerErrorException if the request could not be served.
      */
     @GetMapping(MAPPING_GETSTOCKS)
     @Override
diff --git a/src/main/java/fr/unistra/sil/erp/back/db/DatabaseInterface.java b/src/main/java/fr/unistra/sil/erp/back/db/DatabaseInterface.java
index c71e083..0fd55f5 100644
--- a/src/main/java/fr/unistra/sil/erp/back/db/DatabaseInterface.java
+++ b/src/main/java/fr/unistra/sil/erp/back/db/DatabaseInterface.java
@@ -48,7 +48,7 @@ public interface DatabaseInterface {
     
     /**
      * Returns the stock entry of an item.
-     * @param id the item's ID.
+     * @param itemId the item's ID.
      * @return the stock line.
      * @throws DatabaseResourceNotFoundException when the query fails.
      */
@@ -59,6 +59,7 @@ public interface DatabaseInterface {
      * Updates the specified stock's quantity.
      * @param id the stock entry's ID.
      * @param quantity the new quantity.
+     * @throws DatabaseConnectionException when the database is unreachable.
      * @throws DatabaseUpdateException when the query fails.
      */
     public void updateStock(int id, int quantity)
diff --git a/src/main/java/fr/unistra/sil/erp/back/interceptor/api/ApiAuthenticationInterceptor.java b/src/main/java/fr/unistra/sil/erp/back/interceptor/api/ApiAuthenticationInterceptor.java
index c605793..5061c77 100644
--- a/src/main/java/fr/unistra/sil/erp/back/interceptor/api/ApiAuthenticationInterceptor.java
+++ b/src/main/java/fr/unistra/sil/erp/back/interceptor/api/ApiAuthenticationInterceptor.java
@@ -28,11 +28,22 @@ public class ApiAuthenticationInterceptor implements HandlerInterceptor {
      */
     private final String apikey;
     
+    /**
+     * Class constructor.
+     * @param apikey the API key.
+     */
     public ApiAuthenticationInterceptor(String apikey)
     {
         this.apikey = apikey;
     }
     
+    /**
+     * Code used to check the request's API key against the real one.
+     * @param request the HTTP Servlet request.
+     * @param response the HTTP Servlet response.
+     * @param handler the handler Object.
+     * @return whether the request should be continued.
+     */
     @Override
     public boolean preHandle(HttpServletRequest request,
             HttpServletResponse response, Object handler)
-- 
GitLab