From 54df1e64385c6a62a6b24c739e9c012bcc0b0a76 Mon Sep 17 00:00:00 2001 From: Sanghoon Jeong <67852689+wjdtkdgns@users.noreply.github.com> Date: Fri, 25 Aug 2023 21:27:06 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20recycle=20500=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EB=8C=80=EC=9D=91=20(#139)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [fix] list 생성 방식 수정 #136 * [chore] spotless 적용 #136 --- .../service/ClearDeletedObjectUseCase.java | 16 ++++++++-------- .../service/ClearOldDeletedObjectUseCase.java | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Api/src/main/java/allchive/server/api/recycle/service/ClearDeletedObjectUseCase.java b/Api/src/main/java/allchive/server/api/recycle/service/ClearDeletedObjectUseCase.java index 335f682f..17ce7d2c 100644 --- a/Api/src/main/java/allchive/server/api/recycle/service/ClearDeletedObjectUseCase.java +++ b/Api/src/main/java/allchive/server/api/recycle/service/ClearDeletedObjectUseCase.java @@ -21,6 +21,7 @@ import allchive.server.infrastructure.s3.service.S3DeleteObjectService; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.springframework.transaction.annotation.Transactional; @@ -60,24 +61,23 @@ public void execute(ClearDeletedObjectRequest request) { private void deleteS3Object(List contents, List archivings) { List imageKeys = - new ArrayList<>( - archivings.stream() - .map(Archiving::getImageUrl) - .filter(url -> !url.isEmpty()) - .filter(url -> !url.startsWith("http")) - .toList()); + archivings.stream() + .map(Archiving::getImageUrl) + .filter(url -> !url.isEmpty()) + .filter(url -> !url.startsWith("http")) + .collect(Collectors.toList()); imageKeys.addAll( contents.stream() .filter(content -> content.getContentType().equals(ContentType.IMAGE)) .map(Content::getImageUrl) .filter(url -> !url.isEmpty()) .filter(url -> !url.startsWith("http")) - .toList()); + .collect(Collectors.toList())); s3DeleteObjectService.deleteS3Object(imageKeys); } private List getContentsId(List contents, ClearDeletedObjectRequest request) { - List contentsId = contents.stream().map(Content::getId).toList(); + List contentsId = contents.stream().map(Content::getId).collect(Collectors.toList()); if (!request.getContentIds().isEmpty()) { if (contentsId.isEmpty()) { contentsId = new ArrayList<>(); diff --git a/Api/src/main/java/allchive/server/api/recycle/service/ClearOldDeletedObjectUseCase.java b/Api/src/main/java/allchive/server/api/recycle/service/ClearOldDeletedObjectUseCase.java index b6d5ccc7..161e2bcf 100644 --- a/Api/src/main/java/allchive/server/api/recycle/service/ClearOldDeletedObjectUseCase.java +++ b/Api/src/main/java/allchive/server/api/recycle/service/ClearOldDeletedObjectUseCase.java @@ -20,6 +20,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Scheduled; @@ -63,19 +64,18 @@ public void executeSchedule() { private void deleteS3Object(List contents, List archivings) { List imageKeys = - new ArrayList<>( - archivings.stream() - .map(Archiving::getImageUrl) - .filter(url -> !url.isEmpty()) - .filter(url -> !url.startsWith("http")) - .toList()); + archivings.stream() + .map(Archiving::getImageUrl) + .filter(url -> !url.isEmpty()) + .filter(url -> !url.startsWith("http")) + .collect(Collectors.toList()); imageKeys.addAll( contents.stream() .filter(content -> content.getContentType().equals(ContentType.IMAGE)) .map(Content::getImageUrl) .filter(url -> !url.isEmpty()) .filter(url -> !url.startsWith("http")) - .toList()); + .collect(Collectors.toList())); s3DeleteObjectService.deleteS3Object(imageKeys); } @@ -91,7 +91,7 @@ private List getContentsId(List recycles, List contents) recycles.stream() .filter(recycle -> recycle.getRecycleType().equals(RecycleType.CONTENT)) .map(Recycle::getContentId) - .toList(); + .collect(Collectors.toList()); if (contentIds.isEmpty()) { contentIds = new ArrayList<>();