From de5c0b44c1e5311eaf85c1644a93c0b83e486fe2 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Thu, 31 Aug 2023 15:49:32 +0200 Subject: [PATCH 1/2] chore: optimize imports --- .../shogun/boot/config/ApplicationConfig.java | 1 - .../boot/controller/ResourceController.java | 1 - .../boot/architecture/DependencyRulesTest.java | 3 +-- .../controller/ApplicationControllerTest.java | 1 - .../boot/flyway/FlywayMigrationsTest.java | 8 +++----- .../shogun/properties/FileUploadProperties.java | 2 -- .../GeoServerInterceptorController.java | 1 - .../shogun/lib/config/MethodSecurityConfig.java | 3 ++- .../shogun/lib/controller/BaseController.java | 4 ---- .../lib/controller/BaseFileController.java | 1 - .../lib/dto/PermissionCollectionTypeDto.java | 5 ----- .../permission/EntityAccessDeniedException.java | 3 ++- .../permission/EntityNotFoundException.java | 3 ++- .../EntityPermissionNotFoundException.java | 3 ++- .../permission/UserNotFoundException.java | 1 - .../shogun/lib/graphql/dto/MutateGroup.java | 1 - .../lib/graphql/scalar/DateTimeScalar.java | 17 ++++++----------- .../security/permission/BasePermission.java | 1 - .../lib/repository/ApplicationRepository.java | 5 +++-- .../lib/repository/BaseFileRepository.java | 7 ++++--- .../GroupClassPermissionRepository.java | 7 ++++--- .../GroupInstancePermissionRepository.java | 7 ++++--- .../PermissionCollectionRepository.java | 5 +++-- .../entity/BaseEntityPermissionEvaluator.java | 3 --- .../shogun/lib/service/ApplicationService.java | 2 +- .../shogun/lib/service/FileService.java | 8 ++++---- .../shogun/lib/service/BaseFileServiceTest.java | 10 ---------- .../shogun/lib/service/GroupServiceTest.java | 1 - .../shogun/service/HttpProxyService.java | 5 +++-- 29 files changed, 44 insertions(+), 75 deletions(-) diff --git a/shogun-boot/src/main/java/de/terrestris/shogun/boot/config/ApplicationConfig.java b/shogun-boot/src/main/java/de/terrestris/shogun/boot/config/ApplicationConfig.java index b28f1eae0..01868bb3a 100644 --- a/shogun-boot/src/main/java/de/terrestris/shogun/boot/config/ApplicationConfig.java +++ b/shogun-boot/src/main/java/de/terrestris/shogun/boot/config/ApplicationConfig.java @@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; diff --git a/shogun-boot/src/main/java/de/terrestris/shogun/boot/controller/ResourceController.java b/shogun-boot/src/main/java/de/terrestris/shogun/boot/controller/ResourceController.java index e8a170bee..173388c96 100644 --- a/shogun-boot/src/main/java/de/terrestris/shogun/boot/controller/ResourceController.java +++ b/shogun-boot/src/main/java/de/terrestris/shogun/boot/controller/ResourceController.java @@ -22,7 +22,6 @@ import org.springframework.boot.info.BuildProperties; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller diff --git a/shogun-boot/src/test/java/de/terrestris/shogun/boot/architecture/DependencyRulesTest.java b/shogun-boot/src/test/java/de/terrestris/shogun/boot/architecture/DependencyRulesTest.java index e9ac814b6..f4bb8b70b 100644 --- a/shogun-boot/src/test/java/de/terrestris/shogun/boot/architecture/DependencyRulesTest.java +++ b/shogun-boot/src/test/java/de/terrestris/shogun/boot/architecture/DependencyRulesTest.java @@ -16,7 +16,6 @@ */ package de.terrestris.shogun.boot.architecture; -import com.tngtech.archunit.base.DescribedPredicate; import com.tngtech.archunit.core.importer.ImportOption; import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; @@ -31,7 +30,7 @@ import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RestController; -import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.*; +import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; @AnalyzeClasses(packages = "de.terrestris", importOptions = { ImportOption.DoNotIncludeTests.class }) public class DependencyRulesTest { diff --git a/shogun-boot/src/test/java/de/terrestris/shogun/boot/controller/ApplicationControllerTest.java b/shogun-boot/src/test/java/de/terrestris/shogun/boot/controller/ApplicationControllerTest.java index 32e970528..d970b7bdd 100644 --- a/shogun-boot/src/test/java/de/terrestris/shogun/boot/controller/ApplicationControllerTest.java +++ b/shogun-boot/src/test/java/de/terrestris/shogun/boot/controller/ApplicationControllerTest.java @@ -18,7 +18,6 @@ import de.terrestris.shogun.lib.controller.ApplicationController; import de.terrestris.shogun.lib.model.Application; -import de.terrestris.shogun.lib.model.Group; import de.terrestris.shogun.lib.repository.ApplicationRepository; import java.util.ArrayList; diff --git a/shogun-boot/src/test/java/de/terrestris/shogun/boot/flyway/FlywayMigrationsTest.java b/shogun-boot/src/test/java/de/terrestris/shogun/boot/flyway/FlywayMigrationsTest.java index 0c93bf611..0957910c7 100644 --- a/shogun-boot/src/test/java/de/terrestris/shogun/boot/flyway/FlywayMigrationsTest.java +++ b/shogun-boot/src/test/java/de/terrestris/shogun/boot/flyway/FlywayMigrationsTest.java @@ -16,14 +16,12 @@ */ package de.terrestris.shogun.boot.flyway; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.matchesPattern; +import org.junit.jupiter.api.Test; import java.io.File; -import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; -import org.mockito.junit.MockitoJUnitRunner; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.matchesPattern; public class FlywayMigrationsTest { diff --git a/shogun-config/src/main/java/de/terrestris/shogun/properties/FileUploadProperties.java b/shogun-config/src/main/java/de/terrestris/shogun/properties/FileUploadProperties.java index f142967d3..5febdb7f8 100644 --- a/shogun-config/src/main/java/de/terrestris/shogun/properties/FileUploadProperties.java +++ b/shogun-config/src/main/java/de/terrestris/shogun/properties/FileUploadProperties.java @@ -18,9 +18,7 @@ import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.NestedConfigurationProperty; import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Component; import java.util.List; diff --git a/shogun-gs-interceptor/src/main/java/de/terrestris/shogun/interceptor/controller/GeoServerInterceptorController.java b/shogun-gs-interceptor/src/main/java/de/terrestris/shogun/interceptor/controller/GeoServerInterceptorController.java index e254feeda..96b830fdc 100644 --- a/shogun-gs-interceptor/src/main/java/de/terrestris/shogun/interceptor/controller/GeoServerInterceptorController.java +++ b/shogun-gs-interceptor/src/main/java/de/terrestris/shogun/interceptor/controller/GeoServerInterceptorController.java @@ -26,7 +26,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/config/MethodSecurityConfig.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/config/MethodSecurityConfig.java index 3bd4d655e..6aae3f6a7 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/config/MethodSecurityConfig.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/config/MethodSecurityConfig.java @@ -18,7 +18,6 @@ import de.terrestris.shogun.lib.security.access.BasePermissionEvaluator; import de.terrestris.shogun.lib.security.access.entity.BaseEntityPermissionEvaluator; -import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; @@ -27,6 +26,8 @@ import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; +import java.util.List; + @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true) public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseController.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseController.java index 31ffac61c..71ce4b7b4 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseController.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseController.java @@ -19,12 +19,10 @@ import com.github.fge.jsonpatch.mergepatch.JsonMergePatch; import de.terrestris.shogun.lib.controller.security.permission.BasePermissionController; import de.terrestris.shogun.lib.model.BaseEntity; -import de.terrestris.shogun.lib.model.User; import de.terrestris.shogun.lib.service.BaseService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; @@ -45,9 +43,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; -import java.lang.reflect.ParameterizedType; import java.time.OffsetDateTime; -import java.util.List; import java.util.Optional; // TODO Specify and type extension of BaseService diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseFileController.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseFileController.java index cb1a21b31..dcb4f9490 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseFileController.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseFileController.java @@ -35,7 +35,6 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.server.ResponseStatusException; -import java.util.List; import java.util.Optional; import java.util.UUID; diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/dto/PermissionCollectionTypeDto.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/dto/PermissionCollectionTypeDto.java index 605de2405..8692e2879 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/dto/PermissionCollectionTypeDto.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/dto/PermissionCollectionTypeDto.java @@ -22,11 +22,6 @@ import lombok.NoArgsConstructor; import lombok.ToString; -import javax.validation.constraints.AssertTrue; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - @Data @AllArgsConstructor @NoArgsConstructor diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityAccessDeniedException.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityAccessDeniedException.java index f09e4b9c0..c8ecd1b8a 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityAccessDeniedException.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityAccessDeniedException.java @@ -18,13 +18,14 @@ package de.terrestris.shogun.lib.exception.security.permission; -import java.io.Serializable; import lombok.extern.log4j.Log4j2; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.http.HttpStatus; import org.springframework.web.server.ResponseStatusException; +import java.io.Serializable; + @Log4j2 public final class EntityAccessDeniedException extends ResponseStatusException { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityNotFoundException.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityNotFoundException.java index 9d31c3b6d..e65cb8a6d 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityNotFoundException.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityNotFoundException.java @@ -18,13 +18,14 @@ package de.terrestris.shogun.lib.exception.security.permission; -import java.io.Serializable; import lombok.extern.log4j.Log4j2; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.http.HttpStatus; import org.springframework.web.server.ResponseStatusException; +import java.io.Serializable; + @Log4j2 public final class EntityNotFoundException extends ResponseStatusException { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityPermissionNotFoundException.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityPermissionNotFoundException.java index 05fb97c4f..305722e9b 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityPermissionNotFoundException.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/EntityPermissionNotFoundException.java @@ -18,13 +18,14 @@ package de.terrestris.shogun.lib.exception.security.permission; -import java.io.Serializable; import lombok.extern.log4j.Log4j2; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.http.HttpStatus; import org.springframework.web.server.ResponseStatusException; +import java.io.Serializable; + @Log4j2 public final class EntityPermissionNotFoundException extends ResponseStatusException { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/UserNotFoundException.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/UserNotFoundException.java index f1be8deba..1b12f1d7f 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/UserNotFoundException.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/exception/security/permission/UserNotFoundException.java @@ -18,7 +18,6 @@ package de.terrestris.shogun.lib.exception.security.permission; -import java.io.Serializable; import lombok.extern.log4j.Log4j2; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/graphql/dto/MutateGroup.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/graphql/dto/MutateGroup.java index bdcdba2e9..dbe0e2a7c 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/graphql/dto/MutateGroup.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/graphql/dto/MutateGroup.java @@ -22,7 +22,6 @@ import lombok.Setter; import java.io.Serializable; -import java.util.HashMap; @Getter @Setter diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/graphql/scalar/DateTimeScalar.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/graphql/scalar/DateTimeScalar.java index 0c2deec58..f4f20e20c 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/graphql/scalar/DateTimeScalar.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/graphql/scalar/DateTimeScalar.java @@ -19,13 +19,12 @@ import graphql.Internal; import graphql.language.StringValue; import graphql.language.Value; -import graphql.schema.Coercing; -import graphql.schema.CoercingParseLiteralException; -import graphql.schema.CoercingParseValueException; -import graphql.schema.CoercingSerializeException; -import graphql.schema.GraphQLScalarType; +import graphql.schema.*; -import java.time.*; +import java.time.DateTimeException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.DateTimeParseException; @@ -33,11 +32,7 @@ import static graphql.scalars.util.Kit.typeName; import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE; -import static java.time.temporal.ChronoField.HOUR_OF_DAY; -import static java.time.temporal.ChronoField.MINUTE_OF_HOUR; -import static java.time.temporal.ChronoField.NANO_OF_SECOND; -import static java.time.temporal.ChronoField.OFFSET_SECONDS; -import static java.time.temporal.ChronoField.SECOND_OF_MINUTE; +import static java.time.temporal.ChronoField.*; /** * Access this via {@link graphql.scalars.ExtendedScalars#DateTime} diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/model/security/permission/BasePermission.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/model/security/permission/BasePermission.java index df6c31c74..c5a859be5 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/model/security/permission/BasePermission.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/model/security/permission/BasePermission.java @@ -27,7 +27,6 @@ import javax.persistence.FetchType; import javax.persistence.MappedSuperclass; import javax.persistence.OneToOne; - import java.util.Objects; import static org.hibernate.envers.RelationTargetAuditMode.NOT_AUDITED; diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/ApplicationRepository.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/ApplicationRepository.java index eca8907dc..38fd5b329 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/ApplicationRepository.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/ApplicationRepository.java @@ -17,12 +17,13 @@ package de.terrestris.shogun.lib.repository; import de.terrestris.shogun.lib.model.Application; -import java.util.Optional; -import javax.persistence.QueryHint; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.QueryHints; import org.springframework.stereotype.Repository; +import javax.persistence.QueryHint; +import java.util.Optional; + @Repository public interface ApplicationRepository extends BaseCrudRepository, JpaSpecificationExecutor { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/BaseFileRepository.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/BaseFileRepository.java index e25167587..d19f0706a 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/BaseFileRepository.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/BaseFileRepository.java @@ -16,12 +16,13 @@ */ package de.terrestris.shogun.lib.repository; -import java.util.Optional; -import java.util.UUID; -import javax.persistence.QueryHint; import org.springframework.data.jpa.repository.QueryHints; import org.springframework.data.repository.NoRepositoryBean; +import javax.persistence.QueryHint; +import java.util.Optional; +import java.util.UUID; + @NoRepositoryBean public interface BaseFileRepository extends BaseCrudRepository { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/GroupClassPermissionRepository.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/GroupClassPermissionRepository.java index e7fccb303..3fe738ad9 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/GroupClassPermissionRepository.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/GroupClassPermissionRepository.java @@ -18,14 +18,15 @@ import de.terrestris.shogun.lib.model.Group; import de.terrestris.shogun.lib.model.security.permission.GroupClassPermission; -import java.util.List; -import java.util.Optional; -import javax.persistence.QueryHint; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.QueryHints; import org.springframework.stereotype.Repository; +import javax.persistence.QueryHint; +import java.util.List; +import java.util.Optional; + @Repository public interface GroupClassPermissionRepository extends BasePermissionRepository, JpaSpecificationExecutor { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/GroupInstancePermissionRepository.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/GroupInstancePermissionRepository.java index cb243e671..5a589abe3 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/GroupInstancePermissionRepository.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/GroupInstancePermissionRepository.java @@ -18,14 +18,15 @@ import de.terrestris.shogun.lib.model.Group; import de.terrestris.shogun.lib.model.security.permission.GroupInstancePermission; -import java.util.List; -import java.util.Optional; -import javax.persistence.QueryHint; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.QueryHints; import org.springframework.stereotype.Repository; +import javax.persistence.QueryHint; +import java.util.List; +import java.util.Optional; + @Repository public interface GroupInstancePermissionRepository extends BasePermissionRepository, JpaSpecificationExecutor { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/PermissionCollectionRepository.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/PermissionCollectionRepository.java index d4a6cc9f3..1aa693a3c 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/PermissionCollectionRepository.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/repository/security/permission/PermissionCollectionRepository.java @@ -18,12 +18,13 @@ import de.terrestris.shogun.lib.enumeration.PermissionCollectionType; import de.terrestris.shogun.lib.model.security.permission.PermissionCollection; -import java.util.Optional; -import javax.persistence.QueryHint; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.QueryHints; import org.springframework.stereotype.Repository; +import javax.persistence.QueryHint; +import java.util.Optional; + @Repository public interface PermissionCollectionRepository extends BasePermissionRepository, JpaSpecificationExecutor { diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/security/access/entity/BaseEntityPermissionEvaluator.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/security/access/entity/BaseEntityPermissionEvaluator.java index f7e4bdeed..29d55fad7 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/security/access/entity/BaseEntityPermissionEvaluator.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/security/access/entity/BaseEntityPermissionEvaluator.java @@ -25,20 +25,17 @@ import de.terrestris.shogun.lib.model.security.permission.PermissionCollection; import de.terrestris.shogun.lib.model.security.permission.UserClassPermission; import de.terrestris.shogun.lib.repository.BaseCrudRepository; -import de.terrestris.shogun.lib.service.BaseService; import de.terrestris.shogun.lib.service.security.permission.GroupClassPermissionService; import de.terrestris.shogun.lib.service.security.permission.GroupInstancePermissionService; import de.terrestris.shogun.lib.service.security.permission.UserClassPermissionService; import de.terrestris.shogun.lib.service.security.permission.UserInstancePermissionService; import de.terrestris.shogun.lib.service.security.provider.GroupProviderService; -import de.terrestris.shogun.lib.service.security.provider.UserProviderService; import lombok.extern.log4j.Log4j2; import org.apache.commons.lang3.StringUtils; import org.keycloak.representations.idm.GroupRepresentation; import org.keycloak.representations.idm.UserRepresentation; import org.springframework.aop.framework.AopProxyUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; import org.springframework.core.GenericTypeResolver; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ApplicationService.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ApplicationService.java index 50794a17f..6ac104e98 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ApplicationService.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ApplicationService.java @@ -16,8 +16,8 @@ */ package de.terrestris.shogun.lib.service; -import de.terrestris.shogun.lib.repository.ApplicationRepository; import de.terrestris.shogun.lib.model.Application; +import de.terrestris.shogun.lib.repository.ApplicationRepository; import org.springframework.stereotype.Service; @Service diff --git a/shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java b/shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java index f036b980b..20a4d030d 100644 --- a/shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java +++ b/shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java @@ -23,15 +23,15 @@ import lombok.extern.log4j.Log4j2; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.tomcat.util.http.fileupload.impl.InvalidContentTypeException; -import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.util.PatternMatchUtils; import org.springframework.web.multipart.MultipartFile; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; import java.util.List; import java.util.UUID; diff --git a/shogun-lib/src/test/java/de/terrestris/shogun/lib/service/BaseFileServiceTest.java b/shogun-lib/src/test/java/de/terrestris/shogun/lib/service/BaseFileServiceTest.java index a73fe740a..2c78be4f1 100644 --- a/shogun-lib/src/test/java/de/terrestris/shogun/lib/service/BaseFileServiceTest.java +++ b/shogun-lib/src/test/java/de/terrestris/shogun/lib/service/BaseFileServiceTest.java @@ -16,24 +16,14 @@ */ package de.terrestris.shogun.lib.service; -import de.terrestris.shogun.properties.FileUploadProperties; -import de.terrestris.shogun.properties.UploadProperties; import org.apache.tomcat.util.http.fileupload.InvalidFileNameException; -import org.apache.tomcat.util.http.fileupload.impl.InvalidContentTypeException; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; -import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; import static org.junit.Assert.assertThrows; import static org.junit.Assert.fail; -import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class BaseFileServiceTest { diff --git a/shogun-lib/src/test/java/de/terrestris/shogun/lib/service/GroupServiceTest.java b/shogun-lib/src/test/java/de/terrestris/shogun/lib/service/GroupServiceTest.java index 44d3dd2dc..8128683f6 100644 --- a/shogun-lib/src/test/java/de/terrestris/shogun/lib/service/GroupServiceTest.java +++ b/shogun-lib/src/test/java/de/terrestris/shogun/lib/service/GroupServiceTest.java @@ -29,7 +29,6 @@ import java.util.Optional; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; public class GroupServiceTest extends BaseServiceTest { diff --git a/shogun-proxy/src/main/java/de/terrestris/shogun/service/HttpProxyService.java b/shogun-proxy/src/main/java/de/terrestris/shogun/service/HttpProxyService.java index c65832408..f75fb4efc 100644 --- a/shogun-proxy/src/main/java/de/terrestris/shogun/service/HttpProxyService.java +++ b/shogun-proxy/src/main/java/de/terrestris/shogun/service/HttpProxyService.java @@ -24,7 +24,6 @@ import org.apache.http.HttpException; import org.apache.http.client.utils.URIBuilder; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -37,7 +36,9 @@ import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Set; /** * Simple HTTP Proxy service (forward proxy) From c1e9d778d43e8434dd6ad36e9ec5955ff1754ddd Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Thu, 31 Aug 2023 15:50:29 +0200 Subject: [PATCH 2/2] chore: optimize svg declarations/attributes/namespaces --- .../public/assets/lib/fontawesome/webfonts/fa-brands-400.svg | 2 +- .../public/assets/lib/fontawesome/webfonts/fa-regular-400.svg | 2 +- .../public/assets/lib/fontawesome/webfonts/fa-solid-900.svg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-brands-400.svg b/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-brands-400.svg index b9881a43b..cea13565d 100644 --- a/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-brands-400.svg +++ b/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-brands-400.svg @@ -1,6 +1,6 @@ - + Created by FontForge 20201107 at Wed Aug 4 12:25:29 2021 By Robert Madole diff --git a/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-regular-400.svg b/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-regular-400.svg index 463af27c0..2f1bee766 100644 --- a/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-regular-400.svg +++ b/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-regular-400.svg @@ -1,6 +1,6 @@ - + Created by FontForge 20201107 at Wed Aug 4 12:25:29 2021 By Robert Madole diff --git a/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-solid-900.svg b/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-solid-900.svg index 00296e959..16712f022 100644 --- a/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-solid-900.svg +++ b/shogun-boot/src/main/resources/public/assets/lib/fontawesome/webfonts/fa-solid-900.svg @@ -1,6 +1,6 @@ - + Created by FontForge 20201107 at Wed Aug 4 12:25:29 2021 By Robert Madole