View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package org.kuali.kfs.coa.businessobject;
21  
22  import java.sql.Date;
23  import java.util.LinkedHashMap;
24  
25  import org.apache.commons.lang.StringUtils;
26  import org.kuali.kfs.sys.context.SpringContext;
27  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
28  import org.kuali.rice.core.api.util.type.KualiDecimal;
29  import org.kuali.rice.kew.api.doctype.DocumentTypeService;
30  import org.kuali.rice.kew.doctype.bo.DocumentType;
31  import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
32  import org.kuali.rice.kim.api.identity.Person;
33  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
34  
35  /**
36   *
37   */
38  public class AccountDelegateModelDetail extends PersistableBusinessObjectBase implements MutableInactivatable {
39  
40      private String chartOfAccountsCode;
41      private String organizationCode;
42      private String accountDelegateModelName;
43      private String accountDelegateUniversalId;
44      private String financialDocumentTypeCode;
45      private KualiDecimal approvalFromThisAmount;
46      private KualiDecimal approvalToThisAmount;
47      private boolean accountDelegatePrimaryRoutingIndicator;
48      private Date accountDelegateStartDate;
49      private boolean active;
50  
51      private Chart chartOfAccounts;
52      private DocumentTypeEBO financialSystemDocumentTypeCode;
53      private Person accountDelegate;
54  
55      /**
56       * Default constructor.
57       */
58      public AccountDelegateModelDetail() {
59      }
60  
61      public AccountDelegateModelDetail(AccountDelegateGlobalDetail delegateGlobalDetail) {
62          accountDelegateUniversalId = delegateGlobalDetail.getAccountDelegateUniversalId();
63          accountDelegatePrimaryRoutingIndicator = delegateGlobalDetail.getAccountDelegatePrimaryRoutingIndicator();
64          approvalFromThisAmount = delegateGlobalDetail.getApprovalFromThisAmount();
65          approvalToThisAmount = delegateGlobalDetail.getApprovalToThisAmount();
66          accountDelegateStartDate = delegateGlobalDetail.getAccountDelegateStartDate();
67          financialDocumentTypeCode = delegateGlobalDetail.getFinancialDocumentTypeCode();
68      }
69  
70      /**
71       * Gets the chartOfAccountsCode attribute.
72       *
73       * @return Returns the chartOfAccountsCode
74       */
75      public String getChartOfAccountsCode() {
76          return chartOfAccountsCode;
77      }
78  
79      /**
80       * Sets the chartOfAccountsCode attribute.
81       *
82       * @param chartOfAccountsCode The chartOfAccountsCode to set.
83       */
84      public void setChartOfAccountsCode(String chartOfAccountsCode) {
85          this.chartOfAccountsCode = chartOfAccountsCode;
86      }
87  
88  
89      /**
90       * Gets the organizationCode attribute.
91       *
92       * @return Returns the organizationCode
93       */
94      public String getOrganizationCode() {
95          return organizationCode;
96      }
97  
98      /**
99       * Sets the organizationCode attribute.
100      *
101      * @param organizationCode The organizationCode to set.
102      */
103     public void setOrganizationCode(String organizationCode) {
104         this.organizationCode = organizationCode;
105     }
106 
107 
108     /**
109      * Gets the accountDelegateModelName attribute.
110      *
111      * @return Returns the accountDelegateModelName
112      */
113     public String getAccountDelegateModelName() {
114         return accountDelegateModelName;
115     }
116 
117     /**
118      * Sets the accountDelegateModelName attribute.
119      *
120      * @param accountDelegateModelName The accountDelegateModelName to set.
121      */
122     public void setAccountDelegateModelName(String organizationRoutingModelName) {
123         this.accountDelegateModelName = organizationRoutingModelName;
124     }
125 
126 
127     /**
128      * Gets the accountDelegateUniversalId attribute.
129      *
130      * @return Returns the accountDelegateUniversalId
131      */
132     public String getAccountDelegateUniversalId() {
133         return accountDelegateUniversalId;
134     }
135 
136     /**
137      * Sets the accountDelegateUniversalId attribute.
138      *
139      * @param accountDelegateUniversalId The accountDelegateUniversalId to set.
140      */
141     public void setAccountDelegateUniversalId(String accountDelegateUniversalId) {
142         this.accountDelegateUniversalId = accountDelegateUniversalId;
143     }
144 
145 
146     /**
147      * Gets the accountDelegate attribute.
148      *
149      * @return Returns the accountDelegate.
150      */
151     public Person getAccountDelegate() {
152         accountDelegate = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(accountDelegateUniversalId, accountDelegate);
153         return accountDelegate;
154     }
155 
156     /**
157      * Sets the accountDelegate attribute value.
158      *
159      * @param accountDelegate The accountDelegate to set.
160      */
161     public void setAccountDelegate(Person accountDelegate) {
162         this.accountDelegate = accountDelegate;
163     }
164 
165     /**
166      * Gets the financialDocumentTypeCode attribute.
167      *
168      * @return Returns the financialDocumentTypeCode
169      */
170     public String getFinancialDocumentTypeCode() {
171         return financialDocumentTypeCode;
172     }
173 
174     /**
175      * Sets the financialDocumentTypeCode attribute.
176      *
177      * @param financialDocumentTypeCode The financialDocumentTypeCode to set.
178      */
179     public void setFinancialDocumentTypeCode(String financialDocumentTypeCode) {
180         this.financialDocumentTypeCode = financialDocumentTypeCode;
181     }
182 
183     /**
184      * Gets the financialSystemDocumentTypeCode attribute.
185      * @return Returns the financialSystemDocumentTypeCode.
186      */
187     public DocumentTypeEBO getFinancialSystemDocumentTypeCode() {
188         if ( StringUtils.isBlank( financialDocumentTypeCode ) ) {
189             financialSystemDocumentTypeCode = null;
190         } else {
191             if ( financialSystemDocumentTypeCode == null || !StringUtils.equals(financialDocumentTypeCode, financialSystemDocumentTypeCode.getName() ) ) {
192                 org.kuali.rice.kew.api.doctype.DocumentType temp = SpringContext.getBean(DocumentTypeService.class).getDocumentTypeByName(financialDocumentTypeCode);
193                 if ( temp != null ) {
194                     financialSystemDocumentTypeCode = DocumentType.from( temp );
195                 } else {
196                     financialSystemDocumentTypeCode = null;
197                 }
198             }
199         }
200         return financialSystemDocumentTypeCode;
201     }
202 
203     /**
204      * Gets the approvalFromThisAmount attribute.
205      *
206      * @return Returns the approvalFromThisAmount
207      */
208     public KualiDecimal getApprovalFromThisAmount() {
209         return approvalFromThisAmount;
210     }
211 
212     /**
213      * Sets the approvalFromThisAmount attribute.
214      *
215      * @param approvalFromThisAmount The approvalFromThisAmount to set.
216      */
217     public void setApprovalFromThisAmount(KualiDecimal approvalFromThisAmount) {
218         this.approvalFromThisAmount = approvalFromThisAmount;
219     }
220 
221 
222     /**
223      * Gets the approvalToThisAmount attribute.
224      *
225      * @return Returns the approvalToThisAmount
226      */
227     public KualiDecimal getApprovalToThisAmount() {
228         return approvalToThisAmount;
229     }
230 
231     /**
232      * Sets the approvalToThisAmount attribute.
233      *
234      * @param approvalToThisAmount The approvalToThisAmount to set.
235      */
236     public void setApprovalToThisAmount(KualiDecimal approvalToThisAmount) {
237         this.approvalToThisAmount = approvalToThisAmount;
238     }
239 
240 
241     /**
242      * Gets the accountDelegatePrimaryRoutingIndicator attribute.
243      *
244      * @return Returns the accountDelegatePrimaryRoutingIndicator
245      */
246     public boolean getAccountDelegatePrimaryRoutingIndicator() {
247         return accountDelegatePrimaryRoutingIndicator;
248     }
249 
250     /**
251      * Sets the accountDelegatePrimaryRoutingIndicator attribute.
252      *
253      * @param accountDelegatePrimaryRoutingCode The accountDelegatePrimaryRoutingIndicator to set.
254      */
255     public void setAccountDelegatePrimaryRoutingIndicator(boolean accountDelegatePrimaryRoutingCode) {
256         this.accountDelegatePrimaryRoutingIndicator = accountDelegatePrimaryRoutingCode;
257     }
258 
259 
260     /**
261      * Gets the accountDelegateStartDate attribute.
262      *
263      * @return Returns the accountDelegateStartDate
264      */
265     public Date getAccountDelegateStartDate() {
266         return accountDelegateStartDate;
267     }
268 
269     /**
270      * Sets the accountDelegateStartDate attribute.
271      *
272      * @param accountDelegateStartDate The accountDelegateStartDate to set.
273      */
274     public void setAccountDelegateStartDate(Date accountDelegateStartDate) {
275         this.accountDelegateStartDate = accountDelegateStartDate;
276     }
277 
278     /**
279      * Gets the active attribute.
280      *
281      * @return Returns the active.
282      */
283     @Override
284     public boolean isActive() {
285         return active;
286     }
287 
288     /**
289      * Sets the active attribute value.
290      *
291      * @param active The active to set.
292      */
293     public void setActive(boolean active) {
294         this.active = active;
295     }
296 
297     /**
298      * Gets the chartOfAccounts attribute.
299      *
300      * @return Returns the chartOfAccounts
301      */
302     public Chart getChartOfAccounts() {
303         return chartOfAccounts;
304     }
305 
306     /**
307      * Sets the chartOfAccounts attribute.
308      *
309      * @param chartOfAccounts The chartOfAccounts to set.
310      * @deprecated
311      */
312     public void setChartOfAccounts(Chart chartOfAccounts) {
313         this.chartOfAccounts = chartOfAccounts;
314     }
315 
316     /**
317      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
318      */
319     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
320         LinkedHashMap m = new LinkedHashMap();
321         m.put("chartOfAccountsCode", this.chartOfAccountsCode);
322         m.put("organizationCode", this.organizationCode);
323         m.put("accountDelegateModelName", this.accountDelegateModelName);
324         m.put("accountDelegateUniversalId", this.accountDelegateUniversalId);
325         m.put("financialDocumentTypeCode", this.financialDocumentTypeCode);
326         return m;
327     }
328 }
329