01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.purap.fixtures;
17:
18: import java.sql.Date;
19:
20: import org.kuali.core.util.ObjectUtils;
21: import org.kuali.module.purap.document.PurchasingDocument;
22: import org.kuali.module.purap.fixtures.PurapTestConstants.BeginEndDates;
23: import org.kuali.module.purap.fixtures.PurapTestConstants.RecurringPaymentTypes;
24:
25: public enum RecurringPaymentBeginEndDatesFixture {
26:
27: REQ_RIGHT_ORDER(BeginEndDates.REQ, BeginEndDates.FIRST_DATE,
28: BeginEndDates.LAST_DATE, RecurringPaymentTypes.FIXD), REQ_WRONG_ORDER(
29: BeginEndDates.REQ, BeginEndDates.LAST_DATE,
30: BeginEndDates.FIRST_DATE, RecurringPaymentTypes.FIXD), REQ_SEQUENTIAL_NEXT_FY(
31: BeginEndDates.REQ, BeginEndDates.FIRST_DATE,
32: BeginEndDates.LAST_DATE, PurapTestConstants.FY_2007,
33: RecurringPaymentTypes.FIXD), REQ_NON_SEQUENTIAL_NEXT_FY(
34: BeginEndDates.REQ, BeginEndDates.LAST_DATE,
35: BeginEndDates.FIRST_DATE, PurapTestConstants.FY_2007,
36: RecurringPaymentTypes.FIXD), PO_RIGHT_ORDER(
37: BeginEndDates.PO, BeginEndDates.FIRST_DATE,
38: BeginEndDates.LAST_DATE, RecurringPaymentTypes.FIXD), PO_WRONG_ORDER(
39: BeginEndDates.PO, BeginEndDates.LAST_DATE,
40: BeginEndDates.FIRST_DATE, RecurringPaymentTypes.FIXD), PO_SEQUENTIAL_NEXT_FY(
41: BeginEndDates.PO, BeginEndDates.FIRST_DATE,
42: BeginEndDates.LAST_DATE, PurapTestConstants.FY_2007,
43: RecurringPaymentTypes.FIXD), PO_NON_SEQUENTIAL_NEXT_FY(
44: BeginEndDates.PO, BeginEndDates.LAST_DATE,
45: BeginEndDates.FIRST_DATE, PurapTestConstants.FY_2007,
46: RecurringPaymentTypes.FIXD);
47:
48: PurchasingDocument document;
49: Date beginDate;
50: Date endDate;
51: Integer currentFiscalYear;
52: String recurringPaymentType;
53:
54: private RecurringPaymentBeginEndDatesFixture(
55: PurchasingDocument document, Date date1, Date date2,
56: String recurringPaymentType) {
57: this .document = document;
58: this .beginDate = date1;
59: this .endDate = date2;
60: this .recurringPaymentType = recurringPaymentType;
61: }
62:
63: private RecurringPaymentBeginEndDatesFixture(
64: PurchasingDocument document, Date date1, Date date2,
65: Integer currentFY, String recurringPaymentType) {
66: this .document = document;
67: this .beginDate = date1;
68: this .endDate = date2;
69: this .currentFiscalYear = currentFY;
70: this .recurringPaymentType = recurringPaymentType;
71: }
72:
73: public PurchasingDocument populateDocument() {
74: this .document.setPurchaseOrderBeginDate(beginDate);
75: this .document.setPurchaseOrderEndDate(endDate);
76: this .document.setRecurringPaymentTypeCode(recurringPaymentType);
77: if (ObjectUtils.isNotNull(this .currentFiscalYear)) {
78: this .document.setPostingYear(new Integer(
79: this .currentFiscalYear + 1));
80: }
81: return document;
82: }
83:
84: }
|