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 org.kuali.core.service.DocumentService;
19: import org.kuali.kfs.context.SpringContext;
20: import org.kuali.module.financial.document.AccountingDocumentTestUtils;
21: import org.kuali.module.purap.PurapConstants.PurchaseOrderStatuses;
22: import org.kuali.module.purap.document.PurchaseOrderDocument;
23:
24: import edu.iu.uis.eden.exception.WorkflowException;
25:
26: public enum PurchaseOrderHoldFixture {
27:
28: STATUS_OPEN(PurchaseOrderStatuses.OPEN), STATUS_CLOSED(
29: PurchaseOrderStatuses.CLOSED), STATUS_HOLD(
30: PurchaseOrderStatuses.PAYMENT_HOLD), ;
31:
32: private String status;
33:
34: private PurchaseOrderHoldFixture(String status) {
35: this .status = status;
36: }
37:
38: public PurchaseOrderDocument populate(PurchaseOrderDocument po) {
39: try {
40: po = PurchaseOrderDocumentFixture.PO_ONLY_REQUIRED_FIELDS
41: .createPurchaseOrderDocument();
42: } catch (Exception e) {
43: throw new RuntimeException("Problems creating new PO: " + e);
44: }
45: po.setStatusCode(status);
46: po.refreshNonUpdateableReferences();
47: return po;
48: }
49: }
|