001/** 002 * Copyright 2004-2014 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 */ 016package org.kuali.kpme.tklm.leave.approval.web; 017 018import java.util.ArrayList; 019import java.util.List; 020 021import org.apache.commons.lang.StringUtils; 022import org.joda.time.LocalDateTime; 023import org.kuali.kpme.tklm.api.leave.approval.ApprovalLeaveSummaryRowContract; 024import org.kuali.kpme.tklm.common.CalendarApprovalForm; 025import org.kuali.kpme.tklm.common.LMConstants; 026import org.kuali.rice.core.api.config.property.ConfigContext; 027 028public class LeaveApprovalActionForm extends CalendarApprovalForm { 029 030 private static final long serialVersionUID = 1L; 031 032 private List<ApprovalLeaveSummaryRowContract> leaveApprovalRows; 033 private List<LocalDateTime> leaveCalendarDates = new ArrayList<LocalDateTime>(); 034 private Boolean displayYTDFMLA; 035 036 public boolean isDisplayYTDFMLA() { 037 if(displayYTDFMLA == null) { 038 String displayColumn = ConfigContext.getCurrentContextConfig().getProperty(LMConstants.DISPLAY_YTD_FMLA_LEAVESUMMARY); 039 if (StringUtils.equals(displayColumn, "Yes")) { 040 displayYTDFMLA = Boolean.TRUE; 041 } else { 042 displayYTDFMLA = Boolean.FALSE; 043 } 044 } 045 return displayYTDFMLA; 046 } 047 048 public void setDisplayYTDFMLA(boolean displayYTDFMLA) { 049 this.displayYTDFMLA = displayYTDFMLA; 050 } 051 052 public List<ApprovalLeaveSummaryRowContract> getLeaveApprovalRows() { 053 return leaveApprovalRows; 054 } 055 public void setLeaveApprovalRows(List<ApprovalLeaveSummaryRowContract> leaveApprovalRows) { 056 this.leaveApprovalRows = leaveApprovalRows; 057 } 058 public List<LocalDateTime> getLeaveCalendarDates() { 059 return leaveCalendarDates; 060 } 061 public void setLeaveCalendarDates(List<LocalDateTime> leaveCalendarDates) { 062 this.leaveCalendarDates = leaveCalendarDates; 063 } 064 065 public boolean isAnyApprovalRowApprovable() { 066 boolean isAnyApprovalRowApprovable = false; 067 068 if (leaveApprovalRows != null) { 069 for (ApprovalLeaveSummaryRowContract approvalRow : leaveApprovalRows) { 070 if (approvalRow.isApprovable()) { 071 isAnyApprovalRowApprovable = true; 072 break; 073 } 074 } 075 } 076 077 return isAnyApprovalRowApprovable; 078 } 079 080 081}