From bbee9c831406977bc016d30ddc849beec694a5a5 Mon Sep 17 00:00:00 2001 From: Kevin Guanche Darias Date: Fri, 9 Feb 2024 22:19:55 +0000 Subject: [PATCH] Migrate to Spring Boot 3 --- business/pom.xml | 54 +++++- .../business/ActiveTimeSpecialBo.java | 3 +- .../owgejava/business/AdminUserBo.java | 4 +- .../owgejava/business/AuthenticationBo.java | 60 +++--- .../owgejava/business/BaseBo.java | 3 +- .../owgejava/business/ConfigurationBo.java | 3 +- .../owgejava/business/MissionBo.java | 3 +- .../owgejava/business/ObtainedUpgradeBo.java | 3 +- .../owgejava/business/PlanetBo.java | 3 +- .../QuartzScheduledTaskManagerService.java | 180 +++++++++--------- .../owgejava/business/RequirementBo.java | 6 +- .../owgejava/business/SocketIoService.java | 4 +- .../owgejava/business/UnitBo.java | 3 +- .../owgejava/business/UnitMissionBo.java | 3 +- .../owgejava/business/UnitTypeBo.java | 3 +- .../owgejava/business/UserStorageBo.java | 3 +- .../business/WebsocketSyncService.java | 3 +- .../owgejava/business/audit/AuditBo.java | 6 +- .../mission/MissionConfigurationBo.java | 3 +- .../mission/MissionEventEmitterBo.java | 3 +- .../processor/DeployMissionProcessor.java | 3 +- .../TemporalUnitScheduleListener.java | 3 +- .../business/unit/ObtainedUnitFinderBo.java | 3 +- .../unit/obtained/ObtainedUnitBo.java | 3 +- ...inedUnitImprovementCalculationService.java | 2 +- .../business/user/UserEventEmitterBo.java | 2 +- .../WebsocketConfiguration.java | 2 +- .../owgejava/entity/ActiveTimeSpecial.java | 3 +- .../owgejava/entity/AdminUser.java | 12 +- .../owgejava/entity/Alliance.java | 13 +- .../owgejava/entity/AllianceJoinRequest.java | 3 +- .../owgejava/entity/AttackRule.java | 17 +- .../owgejava/entity/AttackRuleEntry.java | 24 +-- .../owgejava/entity/Audit.java | 3 +- .../owgejava/entity/CommonEntity.java | 3 +- .../entity/CommonEntityWithImage.java | 4 +- .../entity/CommonEntityWithImageStore.java | 9 +- .../owgejava/entity/Configuration.java | 3 +- .../owgejava/entity/CriticalAttack.java | 3 +- .../owgejava/entity/CriticalAttackEntry.java | 21 +- .../entity/EntityWithMissionLimitation.java | 15 +- .../entity/EntityWithRelationImp.java | 7 +- .../owgejava/entity/ExploredPlanet.java | 17 +- .../owgejava/entity/Faction.java | 3 +- .../owgejava/entity/FactionSpawnLocation.java | 14 +- .../owgejava/entity/FactionUnitType.java | 19 +- .../owgejava/entity/Galaxy.java | 3 +- .../owgejava/entity/ImageStore.java | 17 +- .../owgejava/entity/Improvement.java | 9 +- .../owgejava/entity/ImprovementBase.java | 11 +- .../owgejava/entity/ImprovementUnitType.java | 3 +- .../entity/InterceptableSpeedGroup.java | 17 +- .../owgejava/entity/Mission.java | 3 +- .../owgejava/entity/MissionInformation.java | 19 +- .../owgejava/entity/MissionReport.java | 3 +- .../owgejava/entity/MissionType.java | 13 +- .../owgejava/entity/ObjectEntity.java | 9 +- .../owgejava/entity/ObjectRelation.java | 21 +- .../ObjectRelationToObjectRelation.java | 19 +- .../owgejava/entity/ObtainedUnit.java | 3 +- .../owgejava/entity/ObtainedUpgrade.java | 3 +- .../owgejava/entity/Planet.java | 3 +- .../owgejava/entity/PlanetList.java | 8 +- .../owgejava/entity/Requirement.java | 11 +- .../owgejava/entity/RequirementGroup.java | 3 +- .../entity/RequirementInformation.java | 3 +- .../owgejava/entity/Rule.java | 2 +- .../owgejava/entity/SpecialLocation.java | 3 +- .../owgejava/entity/SpeedImpactGroup.java | 3 +- .../owgejava/entity/Sponsor.java | 11 +- .../owgejava/entity/Suspicion.java | 3 +- .../owgejava/entity/SystemMessage.java | 3 +- .../owgejava/entity/TimeSpecial.java | 3 +- .../owgejava/entity/TorIpData.java | 5 +- .../owgejava/entity/Translatable.java | 17 +- .../entity/TranslatableTranslation.java | 19 +- .../owgejava/entity/TutorialSection.java | 9 +- .../TutorialSectionAvailableHtmlSymbol.java | 19 +- .../owgejava/entity/TutorialSectionEntry.java | 23 +-- .../owgejava/entity/Unit.java | 3 +- .../owgejava/entity/UnitType.java | 3 +- .../owgejava/entity/UnlockedRelation.java | 3 +- .../owgejava/entity/Upgrade.java | 3 +- .../owgejava/entity/UpgradeType.java | 11 +- .../entity/UserReadSystemMessage.java | 17 +- .../owgejava/entity/UserStorage.java | 2 +- .../entity/VisitedTutorialSectionEntry.java | 16 +- .../entity/WebsocketEventsInformation.java | 9 +- .../entity/embeddedid/EventNameUserId.java | 5 +- .../entity/embeddedid/PlanetUser.java | 9 +- .../listener/AttackRuleEntityListener.java | 47 +++-- .../EntityWithByUserCacheTagListener.java | 6 +- .../listener/EntityWithRelationListener.java | 6 +- .../EntityWithRequirementGroupsListener.java | 2 +- .../EntityWithTaggableCacheListener.java | 6 +- .../entity/listener/ImageStoreListener.java | 27 ++- ...bjectRelationToObjectRelationListener.java | 45 ++--- .../listener/RequirementGroupListener.java | 2 +- .../entity/listener/TranslatableListener.java | 94 +++++---- .../entity/listener/UnitListener.java | 7 +- .../entity/listener/UpgradeListener.java | 2 +- .../CustomSpringDataRepositoryFactory.java | 87 +++++---- .../repository/GameJpaRepository.java | 72 +++---- .../owgejava/util/MavenUtilService.java | 138 +++++++------- .../owgejava/business/MissionBoTest.java | 3 +- .../owgejava/business/ObtainedUnitBoTest.java | 3 +- .../owgejava/business/PlanetBoTest.java | 3 +- .../owgejava/business/RequirementBoTest.java | 3 +- .../owgejava/business/UnitBoTest.java | 3 +- .../owgejava/business/UserStorageBoTest.java | 2 +- .../owgejava/business/audit/AuditBoTest.java | 6 +- .../mission/MissionEventEmitterBoTest.java | 3 +- .../processor/DeployMissionProcessorTest.java | 3 +- .../unit/ObtainedUnitFinderBoTest.java | 3 +- .../EntityWithRelationListenerTest.java | 6 +- ...tityWithRequirementGroupsListenerTest.java | 3 +- .../entity/listener/UnitListenerTest.java | 7 +- .../NonPostConstructActiveTimeSpecialBo.java | 5 +- .../fake/NonPostConstructRequirementBo.java | 6 +- .../NonPostConstructWebsocketSyncService.java | 3 +- game-frontend/CHANGELOG.md | 3 + game-rest/pom.xml | 6 +- .../BootJacksonConfigurationService.java | 3 +- .../CorsFilterConfiguration.java | 84 ++++---- .../GameSecurityConfiguration.java | 48 ++--- .../SecurityBeansConfiguration.java | 43 ++--- .../filter/BootJwtAuthenticationFilter.java | 20 +- .../filter/OpenWebsocketSyncFilter.java | 12 +- .../owgejava/filter/OwgeContextFilter.java | 4 +- .../OwgeNullSecurityContextRepository.java | 47 +++-- .../rest/game/AllianceRestService.java | 2 +- .../owgejava/rest/game/UserRestService.java | 4 +- .../rest/trait/BaseRestServiceTrait.java | 49 +++-- ...WithRequirementGroupsRestServiceTrait.java | 3 +- .../CrudWithRequirementsRestServiceTrait.java | 4 +- .../security/AdminTokenConfigLoader.java | 116 +++++------ .../owgejava/OwgeTestConfiguration.java | 2 +- 137 files changed, 1070 insertions(+), 929 deletions(-) diff --git a/business/pom.xml b/business/pom.xml index 7bf5a814..19756150 100644 --- a/business/pom.xml +++ b/business/pom.xml @@ -4,7 +4,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.14 + 3.0.13 com.kevinguanchedarias.owge @@ -95,6 +95,22 @@ ch.qos.logback logback-classic + + org.apache.tomcat.embed + tomcat-embed-core + + + org.springframework + spring-core + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + @@ -176,13 +192,33 @@ mysql mysql-connector-java + + org.springframework + spring-core + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + + + javax.servlet + servlet-api + + + org.hibernate.jakarta.persistence + hibernate-jpa-2.1-api + com.github.KevinGuancheDarias kevinsuite-java-rest-commons - v0.4.2 + v0.5.0 log4j @@ -195,6 +231,12 @@ com.github.KevinGuancheDarias taggable-cache v0.2.2 + + + org.yaml + snakeyaml + + @@ -202,6 +244,14 @@ lombok + + + jakarta.servlet + jakarta.servlet-api + 6.0.0 + provided + + org.springframework.boot spring-boot-starter-test diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/ActiveTimeSpecialBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/ActiveTimeSpecialBo.java index dd264f61..d548f5d7 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/ActiveTimeSpecialBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/ActiveTimeSpecialBo.java @@ -28,7 +28,8 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.io.Serial; import java.util.Date; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/AdminUserBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/AdminUserBo.java index d07af4f5..68e47938 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/AdminUserBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/AdminUserBo.java @@ -8,13 +8,13 @@ import com.kevinguanchedarias.owgejava.pojo.TokenPojo; import com.kevinguanchedarias.owgejava.repository.AdminUserRepository; import io.jsonwebtoken.SignatureAlgorithm; +import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import java.io.Serial; import java.util.Date; import java.util.HashMap; @@ -29,7 +29,7 @@ public class AdminUserBo implements BaseBo { @Serial private static final long serialVersionUID = -5545554818842439920L; - + public static final String ADMIN_USER_CACHE_TAG = "admin_user"; public static final String JWT_SECRET_DB_CODE = "ADMIN_JWT_SECRET"; public static final String JWT_HASHING_ALGO = "ADMIN_JWT_ALGO"; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/AuthenticationBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/AuthenticationBo.java index bb1bb06b..0dbed877 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/AuthenticationBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/AuthenticationBo.java @@ -5,7 +5,7 @@ import java.io.Serializable; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -17,37 +17,37 @@ /** * Has methods to interact with the authentication system * - * @since 0.8.0 * @author Kevin Guanche Darias + * @since 0.8.0 */ @Service public class AuthenticationBo implements Serializable { - private static final long serialVersionUID = 5427846503367637891L; - - private static final Logger LOGGER = Logger.getLogger(AuthenticationBo.class); - - @Autowired(required = false) - private transient SecurityContextService securityContextService; - - @PostConstruct - public void init() { - if (securityContextService == null) { - securityContextService = new SecurityContextService(); - LOGGER.warn("Had to spawn an entire " + SecurityContextService.class.getName() - + " because it's not defined as a bean, define a singletone bean for performance and convenience purposes"); - } - } - - /** - * Finds the currently logged in user token - * - * @return - * @since 0.8.0 - * @author Kevin Guanche Darias - */ - public TokenUser findTokenUser() { - return securityContextService != null && securityContextService.getAuthentication() != null - ? (TokenUser) securityContextService.getAuthentication().getDetails() - : null; - } + private static final long serialVersionUID = 5427846503367637891L; + + private static final Logger LOGGER = Logger.getLogger(AuthenticationBo.class); + + @Autowired(required = false) + private transient SecurityContextService securityContextService; + + @PostConstruct + public void init() { + if (securityContextService == null) { + securityContextService = new SecurityContextService(); + LOGGER.warn("Had to spawn an entire " + SecurityContextService.class.getName() + + " because it's not defined as a bean, define a singletone bean for performance and convenience purposes"); + } + } + + /** + * Finds the currently logged in user token + * + * @return + * @author Kevin Guanche Darias + * @since 0.8.0 + */ + public TokenUser findTokenUser() { + return securityContextService != null && securityContextService.getAuthentication() != null + ? (TokenUser) securityContextService.getAuthentication().getDetails() + : null; + } } diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/BaseBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/BaseBo.java index 1ef8dfd5..afcce8d0 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/BaseBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/BaseBo.java @@ -5,7 +5,8 @@ import com.kevinguanchedarias.owgejava.entity.SpecialLocation; import com.kevinguanchedarias.owgejava.exception.ProgrammingException; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.io.Serializable; import java.util.Optional; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/ConfigurationBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/ConfigurationBo.java index fa42f49e..256a3f06 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/ConfigurationBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/ConfigurationBo.java @@ -10,7 +10,8 @@ import org.apache.log4j.Logger; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.io.Serial; import java.io.Serializable; import java.util.*; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/MissionBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/MissionBo.java index bae63f0d..b3529741 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/MissionBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/MissionBo.java @@ -34,7 +34,8 @@ import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/ObtainedUpgradeBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/ObtainedUpgradeBo.java index a765f67b..1a2775f9 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/ObtainedUpgradeBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/ObtainedUpgradeBo.java @@ -13,7 +13,8 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/PlanetBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/PlanetBo.java index 3477c091..f1f00d6f 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/PlanetBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/PlanetBo.java @@ -26,7 +26,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/QuartzScheduledTaskManagerService.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/QuartzScheduledTaskManagerService.java index 5f279b0e..2a2d861b 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/QuartzScheduledTaskManagerService.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/QuartzScheduledTaskManagerService.java @@ -3,7 +3,7 @@ import java.util.Date; import java.util.UUID; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.apache.log4j.Logger; import org.quartz.JobBuilder; @@ -39,93 +39,93 @@ @Service public class QuartzScheduledTaskManagerService extends AbstractScheduledTasksManagerService { - private static final Logger LOG = Logger.getLogger(QuartzScheduledTaskManagerService.class); - - private Gson gson; - - public static class JobHandler extends QuartzJobBean { - private String task; - - /** - * @return the task - */ - public String getTask() { - return task; - } - - /** - * @param task the task to set - */ - public void setTask(String task) { - this.task = task; - } - - @Override - protected void executeInternal(JobExecutionContext context) throws JobExecutionException { - try { - SchedulerContext schedulercontext = context.getScheduler().getContext(); - ApplicationContext applicationContext = (ApplicationContext) schedulercontext.get("applicationContext"); - QuartzScheduledTaskManagerService service = applicationContext - .getBean(QuartzScheduledTaskManagerService.class); - service.fireHandlersForEvent(new Gson().fromJson(task, ScheduledTask.class)); - } catch (SchedulerException e) { - throw new SgtBackendSchedulerException("Could not get application context inside job parser", e); - } - } - - } - - @Autowired(required = false) - protected SchedulerFactoryBean schedulerFactory; - - @PostConstruct - public void init() { - gson = new Gson(); - } - - @Transactional(propagation = Propagation.NOT_SUPPORTED) - @Override - public String registerEvent(ScheduledTask task, long deliverAfterSeconds) { - return doSchedule(task, deliverAfterSeconds); - } - - @Override - public void cancelEvent(String id, String event) { - try { - schedulerFactory.getScheduler().unscheduleJob(genTriggerKey(id, event)); - } catch (SchedulerException e) { - throw new SgtBackendSchedulerException("Not able to remove the job", e); - } - } - - private String doSchedule(ScheduledTask task, long deliverAfterSeconds) { - if (schedulerFactory != null) { - String jobName = UUID.randomUUID().toString(); - Scheduler scheduler = schedulerFactory.getScheduler(); - JobKey jobKey = new JobKey(jobName, task.getType()); - TriggerKey triggerKey = genTriggerKey(jobName, task.getType()); - JobDataMap jobData = new JobDataMap(); - task.setId(jobName); - jobData.put("eventUuid", jobName); - jobData.put("task", gson.toJson(task)); - LOG.debug("Scheduling event with id " + jobName + " and of type " + task.getType()); - JobDetail jobDetail = JobBuilder.newJob(JobHandler.class).withIdentity(jobKey).setJobData(jobData).build(); - Date startAt = new Date(new Date().getTime() + (deliverAfterSeconds * 1000)); - SimpleTrigger trigger = (SimpleTrigger) TriggerBuilder.newTrigger().withIdentity(triggerKey) - .forJob(jobDetail).startAt(startAt).forJob(jobKey).build(); - try { - scheduler.addJob(jobDetail, true, true); - scheduler.scheduleJob(trigger); - return jobName; - } catch (SchedulerException e) { - throw new SgtBackendSchedulerException("Couldn't store job: " + jobName, e); - } - } else { - throw new SgtBackendSchedulerException("Null factory should never happend"); - } - } - - private TriggerKey genTriggerKey(String uuid, String eventType) { - return new TriggerKey("trigger_" + uuid, eventType); - } + private static final Logger LOG = Logger.getLogger(QuartzScheduledTaskManagerService.class); + + private Gson gson; + + public static class JobHandler extends QuartzJobBean { + private String task; + + /** + * @return the task + */ + public String getTask() { + return task; + } + + /** + * @param task the task to set + */ + public void setTask(String task) { + this.task = task; + } + + @Override + protected void executeInternal(JobExecutionContext context) throws JobExecutionException { + try { + SchedulerContext schedulercontext = context.getScheduler().getContext(); + ApplicationContext applicationContext = (ApplicationContext) schedulercontext.get("applicationContext"); + QuartzScheduledTaskManagerService service = applicationContext + .getBean(QuartzScheduledTaskManagerService.class); + service.fireHandlersForEvent(new Gson().fromJson(task, ScheduledTask.class)); + } catch (SchedulerException e) { + throw new SgtBackendSchedulerException("Could not get application context inside job parser", e); + } + } + + } + + @Autowired(required = false) + protected SchedulerFactoryBean schedulerFactory; + + @PostConstruct + public void init() { + gson = new Gson(); + } + + @Transactional(propagation = Propagation.NOT_SUPPORTED) + @Override + public String registerEvent(ScheduledTask task, long deliverAfterSeconds) { + return doSchedule(task, deliverAfterSeconds); + } + + @Override + public void cancelEvent(String id, String event) { + try { + schedulerFactory.getScheduler().unscheduleJob(genTriggerKey(id, event)); + } catch (SchedulerException e) { + throw new SgtBackendSchedulerException("Not able to remove the job", e); + } + } + + private String doSchedule(ScheduledTask task, long deliverAfterSeconds) { + if (schedulerFactory != null) { + String jobName = UUID.randomUUID().toString(); + Scheduler scheduler = schedulerFactory.getScheduler(); + JobKey jobKey = new JobKey(jobName, task.getType()); + TriggerKey triggerKey = genTriggerKey(jobName, task.getType()); + JobDataMap jobData = new JobDataMap(); + task.setId(jobName); + jobData.put("eventUuid", jobName); + jobData.put("task", gson.toJson(task)); + LOG.debug("Scheduling event with id " + jobName + " and of type " + task.getType()); + JobDetail jobDetail = JobBuilder.newJob(JobHandler.class).withIdentity(jobKey).setJobData(jobData).build(); + Date startAt = new Date(new Date().getTime() + (deliverAfterSeconds * 1000)); + SimpleTrigger trigger = (SimpleTrigger) TriggerBuilder.newTrigger().withIdentity(triggerKey) + .forJob(jobDetail).startAt(startAt).forJob(jobKey).build(); + try { + scheduler.addJob(jobDetail, true, true); + scheduler.scheduleJob(trigger); + return jobName; + } catch (SchedulerException e) { + throw new SgtBackendSchedulerException("Couldn't store job: " + jobName, e); + } + } else { + throw new SgtBackendSchedulerException("Null factory should never happend"); + } + } + + private TriggerKey genTriggerKey(String uuid, String eventType) { + return new TriggerKey("trigger_" + uuid, eventType); + } } diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/RequirementBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/RequirementBo.java index 7db630f6..37c0fcbd 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/RequirementBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/RequirementBo.java @@ -33,8 +33,10 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.PostConstruct; -import javax.persistence.EntityManager; +import jakarta.annotation.PostConstruct; + +import jakarta.persistence.EntityManager; + import java.io.Serial; import java.io.Serializable; import java.util.*; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/SocketIoService.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/SocketIoService.java index a8ae6630..45742ab6 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/SocketIoService.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/SocketIoService.java @@ -12,6 +12,8 @@ import com.kevinguanchedarias.owgejava.filter.OwgeJwtAuthenticationFilter; import com.kevinguanchedarias.owgejava.pojo.WebsocketMessage; import com.kevinguanchedarias.owgejava.repository.UserStorageRepository; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; @@ -25,8 +27,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronizationManager; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitBo.java index fdbed247..10bb3018 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitBo.java @@ -21,7 +21,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitMissionBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitMissionBo.java index de2bdd8d..5b2cd59e 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitMissionBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitMissionBo.java @@ -33,7 +33,8 @@ import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.time.Instant; import java.time.ZoneOffset; import java.util.*; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitTypeBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitTypeBo.java index 9e6b2318..76eb6a94 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitTypeBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/UnitTypeBo.java @@ -20,7 +20,8 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/UserStorageBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/UserStorageBo.java index 66b5f5ad..9c1bc816 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/UserStorageBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/UserStorageBo.java @@ -18,7 +18,8 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.io.Serial; import java.time.LocalDateTime; import java.util.Date; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/WebsocketSyncService.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/WebsocketSyncService.java index cf1cbfee..645751a9 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/WebsocketSyncService.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/WebsocketSyncService.java @@ -10,7 +10,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.HashMap; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/audit/AuditBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/audit/AuditBo.java index 2476ef1d..ad621e94 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/audit/AuditBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/audit/AuditBo.java @@ -15,6 +15,9 @@ import com.kevinguanchedarias.owgejava.exception.SgtBackendInvalidInputException; import com.kevinguanchedarias.owgejava.repository.AuditRepository; import com.kevinguanchedarias.owgejava.repository.UserStorageRepository; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; @@ -29,9 +32,6 @@ import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.util.WebUtils; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.Serial; import java.net.Inet4Address; import java.net.InetAddress; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/MissionConfigurationBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/MissionConfigurationBo.java index 34a1c002..b1f7fd38 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/MissionConfigurationBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/MissionConfigurationBo.java @@ -10,7 +10,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/MissionEventEmitterBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/MissionEventEmitterBo.java index cfd5cc53..4d1785f9 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/MissionEventEmitterBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/MissionEventEmitterBo.java @@ -9,7 +9,8 @@ import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; import static com.kevinguanchedarias.owgejava.business.MissionBo.UNIT_BUILD_MISSION_CHANGE; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/processor/DeployMissionProcessor.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/processor/DeployMissionProcessor.java index b7d9789e..1595505c 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/processor/DeployMissionProcessor.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/mission/processor/DeployMissionProcessor.java @@ -16,7 +16,8 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; @Service diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/schedule/TemporalUnitScheduleListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/schedule/TemporalUnitScheduleListener.java index cea5bcdf..a0146066 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/schedule/TemporalUnitScheduleListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/schedule/TemporalUnitScheduleListener.java @@ -23,7 +23,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.util.List; import java.util.Objects; import java.util.Set; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/ObtainedUnitFinderBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/ObtainedUnitFinderBo.java index 0ed70bf4..27b7fad9 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/ObtainedUnitFinderBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/ObtainedUnitFinderBo.java @@ -15,7 +15,8 @@ import org.hibernate.Hibernate; import org.springframework.stereotype.Service; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/obtained/ObtainedUnitBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/obtained/ObtainedUnitBo.java index 32caf33a..4f48070e 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/obtained/ObtainedUnitBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/obtained/ObtainedUnitBo.java @@ -28,7 +28,8 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/obtained/ObtainedUnitImprovementCalculationService.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/obtained/ObtainedUnitImprovementCalculationService.java index fbca7865..f64d3fd0 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/obtained/ObtainedUnitImprovementCalculationService.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/unit/obtained/ObtainedUnitImprovementCalculationService.java @@ -8,7 +8,7 @@ import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; @Service @AllArgsConstructor diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/business/user/UserEventEmitterBo.java b/business/src/main/java/com/kevinguanchedarias/owgejava/business/user/UserEventEmitterBo.java index 69bdc581..53a0e9b0 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/business/user/UserEventEmitterBo.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/business/user/UserEventEmitterBo.java @@ -14,7 +14,7 @@ import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; @Service @AllArgsConstructor diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/configurations/WebsocketConfiguration.java b/business/src/main/java/com/kevinguanchedarias/owgejava/configurations/WebsocketConfiguration.java index dc442707..244052d7 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/configurations/WebsocketConfiguration.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/configurations/WebsocketConfiguration.java @@ -3,10 +3,10 @@ import com.corundumstudio.socketio.Configuration; import com.corundumstudio.socketio.protocol.JacksonJsonSupport; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; @Component public class WebsocketConfiguration extends Configuration { diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ActiveTimeSpecial.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ActiveTimeSpecial.java index 2e78b2e9..06f52963 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ActiveTimeSpecial.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ActiveTimeSpecial.java @@ -10,7 +10,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.Date; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AdminUser.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AdminUser.java index 621c2680..37c1f823 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AdminUser.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AdminUser.java @@ -8,16 +8,16 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + import java.io.Serial; /** - * - * @since 0.8.0 * @author Kevin Guanche Darias + * @since 0.8.0 */ @Entity @Data diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Alliance.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Alliance.java index 8e6675b5..d6618e8b 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Alliance.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Alliance.java @@ -9,12 +9,13 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToMany; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AllianceJoinRequest.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AllianceJoinRequest.java index 2a1280b9..65bbae48 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AllianceJoinRequest.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AllianceJoinRequest.java @@ -7,7 +7,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.time.LocalDateTime; import java.time.ZoneOffset; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AttackRule.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AttackRule.java index d746e1fd..9516520b 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AttackRule.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AttackRule.java @@ -7,14 +7,15 @@ import lombok.NoArgsConstructor; import lombok.ToString; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AttackRuleEntry.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AttackRuleEntry.java index 8dabcbba..5fb467be 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AttackRuleEntry.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/AttackRuleEntry.java @@ -6,18 +6,18 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import javax.persistence.Transient; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import jakarta.persistence.Transient; /** * @author Kevin Guanche Darias diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Audit.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Audit.java index 0efe16ae..789cd40c 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Audit.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Audit.java @@ -3,7 +3,8 @@ import com.kevinguanchedarias.owgejava.enumerations.AuditActionEnum; import lombok.*; -import javax.persistence.*; +import jakarta.persistence.*; + import java.time.LocalDateTime; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntity.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntity.java index 6ea4ecbd..32fdd7fa 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntity.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntity.java @@ -3,7 +3,8 @@ import lombok.EqualsAndHashCode; import lombok.ToString; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntityWithImage.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntityWithImage.java index bebd1d03..dfba6105 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntityWithImage.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntityWithImage.java @@ -2,8 +2,8 @@ import lombok.EqualsAndHashCode; -import javax.persistence.Column; -import javax.persistence.MappedSuperclass; +import jakarta.persistence.Column; +import jakarta.persistence.MappedSuperclass; /** * Represents a CommonEntity that also has an image diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntityWithImageStore.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntityWithImageStore.java index a0558d5a..3c3cfcc8 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntityWithImageStore.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CommonEntityWithImageStore.java @@ -3,10 +3,11 @@ import lombok.EqualsAndHashCode; import lombok.ToString; -import javax.persistence.FetchType; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.MappedSuperclass; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.MappedSuperclass; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Configuration.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Configuration.java index ec8dac10..cbedb976 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Configuration.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Configuration.java @@ -8,7 +8,8 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CriticalAttack.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CriticalAttack.java index 273f914f..1bd06566 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CriticalAttack.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CriticalAttack.java @@ -3,7 +3,8 @@ import lombok.*; import org.hibernate.annotations.CacheConcurrencyStrategy; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CriticalAttackEntry.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CriticalAttackEntry.java index 17fab331..4b19fac1 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CriticalAttackEntry.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/CriticalAttackEntry.java @@ -7,16 +7,17 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/EntityWithMissionLimitation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/EntityWithMissionLimitation.java index b9237dee..5f0ebb6a 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/EntityWithMissionLimitation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/EntityWithMissionLimitation.java @@ -8,13 +8,14 @@ import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import javax.persistence.Column; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.MappedSuperclass; +import jakarta.persistence.Column; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.MappedSuperclass; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/EntityWithRelationImp.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/EntityWithRelationImp.java index 0cb28855..6ef16323 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/EntityWithRelationImp.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/EntityWithRelationImp.java @@ -2,9 +2,10 @@ import com.kevinguanchedarias.owgejava.entity.listener.EntityWithRelationListener; -import javax.persistence.EntityListeners; -import javax.persistence.MappedSuperclass; -import javax.persistence.Transient; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import jakarta.persistence.Transient; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ExploredPlanet.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ExploredPlanet.java index 1190351c..1cc8497d 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ExploredPlanet.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ExploredPlanet.java @@ -5,14 +5,15 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Faction.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Faction.java index 1d813725..a6f15671 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Faction.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Faction.java @@ -3,7 +3,8 @@ import com.kevinguanchedarias.owgejava.entity.cache.EntityWithTaggableCache; import lombok.*; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/FactionSpawnLocation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/FactionSpawnLocation.java index 1d2e7587..499dadab 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/FactionSpawnLocation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/FactionSpawnLocation.java @@ -5,13 +5,13 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; @Entity @Data diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/FactionUnitType.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/FactionUnitType.java index cccce439..8c4780e7 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/FactionUnitType.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/FactionUnitType.java @@ -6,15 +6,16 @@ import lombok.NoArgsConstructor; import lombok.Setter; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Galaxy.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Galaxy.java index 8f3889d5..95ac5428 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Galaxy.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Galaxy.java @@ -4,7 +4,8 @@ import org.hibernate.annotations.Cascade; import org.hibernate.annotations.CascadeType; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImageStore.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImageStore.java index a5fca80b..8c52e652 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImageStore.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImageStore.java @@ -7,14 +7,15 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Transient; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.persistence.Transient; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Improvement.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Improvement.java index 1272c0d8..2624d252 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Improvement.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Improvement.java @@ -7,10 +7,11 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.OneToMany; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImprovementBase.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImprovementBase.java index 8c91a5f1..2632b31a 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImprovementBase.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImprovementBase.java @@ -5,11 +5,12 @@ import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.MappedSuperclass; +import jakarta.persistence.Column; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.MappedSuperclass; + import java.io.Serial; @MappedSuperclass diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImprovementUnitType.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImprovementUnitType.java index 859aab4d..56ab8fa2 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImprovementUnitType.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ImprovementUnitType.java @@ -4,7 +4,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/InterceptableSpeedGroup.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/InterceptableSpeedGroup.java index 3cf36af8..9301b288 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/InterceptableSpeedGroup.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/InterceptableSpeedGroup.java @@ -5,14 +5,15 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Mission.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Mission.java index 0f534c43..8f39c5d6 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Mission.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Mission.java @@ -6,7 +6,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.time.LocalDateTime; import java.time.ZoneOffset; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionInformation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionInformation.java index 12061f4b..6e000ef0 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionInformation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionInformation.java @@ -8,15 +8,16 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionReport.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionReport.java index cd7cafa0..b4e79c8b 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionReport.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionReport.java @@ -2,7 +2,8 @@ import lombok.*; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.Date; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionType.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionType.java index 2917ffa7..96ca0633 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionType.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/MissionType.java @@ -5,12 +5,13 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + import java.io.Serial; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectEntity.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectEntity.java index 2626490e..b78ac0f1 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectEntity.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectEntity.java @@ -6,10 +6,11 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectRelation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectRelation.java index a2aea4bf..22eab4fd 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectRelation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectRelation.java @@ -9,16 +9,17 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectRelationToObjectRelation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectRelationToObjectRelation.java index e4cef0ce..6f4cd1b4 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectRelationToObjectRelation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObjectRelationToObjectRelation.java @@ -8,15 +8,16 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObtainedUnit.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObtainedUnit.java index 296c2026..37801162 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObtainedUnit.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObtainedUnit.java @@ -4,7 +4,8 @@ import com.kevinguanchedarias.owgejava.entity.listener.EntityWithByUserCacheTagListener; import lombok.*; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObtainedUpgrade.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObtainedUpgrade.java index ca6ff6c6..82adc2e1 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObtainedUpgrade.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/ObtainedUpgrade.java @@ -4,7 +4,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Planet.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Planet.java index d6dd6994..4e7d713e 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Planet.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Planet.java @@ -2,7 +2,8 @@ import lombok.*; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/PlanetList.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/PlanetList.java index 05a9820d..647e379a 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/PlanetList.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/PlanetList.java @@ -6,10 +6,10 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; @Entity @Table(name = "planet_list") diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Requirement.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Requirement.java index a690f71e..69711a91 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Requirement.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Requirement.java @@ -5,11 +5,12 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/RequirementGroup.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/RequirementGroup.java index 6726f852..e625bee6 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/RequirementGroup.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/RequirementGroup.java @@ -6,7 +6,8 @@ import com.kevinguanchedarias.owgejava.enumerations.ObjectEnum; import lombok.*; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/RequirementInformation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/RequirementInformation.java index 0b6aa34f..a48f3b86 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/RequirementInformation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/RequirementInformation.java @@ -7,7 +7,8 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Rule.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Rule.java index 001db7d5..1c6b34a4 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Rule.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Rule.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.*; +import jakarta.persistence.*; @Entity @Table(name = "rules") diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SpecialLocation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SpecialLocation.java index 6f48f02a..aa340e8c 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SpecialLocation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SpecialLocation.java @@ -6,7 +6,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SpeedImpactGroup.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SpeedImpactGroup.java index bf65f706..24734f01 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SpeedImpactGroup.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SpeedImpactGroup.java @@ -8,7 +8,8 @@ import lombok.*; import lombok.experimental.SuperBuilder; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Sponsor.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Sponsor.java index 7bdf1612..4e8300f4 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Sponsor.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Sponsor.java @@ -4,10 +4,11 @@ import lombok.Getter; import lombok.Setter; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.Table; + import java.io.Serial; /** @@ -23,7 +24,7 @@ public class Sponsor extends CommonEntityWithImageStore { @Serial private static final long serialVersionUID = -8178529676124231495L; - + private String url; @Enumerated(EnumType.STRING) diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Suspicion.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Suspicion.java index 7aa87acf..490233bf 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Suspicion.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Suspicion.java @@ -4,7 +4,8 @@ import lombok.*; import org.springframework.data.annotation.CreatedDate; -import javax.persistence.*; +import jakarta.persistence.*; + import java.time.LocalDateTime; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SystemMessage.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SystemMessage.java index 66b7d475..df013c7d 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SystemMessage.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/SystemMessage.java @@ -5,7 +5,8 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.time.LocalDateTime; import java.time.ZoneOffset; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TimeSpecial.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TimeSpecial.java index 224008b6..01c0ba1d 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TimeSpecial.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TimeSpecial.java @@ -8,7 +8,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TorIpData.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TorIpData.java index 5cdf72a8..57b63c0b 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TorIpData.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TorIpData.java @@ -5,8 +5,9 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.Id; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; + import java.time.LocalDateTime; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Translatable.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Translatable.java index 38a10ff9..b93b46c5 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Translatable.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Translatable.java @@ -7,14 +7,15 @@ import lombok.NoArgsConstructor; import lombok.ToString; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Transient; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.persistence.Transient; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TranslatableTranslation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TranslatableTranslation.java index 4dbdb0ce..47a26a05 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TranslatableTranslation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TranslatableTranslation.java @@ -5,15 +5,16 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSection.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSection.java index 2733658d..08e0ee86 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSection.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSection.java @@ -7,10 +7,11 @@ import lombok.NoArgsConstructor; import lombok.ToString; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.OneToMany; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSectionAvailableHtmlSymbol.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSectionAvailableHtmlSymbol.java index 9beee0d5..6ed66df8 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSectionAvailableHtmlSymbol.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSectionAvailableHtmlSymbol.java @@ -7,15 +7,16 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSectionEntry.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSectionEntry.java index 679ebe61..04fe6799 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSectionEntry.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/TutorialSectionEntry.java @@ -8,17 +8,18 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Unit.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Unit.java index 7cfb4a25..ff86a596 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Unit.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Unit.java @@ -9,7 +9,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UnitType.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UnitType.java index 9b9201b7..edd4ad20 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UnitType.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UnitType.java @@ -8,7 +8,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UnlockedRelation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UnlockedRelation.java index f043d4e2..9aa3ad26 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UnlockedRelation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UnlockedRelation.java @@ -4,7 +4,8 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Upgrade.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Upgrade.java index 270fa971..041db880 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Upgrade.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/Upgrade.java @@ -8,7 +8,8 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.*; +import jakarta.persistence.*; + import java.io.Serial; import java.util.List; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UpgradeType.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UpgradeType.java index c14e96f2..ed652e70 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UpgradeType.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UpgradeType.java @@ -6,11 +6,12 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + import java.io.Serial; @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UserReadSystemMessage.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UserReadSystemMessage.java index fe49a42e..111e65e3 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UserReadSystemMessage.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UserReadSystemMessage.java @@ -5,14 +5,15 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; + import java.io.Serial; /** diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UserStorage.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UserStorage.java index 82209dbe..70696fd6 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UserStorage.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/UserStorage.java @@ -2,10 +2,10 @@ import com.kevinguanchedarias.owgejava.entity.cache.EntityWithTaggableCache; import com.kevinguanchedarias.owgejava.entity.listener.EntityWithTaggableCacheListener; +import jakarta.persistence.*; import lombok.*; import org.hibernate.annotations.CacheConcurrencyStrategy; -import javax.persistence.*; import java.io.Serial; import java.time.LocalDateTime; import java.util.Date; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/VisitedTutorialSectionEntry.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/VisitedTutorialSectionEntry.java index eb016811..08601353 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/VisitedTutorialSectionEntry.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/VisitedTutorialSectionEntry.java @@ -5,14 +5,14 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; @Table(name = "visited_tutorial_entries") @Entity diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/WebsocketEventsInformation.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/WebsocketEventsInformation.java index 19f948fc..73453327 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/WebsocketEventsInformation.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/WebsocketEventsInformation.java @@ -6,10 +6,11 @@ import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; +import jakarta.persistence.Entity; +import jakarta.persistence.Table; + import java.io.Serial; import java.io.Serializable; import java.time.Instant; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/embeddedid/EventNameUserId.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/embeddedid/EventNameUserId.java index 736d2b1a..b86976f8 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/embeddedid/EventNameUserId.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/embeddedid/EventNameUserId.java @@ -2,8 +2,9 @@ import lombok.Data; -import javax.persistence.Column; -import javax.persistence.Embeddable; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/embeddedid/PlanetUser.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/embeddedid/PlanetUser.java index 6c1f4c6f..337c3be1 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/embeddedid/PlanetUser.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/embeddedid/PlanetUser.java @@ -9,10 +9,11 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import javax.persistence.Embeddable; -import javax.persistence.FetchType; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; +import jakarta.persistence.Embeddable; +import jakarta.persistence.FetchType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; + import java.io.Serial; import java.io.Serializable; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/AttackRuleEntityListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/AttackRuleEntityListener.java index 4be776c0..fbee93be 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/AttackRuleEntityListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/AttackRuleEntityListener.java @@ -1,6 +1,6 @@ package com.kevinguanchedarias.owgejava.entity.listener; -import javax.persistence.PostLoad; +import jakarta.persistence.PostLoad; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -13,33 +13,32 @@ /** * Does a workaround loading rule entries, as doesn't work for unknown reasons * - * @since 0.9.0 * @author Kevin Guanche Darias - * + * @since 0.9.0 */ @Component public class AttackRuleEntityListener { - private AttackRuleEntryRepository attackRuleEntryRepository; - - @Lazy - public AttackRuleEntityListener(AttackRuleEntryRepository attackRuleEntryRepository) { - this.attackRuleEntryRepository = attackRuleEntryRepository; - } - - /** - * Apply the workaround to the collection loading - * - * @todo Complete issue #258 - * @param attackRule - * @since 0.9.0 - * @author Kevin Guanche Darias - */ - @PostLoad - @Transactional(propagation = Propagation.REQUIRES_NEW) - public void loadRuleEntries(AttackRule attackRule) { - attackRule.setAttackRuleEntries(attackRuleEntryRepository.findByAttackRule(attackRule)); - } + private AttackRuleEntryRepository attackRuleEntryRepository; + + @Lazy + public AttackRuleEntityListener(AttackRuleEntryRepository attackRuleEntryRepository) { + this.attackRuleEntryRepository = attackRuleEntryRepository; + } + + /** + * Apply the workaround to the collection loading + * + * @param attackRule + * @todo Complete issue #258 + * @author Kevin Guanche Darias + * @since 0.9.0 + */ + @PostLoad + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void loadRuleEntries(AttackRule attackRule) { + attackRule.setAttackRuleEntries(attackRuleEntryRepository.findByAttackRule(attackRule)); + } } diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithByUserCacheTagListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithByUserCacheTagListener.java index 3a904fc9..13274bca 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithByUserCacheTagListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithByUserCacheTagListener.java @@ -7,9 +7,9 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; -import javax.persistence.PostPersist; -import javax.persistence.PostRemove; -import javax.persistence.PostUpdate; +import jakarta.persistence.PostPersist; +import jakarta.persistence.PostRemove; +import jakarta.persistence.PostUpdate; @Component @Lazy diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRelationListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRelationListener.java index b8bd66f4..d2ac389d 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRelationListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRelationListener.java @@ -9,9 +9,9 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.PostLoad; -import javax.persistence.PostPersist; -import javax.persistence.PreRemove; +import jakarta.persistence.PostLoad; +import jakarta.persistence.PostPersist; +import jakarta.persistence.PreRemove; /** * Handles the fetching, saving, and deleting of entities that supports diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRequirementGroupsListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRequirementGroupsListener.java index 16926829..dc943458 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRequirementGroupsListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRequirementGroupsListener.java @@ -7,7 +7,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.PostLoad; +import jakarta.persistence.PostLoad; /** * @author Kevin Guanche Darias diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithTaggableCacheListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithTaggableCacheListener.java index 93709adc..9ebc10e7 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithTaggableCacheListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithTaggableCacheListener.java @@ -6,9 +6,9 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; -import javax.persistence.PostPersist; -import javax.persistence.PostRemove; -import javax.persistence.PostUpdate; +import jakarta.persistence.PostPersist; +import jakarta.persistence.PostRemove; +import jakarta.persistence.PostUpdate; @Component @Lazy diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/ImageStoreListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/ImageStoreListener.java index 97b29689..8ae4558f 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/ImageStoreListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/ImageStoreListener.java @@ -1,8 +1,8 @@ package com.kevinguanchedarias.owgejava.entity.listener; -import javax.persistence.PostLoad; -import javax.persistence.PostPersist; -import javax.persistence.PostUpdate; +import jakarta.persistence.PostLoad; +import jakarta.persistence.PostPersist; +import jakarta.persistence.PostUpdate; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -15,22 +15,21 @@ * * @author Kevin Guanche Darias * @since 0.9.0 - * */ @Component @Lazy public class ImageStoreListener { - private ImageStoreBo imageStoreBo; + private ImageStoreBo imageStoreBo; - public ImageStoreListener(ImageStoreBo imageStoreBo) { - this.imageStoreBo = imageStoreBo; - } + public ImageStoreListener(ImageStoreBo imageStoreBo) { + this.imageStoreBo = imageStoreBo; + } - @PostLoad - @PostPersist - @PostUpdate - public void postLoad(ImageStore imageStore) { - imageStoreBo.computeImageUrl(imageStore); + @PostLoad + @PostPersist + @PostUpdate + public void postLoad(ImageStore imageStore) { + imageStoreBo.computeImageUrl(imageStore); - } + } } diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/ObjectRelationToObjectRelationListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/ObjectRelationToObjectRelationListener.java index acb6d00b..4448d038 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/ObjectRelationToObjectRelationListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/ObjectRelationToObjectRelationListener.java @@ -1,7 +1,7 @@ package com.kevinguanchedarias.owgejava.entity.listener; -import javax.persistence.PrePersist; -import javax.persistence.PreUpdate; +import jakarta.persistence.PrePersist; +import jakarta.persistence.PreUpdate; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -12,31 +12,28 @@ import com.kevinguanchedarias.owgejava.exception.ProgrammingException; /** - * - * @since 0.9.0 * @author Kevin Guanche Darias - * + * @since 0.9.0 */ public class ObjectRelationToObjectRelationListener { - /** - * - * @param objectRelationToObjectRelation - * @since 0.9.0 - * @author Kevin Guanche Darias - */ - @PrePersist - @PreUpdate - @Transactional(propagation = Propagation.MANDATORY) - public void validateProgrammingSmell(ObjectRelationToObjectRelation objectRelationToObjectRelation) { - ObjectRelation masterObjectRelation = objectRelationToObjectRelation.getMaster(); - ObjectRelation slave = objectRelationToObjectRelation.getSlave(); - if (masterObjectRelation.getObject().findCodeAsEnum() == ObjectEnum.REQUIREMENT_GROUP) { - throw new ProgrammingException("Can't use REQUIREMENT_GROUP as master"); - } - if (slave.getObject().findCodeAsEnum() != ObjectEnum.REQUIREMENT_GROUP) { - throw new ProgrammingException("Only REQUIREMENT_GROUP can be set as slave"); - } - } + /** + * @param objectRelationToObjectRelation + * @author Kevin Guanche Darias + * @since 0.9.0 + */ + @PrePersist + @PreUpdate + @Transactional(propagation = Propagation.MANDATORY) + public void validateProgrammingSmell(ObjectRelationToObjectRelation objectRelationToObjectRelation) { + ObjectRelation masterObjectRelation = objectRelationToObjectRelation.getMaster(); + ObjectRelation slave = objectRelationToObjectRelation.getSlave(); + if (masterObjectRelation.getObject().findCodeAsEnum() == ObjectEnum.REQUIREMENT_GROUP) { + throw new ProgrammingException("Can't use REQUIREMENT_GROUP as master"); + } + if (slave.getObject().findCodeAsEnum() != ObjectEnum.REQUIREMENT_GROUP) { + throw new ProgrammingException("Only REQUIREMENT_GROUP can be set as slave"); + } + } } diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/RequirementGroupListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/RequirementGroupListener.java index f6f2ef7e..f8bf5aa9 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/RequirementGroupListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/RequirementGroupListener.java @@ -6,7 +6,7 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; -import javax.persistence.PostLoad; +import jakarta.persistence.PostLoad; /** * @author Kevin Guanche Darias diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/TranslatableListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/TranslatableListener.java index 9dc9e412..061b1e89 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/TranslatableListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/TranslatableListener.java @@ -1,69 +1,67 @@ package com.kevinguanchedarias.owgejava.entity.listener; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.PostLoad; -import javax.servlet.http.HttpServletRequest; - +import com.kevinguanchedarias.owgejava.business.TranslationBo; +import com.kevinguanchedarias.owgejava.entity.Translatable; +import com.kevinguanchedarias.owgejava.exception.SgtBackendInvalidInputException; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; -import com.kevinguanchedarias.owgejava.business.TranslationBo; -import com.kevinguanchedarias.owgejava.entity.Translatable; -import com.kevinguanchedarias.owgejava.exception.SgtBackendInvalidInputException; +import jakarta.persistence.PostLoad; + +import java.util.ArrayList; +import java.util.List; /** - * * @param translatableTranslationRepository * @param httpServletRequest - * @since 0.9.0 * @author Kevin Guanche Darias + * @since 0.9.0 */ @Component public class TranslatableListener { - private static final Logger LOG = Logger.getLogger(TranslatableListener.class); - private static final List SUPPORTED_LANGUAGES = new ArrayList<>(); - static { - SUPPORTED_LANGUAGES.add("en"); - SUPPORTED_LANGUAGES.add("es"); - } + private static final Logger LOG = Logger.getLogger(TranslatableListener.class); + private static final List SUPPORTED_LANGUAGES = new ArrayList<>(); + + static { + SUPPORTED_LANGUAGES.add("en"); + SUPPORTED_LANGUAGES.add("es"); + } - private HttpServletRequest httpServletRequest; - private TranslationBo translationBo; + private HttpServletRequest httpServletRequest; + private TranslationBo translationBo; - @Lazy - public TranslatableListener(HttpServletRequest httpServletRequest, TranslationBo translationBo) { - this.httpServletRequest = httpServletRequest; - this.translationBo = translationBo; - } + @Lazy + public TranslatableListener(HttpServletRequest httpServletRequest, TranslationBo translationBo) { + this.httpServletRequest = httpServletRequest; + this.translationBo = translationBo; + } - /** - * - * @param translatable - * @since 0.9.0 - * @author Kevin Guanche Darias - */ - @PostLoad - public void onLoad(Translatable translatable) { - if (httpServletRequest != null) { - String headerValue = httpServletRequest.getHeader("X-Owge-Lang"); - if (StringUtils.isEmpty(headerValue)) { - throw new SgtBackendInvalidInputException("Frontend is not sending the http lang header"); - } else { - doTranslate(translatable, headerValue); - } - } else { - LOG.warn( - "Unable to handle translation, as translatable has been invoked outside of a request. Most likely from a Quartz job"); - } - } + /** + * @param translatable + * @author Kevin Guanche Darias + * @since 0.9.0 + */ + @PostLoad + public void onLoad(Translatable translatable) { + if (httpServletRequest != null) { + String headerValue = httpServletRequest.getHeader("X-Owge-Lang"); + if (StringUtils.isEmpty(headerValue)) { + throw new SgtBackendInvalidInputException("Frontend is not sending the http lang header"); + } else { + doTranslate(translatable, headerValue); + } + } else { + LOG.warn( + "Unable to handle translation, as translatable has been invoked outside of a request. Most likely from a Quartz job"); + } + } - private void doTranslate(Translatable translatable, String headerValue) { - String targetLang = SUPPORTED_LANGUAGES.contains(headerValue) ? headerValue : translatable.getDefaultLangCode(); - translatable.setTranslation(translationBo.findByIdAndLangCode(translatable.getId(), targetLang)); - } + private void doTranslate(Translatable translatable, String headerValue) { + String targetLang = SUPPORTED_LANGUAGES.contains(headerValue) ? headerValue : translatable.getDefaultLangCode(); + translatable.setTranslation(translationBo.findByIdAndLangCode(translatable.getId(), targetLang)); + } } diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/UnitListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/UnitListener.java index 3857ee75..3f3d6bdd 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/UnitListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/UnitListener.java @@ -11,9 +11,10 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; -import javax.persistence.PostPersist; -import javax.persistence.PostUpdate; -import javax.persistence.PreRemove; +import jakarta.persistence.PostPersist; +import jakarta.persistence.PostUpdate; +import jakarta.persistence.PreRemove; + import java.util.HashSet; import java.util.Set; diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/UpgradeListener.java b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/UpgradeListener.java index 7cf69ea3..84fd2036 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/UpgradeListener.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/entity/listener/UpgradeListener.java @@ -8,7 +8,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import javax.persistence.PostLoad; +import jakarta.persistence.PostLoad; /** * @author Kevin Guanche Darias diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/factory/CustomSpringDataRepositoryFactory.java b/business/src/main/java/com/kevinguanchedarias/owgejava/factory/CustomSpringDataRepositoryFactory.java index cff38d32..0ee2b84f 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/factory/CustomSpringDataRepositoryFactory.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/factory/CustomSpringDataRepositoryFactory.java @@ -5,8 +5,8 @@ import java.io.Serializable; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.support.JpaEntityInformation; import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; @@ -19,55 +19,54 @@ import com.kevinguanchedarias.owgejava.repository.GameJpaRepository; /** - * - * @since 0.8.0 * @author Kevin Guanche Darias + * @since 0.8.0 */ public class CustomSpringDataRepositoryFactory, T, I extends Serializable> - extends JpaRepositoryFactoryBean { + extends JpaRepositoryFactoryBean { - /** - * @param repositoryInterface - * @since 0.8.0 - * @author Kevin Guanche Darias - */ - public CustomSpringDataRepositoryFactory(Class repositoryInterface) { - super(repositoryInterface); - } + /** + * @param repositoryInterface + * @author Kevin Guanche Darias + * @since 0.8.0 + */ + public CustomSpringDataRepositoryFactory(Class repositoryInterface) { + super(repositoryInterface); + } - @Override - protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) { - return new SimpleJpaExecutorFactory(entityManager); - } + @Override + protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) { + return new SimpleJpaExecutorFactory(entityManager); + } - /** - * Simple jpa executor factory - * - * @param - * @param - */ - private static class SimpleJpaExecutorFactory extends JpaRepositoryFactory { - /** - * Simple jpa executor factory constructor - * - * @param entityManager entity manager - */ - public SimpleJpaExecutorFactory(EntityManager entityManager) { - super(entityManager); - } + /** + * Simple jpa executor factory + * + * @param + * @param + */ + private static class SimpleJpaExecutorFactory extends JpaRepositoryFactory { + /** + * Simple jpa executor factory constructor + * + * @param entityManager entity manager + */ + public SimpleJpaExecutorFactory(EntityManager entityManager) { + super(entityManager); + } - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - protected JpaRepositoryImplementation getTargetRepository(RepositoryInformation repositoryInformation, - EntityManager em) { - JpaEntityInformation entityInformation = getEntityInformation(repositoryInformation.getDomainType()); - return new GameJpaRepository(entityInformation, em); - } + @SuppressWarnings({"rawtypes", "unchecked"}) + @Override + protected JpaRepositoryImplementation getTargetRepository(RepositoryInformation repositoryInformation, + EntityManager em) { + JpaEntityInformation entityInformation = getEntityInformation(repositoryInformation.getDomainType()); + return new GameJpaRepository(entityInformation, em); + } - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - protected Class getRepositoryBaseClass(RepositoryMetadata metadata) { - return GameJpaRepository.class; - } - } + @SuppressWarnings({"rawtypes", "unchecked"}) + @Override + protected Class getRepositoryBaseClass(RepositoryMetadata metadata) { + return GameJpaRepository.class; + } + } } \ No newline at end of file diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/repository/GameJpaRepository.java b/business/src/main/java/com/kevinguanchedarias/owgejava/repository/GameJpaRepository.java index 3ce52f3a..4e7f5a57 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/repository/GameJpaRepository.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/repository/GameJpaRepository.java @@ -1,11 +1,11 @@ /** - * + * */ package com.kevinguanchedarias.owgejava.repository; import java.io.Serializable; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import org.springframework.data.jpa.repository.support.JpaEntityInformation; import org.springframework.data.jpa.repository.support.SimpleJpaRepository; @@ -17,39 +17,39 @@ */ public class GameJpaRepository extends SimpleJpaRepository { - private Class entityClass; - - /** - * @param domainClass - * @param em - * @since 0.8.0 - * @author Kevin Guanche Darias - */ - public GameJpaRepository(Class domainClass, EntityManager em) { - super(domainClass, em); - entityClass = domainClass; - } - - /** - * @param entityInformation - * @param entityManager - * @since 0.8.0 - * @author Kevin Guanche Darias - */ - public GameJpaRepository(JpaEntityInformation entityInformation, EntityManager entityManager) { - super(entityInformation, entityManager); - entityClass = entityInformation.getJavaType(); - } - - /** - * Finds the class associated with the repository - * - * @return - * @since 0.8.0 - * @author Kevin Guanche Darias - */ - public Class findEntityClass() { - return entityClass; - } + private Class entityClass; + + /** + * @param domainClass + * @param em + * @since 0.8.0 + * @author Kevin Guanche Darias + */ + public GameJpaRepository(Class domainClass, EntityManager em) { + super(domainClass, em); + entityClass = domainClass; + } + + /** + * @param entityInformation + * @param entityManager + * @since 0.8.0 + * @author Kevin Guanche Darias + */ + public GameJpaRepository(JpaEntityInformation entityInformation, EntityManager entityManager) { + super(entityInformation, entityManager); + entityClass = entityInformation.getJavaType(); + } + + /** + * Finds the class associated with the repository + * + * @return + * @since 0.8.0 + * @author Kevin Guanche Darias + */ + public Class findEntityClass() { + return entityClass; + } } diff --git a/business/src/main/java/com/kevinguanchedarias/owgejava/util/MavenUtilService.java b/business/src/main/java/com/kevinguanchedarias/owgejava/util/MavenUtilService.java index 618d665b..ee541447 100644 --- a/business/src/main/java/com/kevinguanchedarias/owgejava/util/MavenUtilService.java +++ b/business/src/main/java/com/kevinguanchedarias/owgejava/util/MavenUtilService.java @@ -1,12 +1,12 @@ /** - * + * */ package com.kevinguanchedarias.owgejava.util; import java.io.InputStream; import java.util.Properties; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; @@ -15,83 +15,83 @@ /** * Has methods for interacting with the maven available properties - * + * * @since 0.8.0 * @author Kevin Guanche Darias */ @Service public class MavenUtilService { - private static final Logger LOG = LogManager.getLogger(MavenUtilService.class); + private static final Logger LOG = LogManager.getLogger(MavenUtilService.class); - private String version; + private String version; - /** - * Find the project version in time - * - * @see Related - * StackOverflow answer - * @since 0.8.0 - * @author Kevin Guanche Darias - */ - @PostConstruct - public void init() { - try { - Properties p = new Properties(); - InputStream is = getClass().getResourceAsStream( - "/META-INF/maven/com.kevinguanchedarias.owgejava/owgejava-backend/pom.properties"); - if (is != null) { - p.load(is); - version = p.getProperty("version", ""); - } - } catch (Exception e) { - // ignore - } + /** + * Find the project version in time + * + * @see Related + * StackOverflow answer + * @since 0.8.0 + * @author Kevin Guanche Darias + */ + @PostConstruct + public void init() { + try { + Properties p = new Properties(); + InputStream is = getClass().getResourceAsStream( + "/META-INF/maven/com.kevinguanchedarias.owgejava/owgejava-backend/pom.properties"); + if (is != null) { + p.load(is); + version = p.getProperty("version", ""); + } + } catch (Exception e) { + // ignore + } - // fallback to using Java API - if (version == null) { - Package aPackage = getClass().getPackage(); - if (aPackage != null) { - version = aPackage.getImplementationVersion(); - if (version == null) { - version = aPackage.getSpecificationVersion(); - } - } - } - version = normalizeVersion(version); - LOG.debug("Project maven version is: " + version); - } + // fallback to using Java API + if (version == null) { + Package aPackage = getClass().getPackage(); + if (aPackage != null) { + version = aPackage.getImplementationVersion(); + if (version == null) { + version = aPackage.getSpecificationVersion(); + } + } + } + version = normalizeVersion(version); + LOG.debug("Project maven version is: " + version); + } - /** - * Finds the project maven version, if not possible will fallback to "master" - * - * @return - * @since 0.8.0 - * @author Kevin Guanche Darias - */ - public String findVersion() { - return findVersion("master"); - } + /** + * Finds the project maven version, if not possible will fallback to "master" + * + * @return + * @since 0.8.0 + * @author Kevin Guanche Darias + */ + public String findVersion() { + return findVersion("master"); + } - /** - * Finds the project maven version (if not possible will return the - * fallbackValue) - * - * @param fallbackValue Value to use when not able to resolve the version - * @return - * @since 0.8.0 - * @author Kevin Guanche Darias - */ - public String findVersion(String fallbackValue) { - if (StringUtils.isEmpty(version)) { - LOG.info("Not able to resolve project version, defaulting to: " + fallbackValue); - return fallbackValue; - } else { - return version; - } - } + /** + * Finds the project maven version (if not possible will return the + * fallbackValue) + * + * @param fallbackValue Value to use when not able to resolve the version + * @return + * @since 0.8.0 + * @author Kevin Guanche Darias + */ + public String findVersion(String fallbackValue) { + if (StringUtils.isEmpty(version)) { + LOG.info("Not able to resolve project version, defaulting to: " + fallbackValue); + return fallbackValue; + } else { + return version; + } + } - private String normalizeVersion(String version) { - return version == null ? version : version.replaceAll("-SNAPSHOT", ""); + private String normalizeVersion(String version) { + return version == null ? version : version.replaceAll("-SNAPSHOT", ""); - } + } } diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/MissionBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/MissionBoTest.java index 9c49a75d..8d10fa18 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/MissionBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/MissionBoTest.java @@ -39,7 +39,8 @@ import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.time.LocalDateTime; import java.util.List; import java.util.Optional; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/ObtainedUnitBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/ObtainedUnitBoTest.java index 57c7cf24..3b22b2a7 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/ObtainedUnitBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/ObtainedUnitBoTest.java @@ -29,7 +29,8 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.system.OutputCaptureExtension; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; import java.util.Optional; import java.util.stream.Stream; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/PlanetBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/PlanetBoTest.java index d735d6b5..2fd2f53e 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/PlanetBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/PlanetBoTest.java @@ -34,7 +34,8 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.PageRequest; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; import java.util.Optional; import java.util.stream.Stream; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/RequirementBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/RequirementBoTest.java index 31f1b711..1ccab8fa 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/RequirementBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/RequirementBoTest.java @@ -29,7 +29,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; import java.util.stream.Stream; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/UnitBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/UnitBoTest.java index b0911039..70945ad6 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/UnitBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/UnitBoTest.java @@ -19,7 +19,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; import java.util.stream.Stream; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/UserStorageBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/UserStorageBoTest.java index 74e9ed99..f619dbf0 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/UserStorageBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/UserStorageBoTest.java @@ -18,7 +18,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; import static com.kevinguanchedarias.owgejava.mock.FactionMock.*; import static com.kevinguanchedarias.owgejava.mock.GalaxyMock.GALAXY_ID; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/audit/AuditBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/audit/AuditBoTest.java index 41abe0ff..b8d0601b 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/audit/AuditBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/audit/AuditBoTest.java @@ -14,6 +14,9 @@ import com.kevinguanchedarias.owgejava.repository.AuditRepository; import com.kevinguanchedarias.owgejava.repository.UserStorageRepository; import com.kevinguanchedarias.owgejava.test.answer.InvokeRunnableLambdaAnswer; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -27,9 +30,6 @@ import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.util.WebUtils; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/mission/MissionEventEmitterBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/mission/MissionEventEmitterBoTest.java index 34a6546e..8d02325a 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/mission/MissionEventEmitterBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/mission/MissionEventEmitterBoTest.java @@ -19,7 +19,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; import java.util.stream.Stream; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/mission/processor/DeployMissionProcessorTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/mission/processor/DeployMissionProcessorTest.java index d90762c0..832e14bb 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/mission/processor/DeployMissionProcessorTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/mission/processor/DeployMissionProcessorTest.java @@ -19,7 +19,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; import java.util.stream.Stream; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/business/unit/ObtainedUnitFinderBoTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/business/unit/ObtainedUnitFinderBoTest.java index 3e14ab51..5660b120 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/business/unit/ObtainedUnitFinderBoTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/business/unit/ObtainedUnitFinderBoTest.java @@ -18,7 +18,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.EntityManager; +import jakarta.persistence.EntityManager; + import java.util.List; import java.util.stream.Stream; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRelationListenerTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRelationListenerTest.java index f6e3b679..cb937018 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRelationListenerTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRelationListenerTest.java @@ -10,9 +10,9 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.PostLoad; -import javax.persistence.PostPersist; -import javax.persistence.PreRemove; +import jakarta.persistence.PostLoad; +import jakarta.persistence.PostPersist; +import jakarta.persistence.PreRemove; import static com.kevinguanchedarias.owgejava.mock.ObjectRelationMock.givenObjectRelation; import static com.kevinguanchedarias.owgejava.mock.UnitMock.UNIT_ID_1; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRequirementGroupsListenerTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRequirementGroupsListenerTest.java index 8e240452..82dc45b4 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRequirementGroupsListenerTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/EntityWithRequirementGroupsListenerTest.java @@ -9,7 +9,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.PostLoad; +import jakarta.persistence.PostLoad; + import java.util.List; import static com.kevinguanchedarias.owgejava.mock.RequirementGroupMock.givenRequirementGroup; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/UnitListenerTest.java b/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/UnitListenerTest.java index 5c4b4634..9633affb 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/UnitListenerTest.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/entity/listener/UnitListenerTest.java @@ -17,9 +17,10 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import javax.persistence.PostPersist; -import javax.persistence.PostUpdate; -import javax.persistence.PreRemove; +import jakarta.persistence.PostPersist; +import jakarta.persistence.PostUpdate; +import jakarta.persistence.PreRemove; + import java.util.List; import java.util.Optional; import java.util.stream.Stream; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructActiveTimeSpecialBo.java b/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructActiveTimeSpecialBo.java index 85b359c5..6afbc63a 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructActiveTimeSpecialBo.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructActiveTimeSpecialBo.java @@ -4,7 +4,8 @@ import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.io.Serial; @Service @@ -18,7 +19,7 @@ public class NonPostConstructActiveTimeSpecialBo extends ActiveTimeSpecialBo { public void init() { // Does nothing } - + public void realInit() { super.init(); } diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructRequirementBo.java b/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructRequirementBo.java index ea66dd1f..f8865175 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructRequirementBo.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructRequirementBo.java @@ -13,8 +13,10 @@ import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; -import javax.persistence.EntityManager; +import jakarta.annotation.PostConstruct; + +import jakarta.persistence.EntityManager; + import java.io.Serial; import java.util.List; diff --git a/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructWebsocketSyncService.java b/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructWebsocketSyncService.java index 9de866e8..13388404 100644 --- a/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructWebsocketSyncService.java +++ b/business/src/test/java/com/kevinguanchedarias/owgejava/fake/NonPostConstructWebsocketSyncService.java @@ -7,7 +7,8 @@ import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.util.List; @Service diff --git a/game-frontend/CHANGELOG.md b/game-frontend/CHANGELOG.md index 7ec503fe..0ace1230 100644 --- a/game-frontend/CHANGELOG.md +++ b/game-frontend/CHANGELOG.md @@ -1,5 +1,8 @@ # OWGE changelog +v0.11.5 (latest) +==================== +* [class=Developer] __Improvement:__ Migrate to Spring Boot 3.0 v0.11.4 (2024-02-08 05:39) ================== diff --git a/game-rest/pom.xml b/game-rest/pom.xml index 01b14a6a..60595e25 100644 --- a/game-rest/pom.xml +++ b/game-rest/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.6 + 3.0.13 com.kevinguanchedarias.owgejava @@ -71,8 +71,8 @@ true - mysql - mysql-connector-java + com.mysql + mysql-connector-j runtime diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/BootJacksonConfigurationService.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/BootJacksonConfigurationService.java index df9a0d87..38229f53 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/BootJacksonConfigurationService.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/BootJacksonConfigurationService.java @@ -12,7 +12,8 @@ import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.util.Set; @Service diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/CorsFilterConfiguration.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/CorsFilterConfiguration.java index 2a2c4b1c..931ba966 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/CorsFilterConfiguration.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/CorsFilterConfiguration.java @@ -1,55 +1,55 @@ package com.kevinguanchedarias.owgejava.configuration; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - +import com.kevinguanchedarias.kevinsuite.commons.rest.security.cors.CorsConfigurator; +import com.kevinguanchedarias.kevinsuite.commons.rest.security.cors.CorsFilter; +import com.kevinguanchedarias.kevinsuite.commons.rest.security.cors.SimpleCorsConfigurator; +import com.kevinguanchedarias.owgejava.filter.OwgeNullSecurityContextRepository; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; -import com.kevinguanchedarias.kevinsuite.commons.rest.security.cors.CorsConfigurator; -import com.kevinguanchedarias.kevinsuite.commons.rest.security.cors.CorsFilter; -import com.kevinguanchedarias.kevinsuite.commons.rest.security.cors.SimpleCorsConfigurator; -import com.kevinguanchedarias.owgejava.filter.OwgeNullSecurityContextRepository; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; @Configuration -class CorsFilterConfiguration extends WebSecurityConfigurerAdapter { - @Value("${OWGE_CORS_CUSTOM_ORIGIN:}") - private String customOrigin; - - @Override - protected void configure(HttpSecurity http) throws Exception { - CorsFilter filter = new CorsFilter(); - filter.setCorsConfigurator(createFilterConfiguration()); - http.addFilterBefore(filter, org.springframework.web.filter.CorsFilter.class).sessionManagement() - .sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().securityContext() - .securityContextRepository(new OwgeNullSecurityContextRepository()).and().csrf().disable(); +class CorsFilterConfiguration { + @Value("${OWGE_CORS_CUSTOM_ORIGIN:}") + private String customOrigin; - } + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + CorsFilter filter = new CorsFilter(); + filter.setCorsConfigurator(createFilterConfiguration()); + http.addFilterBefore(filter, org.springframework.web.filter.CorsFilter.class).sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().securityContext() + .securityContextRepository(new OwgeNullSecurityContextRepository()).and().csrf().disable(); + return http.build(); + } - private CorsConfigurator createFilterConfiguration() { - SimpleCorsConfigurator corsConfigurator = new SimpleCorsConfigurator(); - String[] originStrings = { "http://owgejava_ci.kevinguanchedarias.com", "http://localhost:4200", - "http://localhost", "http://192.168.99.100:8080" }; - List originList = new ArrayList<>(Arrays.asList(originStrings)); - if (!StringUtils.isEmpty(customOrigin)) { - originList.add(customOrigin); - } - List rootOriginList = new ArrayList<>(); - rootOriginList.add("kevinguanchedarias.com"); - rootOriginList.add("owge.net"); - List methodList = new ArrayList<>(); - methodList.add("GET"); - methodList.add("POST"); - methodList.add("PUT"); - methodList.add("DELETE"); - corsConfigurator.setOriginList(originList); - corsConfigurator.setRootOriginList(rootOriginList); - corsConfigurator.setMethodList(methodList); - return corsConfigurator; - } + private CorsConfigurator createFilterConfiguration() { + SimpleCorsConfigurator corsConfigurator = new SimpleCorsConfigurator(); + String[] originStrings = {"http://owgejava_ci.kevinguanchedarias.com", "http://localhost:4200", + "http://localhost", "http://192.168.99.100:8080"}; + List originList = new ArrayList<>(Arrays.asList(originStrings)); + if (!StringUtils.isEmpty(customOrigin)) { + originList.add(customOrigin); + } + List rootOriginList = new ArrayList<>(); + rootOriginList.add("kevinguanchedarias.com"); + rootOriginList.add("owge.net"); + List methodList = new ArrayList<>(); + methodList.add("GET"); + methodList.add("POST"); + methodList.add("PUT"); + methodList.add("DELETE"); + corsConfigurator.setOriginList(originList); + corsConfigurator.setRootOriginList(rootOriginList); + corsConfigurator.setMethodList(methodList); + return corsConfigurator; + } } \ No newline at end of file diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/GameSecurityConfiguration.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/GameSecurityConfiguration.java index 82f238f9..0c69e39e 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/GameSecurityConfiguration.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/GameSecurityConfiguration.java @@ -1,38 +1,38 @@ package com.kevinguanchedarias.owgejava.configuration; -import org.springframework.beans.factory.annotation.Autowired; +import com.kevinguanchedarias.owgejava.exception.CommonException; +import lombok.AllArgsConstructor; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; -import com.kevinguanchedarias.kevinsuite.commons.rest.security.JwtAuthenticationProvider; - @Configuration @Order(104) -class GameSecurityConfiguration extends WebSecurityConfigurerAdapter { - @Autowired - private SecurityBeansConfiguration securityBeansConfiguration; - - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { - auth.authenticationProvider(new JwtAuthenticationProvider()); - } +@AllArgsConstructor +class GameSecurityConfiguration { + private final SecurityBeansConfiguration securityBeansConfiguration; - @Override - protected void configure(HttpSecurity http) throws Exception { - http.csrf().disable(); - http.antMatcher("/**"); - http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); - http.addFilterBefore(securityBeansConfiguration.getGameBootJwtAuthenticationFilter(), - BasicAuthenticationFilter.class).exceptionHandling() - .authenticationEntryPoint(securityBeansConfiguration.getAuthenticationEntryPoint()); - http.antMatcher("/game/**").authorizeRequests().anyRequest().authenticated() - .and().cors().disable(); + @Bean + public SecurityFilterChain gameSecurityFilterChain(HttpSecurity http) throws Exception { + http.csrf().disable(); + http.authorizeHttpRequests(authz -> { + authz.requestMatchers("/**"); + try { + authz.requestMatchers("/game/**").authenticated().and().cors().disable(); + } catch (Exception e) { + throw new CommonException("Not able to disable cors", e); + } + }); + http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); - } + http.addFilterBefore(securityBeansConfiguration.getGameBootJwtAuthenticationFilter(), + BasicAuthenticationFilter.class).exceptionHandling() + .authenticationEntryPoint(securityBeansConfiguration.getAuthenticationEntryPoint()); + return http.build(); + } } \ No newline at end of file diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/SecurityBeansConfiguration.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/SecurityBeansConfiguration.java index ba70b1c5..3e288f90 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/SecurityBeansConfiguration.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/configuration/SecurityBeansConfiguration.java @@ -9,7 +9,8 @@ import com.kevinguanchedarias.owgejava.security.AdminTokenConfigLoader; import com.kevinguanchedarias.owgejava.security.DevelopmentSgtTokenConfigLoader; import com.kevinguanchedarias.owgejava.security.SgtTokenConfigLoader; -import org.springframework.beans.factory.annotation.Autowired; +import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; @@ -17,8 +18,9 @@ import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; +import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; @@ -27,11 +29,12 @@ import java.util.Arrays; @Configuration +@RequiredArgsConstructor @Order(101) -class SecurityBeansConfiguration extends WebSecurityConfigurerAdapter { +@Getter +class SecurityBeansConfiguration { - @Autowired - private Environment environment; + private final Environment environment; private final AuthenticationEntryPoint authenticationEntryPoint = new RestAuthenticationEntryPoint(); private final BootJwtAuthenticationFilter adminBootJwtAuthenticationFilter = new BootJwtAuthenticationFilter("/admin/**"); @@ -81,8 +84,8 @@ public FilterEventHandler owgeResourceAutoUpdateEventHandler( public BootJwtAuthenticationFilter gameBootJwtAuthenticationFilter( AuthenticationSuccessHandler authenticationSuccessHandler, @Qualifier("gameOwgeTokenConfigLoader") TokenConfigLoader tokenConfigLoader, - FilterEventHandler filterEventHandler) throws Exception { - gameBootJwtAuthenticationFilter.setAuthenticationManager(authenticationManager()); + FilterEventHandler filterEventHandler, AuthenticationManager authenticationManager) { + gameBootJwtAuthenticationFilter.setAuthenticationManager(authenticationManager); gameBootJwtAuthenticationFilter.setAuthenticationSuccessHandler(authenticationSuccessHandler); gameBootJwtAuthenticationFilter.setTokenConfigLoader(tokenConfigLoader); gameBootJwtAuthenticationFilter.setConvertExceptionToJson(true); @@ -95,8 +98,8 @@ public BootJwtAuthenticationFilter gameBootJwtAuthenticationFilter( @Bean public BootJwtAuthenticationFilter adminBootJwtAuthenticationFilter( AuthenticationSuccessHandler authenticationSuccessHandler, - @Qualifier("adminOwgeTokenConfigLoader") TokenConfigLoader tokenConfigLoader) throws Exception { - adminBootJwtAuthenticationFilter.setAuthenticationManager(authenticationManager()); + @Qualifier("adminOwgeTokenConfigLoader") TokenConfigLoader tokenConfigLoader, AuthenticationManager authenticationManager) { + adminBootJwtAuthenticationFilter.setAuthenticationManager(authenticationManager); adminBootJwtAuthenticationFilter.setAuthenticationSuccessHandler(authenticationSuccessHandler); adminBootJwtAuthenticationFilter.setTokenConfigLoader(tokenConfigLoader); adminBootJwtAuthenticationFilter.setConvertExceptionToJson(true); @@ -114,24 +117,10 @@ public FilterRegistrationBean runLastGameAuth( return filterRegistrationBean; } - public AuthenticationEntryPoint getAuthenticationEntryPoint() { - return authenticationEntryPoint; - } - - public BootJwtAuthenticationFilter getAdminBootJwtAuthenticationFilter() { - return adminBootJwtAuthenticationFilter; - } - - public BootJwtAuthenticationFilter getGameBootJwtAuthenticationFilter() { - return gameBootJwtAuthenticationFilter; - } - - public JwtAuthenticationProvider getJwtAuthenticationProvider() { - return jwtAuthenticationProvider; - } - - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { + @Bean + public AuthenticationManager authenticationManager(HttpSecurity httpSecurity) throws Exception { + var auth = httpSecurity.getSharedObject(AuthenticationManagerBuilder.class); auth.authenticationProvider(jwtAuthenticationProvider); + return auth.build(); } } \ No newline at end of file diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/BootJwtAuthenticationFilter.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/BootJwtAuthenticationFilter.java index 1facdcea..ce6f6242 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/BootJwtAuthenticationFilter.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/BootJwtAuthenticationFilter.java @@ -1,16 +1,16 @@ package com.kevinguanchedarias.owgejava.filter; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; public class BootJwtAuthenticationFilter extends OwgeJwtAuthenticationFilter { - public BootJwtAuthenticationFilter(String pattern) { - super(true); - setFilterProcessesUrl(pattern); - } + public BootJwtAuthenticationFilter(String pattern) { + super(true); + setFilterProcessesUrl(pattern); + } - @Override - protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) { - return request.getMethod().equals("OPTIONS") ? false : super.requiresAuthentication(request, response); - } + @Override + protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) { + return request.getMethod().equals("OPTIONS") ? false : super.requiresAuthentication(request, response); + } } \ No newline at end of file diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OpenWebsocketSyncFilter.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OpenWebsocketSyncFilter.java index 92bbc725..1ff4d2fa 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OpenWebsocketSyncFilter.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OpenWebsocketSyncFilter.java @@ -5,6 +5,12 @@ import com.kevinguanchedarias.owgejava.annotation.WebControllerCache; import com.kevinguanchedarias.owgejava.util.filter.ArgumentResolutionInvocableHandlerMethod; import com.kevinguanchedarias.taggablecache.manager.TaggableCacheManager; +import jakarta.servlet.Filter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletRequest; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -21,12 +27,6 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.time.LocalDateTime; import java.util.Arrays; import java.util.List; diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OwgeContextFilter.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OwgeContextFilter.java index 8b085b61..d360aef9 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OwgeContextFilter.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OwgeContextFilter.java @@ -5,12 +5,12 @@ import com.kevinguanchedarias.owgejava.entity.Planet; import com.kevinguanchedarias.owgejava.repository.PlanetRepository; import io.opentelemetry.api.trace.Span; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; import lombok.AllArgsConstructor; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.util.Optional; diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OwgeNullSecurityContextRepository.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OwgeNullSecurityContextRepository.java index 1fff32f0..96e3eb2f 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OwgeNullSecurityContextRepository.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/filter/OwgeNullSecurityContextRepository.java @@ -1,28 +1,45 @@ package com.kevinguanchedarias.owgejava.filter; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.core.context.DeferredSecurityContext; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.context.SecurityContextImpl; import org.springframework.security.web.context.HttpRequestResponseHolder; import org.springframework.security.web.context.SecurityContextRepository; public class OwgeNullSecurityContextRepository implements SecurityContextRepository { - @Override - public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) { - return SecurityContextHolder.getContext(); - } + @Override + public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) { + return new SecurityContextImpl(); + } + + @Override + public DeferredSecurityContext loadDeferredContext(HttpServletRequest request) { + var context = SecurityContextHolder.getContext(); + return new DeferredSecurityContext() { + @Override + public boolean isGenerated() { + return false; + } + + @Override + public SecurityContext get() { + return context; + } + }; + } - @Override - public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) { - // Do nothing - } + @Override + public void saveContext(SecurityContext context, HttpServletRequest request, HttpServletResponse response) { + // Do nothing + } - @Override - public boolean containsContext(HttpServletRequest request) { - return false; - } + @Override + public boolean containsContext(HttpServletRequest request) { + return false; + } } diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/game/AllianceRestService.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/game/AllianceRestService.java index 2b4c7e11..4363b2d4 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/game/AllianceRestService.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/game/AllianceRestService.java @@ -12,11 +12,11 @@ import com.kevinguanchedarias.owgejava.repository.AllianceRepository; import com.kevinguanchedarias.owgejava.rest.trait.BaseRestServiceTrait; import com.kevinguanchedarias.owgejava.util.DtoUtilService; +import jakarta.servlet.http.HttpServletRequest; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.annotation.ApplicationScope; -import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/game/UserRestService.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/game/UserRestService.java index f7960d24..f2568f3d 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/game/UserRestService.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/game/UserRestService.java @@ -8,6 +8,8 @@ import com.kevinguanchedarias.owgejava.dto.UserStorageDto; import com.kevinguanchedarias.owgejava.entity.UserStorage; import com.kevinguanchedarias.owgejava.interfaces.SyncSource; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -15,8 +17,6 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.annotation.ApplicationScope; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.util.Map; import java.util.function.Function; diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/BaseRestServiceTrait.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/BaseRestServiceTrait.java index ebc9fff2..58e47133 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/BaseRestServiceTrait.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/BaseRestServiceTrait.java @@ -1,13 +1,12 @@ /** - * + * */ package com.kevinguanchedarias.owgejava.rest.trait; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - import com.kevinguanchedarias.owgejava.exception.SgtBackendInvalidInputException; +import jakarta.servlet.http.HttpServletRequest; + +import java.util.Map; /** * @@ -15,26 +14,26 @@ * @author Kevin Guanche Darias */ public interface BaseRestServiceTrait { - public default void checkPost(Object id, HttpServletRequest request) { - if (id != null && request.getMethod().equals("POST")) { - throw new SgtBackendInvalidInputException("Post request can't contain an id"); - } - } + public default void checkPost(Object id, HttpServletRequest request) { + if (id != null && request.getMethod().equals("POST")) { + throw new SgtBackendInvalidInputException("Post request can't contain an id"); + } + } - /** - * Checks if the map contains the specified key - * - * @param inputMap - * Map, usually comes from JSON - * @param key - * @since 0.7.0 - * @author Kevin Guanche Darias - */ - @SuppressWarnings("rawtypes") - public default void checkMapEntry(Map inputMap, String key) { - if (inputMap.get(key) == null) { - throw new SgtBackendInvalidInputException("No value for key " + key); - } - } + /** + * Checks if the map contains the specified key + * + * @param inputMap + * Map, usually comes from JSON + * @param key + * @since 0.7.0 + * @author Kevin Guanche Darias + */ + @SuppressWarnings("rawtypes") + public default void checkMapEntry(Map inputMap, String key) { + if (inputMap.get(key) == null) { + throw new SgtBackendInvalidInputException("No value for key " + key); + } + } } diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/CrudWithRequirementGroupsRestServiceTrait.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/CrudWithRequirementGroupsRestServiceTrait.java index 413d1900..ddf417c1 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/CrudWithRequirementGroupsRestServiceTrait.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/CrudWithRequirementGroupsRestServiceTrait.java @@ -24,7 +24,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; + import java.util.List; import static com.kevinguanchedarias.owgejava.entity.RequirementGroup.REQUIREMENT_GROUP_CACHE_TAG; diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/CrudWithRequirementsRestServiceTrait.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/CrudWithRequirementsRestServiceTrait.java index 8a0377cd..d74522e6 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/CrudWithRequirementsRestServiceTrait.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/rest/trait/CrudWithRequirementsRestServiceTrait.java @@ -12,6 +12,8 @@ import com.kevinguanchedarias.owgejava.enumerations.ObjectEnum; import com.kevinguanchedarias.owgejava.util.DtoUtilService; import com.kevinguanchedarias.owgejava.util.SpringRepositoryUtil; +import jakarta.annotation.PostConstruct; +import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.springframework.beans.factory.BeanFactory; @@ -23,8 +25,6 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; -import javax.annotation.PostConstruct; -import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/security/AdminTokenConfigLoader.java b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/security/AdminTokenConfigLoader.java index dcccf1d5..d0dbaa24 100644 --- a/game-rest/src/main/java/com/kevinguanchedarias/owgejava/security/AdminTokenConfigLoader.java +++ b/game-rest/src/main/java/com/kevinguanchedarias/owgejava/security/AdminTokenConfigLoader.java @@ -1,9 +1,9 @@ /** - * + * */ package com.kevinguanchedarias.owgejava.security; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; @@ -20,67 +20,67 @@ */ public class AdminTokenConfigLoader implements TokenConfigLoader { - @Autowired - private ConfigurationBo configurationBo; + @Autowired + private ConfigurationBo configurationBo; - private String tokenSecret; + private String tokenSecret; - @PostConstruct - public void init() { - tokenSecret = configurationBo.findOrSetDefault(AdminUserBo.JWT_SECRET_DB_CODE, genRandomTokenSecret()) - .getValue(); - } + @PostConstruct + public void init() { + tokenSecret = configurationBo.findOrSetDefault(AdminUserBo.JWT_SECRET_DB_CODE, genRandomTokenSecret()) + .getValue(); + } - /* - * (non-Javadoc) - * - * @see - * com.kevinguanchedarias.kevinsuite.commons.rest.security.TokenConfigLoader - * #getTokenSecret() - */ - @Override - public String getTokenSecret() { - return tokenSecret; - } + /* + * (non-Javadoc) + * + * @see + * com.kevinguanchedarias.kevinsuite.commons.rest.security.TokenConfigLoader + * #getTokenSecret() + */ + @Override + public String getTokenSecret() { + return tokenSecret; + } - /* - * (non-Javadoc) - * - * @see - * com.kevinguanchedarias.kevinsuite.commons.rest.security.TokenConfigLoader - * #getVerificationMethod() - */ - @Override - public TokenVerificationMethod getVerificationMethod() { - return TokenVerificationMethod.SECRET; - } + /* + * (non-Javadoc) + * + * @see + * com.kevinguanchedarias.kevinsuite.commons.rest.security.TokenConfigLoader + * #getVerificationMethod() + */ + @Override + public TokenVerificationMethod getVerificationMethod() { + return TokenVerificationMethod.SECRET; + } - /* - * (non-Javadoc) - * - * @see - * com.kevinguanchedarias.kevinsuite.commons.rest.security.TokenConfigLoader - * #getPrivateKey() - */ - @Override - public String getPrivateKey() { - return null; - } + /* + * (non-Javadoc) + * + * @see + * com.kevinguanchedarias.kevinsuite.commons.rest.security.TokenConfigLoader + * #getPrivateKey() + */ + @Override + public String getPrivateKey() { + return null; + } - /* - * (non-Javadoc) - * - * @see - * com.kevinguanchedarias.kevinsuite.commons.rest.security.TokenConfigLoader - * #getPublicKey() - */ - @Override - public String getPublicKey() { - return null; - } + /* + * (non-Javadoc) + * + * @see + * com.kevinguanchedarias.kevinsuite.commons.rest.security.TokenConfigLoader + * #getPublicKey() + */ + @Override + public String getPublicKey() { + return null; + } - private String genRandomTokenSecret() { - Double number = Double.valueOf(Math.random() * 10000 + 5000); - return String.valueOf(number.intValue()); - } + private String genRandomTokenSecret() { + Double number = Double.valueOf(Math.random() * 10000 + 5000); + return String.valueOf(number.intValue()); + } } diff --git a/game-rest/src/test/java/com/kevinguanchedarias/owgejava/OwgeTestConfiguration.java b/game-rest/src/test/java/com/kevinguanchedarias/owgejava/OwgeTestConfiguration.java index 833ebd6e..8d2743ed 100644 --- a/game-rest/src/test/java/com/kevinguanchedarias/owgejava/OwgeTestConfiguration.java +++ b/game-rest/src/test/java/com/kevinguanchedarias/owgejava/OwgeTestConfiguration.java @@ -12,7 +12,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.ComponentScan; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when;