View Javadoc

1   /* Copyright 2011 The Kuali Foundation
2    *
3    * Licensed under the Educational Community License, Version 1.0 (the
4    * "License"); you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    * http://www.opensource.org/licenses/ecl1.php
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12   * License for the specific language governing permissions and limitations under
13   * the License.
14   */
15  package org.kuali.student.enrollment.class2.acal.dto;
16  
17  import org.kuali.student.r2.core.acal.dto.HolidayCalendarInfo;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  /**
24   * This is a wrapper for the holiday Calendar associated with academic calendar
25   *
26   * Note: This wrapper is being used only in Academic Calendar.
27   *
28   * @author Kuali Student Team
29   */
30  public class HolidayCalendarWrapper {
31  
32      private String id;
33      private String adminOrgName;
34      private String stateName;
35      private String acalStartYear;
36  
37      private HolidayCalendarInfo holidayCalendarInfo;
38      private List<HolidayWrapper> holidays;
39  
40      public HolidayCalendarWrapper(){
41          holidays = new ArrayList<HolidayWrapper>();
42      }
43  
44      /**
45       * Holiday calendar Id
46       *
47       * @return the id
48       */
49      public String getId() {
50          return id;
51      }
52  
53      /**
54       * Holiday calendar id.
55       *
56       * @param id the id to set. It equals to holidayCalendarInfo.getId()
57       */
58      public void setId(String id) {
59          this.id = id;
60      }
61  
62      /**
63       * Holiday calendar heading for display. (Used in view xml)
64       *
65       * @return formatted heading text
66       */
67      @SuppressWarnings("unused")
68      public String getHolidayCalendarHeading(){
69          String sHeading = "No calendar available";
70          HolidayCalendarInfo holidayCalendarInfo = getHolidayCalendarInfo();
71          if (holidayCalendarInfo != null) {
72              sHeading = holidayCalendarInfo.getName();
73          }
74          return sHeading;
75      }
76  
77      /**
78       * Returns Hcal dto
79       *
80       * @return hcal dto
81       */
82      public HolidayCalendarInfo getHolidayCalendarInfo(){
83          return holidayCalendarInfo;
84      }
85  
86      /**
87       * Sets the holiday calendar dto for a wrapper
88       *
89       * @param holidayCalendarInfo hcal dto
90       */
91      public void setHolidayCalendarInfo (HolidayCalendarInfo holidayCalendarInfo){
92          this.holidayCalendarInfo = holidayCalendarInfo;
93      }
94  
95      /**
96       * Returns organization name
97       *
98       * @return admin organization name
99       */
100     public String getAdminOrgName() {
101         return adminOrgName;
102     }
103 
104     /**
105      * Sets the org associated with the hcal
106      *
107      * @param adminOrgName admin organization name
108      */
109     public void setAdminOrgName(String adminOrgName) {
110         this.adminOrgName = adminOrgName;
111     }
112 
113     /**
114      * Returns the state name.
115      *
116      * @return state name
117      */
118     @SuppressWarnings("unused")
119     public String getStateName() {
120         return stateName;
121     }
122 
123     /**
124      * Sets the state of the holiday calendar.
125      *
126      * @param stateName state name
127      */
128     public void setStateName(String stateName) {
129         this.stateName = stateName;
130     }
131 
132     /**
133      * Holidays list in a calendar. (Used in view xml)
134      *
135      * @return a list of holidays
136      */
137     @SuppressWarnings("unused")
138     public List<HolidayWrapper> getHolidays() {
139         Collections.sort(holidays);
140         return holidays;
141     }
142 
143     /**
144      * Sets a list of holidays for a hcal
145      *
146      * @param holidays list of holidays
147      */
148     public void setHolidays(List<HolidayWrapper> holidays){
149         this.holidays = holidays;
150     }
151 
152     /**
153      * Acal start date
154      *
155      * @return the acal start date
156      */
157     @SuppressWarnings("unused")
158     public String getAcalStartYear(){
159         return acalStartYear;
160     }
161 
162     /**
163      * Used in HolidayCalendarWrapperLookupAndInquiryView.xml
164      *
165      * @param acalStartYear
166      */
167     public void setAcalStartYear(String acalStartYear) {
168         this.acalStartYear = acalStartYear;
169     }
170     
171 }