View Javadoc

1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.tklm.common;
17  
18  import java.util.ArrayList;
19  import java.util.Date;
20  import java.util.HashMap;
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.joda.time.DateTime;
25  import org.kuali.kpme.core.calendar.entry.CalendarEntry;
26  import org.kuali.kpme.core.document.calendar.CalendarDocument;
27  
28  public abstract class CalendarApprovalForm extends ApprovalForm {
29  	
30  	private static final long serialVersionUID = -173408280988754540L;
31  	
32  	public static final String ORDER_BY_PRINCIPAL = "principalName";
33      public static final String ORDER_BY_DOCID = "documentId";
34      public static final String ORDER_BY_STATUS = "Status";
35      public static final String ORDER_BY_WORKAREA = "WorkArea";
36      
37      private String hrCalendarEntryId;
38      
39      private String prevHrCalendarEntryId;
40      private String nextHrCalendarEntryId;
41      
42  	private Date beginCalendarEntryDate;
43  	private Date endCalendarEntryDate;
44  	
45      private CalendarEntry calendarEntry;
46  	
47  	private List<String> calendarYears = new ArrayList<String>();
48      private Map<String,String> payPeriodsMap = new HashMap<String,String>();
49      
50      private String selectedCalendarYear;
51      private String selectedPayPeriod;
52      
53      private CalendarDocument calendarDocument;
54  
55      private String outputString;
56  
57      private String searchField;
58      private String searchTerm;
59  
60      private Integer resultSize = 0;
61      
62  	public String getHrCalendarEntryId() {
63  		return hrCalendarEntryId;
64  	}
65  
66  	public void setHrCalendarEntryId(String hrCalendarEntryId) {
67  		this.hrCalendarEntryId = hrCalendarEntryId;
68  	}
69  	
70  	public String getPrevHrCalendarEntryId() {
71  		return prevHrCalendarEntryId;
72  	}
73  
74  	public void setPrevHrCalendarEntryId(String prevHrCalendarEntryId) {
75  		this.prevHrCalendarEntryId = prevHrCalendarEntryId;
76  	}
77  
78  	public String getNextHrCalendarEntryId() {
79  		return nextHrCalendarEntryId;
80  	}
81  
82  	public void setNextHrCalendarEntryId(String nextHrCalendarEntryId) {
83  		this.nextHrCalendarEntryId = nextHrCalendarEntryId;
84  	}
85  
86  	public Date getBeginCalendarEntryDate() {
87  		return beginCalendarEntryDate;
88  	}
89  
90  	public void setBeginCalendarEntryDate(Date beginCalendarEntryDate) {
91  		this.beginCalendarEntryDate = beginCalendarEntryDate;
92  	}
93  
94  	public Date getEndCalendarEntryDate() {
95  		return endCalendarEntryDate;
96  	}
97  
98  	public void setEndCalendarEntryDate(Date endCalendarEntryDate) {
99  		this.endCalendarEntryDate = endCalendarEntryDate;
100 	}
101 
102 	public List<String> getCalendarYears() {
103 		return calendarYears;
104 	}
105 	
106 	public void setCalendarYears(List<String> calendarYears) {
107 		this.calendarYears = calendarYears;
108 	}
109 	
110 	public Map<String, String> getPayPeriodsMap() {
111 		return payPeriodsMap;
112 	}
113 	
114 	public void setPayPeriodsMap(Map<String, String> payPeriodsMap) {
115 		this.payPeriodsMap = payPeriodsMap;
116 	}
117 	
118     public CalendarEntry getCalendarEntry() {
119         return calendarEntry;
120     }
121 
122     public void setCalendarEntry(CalendarEntry calendarEntry) {
123         this.calendarEntry = calendarEntry;
124     }
125 	
126 	public String getSelectedCalendarYear() {
127 		return selectedCalendarYear;
128 	}
129 	
130 	public void setSelectedCalendarYear(String selectedCalendarYear) {
131 		this.selectedCalendarYear = selectedCalendarYear;
132 	}
133 	
134 	public String getSelectedPayPeriod() {
135 		return selectedPayPeriod;
136 	}
137 	
138 	public void setSelectedPayPeriod(String selectedPayPeriod) {
139 		this.selectedPayPeriod = selectedPayPeriod;
140 	}
141 
142 	public CalendarDocument getCalendarDocument() {
143 		return calendarDocument;
144 	}
145 
146 	public void setCalendarDocument(CalendarDocument calendarDocument) {
147 		this.calendarDocument = calendarDocument;
148 	}
149 
150 	public boolean isOnCurrentPeriod() {
151 		boolean isOnCurrentPeriod = false;
152 		
153 		if (getCalendarEntry() != null) {
154 			DateTime beginPeriodDateTime = getCalendarEntry().getBeginPeriodFullDateTime();
155 			DateTime endPeriodDateTime = getCalendarEntry().getEndPeriodFullDateTime();
156 			isOnCurrentPeriod = (beginPeriodDateTime.isEqualNow() || beginPeriodDateTime.isBeforeNow()) && endPeriodDateTime.isAfterNow();
157 		}
158 		
159 		return isOnCurrentPeriod;
160 	}
161 
162     public String getOutputString() {
163         return outputString;
164     }
165 
166     public void setOutputString(String outputString) {
167         this.outputString = outputString;
168     }
169 
170     public String getSearchField() {
171         return searchField;
172     }
173 
174     public void setSearchField(String searchField) {
175         this.searchField = searchField;
176     }
177 
178     public String getSearchTerm() {
179         return searchTerm;
180     }
181 
182     public void setSearchTerm(String searchTerm) {
183         this.searchTerm = searchTerm;
184     }
185 
186     public int getResultSize() {
187         return resultSize;
188     }
189 
190     public void setResultSize(Integer resultSize) {
191         this.resultSize = resultSize;
192     }
193 
194 }