@@ -66,4 +66,56 @@ public enum ExceptionType {
6666 @ AttributeOverride (name = "untilDate" , column = @ Column (name = "modified_until_date" ))
6767 })
6868 private RepeatRuleEmbeddable modifiedRepeatRule ;
69+
70+ // 정적 팩토리 메서드 - 수정 예외
71+ public static StudyPlanException createModified (StudyPlan studyPlan , LocalDate exceptionDate ,
72+ ApplyScope applyScope , String modifiedSubject ,
73+ LocalDateTime modifiedStartDate , LocalDateTime modifiedEndDate ,
74+ Color modifiedColor , RepeatRuleEmbeddable modifiedRepeatRule ) {
75+ StudyPlanException exception = new StudyPlanException ();
76+ exception .studyPlan = studyPlan ;
77+ exception .exceptionDate = exceptionDate ;
78+ exception .exceptionType = ExceptionType .MODIFIED ;
79+ exception .applyScope = applyScope ;
80+ exception .modifiedSubject = modifiedSubject ;
81+ exception .modifiedStartDate = modifiedStartDate ;
82+ exception .modifiedEndDate = modifiedEndDate ;
83+ exception .modifiedColor = modifiedColor ;
84+ exception .modifiedRepeatRule = modifiedRepeatRule ;
85+ return exception ;
86+ }
87+
88+ // 정적 팩토리 메서드 - 삭제 예외
89+ public static StudyPlanException createDeleted (StudyPlan studyPlan , LocalDate exceptionDate ,
90+ ApplyScope applyScope ) {
91+ StudyPlanException exception = new StudyPlanException ();
92+ exception .studyPlan = studyPlan ;
93+ exception .exceptionDate = exceptionDate ;
94+ exception .exceptionType = ExceptionType .DELETED ;
95+ exception .applyScope = applyScope ;
96+ return exception ;
97+ }
98+
99+ // 수정 내용 업데이트
100+ public void updateModifiedContent (String subject , LocalDateTime startDate ,
101+ LocalDateTime endDate , Color color ,
102+ RepeatRuleEmbeddable repeatRule , ApplyScope applyScope ) {
103+ if (subject != null ) this .modifiedSubject = subject ;
104+ if (startDate != null ) this .modifiedStartDate = startDate ;
105+ if (endDate != null ) this .modifiedEndDate = endDate ;
106+ if (color != null ) this .modifiedColor = color ;
107+ if (repeatRule != null ) this .modifiedRepeatRule = repeatRule ;
108+ if (applyScope != null ) this .applyScope = applyScope ;
109+ }
110+
111+ // 삭제 타입으로 변경
112+ public void changeToDeleted (ApplyScope applyScope ) {
113+ this .exceptionType = ExceptionType .DELETED ;
114+ this .applyScope = applyScope ;
115+ this .modifiedSubject = null ;
116+ this .modifiedStartDate = null ;
117+ this .modifiedEndDate = null ;
118+ this .modifiedColor = null ;
119+ this .modifiedRepeatRule = null ;
120+ }
69121}
0 commit comments