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