001 /*
002 * Copyright 2011 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 package org.kuali.kfs.module.endow.businessobject;
017
018 import java.sql.Date;
019 import java.util.LinkedHashMap;
020 import java.math.BigDecimal;
021 import java.util.List;
022 import org.kuali.rice.kns.util.KualiDecimal;
023 import org.apache.commons.lang.StringUtils;
024 import org.apache.log4j.Logger;
025 import org.kuali.kfs.module.endow.EndowConstants;
026 import org.kuali.kfs.module.endow.EndowPropertyConstants;
027 import org.kuali.rice.kns.bo.Inactivateable;
028 import org.kuali.rice.kns.bo.KualiCodeBase;
029 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
030 import org.kuali.rice.kns.util.TypedArrayList;
031 import org.kuali.kfs.module.endow.businessobject.FrequencyCode;
032 import org.kuali.kfs.module.endow.businessobject.FeeRateDefinitionCode;
033 import org.kuali.kfs.module.endow.businessobject.FeeTypeCode;
034 import org.kuali.kfs.module.endow.businessobject.FeeBaseCode;
035 import org.kuali.kfs.module.endow.businessobject.EndowmentTransactionCode;
036 import org.kuali.kfs.module.endow.businessobject.FeeBalanceTypeCode;
037 import org.kuali.kfs.module.endow.businessobject.FeeClassCode;
038 import org.kuali.kfs.module.endow.businessobject.FeeSecurity;
039 import org.kuali.kfs.module.endow.businessobject.FeePaymentType;
040 import org.kuali.kfs.module.endow.businessobject.FeeTransaction;
041 import org.kuali.kfs.module.endow.businessobject.FeeEndowmentTransactionCode;
042 import org.kuali.kfs.sys.KFSConstants;
043
044 /**
045 * Business Object for Fee Method.
046 */
047 public class FeeMethod extends KualiCodeBase {
048 private static final Logger LOG = Logger.getLogger(FeeMethod.class);
049
050 private String feeFrequencyCode;
051 private Date feeNextProcessDate;
052 private Date feeLastProcessDate;
053 private String feeRateDefinitionCode;
054 private BigDecimal firstFeeRate;
055 private KualiDecimal firstFeeBreakpoint;
056 private BigDecimal secondFeeRate;
057 private KualiDecimal secondFeeBreakpoint;
058 private BigDecimal thirdFeeRate;
059 private KualiDecimal minimumFeeThreshold;
060 private KualiDecimal minimumFeeToCharge;
061 private String feeTypeCode;
062 private String feeBaseCode;
063 private String feeExpenseETranCode;
064 private boolean feePostPendingIndicator;
065 private KualiDecimal corpusPctTolerance;
066 private String feeBalanceTypeCode;
067 private boolean feeByClassCode;
068 private boolean feeBySecurityCode;
069 private boolean feeByTransactionType;
070 private boolean feeByETranCode;
071
072 private FrequencyCode frequencyCode;
073 private FeeRateDefinitionCode feeRateDefinition;
074 private EndowmentTransactionCode endowmentTransactionCode;
075 private FeeTypeCode feeType;
076 private FeeBaseCode feeBase;
077 private FeeBalanceTypeCode feeBalanceType;
078
079 // collection classes
080 private List<FeeClassCode> feeClassCodes;
081 private List<FeeSecurity> feeSecurity;
082 private List<FeePaymentType> feePaymentTypes;
083 private List<FeeTransaction> feeTransactions;
084 private List<FeeEndowmentTransactionCode> feeEndowmentTransactionCodes;
085
086 /**
087 * Constructs a TypeCode object
088 */
089 public FeeMethod() {
090 super();
091 feeClassCodes = new TypedArrayList(FeeClassCode.class);
092 feeSecurity = new TypedArrayList(FeeSecurity.class);
093 feePaymentTypes = new TypedArrayList(FeePaymentType.class);
094 feeTransactions = new TypedArrayList(FeeTransaction.class);
095 feeEndowmentTransactionCodes = new TypedArrayList(FeeEndowmentTransactionCode.class);
096 }
097
098 /**
099 * Gets the feeFrequencyCode attribute.
100 *
101 * @return Returns the feeFrequencyCode.
102 */
103 public String getFeeFrequencyCode() {
104 return feeFrequencyCode;
105 }
106
107 /**
108 * Sets the feeFrequencyCode attribute value.
109 *
110 * @param feeFrequencyCode The feeFrequencyCode to set.
111 */
112 public void setFeeFrequencyCode(String feeFrequencyCode) {
113 this.feeFrequencyCode = feeFrequencyCode;
114 }
115
116 /**
117 * Gets the feeNextProcessDate attribute.
118 *
119 * @return Returns the feeNextProcessDate.
120 */
121 public Date getFeeNextProcessDate() {
122 return feeNextProcessDate;
123 }
124
125 /**
126 * Sets the feeNextProcessDate attribute value.
127 *
128 * @param feeNextProcessDate The feeNextProcessDate to set.
129 */
130 public void setFeeNextProcessDate(Date feeNextProcessDate) {
131 this.feeNextProcessDate = feeNextProcessDate;
132 }
133
134
135 /**
136 * Gets the feeLastProcessDate attribute.
137 *
138 * @return Returns the feeLastProcessDate.
139 */
140 public Date getFeeLastProcessDate() {
141 return feeLastProcessDate;
142 }
143
144 /**
145 * Sets the feeLastProcessDate attribute value.
146 *
147 * @param feeLastProcessDate The feeLastProcessDate to set.
148 */
149 public void setFeeLastProcessDate(Date feeLastProcessDate) {
150 this.feeLastProcessDate = feeLastProcessDate;
151 }
152
153 /**
154 * Gets the feeRateDefinitionCode attribute.
155 *
156 * @return Returns the feeRateDefinitionCode.
157 */
158 public String getFeeRateDefinitionCode() {
159 return feeRateDefinitionCode;
160 }
161
162 /**
163 * Sets the feeRateDefinitionCode attribute value.
164 *
165 * @param feeRateDefinitionCode The feeRateDefinitionCode to set.
166 */
167 public void setFeeRateDefinitionCode(String feeRateDefinitionCode) {
168 this.feeRateDefinitionCode = feeRateDefinitionCode;
169 }
170
171 /**
172 * Gets the firstFeeRate attribute.
173 *
174 * @return Returns the firstFeeRate.
175 */
176 public BigDecimal getFirstFeeRate() {
177 if (firstFeeRate != null) {
178 return firstFeeRate.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
179 }
180 else {
181 return BigDecimal.ZERO.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
182 }
183 }
184
185 /**
186 * Sets the firstFeeRate attribute value.
187 *
188 * @param firstFeeRate The firstFeeRate to set.
189 */
190 public void setFirstFeeRate(BigDecimal firstFeeRate) {
191 this.firstFeeRate = firstFeeRate.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
192 }
193
194 /**
195 * Gets the firstFeeBreakpoint attribute.
196 *
197 * @return Returns the firstFeeBreakpoint.
198 */
199 public KualiDecimal getFirstFeeBreakpoint() {
200 return firstFeeBreakpoint;
201 }
202
203 /**
204 * Sets the firstFeeBreakpoint attribute value.
205 *
206 * @param firstFeeBreakpoint The firstFeeBreakpoint to set.
207 */
208 public void setFirstFeeBreakpoint(KualiDecimal firstFeeBreakpoint) {
209 this.firstFeeBreakpoint = firstFeeBreakpoint;
210 }
211
212 /**
213 * Gets the secondFeeRate attribute.
214 *
215 * @return Returns the address2.
216 */
217 public BigDecimal getSecondFeeRate() {
218 if (secondFeeRate != null) {
219 return secondFeeRate.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
220 }
221 else {
222 return BigDecimal.ZERO.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
223 }
224 }
225
226 /**
227 * Sets the secondFeeRate attribute value.
228 *
229 * @param secondFeeRate The secondFeeRate to set.
230 */
231 public void setSecondFeeRate(BigDecimal secondFeeRate) {
232 this.secondFeeRate = secondFeeRate.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
233 }
234
235 /**
236 * Gets the secondFeeBreakpoint attribute.
237 *
238 * @return Returns the secondFeeBreakpoint.
239 */
240 public KualiDecimal getSecondFeeBreakpoint() {
241 return secondFeeBreakpoint;
242 }
243
244 /**
245 * Sets the secondFeeBreakpoint attribute value.
246 *
247 * @param secondFeeBreakpoint The secondFeeBreakpoint to set.
248 */
249 public void setSecondFeeBreakpoint(KualiDecimal secondFeeBreakpoint) {
250 this.secondFeeBreakpoint = secondFeeBreakpoint;
251 }
252
253 /**
254 * Gets the thirdFeeRate attribute.
255 *
256 * @return Returns the thirdFeeRate.
257 */
258 public BigDecimal getThirdFeeRate() {
259 if (thirdFeeRate != null) {
260 return thirdFeeRate.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
261 }
262 else {
263 return BigDecimal.ZERO.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
264 }
265 }
266
267 /**
268 * Sets the thirdFeeRate attribute value.
269 *
270 * @param thirdFeeRate The thirdFeeRate to set.
271 */
272 public void setThirdFeeRate(BigDecimal thirdFeeRate) {
273 this.thirdFeeRate = thirdFeeRate.setScale(EndowConstants.FeeMethod.FEE_RATE_MAX_SCALE, KualiDecimal.ROUND_BEHAVIOR);
274 }
275
276 /**
277 * Gets the minimumFeeToCharge attribute.
278 *
279 * @return Returns the minimumFeeToCharge.
280 */
281 public KualiDecimal getMinimumFeeToCharge() {
282 return minimumFeeToCharge;
283 }
284
285 /**
286 * Sets the minimumFeeToCharge attribute value.
287 *
288 * @param minimumFeeToCharge The minimumFeeToCharge to set.
289 */
290 public void setMinimumFeeToCharge(KualiDecimal minimumFeeToCharge) {
291 this.minimumFeeToCharge = minimumFeeToCharge;
292 }
293
294 /**
295 * Gets the feeTypeCode attribute.
296 *
297 * @return Returns the feeTypeCode.
298 */
299 public String getFeeTypeCode() {
300 return feeTypeCode;
301 }
302
303 /**
304 * Sets the feeTypeCode attribute value.
305 *
306 * @param feeTypeCode The feeTypeCode to set.
307 */
308 public void setFeeTypeCode(String feeTypeCode) {
309 this.feeTypeCode = feeTypeCode;
310 }
311
312 /**
313 * Gets the feeBaseCode attribute.
314 *
315 * @return Returns the feeBaseCode.
316 */
317 public String getFeeBaseCode() {
318 return feeBaseCode;
319 }
320
321 /**
322 * Sets the feeBaseCode attribute value.
323 *
324 * @param feeBaseCode The feeBaseCode to set.
325 */
326 public void setFeeBaseCode(String feeBaseCode) {
327 this.feeBaseCode = feeBaseCode;
328 }
329
330 /**
331 * Gets the feeExpenseETranCode attribute.
332 *
333 * @return Returns the feeExpenseETranCode.
334 */
335 public String getFeeExpenseETranCode() {
336 return feeExpenseETranCode;
337 }
338
339 /**
340 * Sets the feeExpenseETranCode attribute value.
341 *
342 * @param feeExpenseETranCode feeExpenseETranCode feeBaseCode to set.
343 */
344 public void setFeeExpenseETranCode(String feeExpenseETranCode) {
345 this.feeExpenseETranCode = feeExpenseETranCode;
346 }
347
348 /**
349 * Gets the feePostPendingIndicator attribute.
350 *
351 * @return Returns the feePostPendingIndicator.
352 */
353 public boolean getFeePostPendingIndicator() {
354 return feePostPendingIndicator;
355 }
356
357 /**
358 * Sets the feePostPendingIndicator attribute value.
359 *
360 * @param feePostPendingIndicator The feePostPendingIndicator to set.
361 */
362 public void setFeePostPendingIndicator(boolean feePostPendingIndicator) {
363 this.feePostPendingIndicator = feePostPendingIndicator;
364 }
365
366 /**
367 * Gets the corpusPctTolerance attribute.
368 *
369 * @return Returns the corpusPctTolerance.
370 */
371 public KualiDecimal getCorpusPctTolerance() {
372 return corpusPctTolerance;
373 }
374
375 /**
376 * Sets the corpusPctTolerance attribute value.
377 *
378 * @param corpusPctTolerance The corpusPctTolerance to set.
379 */
380 public void setCorpusPctTolerance(KualiDecimal corpusPctTolerance) {
381 this.corpusPctTolerance = corpusPctTolerance;
382 }
383
384 /**
385 * Gets the feeBalanceTypeCode attribute.
386 *
387 * @return Returns the feeBalanceTypeCode.
388 */
389 public String getFeeBalanceTypeCode() {
390 return feeBalanceTypeCode;
391 }
392
393 /**
394 * Sets the feeBalanceTypeCode attribute value.
395 *
396 * @param feeBalanceTypeCode The feeBalanceTypeCode to set.
397 */
398 public void setFeeBalanceTypeCode(String feeBalanceTypeCode) {
399 this.feeBalanceTypeCode = feeBalanceTypeCode;
400 }
401
402 /**
403 * Gets the feeByClassCode attribute.
404 *
405 * @return Returns the feeByClassCode.
406 */
407 public boolean getFeeByClassCode() {
408 return feeByClassCode;
409 }
410
411 /**
412 * Sets the feeByClassCode attribute value.
413 *
414 * @param feeByClassCode The feeByClassCode to set.
415 */
416 public void setFeeByClassCode(boolean feeByClassCode) {
417 this.feeByClassCode = feeByClassCode;
418 }
419
420 /**
421 * Gets the feeBySecurityCode attribute.
422 *
423 * @return Returns the feeBySecurityCode.
424 */
425 public boolean getFeeBySecurityCode() {
426 return feeBySecurityCode;
427 }
428
429 /**
430 * Sets the feeBySecurityCode attribute value.
431 *
432 * @param feeBySecurityCode The feeBySecurityCode to set.
433 */
434 public void setFeeBySecurityCode(boolean feeBySecurityCode) {
435 this.feeBySecurityCode = feeBySecurityCode;
436 }
437
438 /**
439 * Gets the feeByTransactionType attribute.
440 *
441 * @return Returns the feeByTransactionType.
442 */
443 public boolean getFeeByTransactionType() {
444 return feeByTransactionType;
445 }
446
447 /**
448 * Sets the feeByTransactionType attribute value.
449 *
450 * @param feeByTransactionType The feeByTransactionType to set.
451 */
452 public void setFeeByTransactionType(boolean feeByTransactionType) {
453 this.feeByTransactionType = feeByTransactionType;
454 }
455
456 /**
457 * Gets the feeByETranCode attribute.
458 *
459 * @return Returns the feeByETranCode.
460 */
461 public boolean getFeeByETranCode() {
462 return feeByETranCode;
463 }
464
465 /**
466 * Sets the feeByETranCode attribute value.
467 *
468 * @param feeByETranCode The feeByETranCode to set.
469 */
470 public void setFeeByETranCode(boolean feeByETranCode) {
471 this.feeByETranCode = feeByETranCode;
472 }
473
474 /**
475 * Gets the active attribute.
476 *
477 * @return Returns the active.
478 */
479 public boolean isActive() {
480 return active;
481 }
482
483 /**
484 * Sets the active attribute value.
485 *
486 * @param active The active to set.
487 */
488 public void setActive(boolean active) {
489 this.active = active;
490 }
491
492 /**
493 * Gets the FrequencyCode.
494 *
495 * @return Returns the FrequencyCode.
496 */
497 public FrequencyCode getFrequencyCode() {
498 return frequencyCode;
499 }
500
501 /**
502 * Sets the FrequencyCode.
503 *
504 * @param FrequencyCode The FrequencyCode to set.
505 */
506 public void setFrequencyCode(FrequencyCode frequencyCode) {
507 this.frequencyCode = frequencyCode;
508 }
509
510 /**
511 * Gets the feeRateDefinitionCode .
512 *
513 * @return Returns the feeRateDefinitionCode.
514 */
515 public FeeRateDefinitionCode getFeeRateDefinition() {
516 return feeRateDefinition;
517 }
518
519 /**
520 * Sets the developmentOfficer attribute value.
521 *
522 * @param developmentOfficer The developmentOfficer to set.
523 */
524 public void setFeeRateDefinition(FeeRateDefinitionCode feeRateDefinition) {
525 this.feeRateDefinition = feeRateDefinition;
526 }
527
528 /**
529 * Gets the endowmentTransactionCode.
530 *
531 * @return Returns the endowmentTransactionCode.
532 */
533 public EndowmentTransactionCode getEndowmentTransactionCode() {
534 return endowmentTransactionCode;
535 }
536
537 /**
538 * Sets the endowmentTransactionCode.
539 *
540 * @param endowmentTransactionCode The endowmentTransactionCode to set.
541 */
542 public void setEndowmentTransactionCode(EndowmentTransactionCode endowmentTransactionCode) {
543 this.endowmentTransactionCode = endowmentTransactionCode;
544 }
545
546 /**
547 * Gets the feeTypeCode attribute.
548 *
549 * @return Returns the feeTypeCode.
550 */
551 public FeeTypeCode getFeeType() {
552 return feeType;
553 }
554
555 /**
556 * Sets the firstCorporateContact.
557 *
558 * @param firstCorporateContact The firstCorporateContact to set.
559 */
560 public void setFeeType(FeeTypeCode feeType) {
561 this.feeType = feeType;
562 }
563
564 /**
565 * Gets the feeBaseCode.
566 *
567 * @return Returns the firstContactTitle.
568 */
569 public FeeBaseCode getFeeBase() {
570 return feeBase;
571 }
572
573 /**
574 * Sets the feeBaseCode.
575 *
576 * @param feeBaseCode The feeBaseCode to set.
577 */
578 public void setFeeBase(FeeBaseCode feeBase) {
579 this.feeBase = feeBase;
580 }
581
582 /**
583 * Gets the feeBalanceTypeCode.
584 *
585 * @return Returns the feeBalanceTypeCode.
586 */
587 public FeeBalanceTypeCode getFeeBalanceType() {
588 return feeBalanceType;
589 }
590
591 /**
592 * Sets the feeBalanceTypeCode.
593 *
594 * @param feeBalanceTypeCode The feeBalanceTypeCode to set.
595 */
596 public void setFeeBalanceType(FeeBalanceTypeCode feeBalanceType) {
597 this.feeBalanceType = feeBalanceType;
598 }
599
600 /**
601 * Gets the feeClassCodes attribute.
602 *
603 * @return Returns the feeClassCodes.
604 */
605 public List<FeeClassCode> getFeeClassCodes() {
606 return feeClassCodes;
607 }
608
609 /**
610 * Sets the feeClassCodes attribute value.
611 *
612 * @param feeClassCodes The feeClassCodes to set.
613 */
614 public void setFeeClassCodes(List<FeeClassCode> feeClassCodes) {
615 this.feeClassCodes = feeClassCodes;
616 }
617
618 /**
619 * Gets the feeSecurity attribute.
620 *
621 * @return Returns the feeSecurity.
622 */
623 public List<FeeSecurity> getFeeSecurity() {
624 return feeSecurity;
625 }
626
627 /**
628 * Sets the feeSecurity attribute value.
629 *
630 * @param feeSecurity The feeSecurity to set.
631 */
632 public void setFeeSecurity(List<FeeSecurity> feeSecurity) {
633 this.feeSecurity = feeSecurity;
634 }
635
636 /**
637 * Gets the feePaymentTypes attribute.
638 *
639 * @return Returns the feePaymentTypes.
640 */
641 public List<FeePaymentType> getFeePaymentTypes() {
642 return feePaymentTypes;
643 }
644
645 /**
646 * Sets the feePaymentTypes attribute value.
647 *
648 * @param feePaymentTypes The feePaymentTypes to set.
649 */
650 public void setFeePaymentTypes(List<FeePaymentType> feePaymentTypes) {
651 this.feePaymentTypes = feePaymentTypes;
652 }
653
654 /**
655 * Gets the feeTransactions attribute.
656 *
657 * @return Returns the feeTransactions.
658 */
659 public List<FeeTransaction> getFeeTransactions() {
660 return feeTransactions;
661 }
662
663 /**
664 * Sets the feeTransactions attribute value.
665 *
666 * @param feeTransactions The feeTransactions to set.
667 */
668 public void setFeeTransactions(List<FeeTransaction> feeTransactions) {
669 this.feeTransactions = feeTransactions;
670 }
671
672 /**
673 * Gets the feeEndowmentTransactionCodes attribute.
674 *
675 * @return Returns the feeEndowmentTransactionCodes.
676 */
677 public List<FeeEndowmentTransactionCode> getFeeEndowmentTransactionCodes() {
678 return feeEndowmentTransactionCodes;
679 }
680
681 /**
682 * Sets the feeEndowmentTransactionCodes attribute value.
683 *
684 * @param feeEndowmentTransactionCodes The feeEndowmentTransactionCodes to set.
685 */
686 public void setFeeEndowmentTransactionCodes(List<FeeEndowmentTransactionCode> feeEndowmentTransactionCodes) {
687 this.feeEndowmentTransactionCodes = feeEndowmentTransactionCodes;
688 }
689
690 /**
691 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
692 */
693 @Override
694 protected LinkedHashMap<String, String> toStringMapper() {
695 LinkedHashMap<String, String> m = new LinkedHashMap<String, String>();
696 m.put(EndowPropertyConstants.FEE_METHOD, this.code);
697 return m;
698 }
699
700 /**
701 * gets the codeAndDescription. returns codeAndDescription.
702 */
703 public String getCodeAndDescription() {
704 if (StringUtils.isEmpty(this.code)) {
705 return KFSConstants.EMPTY_STRING;
706 }
707 return getCode() + "-" + getName();
708 }
709 /**
710 * gets the minimumFeeThreshold. returns minimumFeeThreshold.
711 */
712 public KualiDecimal getMinimumFeeThreshold() {
713 if (minimumFeeThreshold == null) {
714 return new KualiDecimal("0");
715 }
716 return minimumFeeThreshold;
717 }
718
719 /**
720 * Sets the minimumFeeThreshold attribute value.
721 * @param minimumFeeThreshold The minimumFeeThreshold to set.
722 */
723 public void setMinimumFeeThreshold(KualiDecimal minimumFeeThreshold) {
724 this.minimumFeeThreshold = minimumFeeThreshold;
725 }
726 }