From 6143a2ebb08b6e6a7ada866ce3a9aa09d01641a9 Mon Sep 17 00:00:00 2001 From: jkuznik Date: Mon, 2 Dec 2024 08:42:35 +0100 Subject: [PATCH] Replace enums --- .../pl/ateam/disasteralerts/API/WeatherMonitoringService.java | 2 +- src/main/java/pl/ateam/disasteralerts/disaster/Disaster.java | 3 ++- .../pl/ateam/disasteralerts/disaster/DisasterController.java | 1 + .../java/pl/ateam/disasteralerts/disaster/DisasterFacade.java | 1 + .../pl/ateam/disasteralerts/disaster/DisasterRepository.java | 3 ++- .../pl/ateam/disasteralerts/disaster/DisasterService.java | 1 + .../pl/ateam/disasteralerts/disaster/DisasterServiceImpl.java | 3 ++- .../pl/ateam/disasteralerts/disaster/dto/DisasterAddDTO.java | 2 +- .../pl/ateam/disasteralerts/disaster/dto/DisasterDTO.java | 4 ++-- .../{disaster => util}/enums/DisasterStatus.java | 2 +- .../disasteralerts/{disaster => util/enums}/DisasterType.java | 2 +- .../pl/ateam/disasteralerts/web/DisasterViewController.java | 4 ++-- .../airiskassessment/RiskAssessmentServiceTest.java | 2 +- .../ateam/disasteralerts/disaster/DisasterControllerTest.java | 1 + .../pl/ateam/disasteralerts/disaster/DisasterFacadeTest.java | 3 ++- .../disasteralerts/disaster/DisasterServiceImplTest.java | 3 ++- .../pl/ateam/disasteralerts/disaster/DisasteralertIT.java | 3 ++- 17 files changed, 25 insertions(+), 15 deletions(-) rename src/main/java/pl/ateam/disasteralerts/{disaster => util}/enums/DisasterStatus.java (55%) rename src/main/java/pl/ateam/disasteralerts/{disaster => util/enums}/DisasterType.java (89%) diff --git a/src/main/java/pl/ateam/disasteralerts/API/WeatherMonitoringService.java b/src/main/java/pl/ateam/disasteralerts/API/WeatherMonitoringService.java index 269e6c0d..da8d29c9 100644 --- a/src/main/java/pl/ateam/disasteralerts/API/WeatherMonitoringService.java +++ b/src/main/java/pl/ateam/disasteralerts/API/WeatherMonitoringService.java @@ -6,7 +6,7 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import pl.ateam.disasteralerts.disaster.DisasterFacade; -import pl.ateam.disasteralerts.disaster.DisasterType; +import pl.ateam.disasteralerts.util.enums.DisasterType; import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; import pl.ateam.disasteralerts.util.CitiesInPoland; diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/Disaster.java b/src/main/java/pl/ateam/disasteralerts/disaster/Disaster.java index 5e1995c4..b5a5467c 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/Disaster.java +++ b/src/main/java/pl/ateam/disasteralerts/disaster/Disaster.java @@ -10,8 +10,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import pl.ateam.disasteralerts.disaster.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterStatus; import pl.ateam.disasteralerts.util.EntityAudit; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.time.LocalDateTime; import java.util.UUID; diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterController.java b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterController.java index 57320af4..57f41f0f 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterController.java +++ b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterController.java @@ -12,6 +12,7 @@ import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; import pl.ateam.disasteralerts.security.AppUser; +import pl.ateam.disasteralerts.util.enums.DisasterType; @RestController @RequestMapping(DisasterController.DISASTERS_BASE_URL) diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterFacade.java b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterFacade.java index e883730a..855845cd 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterFacade.java +++ b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterFacade.java @@ -8,6 +8,7 @@ import org.springframework.validation.annotation.Validated; import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.util.List; import java.util.Map; diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterRepository.java b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterRepository.java index 7dabdc14..c197fefb 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterRepository.java +++ b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterRepository.java @@ -1,7 +1,8 @@ package pl.ateam.disasteralerts.disaster; import org.springframework.data.jpa.repository.JpaRepository; -import pl.ateam.disasteralerts.disaster.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.util.List; import java.util.Optional; diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterService.java b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterService.java index 9bae9f5f..df108abc 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterService.java +++ b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterService.java @@ -6,6 +6,7 @@ import org.springframework.validation.annotation.Validated; import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.util.List; import java.util.Map; diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterServiceImpl.java b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterServiceImpl.java index 3432991c..3edd59fb 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterServiceImpl.java +++ b/src/main/java/pl/ateam/disasteralerts/disaster/DisasterServiceImpl.java @@ -8,7 +8,8 @@ import pl.ateam.disasteralerts.alert.dto.AlertAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; -import pl.ateam.disasteralerts.disaster.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.util.*; import java.util.stream.Collectors; diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/dto/DisasterAddDTO.java b/src/main/java/pl/ateam/disasteralerts/disaster/dto/DisasterAddDTO.java index 107ad3a0..d9785d8c 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/dto/DisasterAddDTO.java +++ b/src/main/java/pl/ateam/disasteralerts/disaster/dto/DisasterAddDTO.java @@ -2,7 +2,7 @@ import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; -import pl.ateam.disasteralerts.disaster.DisasterType; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.util.UUID; diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/dto/DisasterDTO.java b/src/main/java/pl/ateam/disasteralerts/disaster/dto/DisasterDTO.java index 6606e39b..ad0df025 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/dto/DisasterDTO.java +++ b/src/main/java/pl/ateam/disasteralerts/disaster/dto/DisasterDTO.java @@ -1,7 +1,7 @@ package pl.ateam.disasteralerts.disaster.dto; -import pl.ateam.disasteralerts.disaster.enums.DisasterStatus; -import pl.ateam.disasteralerts.disaster.DisasterType; +import pl.ateam.disasteralerts.util.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.time.LocalDateTime; import java.util.UUID; diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/enums/DisasterStatus.java b/src/main/java/pl/ateam/disasteralerts/util/enums/DisasterStatus.java similarity index 55% rename from src/main/java/pl/ateam/disasteralerts/disaster/enums/DisasterStatus.java rename to src/main/java/pl/ateam/disasteralerts/util/enums/DisasterStatus.java index 4b2b9d22..9f09f642 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/enums/DisasterStatus.java +++ b/src/main/java/pl/ateam/disasteralerts/util/enums/DisasterStatus.java @@ -1,4 +1,4 @@ -package pl.ateam.disasteralerts.disaster.enums; +package pl.ateam.disasteralerts.util.enums; public enum DisasterStatus { ACTIVE, FINISHED, FAKE diff --git a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterType.java b/src/main/java/pl/ateam/disasteralerts/util/enums/DisasterType.java similarity index 89% rename from src/main/java/pl/ateam/disasteralerts/disaster/DisasterType.java rename to src/main/java/pl/ateam/disasteralerts/util/enums/DisasterType.java index 5d394a5f..352a58c4 100644 --- a/src/main/java/pl/ateam/disasteralerts/disaster/DisasterType.java +++ b/src/main/java/pl/ateam/disasteralerts/util/enums/DisasterType.java @@ -1,4 +1,4 @@ -package pl.ateam.disasteralerts.disaster; +package pl.ateam.disasteralerts.util.enums; public enum DisasterType { STORM("Burza"), diff --git a/src/main/java/pl/ateam/disasteralerts/web/DisasterViewController.java b/src/main/java/pl/ateam/disasteralerts/web/DisasterViewController.java index 2a5ffb1c..aa31d226 100644 --- a/src/main/java/pl/ateam/disasteralerts/web/DisasterViewController.java +++ b/src/main/java/pl/ateam/disasteralerts/web/DisasterViewController.java @@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import pl.ateam.disasteralerts.disaster.DisasterFacade; -import pl.ateam.disasteralerts.disaster.enums.DisasterStatus; -import pl.ateam.disasteralerts.disaster.DisasterType; +import pl.ateam.disasteralerts.util.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterType; import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; import pl.ateam.disasteralerts.security.AppUser; diff --git a/src/test/java/pl/ateam/disasteralerts/airiskassessment/RiskAssessmentServiceTest.java b/src/test/java/pl/ateam/disasteralerts/airiskassessment/RiskAssessmentServiceTest.java index 3c0230f4..8824f369 100644 --- a/src/test/java/pl/ateam/disasteralerts/airiskassessment/RiskAssessmentServiceTest.java +++ b/src/test/java/pl/ateam/disasteralerts/airiskassessment/RiskAssessmentServiceTest.java @@ -6,7 +6,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import pl.ateam.disasteralerts.disaster.DisasterType; +import pl.ateam.disasteralerts.util.enums.DisasterType; import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.util.CitiesInPoland; diff --git a/src/test/java/pl/ateam/disasteralerts/disaster/DisasterControllerTest.java b/src/test/java/pl/ateam/disasteralerts/disaster/DisasterControllerTest.java index 9041275b..aad51bb0 100644 --- a/src/test/java/pl/ateam/disasteralerts/disaster/DisasterControllerTest.java +++ b/src/test/java/pl/ateam/disasteralerts/disaster/DisasterControllerTest.java @@ -14,6 +14,7 @@ import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; import pl.ateam.disasteralerts.security.AppUser; import pl.ateam.disasteralerts.user.dto.UserDTO; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.util.UUID; diff --git a/src/test/java/pl/ateam/disasteralerts/disaster/DisasterFacadeTest.java b/src/test/java/pl/ateam/disasteralerts/disaster/DisasterFacadeTest.java index e1026123..6ca0adac 100644 --- a/src/test/java/pl/ateam/disasteralerts/disaster/DisasterFacadeTest.java +++ b/src/test/java/pl/ateam/disasteralerts/disaster/DisasterFacadeTest.java @@ -11,7 +11,8 @@ import pl.ateam.disasteralerts.alert.AlertFacade; import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; -import pl.ateam.disasteralerts.disaster.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.time.LocalDateTime; import java.util.UUID; diff --git a/src/test/java/pl/ateam/disasteralerts/disaster/DisasterServiceImplTest.java b/src/test/java/pl/ateam/disasteralerts/disaster/DisasterServiceImplTest.java index 7d4705b2..243d24b4 100644 --- a/src/test/java/pl/ateam/disasteralerts/disaster/DisasterServiceImplTest.java +++ b/src/test/java/pl/ateam/disasteralerts/disaster/DisasterServiceImplTest.java @@ -12,7 +12,8 @@ import pl.ateam.disasteralerts.alert.AlertFacade; import pl.ateam.disasteralerts.disaster.dto.DisasterAddDTO; import pl.ateam.disasteralerts.disaster.dto.DisasterDTO; -import pl.ateam.disasteralerts.disaster.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.time.LocalDateTime; import java.util.Optional; diff --git a/src/test/java/pl/ateam/disasteralerts/disaster/DisasteralertIT.java b/src/test/java/pl/ateam/disasteralerts/disaster/DisasteralertIT.java index e824e019..194cadf3 100644 --- a/src/test/java/pl/ateam/disasteralerts/disaster/DisasteralertIT.java +++ b/src/test/java/pl/ateam/disasteralerts/disaster/DisasteralertIT.java @@ -8,10 +8,11 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import pl.ateam.disasteralerts.API.WeatherMonitoringFacade; -import pl.ateam.disasteralerts.disaster.enums.DisasterStatus; +import pl.ateam.disasteralerts.util.enums.DisasterStatus; import pl.ateam.disasteralerts.security.AppUser; import pl.ateam.disasteralerts.user.UserFacade; import pl.ateam.disasteralerts.user.dto.UserDTO; +import pl.ateam.disasteralerts.util.enums.DisasterType; import java.util.List; import java.util.UUID;