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 e32e6a8aa5a5410eea224ef2db3cc13d14f34904..854d434e5974dcb041afa4c74ad38ce69bf39b55 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 8ca93af70fb842a4be53501c1c6310e39409683d..90871b0d0c9034e138d2d35d26cf7252569732e3 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 9801bef2ad58b423eabdfc5cba656f34c2db50a9..9ff740b774418353d00e3f3354727df46e3e051b 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 251034e54e8016f5c3bb777af38af37552d24a1d..44f89c3843fd55cdc7813054a04e9bd9301f6072 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 c71e0835beece9982d04d1291e4c075041593048..0fd55f52fb6864d8c38d3fbfaba7cb39be73304a 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 c6057937c3351e1431413b2dfa2aa591af9df781..5061c7709ee56a4ff3c1d872df9234b4204c5cd4 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)