Skip to content

Commit

Permalink
[chore] spotless 적용 #154
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdtkdgns committed Aug 30, 2023
1 parent e01c117 commit ec2229b
Show file tree
Hide file tree
Showing 28 changed files with 71 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public class DeleteArchivingUseCase {
private final RecycleDomainService recycleDomainService;

@Transactional
@DistributedLock(lockType = DistributedLockType.ARCHIVING, identifier ={"archivingId"})
@DistributedLock(
lockType = DistributedLockType.ARCHIVING,
identifier = {"archivingId"})
public void execute(Long archivingId) {
Long userId = SecurityUtil.getCurrentUserId();
validateExecution(archivingId, userId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package allchive.server.api.archiving.service;


import allchive.server.api.config.security.SecurityUtil;
import allchive.server.core.annotation.UseCase;
import allchive.server.domain.common.aop.distributedLock.DistributedLock;
import allchive.server.domain.common.enums.DistributedLockType;
Expand All @@ -17,7 +16,9 @@ public class UpdateArchivingPinUseCase {
private final ArchivingDomainService archivingDomainService;

@Transactional
@DistributedLock(lockType = DistributedLockType.ARCHIVING_PIN, identifier ={"archivingId", "userId"})
@DistributedLock(
lockType = DistributedLockType.ARCHIVING_PIN,
identifier = {"archivingId", "userId"})
public void execute(Long archivingId, Boolean cancel, Long userId) {
validateExecution(archivingId, userId, cancel);
archivingDomainService.updatePin(archivingId, userId, !cancel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static allchive.server.core.consts.AllchiveConst.MINUS_ONE;
import static allchive.server.core.consts.AllchiveConst.PLUS_ONE;

import allchive.server.api.config.security.SecurityUtil;
import allchive.server.core.annotation.UseCase;
import allchive.server.domain.common.aop.distributedLock.DistributedLock;
import allchive.server.domain.common.enums.DistributedLockType;
Expand All @@ -27,7 +26,9 @@ public class UpdateArchivingScrapUseCase {
private final ScrapValidator scrapValidator;

@Transactional
@DistributedLock(lockType = DistributedLockType.ARCHIVING_SCRAP, identifier ={"archivingId", "userId"})
@DistributedLock(
lockType = DistributedLockType.ARCHIVING_SCRAP,
identifier = {"archivingId", "userId"})
public void execute(Long archivingId, Boolean cancel, Long userId) {
validateExecution(archivingId, userId, cancel);
User user = userAdaptor.findById(userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
import allchive.server.api.common.util.UrlUtil;
import allchive.server.api.config.security.SecurityUtil;
import allchive.server.core.annotation.UseCase;
import allchive.server.domain.common.aop.distributedLock.DistributedLock;
import allchive.server.domain.common.enums.DistributedLockType;
import allchive.server.core.event.Event;
import allchive.server.core.event.events.s3.S3ImageDeleteEvent;
import allchive.server.domain.common.aop.distributedLock.DistributedLock;
import allchive.server.domain.common.enums.DistributedLockType;
import allchive.server.domain.domains.archiving.adaptor.ArchivingAdaptor;
import allchive.server.domain.domains.archiving.domain.Archiving;
import allchive.server.domain.domains.archiving.service.ArchivingDomainService;
import allchive.server.domain.domains.archiving.validator.ArchivingValidator;
import allchive.server.infrastructure.s3.service.S3DeleteObjectService;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
Expand All @@ -26,7 +25,9 @@ public class UpdateArchivingUseCase {
private final ArchivingValidator archivingValidator;

@Transactional
@DistributedLock(lockType = DistributedLockType.ARCHIVING, identifier ={"archivingId"})
@DistributedLock(
lockType = DistributedLockType.ARCHIVING,
identifier = {"archivingId"})
public void execute(Long archivingId, UpdateArchivingRequest request) {
validateExecution(archivingId);
Archiving archiving = archivingAdaptor.findById(archivingId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public class WithdrawUserUseCase {
private final ArchivingDomainService archivingDomainService;

@Transactional
@DistributedLock(lockType = DistributedLockType.USER, identifier ={"userId"})
@DistributedLock(
lockType = DistributedLockType.USER,
identifier = {"userId"})
public void execute(String appleAccessToken, String referer, Long userId) {
User user = userAdaptor.findById(userId);
// oauth쪽 탈퇴
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public class DeleteBlockUseCase {
private final UserAdaptor userAdaptor;

@Transactional
@DistributedLock(lockType = DistributedLockType.BLOCK, identifier ={"fromUserId, toUserId"})
@DistributedLock(
lockType = DistributedLockType.BLOCK,
identifier = {"fromUserId, toUserId"})
public BlockResponse execute(BlockRequest request, Long fromUserId, Long toUserId) {
Long userId = SecurityUtil.getCurrentUserId();
validateExecution(userId, request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
import allchive.server.domain.domains.content.domain.enums.ContentType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.Getter;

import javax.validation.constraints.Positive;
import lombok.Getter;

@Getter
public class UpdateContentRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public class DeleteContentUseCase {
private final ArchivingAsyncDomainService archivingAsyncDomainService;

@Transactional
@DistributedLock(lockType = DistributedLockType.CONTENT, identifier ={"contentId"})
@DistributedLock(
lockType = DistributedLockType.CONTENT,
identifier = {"contentId"})
public void execute(Long contentId) {
Long userId = SecurityUtil.getCurrentUserId();
validateExecution(contentId, userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public class UpdateContentUseCase {
private final ArchivingAsyncDomainService archivingAsyncDomainService;

@Transactional
@DistributedLock(lockType = DistributedLockType.CONTENT, identifier ={"contentId"})
@DistributedLock(
lockType = DistributedLockType.CONTENT,
identifier = {"contentId"})
public void execute(Long contentId, UpdateContentRequest request) {
validateExecution(contentId, request);
regenerateContentTagGroup(contentId, request.getTagIds());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/recycles")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package allchive.server.api.recycle.service;


import allchive.server.api.config.security.SecurityUtil;
import allchive.server.api.recycle.model.dto.request.ClearDeletedObjectRequest;
import allchive.server.core.annotation.UseCase;
import allchive.server.core.event.Event;
Expand Down Expand Up @@ -46,7 +45,9 @@ public class ClearDeletedObjectUseCase {
private final ArchivingAdaptor archivingAdaptor;

@Transactional
@DistributedLock(lockType = DistributedLockType.RECYCLE, identifier ={"userId"})
@DistributedLock(
lockType = DistributedLockType.RECYCLE,
identifier = {"userId"})
public void execute(ClearDeletedObjectRequest request, Long userId) {
validateExecution(userId, request);
List<Content> contents = contentAdaptor.findAllByArchivingIds(request.getArchivingIds());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static allchive.server.core.consts.AllchiveConst.PLUS_ONE;

import allchive.server.api.config.security.SecurityUtil;
import allchive.server.api.recycle.model.dto.request.RestoreDeletedObjectRequest;
import allchive.server.core.annotation.UseCase;
import allchive.server.domain.common.aop.distributedLock.DistributedLock;
Expand Down Expand Up @@ -30,7 +29,9 @@ public class RestoreDeletedObjectUseCase {
private final ContentAdaptor contentAdaptor;

@Transactional
@DistributedLock(lockType = DistributedLockType.RECYCLE, identifier ={"userId"})
@DistributedLock(
lockType = DistributedLockType.RECYCLE,
identifier = {"userId"})
public void execute(RestoreDeletedObjectRequest request, Long userId) {
validateExecution(request, userId);
archivingDomainService.restoreByIdIn(request.getArchivingIds());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public class DeleteTagUseCase {
private final TagDomainService tagDomainService;

@Transactional
@DistributedLock(lockType = DistributedLockType.TAG, identifier ={"tagId"})
@DistributedLock(
lockType = DistributedLockType.TAG,
identifier = {"tagId"})
public void execute(Long tagId) {
validateExecution(tagId);
Tag tag = tagAdaptor.findById(tagId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public class UpdateTagUseCase {
private final TagDomainService tagDomainService;

@Transactional
@DistributedLock(lockType = DistributedLockType.TAG, identifier ={"tagId"})
@DistributedLock(
lockType = DistributedLockType.TAG,
identifier = {"tagId"})
public void execute(Long tagId, UpdateTagRequest request) {
validateExecution(tagId);
tagDomainService.updateTag(tagId, request.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import allchive.server.api.common.util.UrlUtil;
import allchive.server.api.config.security.SecurityUtil;
import allchive.server.api.user.model.dto.request.UpdateUserInfoRequest;
import allchive.server.core.annotation.UseCase;
import allchive.server.core.event.Event;
Expand All @@ -27,7 +26,9 @@ public class UpdateUserInfoUseCase {
private final S3DeleteObjectService s3DeleteObjectService;

@Transactional
@DistributedLock(lockType = DistributedLockType.USER, identifier ={"userId"})
@DistributedLock(
lockType = DistributedLockType.USER,
identifier = {"userId"})
public void execute(UpdateUserInfoRequest request, Long userId) {
validateExecution(userId);
eliminateOldImage(userId, request.getImgUrl());
Expand Down
4 changes: 2 additions & 2 deletions Core/src/main/java/allchive/server/core/CoreApplication.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package allchive.server.core;


import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class CoreApplication {
}
public class CoreApplication {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package allchive.server.domain;


import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DomainApplication {
}
public class DomainApplication {}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import allchive.server.domain.common.enums.DistributedLockType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
Expand All @@ -38,10 +37,15 @@ public Object lock(final ProceedingJoinPoint joinPoint) throws Throwable {
private String getKey(ProceedingJoinPoint joinPoint, DistributedLock distributedLock) {
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
String[] methodParameterNames = methodSignature.getParameterNames();
return REDISSON_LOCK_PREFIX + distributedLock.lockType().getLockName() + "-" + createDynamicKey(methodParameterNames, joinPoint.getArgs(), distributedLock.identifier());
return REDISSON_LOCK_PREFIX
+ distributedLock.lockType().getLockName()
+ "-"
+ createDynamicKey(
methodParameterNames, joinPoint.getArgs(), distributedLock.identifier());
}

private String createDynamicKey(String[] methodParameterNames, Object[] methodArgs, String[] identifiers) {
private String createDynamicKey(
String[] methodParameterNames, Object[] methodArgs, String[] identifiers) {
List<String> resultList = new ArrayList<>();
for (String identifier : identifiers) {
int indexOfKey = Arrays.asList(methodParameterNames).indexOf(identifier);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package allchive.server.domain.common.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ public Slice<Archiving> querySliceArchivingExceptBlock(
publicStatusTrue(),
categoryEq(category),
deleteStatusFalse())
.orderBy(
scrabListDesc(archivingIdList),
sorting.get(0),
sorting.get(1)
)
.orderBy(scrabListDesc(archivingIdList), sorting.get(0), sorting.get(1))
.offset(pageable.getOffset())
.limit(pageable.getPageSize() + PLUS_ONE)
.fetch();
Expand Down Expand Up @@ -85,9 +81,7 @@ public Slice<Archiving> querySliceArchivingByIdInExceptBlockList(
userIdNotIn(blockList),
categoryEq(category),
deleteStatusFalse())
.orderBy(
sorting.get(0),
sorting.get(1))
.orderBy(sorting.get(0), sorting.get(1))
.offset(pageable.getOffset())
.limit(pageable.getPageSize() + PLUS_ONE)
.fetch();
Expand Down Expand Up @@ -221,7 +215,7 @@ private OrderSpecifier<Long> scrapCntDesc() {
return archiving.scrapCnt.desc();
}

private <T> List<OrderSpecifier> createdAtAndscrapCntDescPriority(Sort sort){
private <T> List<OrderSpecifier> createdAtAndscrapCntDescPriority(Sort sort) {
if (sort.equals(Sort.by("popular"))) {
return List.of(archiving.scrapCnt.desc(), archiving.createdAt.desc());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public class ArchivingAsyncDomainService {
private final ArchivingDomainService archivingDomainService;

@Async(value = "archivingContentCntTaskExecutor")
@DistributedLock(lockType = DistributedLockType.ARCHIVING, identifier ={"archivingId"})
@DistributedLock(
lockType = DistributedLockType.ARCHIVING,
identifier = {"archivingId"})
public void updateContentCnt(Long archivingId, ContentType contentType, int i) {
archivingDomainService.updateContentCnt(archivingId, contentType, i);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package allchive.server.domain.domains.archiving.service;

import static allchive.server.core.consts.AllchiveConst.MINUS_ONE;
import static allchive.server.core.consts.AllchiveConst.PLUS_ONE;

import allchive.server.core.annotation.DomainService;
import allchive.server.domain.domains.archiving.adaptor.ArchivingAdaptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ public List<Recycle> queryRecycleByUserIdAndArchivingIdInOrUserIdAndContentIdIn(
.fetch();
}

private BooleanExpression userIdEq(
Long userId) {
private BooleanExpression userIdEq(Long userId) {
return recycle.userId.eq(userId);
}


private BooleanExpression archivingIdInOrContentIdIn(
List<Long> archivingIdList, List<Long> contentIdList) {
return recycle.archivingId.in(archivingIdList).or(recycle.contentId.in(contentIdList));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package allchive.server.domain;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.function.Executable;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicLong;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.function.Executable;

@Slf4j
public class CalculateCurrentExecutionSupporter {
Expand All @@ -33,4 +33,3 @@ public static void execute(Executable executable, AtomicLong successCount)
latch.await();
}
}

Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package allchive.server.domain;


import java.lang.annotation.*;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import java.lang.annotation.*;

/** 도메인 모듈의 통합테스트의 편의성을 위해서 만든 어노테이션 -이찬진 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
Expand Down
Loading

0 comments on commit ec2229b

Please sign in to comment.