-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 최단 거리 구하는 로직 수정 - Line, Station 생성, 수정 시간 auditing 사용 - line update 로직에 색상 업데이트 추가 - exception 수정, 공백 제거 - Auditing configuration 추가 - transactional 추가 - test 로직 추가
- Loading branch information
Showing
9 changed files
with
89 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
package wooteco.subway.admin.dto; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Function; | ||
|
||
import wooteco.subway.admin.domain.LineStation; | ||
import wooteco.subway.admin.exception.IllegalTypeNameException; | ||
|
||
public enum PathType { | ||
DISTANCE(LineStation::getDistance), | ||
DURATION(LineStation::getDuration); | ||
|
||
private final Function<LineStation, Integer> function; | ||
|
||
PathType( | ||
Function<LineStation, Integer> function) { | ||
PathType(Function<LineStation, Integer> function) { | ||
this.function = function; | ||
} | ||
|
||
public int getWeight(LineStation lineStation){ | ||
public int getWeight(LineStation lineStation) { | ||
return function.apply(lineStation); | ||
} | ||
|
||
public static PathType of(String typeName){ | ||
return valueOf(typeName.toUpperCase()); | ||
public static PathType of(String typeName) { | ||
String upperCaseName = typeName.toUpperCase(); | ||
if (!Objects.equals(upperCaseName, DURATION.name()) && !Objects.equals(upperCaseName, | ||
DISTANCE.name())) { | ||
throw new IllegalTypeNameException(typeName); | ||
} | ||
return valueOf(upperCaseName); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/wooteco/subway/admin/exception/IllegalTypeNameException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package wooteco.subway.admin.exception; | ||
|
||
public class IllegalTypeNameException extends BusinessException { | ||
|
||
public IllegalTypeNameException(String typeName) { | ||
super(typeName +"방식의 경로는 지원하지 않습니다."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters