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  /*
17   * Created on Jul 12, 2004
18   *
19   */
20  package org.kuali.ole.pdp.businessobject;
21  
22  import java.sql.Date;
23  import java.util.HashMap;
24  import java.util.Map;
25  
26  import org.apache.commons.lang.StringUtils;
27  import org.kuali.ole.sys.businessobject.Bank;
28  import org.kuali.ole.sys.context.SpringContext;
29  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
30  import org.kuali.rice.core.api.util.type.KualiInteger;
31  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
32  import org.kuali.rice.krad.service.KualiModuleService;
33  import org.kuali.rice.krad.service.ModuleService;
34  import org.kuali.rice.location.api.LocationConstants;
35  import org.kuali.rice.location.framework.campus.CampusEbo;
36  
37  public class DisbursementNumberRange extends PersistableBusinessObjectBase implements MutableInactivatable {
38  
39      protected String physCampusProcCode;
40      protected KualiInteger beginDisbursementNbr;
41      protected KualiInteger lastAssignedDisbNbr;
42      protected KualiInteger endDisbursementNbr;
43      protected Date disbNbrRangeStartDt;
44      protected String bankCode;
45      protected String disbursementTypeCode;
46      protected boolean active;
47  
48      protected CampusEbo campus;
49      protected Bank bank;
50      protected DisbursementType disbursementType;
51  
52      public DisbursementNumberRange() {
53          super();
54      }
55  
56      /**
57       * @return
58       */
59      public Bank getBank() {
60          return bank;
61      }
62  
63      /**
64       * Gets the bankCode attribute.
65       * 
66       * @return Returns the bankCode.
67       */
68      public String getBankCode() {
69          return bankCode;
70      }
71  
72      /**
73       * Sets the bankCode attribute value.
74       * 
75       * @param bankCode The bankCode to set.
76       */
77      public void setBankCode(String bankCode) {
78          this.bankCode = bankCode;
79      }
80  
81      /**
82       * @return
83       * @hibernate.property column="BEG_DISB_NBR"
84       */
85      public KualiInteger getBeginDisbursementNbr() {
86          return beginDisbursementNbr;
87      }
88  
89      /**
90       * @return
91       * @hibernate.property column="END_DISB_NBR"
92       */
93      public KualiInteger getEndDisbursementNbr() {
94          return endDisbursementNbr;
95      }
96  
97      /**
98       * @return
99       * @hibernate.property column="LST_ASND_DISB_NBR"
100      */
101     public KualiInteger getLastAssignedDisbNbr() {
102         return lastAssignedDisbNbr;
103     }
104 
105     /**
106      * @return
107      * @hibernate.property column="PHYS_CMP_PROC_CD" length="2"
108      */
109     public String getPhysCampusProcCode() {
110         return physCampusProcCode;
111     }
112 
113     /**
114      * @param Bank
115      */
116     @Deprecated
117     public void setBank(Bank bank) {
118         this.bank = bank;
119     }
120 
121     /**
122      * @param integer
123      */
124     public void setBeginDisbursementNbr(KualiInteger integer) {
125         beginDisbursementNbr = integer;
126     }
127 
128     /**
129      * @param integer
130      */
131     public void setEndDisbursementNbr(KualiInteger integer) {
132         endDisbursementNbr = integer;
133     }
134 
135     /**
136      * @param integer
137      */
138     public void setLastAssignedDisbNbr(KualiInteger integer) {
139         lastAssignedDisbNbr = integer;
140     }
141 
142     /**
143      * @param string
144      */
145     public void setPhysCampusProcCode(String string) {
146         physCampusProcCode = string;
147     }
148 
149     /**
150      * Gets the disbursementTypeCode attribute.
151      * 
152      * @return Returns the disbursementTypeCode.
153      */
154     public String getDisbursementTypeCode() {
155         return disbursementTypeCode;
156     }
157 
158     /**
159      * Sets the disbursementTypeCode attribute value.
160      * 
161      * @param disbursementTypeCode The disbursementTypeCode to set.
162      */
163     public void setDisbursementTypeCode(String disbursementTypeCode) {
164         this.disbursementTypeCode = disbursementTypeCode;
165     }
166 
167     /**
168      * Gets the disbursementType attribute.
169      * 
170      * @return Returns the disbursementType.
171      */
172     public DisbursementType getDisbursementType() {
173         return disbursementType;
174     }
175 
176     /**
177      * Sets the disbursementType attribute value.
178      * 
179      * @param disbursementType The disbursementType to set.
180      */
181     public void setDisbursementType(DisbursementType disbursementType) {
182         this.disbursementType = disbursementType;
183     }
184 
185     /**
186      * Gets the campus attribute.
187      * 
188      * @return Returns the campus.
189      */
190     public CampusEbo getCampus() {
191         if ( StringUtils.isBlank(physCampusProcCode) ) {
192             campus = null;
193         } else {
194             if ( campus == null || !StringUtils.equals( campus.getCode(),physCampusProcCode) ) {
195                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CampusEbo.class);
196                 if ( moduleService != null ) {
197                     Map<String,Object> keys = new HashMap<String, Object>(1);
198                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, physCampusProcCode);
199                     campus = moduleService.getExternalizableBusinessObject(CampusEbo.class, keys);
200                 } else {
201                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
202                 }
203             }
204         }
205         return campus;
206     }
207 
208     /**
209      * Sets the campus attribute value.
210      * 
211      * @param campus The campus to set.
212      */
213     public void setCampus(CampusEbo campus) {
214         this.campus = campus;
215     }
216 
217     /**
218      * @see org.kuali.rice.core.api.mo.common.active.MutableInactivatable#isActive()
219      */
220     @Override
221     public boolean isActive() {
222         return active;
223     }
224 
225     /**
226      * @see org.kuali.rice.core.api.mo.common.active.MutableInactivatable#setActive(boolean)
227      */
228     @Override
229     public void setActive(boolean active) {
230         this.active = active;
231     }
232 
233     /**
234      * Gets the disbNbrRangeStartDt attribute.
235      * 
236      * @return Returns the disbNbrRangeStartDt.
237      */
238     public Date getDisbNbrRangeStartDt() {
239         return disbNbrRangeStartDt;
240     }
241 
242     /**
243      * Sets the disbNbrRangeStartDt attribute value.
244      * 
245      * @param disbNbrRangeStartDt The disbNbrRangeStartDt to set.
246      */
247     public void setDisbNbrRangeStartDt(Date disbNbrRangeStartDt) {
248         this.disbNbrRangeStartDt = disbNbrRangeStartDt;
249     }
250 
251 }