001 /* 002 * Copyright 2011 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 017 package org.kuali.kfs.module.cg.document; 018 019 import java.sql.Date; 020 import java.util.LinkedHashMap; 021 022 import org.kuali.kfs.sys.KFSConstants; 023 import org.kuali.kfs.sys.context.SpringContext; 024 import org.kuali.kfs.sys.document.FinancialSystemTransactionalDocumentBase; 025 import org.kuali.rice.kim.bo.Person; 026 import org.kuali.rice.kim.service.PersonService; 027 028 /** 029 * Instances of this class are used to signal to the CloseBatchStep that a close should occur on a particular day. 030 */ 031 public class ProposalAwardCloseDocument extends FinancialSystemTransactionalDocumentBase { 032 033 protected Date closeOnOrBeforeDate; 034 protected Date userInitiatedCloseDate; 035 protected Long awardClosedCount; 036 protected Long proposalClosedCount; 037 protected String principalName; 038 039 protected Person personUser; 040 041 /** 042 * Default constructor. 043 */ 044 public ProposalAwardCloseDocument() { 045 } 046 047 /** 048 * @return whether or not this document has been approved. 049 */ 050 public boolean isApproved() { 051 return KFSConstants.DocumentStatusCodes.APPROVED.equals(getDocumentHeader().getFinancialDocumentStatusCode()); 052 } 053 054 /** 055 * Gets the closeOnOrBeforeDate attribute. 056 * 057 * @return Returns the closeOnOrBeforeDate 058 */ 059 public Date getCloseOnOrBeforeDate() { 060 return closeOnOrBeforeDate; 061 } 062 063 /** 064 * Sets the closeOnOrBeforeDate attribute. 065 * 066 * @param closeOnOrBeforeDate The closeOnOrBeforeDate to set. 067 */ 068 public void setCloseOnOrBeforeDate(Date closeOnOrBeforeDate) { 069 this.closeOnOrBeforeDate = closeOnOrBeforeDate; 070 } 071 072 073 /** 074 * Gets the awardClosedCount attribute. 075 * 076 * @return Returns the awardClosedCount 077 */ 078 public Long getAwardClosedCount() { 079 return awardClosedCount; 080 } 081 082 /** 083 * Sets the awardClosedCount attribute. 084 * 085 * @param awardClosedCount The awardClosedCount to set. 086 */ 087 public void setAwardClosedCount(Long awardClosedCount) { 088 this.awardClosedCount = awardClosedCount; 089 } 090 091 092 /** 093 * Gets the proposalClosedCount attribute. 094 * 095 * @return Returns the proposalClosedCount 096 */ 097 public Long getProposalClosedCount() { 098 return proposalClosedCount; 099 } 100 101 /** 102 * Sets the proposalClosedCount attribute. 103 * 104 * @param proposalClosedCount The proposalClosedCount to set. 105 */ 106 public void setProposalClosedCount(Long proposalClosedCount) { 107 this.proposalClosedCount = proposalClosedCount; 108 } 109 110 111 /** 112 * Gets the principalName attribute. 113 * 114 * @return Returns the principalName 115 */ 116 public String getPrincipalName() { 117 return principalName; 118 } 119 120 /** 121 * Sets the principalName attribute. 122 * 123 * @param principalName The principalName to set. 124 */ 125 public void setPrincipalName(String principalName) { 126 this.principalName = principalName; 127 } 128 129 130 /** 131 * Gets the userInitiatedCloseDate attribute. 132 * 133 * @return Returns the userInitiatedCloseDate 134 */ 135 public Date getUserInitiatedCloseDate() { 136 return userInitiatedCloseDate; 137 } 138 139 /** 140 * Sets the userInitiatedCloseDate attribute. 141 * 142 * @param userInitiatedCloseDate The userInitiatedCloseDate to set. 143 */ 144 public void setUserInitiatedCloseDate(Date userInitiatedCloseDate) { 145 this.userInitiatedCloseDate = userInitiatedCloseDate; 146 } 147 148 /** 149 * @return the {@link Person} for the personUser 150 */ 151 public Person getPersonUser() { 152 personUser = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(principalName, personUser); 153 return personUser; 154 } 155 156 /** 157 * @param personUser The personUser to set. 158 * @deprecated 159 */ 160 public void setPersonUser(Person personUser) { 161 this.personUser = personUser; 162 } 163 164 /** 165 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() 166 */ 167 protected LinkedHashMap toStringMapper() { 168 LinkedHashMap m = new LinkedHashMap(); 169 if (this.documentNumber != null) { 170 m.put("documentNumber", this.documentNumber.toString()); 171 } 172 return m; 173 } 174 } 175