001    /**
002     * Copyright 2004-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.hr.time.base.web;
017    
018    import java.util.ArrayList;
019    import java.util.Date;
020    import java.util.HashMap;
021    import java.util.HashSet;
022    import java.util.LinkedList;
023    import java.util.List;
024    import java.util.Map;
025    import java.util.Set;
026    
027    import org.kuali.hr.time.calendar.CalendarEntries;
028    import org.kuali.hr.time.roles.TkUserRoles;
029    import org.kuali.rice.krad.util.GlobalVariables;
030    
031    public class ApprovalForm extends TkCommonCalendarForm {
032            public static final String ORDER_BY_PRINCIPAL = "principalName";
033        public static final String ORDER_BY_DOCID = "documentId";
034        public static final String ORDER_BY_STATUS = "Status";
035        public static final String ORDER_BY_WORKAREA = "WorkArea";
036    
037        private static final long serialVersionUID = -173408280988754540L;
038    
039        private String hrPyCalendarEntriesId;
040        private String hrPyCalendarId;
041        private String name;
042        private List<String> payCalendarGroups = new LinkedList<String>();
043        private String selectedPayCalendarGroup;
044        private String selectedDept;
045        private String selectedWorkArea;
046        private Date payBeginDate;
047        private Date payEndDate;
048        private String payBeginDateForSearch;
049        private String payEndDateForSearch;
050        private String roleName;
051    
052            
053        private CalendarEntries payCalendarEntries;
054        private Long workArea = null;
055        private Set<Long> deptWorkareas = new HashSet<Long>();
056        private String documentId;
057        private String employeeWorkArea;
058        private List<String> assignmentPrincipalIds = new LinkedList<String>();    
059        private Set<String> principalIds = new HashSet<String>();    
060        private Map<Long,String> workAreaDescr = new HashMap<Long,String>();
061    
062            /**
063         * Used for ajax dynamic row updating
064         */
065        private String outputString;
066    
067        private String searchField;
068        private String searchTerm;
069    
070        private int rowsToShow = 50;
071        private int rowsInTotal;
072        private String sortField;
073        private boolean ascending = true;
074        private boolean ajaxCall = false;
075    
076        private Boolean testSelected = Boolean.FALSE;
077    
078        private String prevPayCalendarId = null;
079        private String nextPayCalendarId = null;
080    
081        private List<String> departments = new ArrayList<String>();
082        private Integer resultSize = 0;
083        private List<String> searchResultList = new LinkedList<String>();
084    
085        private String calNav = null;
086    
087        public String getRoleName() {
088                    return roleName;
089            }
090    
091            public void setRoleName(String roleName) {
092                    this.roleName = roleName;
093            }
094            
095        public String getCalNav() {
096            return calNav;
097        }
098    
099        public void setCalNav(String calNav) {
100            this.calNav = calNav;
101        }
102    
103        public String getHrPyCalendarEntriesId() {
104            return hrPyCalendarEntriesId;
105        }
106    
107        public void setHrPyCalendarEntriesId(String hrPyCalendarEntriesId) {
108            this.hrPyCalendarEntriesId = hrPyCalendarEntriesId;
109        }
110    
111        public String getHrPyCalendarId() {
112            return hrPyCalendarId;
113        }
114    
115        public void setHrPyCalendarId(String hrPyCalendarId) {
116            this.hrPyCalendarId = hrPyCalendarId;
117        }
118    
119        /**
120         * Gets the name of the user that this row represents.
121         *
122         * @return String representing the users name.
123         */
124        public String getName() {
125            return name;
126        }
127    
128        public void setName(String name) {
129            this.name = name;
130        }
131    
132        public void setPayBeginDate(Date payBeginDate) {
133            this.payBeginDate = payBeginDate;
134        }
135    
136        public Date getPayBeginDate() {
137            return payBeginDate;
138        }
139    
140        public void setPayEndDate(Date payEndDate) {
141            this.payEndDate = payEndDate;
142        }
143    
144        public Date getPayEndDate() {
145            return payEndDate;
146        }
147    
148        public CalendarEntries getPayCalendarEntries() {
149                    return payCalendarEntries;
150            }
151    
152            public void setPayCalendarEntries(CalendarEntries payCalendarEntries) {
153                    this.payCalendarEntries = payCalendarEntries;
154            }
155    
156        public String getDocumentId() {
157            return documentId;
158        }
159    
160        public void setDocumentId(String documentId) {
161            this.documentId = documentId;
162        }
163    
164        public String getOutputString() {
165            return outputString;
166        }
167    
168        public void setOutputString(String outputString) {
169            this.outputString = outputString;
170        }
171    
172        public String getSearchField() {
173            return searchField;
174        }
175    
176        public void setSearchField(String searchField) {
177            this.searchField = searchField;
178        }
179    
180        public String getSearchTerm() {
181            return searchTerm;
182        }
183    
184        public void setSearchTerm(String searchTerm) {
185            this.searchTerm = searchTerm;
186        }
187    
188        public int getRowsToShow() {
189            return rowsToShow;
190        }
191    
192        public void setRowsToShow(int rowsToShow) {
193            this.rowsToShow = rowsToShow;
194        }
195    
196        public boolean isAscending() {
197            return ascending;
198        }
199    
200        public void setAscending(boolean ascending) {
201            this.ascending = ascending;
202        }
203    
204        public String getSortField() {
205            return sortField;
206        }
207    
208        public void setSortField(String sortField) {
209            this.sortField = sortField;
210        }
211    
212        public boolean isAjaxCall() {
213            return ajaxCall;
214        }
215    
216        public void setAjaxCall(boolean ajaxCall) {
217            this.ajaxCall = ajaxCall;
218        }
219    
220        public List<String> getPayCalendarGroups() {
221            return payCalendarGroups;
222        }
223    
224        public void setPayCalendarGroups(List<String> payCalendarGroups) {
225            this.payCalendarGroups = payCalendarGroups;
226        }
227    
228        public int getRowsInTotal() {
229            return rowsInTotal;
230        }
231    
232        public void setRowsInTotal(int rowsInTotal) {
233            this.rowsInTotal = rowsInTotal;
234        }
235    
236        /**
237         * Provides a set of WorkArea numbers that the current approver has
238         * dominion over.
239         *
240         * @return A Set of Longs representing work areas.
241         */
242        public Set<Long> getApproverWorkAreas() {
243            return TkUserRoles.getUserRoles(GlobalVariables.getUserSession().getPrincipalId()).getApproverWorkAreas();
244        }
245    
246        public Long getWorkArea() {
247            return workArea;
248        }
249    
250        public void setWorkArea(Long workArea) {
251            this.workArea = workArea;
252        }
253    
254        public String getSelectedPayCalendarGroup() {
255            return selectedPayCalendarGroup;
256        }
257    
258        public void setSelectedPayCalendarGroup(String selectedPayCalendarGroup) {
259            this.selectedPayCalendarGroup = selectedPayCalendarGroup;
260        }
261    
262        public String getEmployeeWorkArea() {
263            return employeeWorkArea;
264        }
265    
266        public void setEmployeeWorkArea(String employeeWorkArea) {
267            this.employeeWorkArea = employeeWorkArea;
268        }
269    
270        public Boolean getTestSelected() {
271            return testSelected;
272        }
273    
274        public void setTestSelected(Boolean testSelected) {
275            this.testSelected = testSelected;
276        }
277    
278        public String getPrevPayCalendarId() {
279            return prevPayCalendarId;
280        }
281    
282        public void setPrevPayCalendarId(String prevPayCalendarId) {
283            this.prevPayCalendarId = prevPayCalendarId;
284        }
285    
286        public String getNextPayCalendarId() {
287            return nextPayCalendarId;
288        }
289    
290        public void setNextPayCalendarId(String nextPayCalendarId) {
291            this.nextPayCalendarId = nextPayCalendarId;
292        }
293    
294        public String getSelectedDept() {
295            return selectedDept;
296        }
297    
298        public void setSelectedDept(String selectedDept) {
299            this.selectedDept = selectedDept;
300        }
301    
302        public List<String> getDepartments() {
303            return departments;
304        }
305    
306        public void setDepartments(List<String> departments) {
307            this.departments = departments;
308        }
309    
310        public Set<Long> getDeptWorkareas() {
311            return deptWorkareas;
312        }
313    
314        public void setDeptWorkareas(Set<Long> deptWorkareas) {
315            this.deptWorkareas = deptWorkareas;
316        }
317    
318        public List<String> getAssignmentPrincipalIds() {
319            return assignmentPrincipalIds;
320        }
321    
322        public void setAssignmentPrincipalIds(List<String> assignmentPrincipalIds) {
323            this.assignmentPrincipalIds = assignmentPrincipalIds;
324        }
325    
326        public int getResultSize() {
327            return resultSize;
328        }
329    
330        public void setResultSize(Integer resultSize) {
331            this.resultSize = resultSize;
332        }
333    
334        public String getSelectedWorkArea() {
335            return selectedWorkArea;
336        }
337    
338        public void setSelectedWorkArea(String selectedWorkArea) {
339            this.selectedWorkArea = selectedWorkArea;
340        }
341    
342        public List<String> getSearchResultList() {
343            return searchResultList;
344        }
345    
346        public void setSearchResultList(List<String> searchResultList) {
347            this.searchResultList = searchResultList;
348        }
349    
350        public String getPayBeginDateForSearch() {
351            return payBeginDateForSearch;
352        }
353    
354        public void setPayBeginDateForSearch(String payBeginDateForSearch) {
355            this.payBeginDateForSearch = payBeginDateForSearch;
356        }
357    
358        public String getPayEndDateForSearch() {
359            return payEndDateForSearch;
360        }
361    
362        public void setPayEndDateForSearch(String payEndDateForSearch) {
363            this.payEndDateForSearch = payEndDateForSearch;
364        }
365    
366        public Set<String> getPrincipalIds() {
367                    return principalIds;
368            }
369    
370            public void setPrincipalIds(Set<String> principalIds) {
371                    this.principalIds = principalIds;
372            }
373    
374            public Map<Long,String> getWorkAreaDescr() {
375                    return workAreaDescr;
376            }
377    
378            public void setWorkAreaDescr(Map<Long,String> workAreaDescr) {
379                    this.workAreaDescr = workAreaDescr;
380            }
381    
382    }