From 7203934c96f0f89b293927bbf29b20d617780e98 Mon Sep 17 00:00:00 2001 From: Albert Tregnaghi Date: Thu, 5 Dec 2024 08:06:27 +0100 Subject: [PATCH] Minor changes #321 - removed auto wire annotation where not necessary - made some fields final - fixed typos - removed unnecessary log output --- .../domain/scan/asset/AssetService.java | 26 ++++++---------- .../domain/scan/template/TemplateService.java | 30 ++++++++----------- .../scan/asset/AssetFileInformationTest.java | 4 +-- .../config/UseCaseAdminUploadsAssetFile.java | 2 +- .../spring/AbstractSharedVolumeStorage.java | 1 - 5 files changed, 24 insertions(+), 39 deletions(-) diff --git a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/asset/AssetService.java b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/asset/AssetService.java index 38e4306b3..28965552c 100644 --- a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/asset/AssetService.java +++ b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/asset/AssetService.java @@ -13,7 +13,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -44,27 +43,20 @@ public class AssetService { private static final Logger LOG = LoggerFactory.getLogger(AssetService.class); - private AssetFileRepository repository; + private final AssetFileRepository repository; - private UserInputAssertion inputAssertion; + private final UserInputAssertion inputAssertion; - private CheckSumSupport checkSumSupport; + private final CheckSumSupport checkSumSupport; - private StorageService storageService; + private final StorageService storageService; - /* @formatter:off */ - AssetService( - @Autowired AssetFileRepository repository, - @Autowired UserInputAssertion inputAssertion, - @Autowired CheckSumSupport checkSumSupport, - @Autowired StorageService storageService - ) { - this.repository=repository; - this.inputAssertion=inputAssertion; - this.checkSumSupport=checkSumSupport; - this.storageService=storageService; + AssetService(AssetFileRepository repository, UserInputAssertion inputAssertion, CheckSumSupport checkSumSupport, StorageService storageService) { + this.repository = repository; + this.inputAssertion = inputAssertion; + this.checkSumSupport = checkSumSupport; + this.storageService = storageService; } - /* @formatter:on */ @UseCaseAdminDeletesAssetCompletely(@Step(number = 2, name = "Services deletes all asset parts")) @Transactional diff --git a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/template/TemplateService.java b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/template/TemplateService.java index 48e57fc8f..ad66b38d3 100644 --- a/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/template/TemplateService.java +++ b/sechub-scan/src/main/java/com/mercedesbenz/sechub/domain/scan/template/TemplateService.java @@ -10,7 +10,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.mercedesbenz.sechub.commons.model.template.TemplateDefinition; @@ -33,26 +32,21 @@ public class TemplateService { private static final Logger LOG = LoggerFactory.getLogger(TemplateService.class); - private TemplateRepository repository; + private final TemplateRepository repository; - private ScanProjectConfigService configService; + private final ScanProjectConfigService configService; - private TemplateTypeScanConfigIdResolver resolver; + private final TemplateTypeScanConfigIdResolver resolver; - private UserInputAssertion inputAssertion; + private final UserInputAssertion inputAssertion; -/* @formatter:off */ - TemplateService( - @Autowired TemplateRepository repository, - @Autowired ScanProjectConfigService configService, - @Autowired UserInputAssertion inputAssertion, - @Autowired TemplateTypeScanConfigIdResolver resolver) { - this.repository=repository; - this.configService=configService; - this.resolver=resolver; - this.inputAssertion=inputAssertion; + TemplateService(TemplateRepository repository, ScanProjectConfigService configService, UserInputAssertion inputAssertion, + TemplateTypeScanConfigIdResolver resolver) { + this.repository = repository; + this.configService = configService; + this.resolver = resolver; + this.inputAssertion = inputAssertion; } - /* @formatter:on */ @UseCaseAdminCreatesOrUpdatesTemplate(@Step(number = 2, name = "Service creates or updates template")) public void createOrUpdateTemplate(String templateId, TemplateDefinition newTemplateDefinition) { @@ -69,9 +63,9 @@ public void createOrUpdateTemplate(String templateId, TemplateDefinition newTemp Optional