View Javadoc

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