View Javadoc
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  package org.kuali.ole.sys.businessobject;
17  
18  import java.io.Serializable;
19  import java.util.LinkedHashMap;
20  
21  import org.kuali.ole.coa.businessobject.Account;
22  import org.kuali.rice.core.api.util.type.KualiDecimal;
23  import org.kuali.rice.krad.bo.TransientBusinessObjectBase;
24  
25  /**
26   * This class holds respnsibility information pertaining to an account specifically whether or not the responsibility is of type
27   * Fiscal Officer, Primary Delegate of Fiscal Officer, or Secondary Delegate of Fiscal Officer, and if it is one of the delegated
28   * responsibility types, then there is additional information about the responsibility such as dollar range and document type
29   */
30  public class AccountResponsibility extends TransientBusinessObjectBase implements Serializable {
31  
32      private static final long serialVersionUID = 3101634819409319387L;
33      public static final int FISCAL_OFFICER_RESPONSIBILITY = 1;
34      public static final int DELEGATED_RESPONSIBILITY = 2;
35  
36      private Account account;
37      private int accountResponsibilityType;
38      private KualiDecimal minimumDollarAmount;
39      private KualiDecimal maximumDollarAmount;
40      private String documentTypeId;
41  
42      public AccountResponsibility() {
43      }
44  
45      /**
46       * Constructor that allows us to create and pop on same line in other files
47       * 
48       * @param accountResponsibilityType
49       * @param minimumDollarAmount
50       * @param maximumDollarAmount
51       * @param documentTypeId
52       */
53      public AccountResponsibility(int accountResponsibilityType, KualiDecimal minimumDollarAmount, KualiDecimal maximumDollarAmount, String documentTypeId, Account account) {
54          if (!isValidResponsibilityType(accountResponsibilityType)) {
55              throw new IllegalArgumentException("invalid accountResponsibilityType passed in");
56          }
57          this.accountResponsibilityType = accountResponsibilityType;
58          this.minimumDollarAmount = minimumDollarAmount;
59          this.maximumDollarAmount = maximumDollarAmount;
60          this.documentTypeId = documentTypeId;
61          this.account = account;
62      }
63  
64      private boolean isValidResponsibilityType(int type) {
65          return type == FISCAL_OFFICER_RESPONSIBILITY || type == DELEGATED_RESPONSIBILITY;
66      }
67  
68  
69      public Account getAccount() {
70          return account;
71      }
72  
73      public void setAccount(Account account) {
74          this.account = account;
75      }
76  
77      public int getAccountResponsibilityType() {
78          return accountResponsibilityType;
79      }
80  
81      public void setAccountResponsibilityType(int accountResponsibilityType) {
82          this.accountResponsibilityType = accountResponsibilityType;
83      }
84  
85      public String getDocumentTypeId() {
86          return documentTypeId;
87      }
88  
89      public void setDocumentTypeId(String documentTypeId) {
90          this.documentTypeId = documentTypeId;
91      }
92  
93      public KualiDecimal getMaximumDollarAmount() {
94          return maximumDollarAmount;
95      }
96  
97      public void setMaximumDollarAmount(KualiDecimal maximumDollarAmount) {
98          this.maximumDollarAmount = maximumDollarAmount;
99      }
100 
101     public KualiDecimal getMinimumDollarAmount() {
102         return minimumDollarAmount;
103     }
104 
105     public void setMinimumDollarAmount(KualiDecimal minimumDollarAmount) {
106         this.minimumDollarAmount = minimumDollarAmount;
107     }
108 
109     /**
110      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
111      */
112     
113     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
114         LinkedHashMap m = new LinkedHashMap();
115         if (account != null) {
116             m.put("accountNumber", this.account.getAccountNumber());
117         }
118         m.put("accountResponsibilityType", this.accountResponsibilityType);
119         m.put("minimumDollarAmount", this.minimumDollarAmount);
120         m.put("maximumDollarAmount", this.maximumDollarAmount);
121         m.put("documentTypeId", this.documentTypeId);
122         return m;
123     }
124 
125 
126 }