1 /*
2 * Copyright 2007 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
17 package org.kuali.ole.module.cg.document;
18
19 import java.sql.Date;
20 import java.util.LinkedHashMap;
21
22 import org.kuali.ole.sys.OLEConstants;
23 import org.kuali.ole.sys.context.SpringContext;
24 import org.kuali.ole.sys.document.FinancialSystemTransactionalDocumentBase;
25 import org.kuali.rice.kim.api.identity.Person;
26
27 /**
28 * Instances of this class are used to signal to the CloseBatchStep that a close should occur on a particular day.
29 */
30 public class ProposalAwardCloseDocument extends FinancialSystemTransactionalDocumentBase {
31
32 protected Date closeOnOrBeforeDate;
33 protected Date userInitiatedCloseDate;
34 protected Long awardClosedCount;
35 protected Long proposalClosedCount;
36 protected String principalName;
37
38 protected Person personUser;
39
40 /**
41 * Default constructor.
42 */
43 public ProposalAwardCloseDocument() {
44 }
45
46 /**
47 * @return whether or not this document has been approved.
48 */
49 public boolean isApproved() {
50 return OLEConstants.DocumentStatusCodes.APPROVED.equals(getFinancialSystemDocumentHeader().getFinancialDocumentStatusCode());
51 }
52
53 /**
54 * Gets the closeOnOrBeforeDate attribute.
55 *
56 * @return Returns the closeOnOrBeforeDate
57 */
58 public Date getCloseOnOrBeforeDate() {
59 return closeOnOrBeforeDate;
60 }
61
62 /**
63 * Sets the closeOnOrBeforeDate attribute.
64 *
65 * @param closeOnOrBeforeDate The closeOnOrBeforeDate to set.
66 */
67 public void setCloseOnOrBeforeDate(Date closeOnOrBeforeDate) {
68 this.closeOnOrBeforeDate = closeOnOrBeforeDate;
69 }
70
71
72 /**
73 * Gets the awardClosedCount attribute.
74 *
75 * @return Returns the awardClosedCount
76 */
77 public Long getAwardClosedCount() {
78 return awardClosedCount;
79 }
80
81 /**
82 * Sets the awardClosedCount attribute.
83 *
84 * @param awardClosedCount The awardClosedCount to set.
85 */
86 public void setAwardClosedCount(Long awardClosedCount) {
87 this.awardClosedCount = awardClosedCount;
88 }
89
90
91 /**
92 * Gets the proposalClosedCount attribute.
93 *
94 * @return Returns the proposalClosedCount
95 */
96 public Long getProposalClosedCount() {
97 return proposalClosedCount;
98 }
99
100 /**
101 * Sets the proposalClosedCount attribute.
102 *
103 * @param proposalClosedCount The proposalClosedCount to set.
104 */
105 public void setProposalClosedCount(Long proposalClosedCount) {
106 this.proposalClosedCount = proposalClosedCount;
107 }
108
109
110 /**
111 * Gets the principalName attribute.
112 *
113 * @return Returns the principalName
114 */
115 public String getPrincipalName() {
116 return principalName;
117 }
118
119 /**
120 * Sets the principalName attribute.
121 *
122 * @param principalName The principalName to set.
123 */
124 public void setPrincipalName(String principalName) {
125 this.principalName = principalName;
126 }
127
128
129 /**
130 * Gets the userInitiatedCloseDate attribute.
131 *
132 * @return Returns the userInitiatedCloseDate
133 */
134 public Date getUserInitiatedCloseDate() {
135 return userInitiatedCloseDate;
136 }
137
138 /**
139 * Sets the userInitiatedCloseDate attribute.
140 *
141 * @param userInitiatedCloseDate The userInitiatedCloseDate to set.
142 */
143 public void setUserInitiatedCloseDate(Date userInitiatedCloseDate) {
144 this.userInitiatedCloseDate = userInitiatedCloseDate;
145 }
146
147 /**
148 * @return the {@link Person} for the personUser
149 */
150 public Person getPersonUser() {
151 personUser = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(principalName, personUser);
152 return personUser;
153 }
154
155 /**
156 * @param personUser The personUser to set.
157 * @deprecated
158 */
159 public void setPersonUser(Person personUser) {
160 this.personUser = personUser;
161 }
162
163 /**
164 * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
165 */
166 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
167 LinkedHashMap m = new LinkedHashMap();
168 if (this.documentNumber != null) {
169 m.put("documentNumber", this.documentNumber.toString());
170 }
171 return m;
172 }
173 }
174