001/*
002 * Copyright 2007 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
017package org.kuali.ole.module.cg.document;
018
019import java.sql.Date;
020import java.util.LinkedHashMap;
021
022import org.kuali.ole.sys.OLEConstants;
023import org.kuali.ole.sys.context.SpringContext;
024import org.kuali.ole.sys.document.FinancialSystemTransactionalDocumentBase;
025import org.kuali.rice.kim.api.identity.Person;
026
027/**
028 * Instances of this class are used to signal to the CloseBatchStep that a close should occur on a particular day.
029 */
030public class ProposalAwardCloseDocument extends FinancialSystemTransactionalDocumentBase {
031
032    protected Date closeOnOrBeforeDate;
033    protected Date userInitiatedCloseDate;
034    protected Long awardClosedCount;
035    protected Long proposalClosedCount;
036    protected String principalName;
037
038    protected Person personUser;
039
040    /**
041     * Default constructor.
042     */
043    public ProposalAwardCloseDocument() {
044    }
045
046    /**
047     * @return whether or not this document has been approved.
048     */
049    public boolean isApproved() {
050        return OLEConstants.DocumentStatusCodes.APPROVED.equals(getFinancialSystemDocumentHeader().getFinancialDocumentStatusCode());
051    }
052
053    /**
054     * Gets the closeOnOrBeforeDate attribute.
055     * 
056     * @return Returns the closeOnOrBeforeDate
057     */
058    public Date getCloseOnOrBeforeDate() {
059        return closeOnOrBeforeDate;
060    }
061
062    /**
063     * Sets the closeOnOrBeforeDate attribute.
064     * 
065     * @param closeOnOrBeforeDate The closeOnOrBeforeDate to set.
066     */
067    public void setCloseOnOrBeforeDate(Date closeOnOrBeforeDate) {
068        this.closeOnOrBeforeDate = closeOnOrBeforeDate;
069    }
070
071
072    /**
073     * Gets the awardClosedCount attribute.
074     * 
075     * @return Returns the awardClosedCount
076     */
077    public Long getAwardClosedCount() {
078        return awardClosedCount;
079    }
080
081    /**
082     * Sets the awardClosedCount attribute.
083     * 
084     * @param awardClosedCount The awardClosedCount to set.
085     */
086    public void setAwardClosedCount(Long awardClosedCount) {
087        this.awardClosedCount = awardClosedCount;
088    }
089
090
091    /**
092     * Gets the proposalClosedCount attribute.
093     * 
094     * @return Returns the proposalClosedCount
095     */
096    public Long getProposalClosedCount() {
097        return proposalClosedCount;
098    }
099
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