Skip to content

Commit aa496bc

Browse files
author
Shelson Ferrari
committed
refatoracao global, doucmentacao javadoc, e melhoria significativa da exibicao e tratamento de erros http - com mensagens de erro descritivas, com a causa exata do erro- e nao mais generico 400 por ex
1 parent 25441d5 commit aa496bc

36 files changed

Lines changed: 547 additions & 332 deletions

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ We only support the latest version of the project. Make sure to update to the la
66

77
| Version | Supported |
88
| ------- | ------------------ |
9-
| 0.5.1 | :white_check_mark: |
10-
| < 0.5.1 | :x: |
9+
| 0.6.2 | :white_check_mark: |
10+
| < 0.6.2 | :x: |
1111

1212
## Reporting a Vulnerability
1313

src/main/java/com/shelson/ShelsonApplication.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@
3030
/**
3131
* Main class for the application.
3232
* This class initializes the Spring Boot application.
33+
*
34+
* @version 0.6.3
35+
* @since 2024-07-24
36+
*
37+
* @author Shelson Ferrari
38+
*
39+
* @see org.springframework.boot.SpringApplication
40+
* @see org.springframework.boot.autoconfigure.SpringBootApplication
41+
* @see org.slf4j.Logger
42+
* @see org.slf4j.LoggerFactory
43+
* @see jakarta.annotation.PreDestroy
3344
*/
3445
@SpringBootApplication
3546
public class ShelsonApplication {

src/main/java/com/shelson/application/controller/CurrencyConversionController.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
1515
* the Licenses for the specific language governing permissions and limitations under the Licenses.
1616
*/
17+
1718
package com.shelson.application.controller;
1819

1920
import java.util.Enumeration;
@@ -51,6 +52,23 @@
5152
* <li>Ensures that the amount to be converted is greater than zero.</li>
5253
* <li>Checks for any unexpected parameters in the request and throws a BusinessException if found.</li>
5354
* </ul>
55+
*
56+
* Example usage:
57+
* <pre>
58+
* {@code
59+
* // URL: /api/v1/conversions/convert?source=USD&target=EUR&amount=100
60+
* CurrencyConversionDTO conversion = currencyConversionController.convertCurrency("USD", "EUR", 100.0);
61+
* System.out.println(conversion);
62+
* }
63+
* </pre>
64+
*
65+
* @author Shelson Ferrari
66+
* @version 0.6.3
67+
* @since 2024-07-24
68+
*
69+
* @see com.shelson.application.dto.CurrencyConversionDTO
70+
* @see com.shelson.application.service.CurrencyConversionService
71+
* @see org.apache.camel.ProducerTemplate
5472
*/
5573
@RestController
5674
@RequestMapping("/api/v1/conversions")

src/main/java/com/shelson/application/controller/HomeController.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
1515
* the Licenses for the specific language governing permissions and limitations under the Licenses.
1616
*/
17+
1718
package com.shelson.application.controller;
1819

1920
import org.slf4j.Logger;
@@ -26,6 +27,18 @@
2627
* Controller responsible for the application's home page.
2728
* This controller redirects root application requests to the Swagger UI interface,
2829
* allowing API exploration.
30+
*
31+
* Example usage:
32+
* <pre>
33+
* {@code
34+
* // URL: /
35+
* // This will redirect to /swagger-ui.html
36+
* }
37+
* </pre>
38+
*
39+
* @author Shelson Ferrari
40+
* @version 0.6.3
41+
* @since 2024-07-24
2942
*/
3043
@Controller
3144
@Hidden // Ignores this controller in Swagger documentation

src/main/java/com/shelson/application/controller/SwaggerRedirectController.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
* Controller responsible for redirecting to the Swagger UI interface.
2828
* This controller handles two different routes to redirect the user
2929
* to the Swagger UI.
30+
*
31+
* @version 0.6.3
32+
* @since 2024-07-24
33+
* @author Shelson Ferrari
3034
*/
3135
@Controller
3236
@Hidden

src/main/java/com/shelson/application/dto/CurrencyConversionDTO.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
* Apache License, Version 2.0:
1111
* http://www.apache.org/licenses/LICENSE-2.0
1212
*
13-
* Unless required by applicable law or agreed to in writing, software distributed under the Licenses é
14-
* distribuído em uma base "COMO ESTÁ", SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, expressas ou implícitas. Veja
15-
* os Licenses para a linguagem específica que rege permissões e limitações sob os Licenses.
13+
* Unless required by applicable law or agreed to in writing, software distributed under the Licenses is
14+
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
15+
* the Licenses for the specific language governing permissions and limitations under the Licenses.
1616
*/
1717
package com.shelson.application.dto;
1818

@@ -32,6 +32,13 @@
3232

3333
/**
3434
* DTO that represents details about the currency conversion.
35+
*
36+
* @version 0.6.3
37+
* @since 2024-07-24
38+
* @see com.shelson.domain.model.Currency
39+
* @see com.shelson.application.service.CurrencyConversionService
40+
* @see org.apache.camel.ProducerTemplate
41+
* @author Shelson Ferrari
3542
*/
3643
@ApiModel(description = "Details about the currency conversion")
3744
public class CurrencyConversionDTO {

src/main/java/com/shelson/application/processors/ExchangeRateProcessor.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@
3232
* Processor to handle exchange rates.
3333
* This processor reads the exchange rate data from the message body,
3434
* parses it, and sets the parsed rates back into the message body.
35+
*
36+
* @version 0.6.3
37+
* @since 2024-07-24
38+
* @see org.apache.camel.Processor
39+
* @see org.apache.camel.Exchange
40+
* @see com.fasterxml.jackson.databind.ObjectMapper
41+
* @see com.fasterxml.jackson.core.type.TypeReference
42+
* @see org.slf4j.Logger
43+
* @see org.slf4j.LoggerFactory
44+
* @see com.shelson.application.service.CurrencyConversionService
45+
* @see com.shelson.application.routes.CurrencyConversionRoute
46+
* @see com.shelson.application.dto.CurrencyConversionDTO
47+
* @see com.shelson.domain.model.Currency
48+
* @see com.shelson.domain.repository.CurrencyConversionRepository
49+
* @see com.shelson.infrastructure.exception.BusinessException
50+
* @see com.shelson.infrastructure.exception.ResourceNotFoundException
51+
* @author Shelson Ferrari
3552
*/
3653
@Component
3754
public class ExchangeRateProcessor implements Processor {

src/main/java/com/shelson/application/routes/CurrencyConversionRoute.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
* Camel route for handling currency conversion requests.
3333
* This route takes the source currency, target currency, and amount as headers,
3434
* processes the conversion using the {@link CurrencyConversionService}, and returns the conversion details.
35+
*
36+
* @version 0.6.3
37+
* @since 2024-07-24
38+
*
39+
* @author Shelson Ferrari
40+
*
41+
* @see com.shelson.application.dto.CurrencyConversionDTO
42+
* @see com.shelson.application.service.CurrencyConversionService
43+
* @see com.shelson.application.processors.ExchangeRateProcessor
44+
* @see org.apache.camel.ProducerTemplate
45+
* @see com.shelson.domain.model.Currency
3546
*/
3647
@Component
3748
public class CurrencyConversionRoute extends RouteBuilder {

src/main/java/com/shelson/application/routes/package-info.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,5 @@
88
* which processes the conversion by extracting headers from the request, validating them,
99
* and invoking the service to perform the conversion.
1010
* </p>
11-
*
12-
* @since 1.0
13-
* @version 1.0
1411
*/
1512
package com.shelson.application.routes;

src/main/java/com/shelson/application/service/CurrencyConversionService.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,20 @@
3636
import com.shelson.infrastructure.exception.ResourceNotFoundException;
3737

3838
/**
39-
* Service class for handling currency conversion operations.
40-
* This class uses a Camel route to fetch the latest exchange rates and performs
41-
* conversions between different currencies.
39+
* Camel route for handling currency conversion requests.
40+
* This route takes the source currency, target currency, and amount as headers,
41+
* processes the conversion using the {@link CurrencyConversionService}, and returns the conversion details.
42+
*
43+
* @version 0.6.3
44+
* @since 2024-07-24
45+
*
46+
* @author Shelson Ferrari
47+
*
48+
* @see com.shelson.application.dto.CurrencyConversionDTO
49+
* @see com.shelson.application.service.CurrencyConversionService
50+
* @see com.shelson.application.processors.ExchangeRateProcessor
51+
* @see org.apache.camel.ProducerTemplate
52+
* @see com.shelson.domain.model.Currency
4253
*/
4354
@Service
4455
public class CurrencyConversionService {

0 commit comments

Comments
 (0)