Coverage Report - org.kuali.student.enrollment.class2.acal.form.HolidayCalendarForm
 
Classes in this File Line Coverage Branch Coverage Complexity
HolidayCalendarForm
0%
0/46
0%
0/8
1.208
 
 1  
 /**
 2  
  * Copyright 2012 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 package org.kuali.student.enrollment.class2.acal.form;
 16  
 
 17  
 import org.kuali.rice.krad.web.form.UifFormBase;
 18  
 import org.kuali.student.enrollment.acal.dto.HolidayCalendarInfo;
 19  
 import org.kuali.student.enrollment.class2.acal.dto.HolidayWrapper;
 20  
 
 21  
 import java.text.SimpleDateFormat;
 22  
 import java.util.ArrayList;
 23  
 import java.util.Collections;
 24  
 import java.util.Date;
 25  
 import java.util.List;
 26  
 
 27  
 /**
 28  
  * This class is the formClass for  HolidayCalendar views
 29  
  *
 30  
  * @author Kuali Student Team
 31  
  */
 32  
 
 33  
 public class HolidayCalendarForm  extends UifFormBase {
 34  
     private static final long serialVersionUID = 7526472595622776147L;
 35  
 
 36  
     private HolidayCalendarInfo holidayCalendarInfo;
 37  
     private List<HolidayWrapper> holidays;
 38  
     private String stateName;
 39  
     private String adminOrgName;
 40  
     private String newCalendarName;
 41  
     private Date newCalendarStartDate;
 42  
     private Date newCalendarEndDate;
 43  
     private String hcId;
 44  
     private String orgHcId;
 45  
     private String updateTimeString;
 46  
     private boolean newCalendar;
 47  
     private boolean officialCalendar;
 48  
 
 49  
     public HolidayCalendarForm() {
 50  0
         super();
 51  0
         holidayCalendarInfo = new HolidayCalendarInfo();
 52  0
         holidays = new ArrayList<HolidayWrapper>();
 53  0
         newCalendar = true;
 54  0
         officialCalendar = false;
 55  0
     }
 56  
 
 57  
     public HolidayCalendarInfo getHolidayCalendarInfo() {
 58  0
         return holidayCalendarInfo;
 59  
     }
 60  
     public void setHolidayCalendarInfo(HolidayCalendarInfo holidayCalendarInfo) {
 61  0
         this.holidayCalendarInfo = holidayCalendarInfo;
 62  0
     }
 63  
 
 64  
     public List<HolidayWrapper> getHolidays() {
 65  
         // Putting sort here causes list to be sorted when addLine "add" clicked, instead of having
 66  
         // the new row added to the top of the collection as desired.  Just so you know.
 67  
         //Collections.sort(holidays);
 68  0
         return holidays;
 69  
     }
 70  
 
 71  
     public void setHolidays(List<HolidayWrapper> holidays) {
 72  0
         this.holidays = holidays;
 73  0
     }
 74  
 
 75  
     public String getStateName() {
 76  0
         return stateName;
 77  
     }
 78  
 
 79  
     public void setStateName(String stateName) {
 80  0
         this.stateName = stateName;
 81  0
     }
 82  
 
 83  
     public String getAdminOrgName() {
 84  0
         return adminOrgName;
 85  
     }
 86  
     public void setAdminOrgName(String adminOrgName) {
 87  0
         this.adminOrgName = adminOrgName;
 88  0
     }
 89  
 
 90  
     public String getNewCalendarName() {
 91  0
         return newCalendarName;
 92  
     }
 93  
     public void setNewCalendarName(String newCalendarName) {
 94  0
         this.newCalendarName = newCalendarName;
 95  0
     }
 96  
 
 97  
     public Date getNewCalendarStartDate() {
 98  0
         return newCalendarStartDate;
 99  
     }
 100  
     public void setNewCalendarStartDate(Date newCalendarStartDate) {
 101  0
         this.newCalendarStartDate = newCalendarStartDate;
 102  0
     }
 103  
 
 104  
     public Date getNewCalendarEndDate() {
 105  0
         return newCalendarEndDate;
 106  
     }
 107  
     public void setNewCalendarEndDate(Date newCalendarEndDate) {
 108  0
         this.newCalendarEndDate = newCalendarEndDate;
 109  0
     }
 110  
 
 111  
     public String getHcId() {
 112  0
         return hcId;
 113  
     }
 114  
 
 115  
     public void setHcId(String hcId) {
 116  0
         this.hcId = hcId;
 117  0
     }
 118  
 
 119  
     public String getOrgHcId() {
 120  0
         return orgHcId;
 121  
     }
 122  
 
 123  
     public void setOrgHcId(String orgHcId) {
 124  0
         this.orgHcId = orgHcId;
 125  0
     }
 126  
 
 127  
     public boolean isNewCalendar() {
 128  0
         return newCalendar;
 129  
     }
 130  
 
 131  
     public void setNewCalendar(boolean newCalendar) {
 132  0
         this.newCalendar = newCalendar;
 133  0
     }
 134  
 
 135  
     public boolean isOfficialCalendar() {
 136  0
         return officialCalendar;
 137  
     }
 138  
 
 139  
     public void setOfficialCalendar(boolean officialCalendar) {
 140  0
         this.officialCalendar = officialCalendar;
 141  0
     }
 142  
 
 143  
     public String getUpdateTimeString(){
 144  0
         updateTimeString = new String("");
 145  0
         if (getHolidayCalendarInfo() == null ||
 146  
             getHolidayCalendarInfo().getId()== null ||
 147  
             getHolidayCalendarInfo().getId().isEmpty()){
 148  0
             return updateTimeString;
 149  
         }
 150  
         else {
 151  0
             Date updateTime = getHolidayCalendarInfo().getMeta().getUpdateTime();
 152  0
             if (updateTime != null){
 153  0
                 updateTimeString = "Last saved at "+new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(updateTime);
 154  
             }
 155  0
             return updateTimeString;
 156  
         }
 157  
     }
 158  
 }