View Javadoc
1   package org.kuali.ole.deliver.calendar.bo;
2   
3   import org.kuali.rice.krad.bo.PersistableBusinessObject;
4   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
5   
6   import java.sql.Timestamp;
7   import java.util.*;
8   
9   /**
10   * Created with IntelliJ IDEA.
11   * User: palanivel
12   * Date: 7/20/13
13   * Time: 4:13 PM
14   * To change this template use File | Settings | File Templates.
15   */
16  public class OleCalendar extends PersistableBusinessObjectBase {
17  
18      private String calendarId;
19      private String calendarDescription;
20      private Timestamp beginDate;
21      private Timestamp endDate;
22      private List<OleCalendarWeek> oleCalendarWeekList = new ArrayList<>();
23      private List<OleCalendarExceptionDate> oleCalendarExceptionDateList = new ArrayList<>();
24      private List<OleCalendarExceptionPeriod> oleCalendarExceptionPeriodList = new ArrayList<>();
25      private List<OleCalendarWeek> oleCalendarWeekDeleteList = new ArrayList<>();
26      private List<OleCalendarExceptionDate> oleCalendarExceptionDateDeleteList = new ArrayList<>();
27      private List<OleCalendarExceptionPeriod> oleCalendarExceptionPeriodDeleteList = new ArrayList<>();
28      private List<OleCalendarExceptionPeriodWeek> oleCalendarExceptionPeriodDeleteWeekList = new ArrayList<>();
29      private OleCalendarGroup oleCalendarGroup;
30      private String calendarGroupId;
31      private boolean hideTime = true;
32  
33      private String endDateYesMessage;
34      private String endDateNoMessage;
35      private String message;
36      private boolean endDateYesFlag;
37      private boolean endDateNoFlag;
38      private boolean cancelOperationEndDateFlag;
39      private boolean cancelOperationFlag;
40  
41      public void sortCalendarWeek(OleCalendar oleCalendar){ //added for OLE-5381
42  
43        Collections.sort(oleCalendar.getOleCalendarWeekList(), new Comparator() {
44              @Override
45              public int compare(Object o1, Object o2) {
46                  OleCalendarWeek oleCalendarWeek1 = (OleCalendarWeek) o1;
47                  OleCalendarWeek oleCalendarWeek2 = (OleCalendarWeek) o2;
48                  return oleCalendarWeek1.getStartDay().compareTo(oleCalendarWeek2.getStartDay());
49              }
50        });
51        for(OleCalendarExceptionPeriod oleCalendarExceptionPeriod:oleCalendar.getOleCalendarExceptionPeriodList()){
52              Collections.sort(oleCalendarExceptionPeriod.getOleCalendarExceptionPeriodWeekList(), new Comparator() {
53                  @Override
54                  public int compare(Object o1, Object o2) {
55                      OleCalendarExceptionPeriodWeek oleCalendarPeriodWeek1 = (OleCalendarExceptionPeriodWeek) o1;
56                      OleCalendarExceptionPeriodWeek oleCalendarPeriodWeek2 = (OleCalendarExceptionPeriodWeek) o2;
57                      return oleCalendarPeriodWeek1.getStartDay().compareTo(oleCalendarPeriodWeek2.getStartDay());
58                  }
59              });
60        }
61      }
62  
63      public List<OleCalendarWeek> getOleCalendarWeekDeleteList() {
64          return oleCalendarWeekDeleteList;
65      }
66  
67      public void setOleCalendarWeekDeleteList(List<OleCalendarWeek> oleCalendarWeekDeleteList) {
68          this.oleCalendarWeekDeleteList = oleCalendarWeekDeleteList;
69      }
70  
71      public List<OleCalendarExceptionDate> getOleCalendarExceptionDateDeleteList() {
72          return oleCalendarExceptionDateDeleteList;
73      }
74  
75      public void setOleCalendarExceptionDateDeleteList(List<OleCalendarExceptionDate> oleCalendarExceptionDateDeleteList) {
76          this.oleCalendarExceptionDateDeleteList = oleCalendarExceptionDateDeleteList;
77      }
78  
79      public List<OleCalendarExceptionPeriod> getOleCalendarExceptionPeriodDeleteList() {
80          return oleCalendarExceptionPeriodDeleteList;
81      }
82  
83      public void setOleCalendarExceptionPeriodDeleteList(List<OleCalendarExceptionPeriod> oleCalendarExceptionPeriodDeleteList) {
84          this.oleCalendarExceptionPeriodDeleteList = oleCalendarExceptionPeriodDeleteList;
85      }
86  
87      public List<OleCalendarExceptionPeriodWeek> getOleCalendarExceptionPeriodDeleteWeekList() {
88          return oleCalendarExceptionPeriodDeleteWeekList;
89      }
90  
91      public void setOleCalendarExceptionPeriodDeleteWeekList(List<OleCalendarExceptionPeriodWeek> oleCalendarExceptionPeriodDeleteWeekList) {
92          this.oleCalendarExceptionPeriodDeleteWeekList = oleCalendarExceptionPeriodDeleteWeekList;
93      }
94  
95      public String getMessage() {
96          return message;
97      }
98  
99      public void setMessage(String message) {
100         this.message = message;
101     }
102 
103     public String getEndDateYesMessage() {
104         return endDateYesMessage;
105     }
106 
107     public void setEndDateYesMessage(String endDateYesMessage) {
108         this.endDateYesMessage = endDateYesMessage;
109     }
110 
111     public String getEndDateNoMessage() {
112         return endDateNoMessage;
113     }
114 
115     public void setEndDateNoMessage(String endDateNoMessage) {
116         this.endDateNoMessage = endDateNoMessage;
117     }
118 
119     private String chronologicalSequence;
120 
121     public String getChronologicalSequence() {
122         return chronologicalSequence;
123     }
124 
125     public void setChronologicalSequence(String chronologicalSequence) {
126         this.chronologicalSequence = chronologicalSequence;
127     }
128 
129     private String exceptionDayChecking;  //added for holiday
130 
131     public String getExceptionDayChecking() {
132         return exceptionDayChecking;
133     }
134 
135     public void setExceptionDayChecking(String exceptionDayChecking) {
136         this.exceptionDayChecking = exceptionDayChecking;
137     }
138 
139     public String getCalendarId() {
140         return calendarId;
141     }
142 
143     public void setCalendarId(String calendarId) {
144         this.calendarId = calendarId;
145     }
146 
147     public String getCalendarDescription() {
148         return calendarDescription;
149     }
150 
151     public void setCalendarDescription(String calendarDescription) {
152         this.calendarDescription = calendarDescription;
153     }
154 
155     public Timestamp getBeginDate() {
156         return beginDate;
157     }
158 
159     public void setBeginDate(Timestamp beginDate) {
160         this.beginDate = beginDate;
161     }
162 
163     public Timestamp getEndDate() {
164         return endDate;
165     }
166 
167     public void setEndDate(Timestamp endDate) {
168         this.endDate = endDate;
169     }
170 
171     public List<OleCalendarWeek> getOleCalendarWeekList() {
172         return oleCalendarWeekList;
173     }
174 
175     public void setOleCalendarWeekList(List<OleCalendarWeek> oleCalendarWeekList) {
176         this.oleCalendarWeekList = oleCalendarWeekList;
177     }
178 
179     public List<OleCalendarExceptionDate> getOleCalendarExceptionDateList() {
180         return oleCalendarExceptionDateList;
181     }
182 
183     public void setOleCalendarExceptionDateList(List<OleCalendarExceptionDate> oleCalendarExceptionDateList) {
184         this.oleCalendarExceptionDateList = oleCalendarExceptionDateList;
185     }
186 
187     public List<OleCalendarExceptionPeriod> getOleCalendarExceptionPeriodList() {
188         return oleCalendarExceptionPeriodList;
189     }
190 
191     public void setOleCalendarExceptionPeriodList(List<OleCalendarExceptionPeriod> oleCalendarExceptionPeriodList) {
192         this.oleCalendarExceptionPeriodList = oleCalendarExceptionPeriodList;
193     }
194 
195     public OleCalendarGroup getOleCalendarGroup() {
196         return oleCalendarGroup;
197     }
198 
199     public void setOleCalendarGroup(OleCalendarGroup oleCalendarGroup) {
200         this.oleCalendarGroup = oleCalendarGroup;
201     }
202 
203     public String getCalendarGroupId() {
204         return calendarGroupId;
205     }
206 
207     public void setCalendarGroupId(String calendarGroupId) {
208         this.calendarGroupId = calendarGroupId;
209     }
210 
211     public boolean isHideTime() {
212         return hideTime;
213     }
214 
215     public void setHideTime(boolean hideTime) {
216         this.hideTime = hideTime;
217     }
218 
219     public boolean isEndDateYesFlag() {
220         return endDateYesFlag;
221     }
222 
223     public void setEndDateYesFlag(boolean endDateYesFlag) {
224         this.endDateYesFlag = endDateYesFlag;
225     }
226 
227     public boolean isEndDateNoFlag() {
228         return endDateNoFlag;
229     }
230 
231     public void setEndDateNoFlag(boolean endDateNoFlag) {
232         this.endDateNoFlag = endDateNoFlag;
233     }
234 
235     public boolean isCancelOperationFlag() {
236         return cancelOperationFlag;
237     }
238 
239     public void setCancelOperationFlag(boolean cancelOperationFlag) {
240         this.cancelOperationFlag = cancelOperationFlag;
241     }
242 
243     public boolean isCancelOperationEndDateFlag() {
244         return cancelOperationEndDateFlag;
245     }
246 
247     public void setCancelOperationEndDateFlag(boolean cancelOperationEndDateFlag) {
248         this.cancelOperationEndDateFlag = cancelOperationEndDateFlag;
249     }
250 
251     @Override
252     public List<Collection<PersistableBusinessObject>> buildListOfDeletionAwareLists() {
253         List<Collection<PersistableBusinessObject>> collectionList = new ArrayList<>();
254         collectionList.add((Collection)getOleCalendarExceptionDateList());
255         collectionList.add((Collection)getOleCalendarExceptionPeriodList());
256         collectionList.add((Collection)getOleCalendarWeekList());
257         return collectionList;
258     }
259 }