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.service.impl;
17:
18: import org.kuali.core.document.Document;
19: import org.kuali.kfs.service.ConciseXmlDocumentConversionService;
20: import org.kuali.module.purap.document.CreditMemoDocument;
21: import org.kuali.module.purap.document.PaymentRequestDocument;
22: import org.kuali.module.purap.document.PurchaseOrderDocument;
23: import org.kuali.module.purap.document.RequisitionDocument;
24: import org.kuali.module.purap.document.WorkflowXmlCreditMemoDocument;
25: import org.kuali.module.purap.document.WorkflowXmlPaymentRequestDocument;
26: import org.kuali.module.purap.document.WorkflowXmlPurchaseOrderDocument;
27: import org.kuali.module.purap.document.WorkflowXmlRequisitionDocument;
28:
29: public class PurapConciseXmlDocumentConversionServiceImpl implements
30: ConciseXmlDocumentConversionService {
31: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
32: .getLogger(PurapConciseXmlDocumentConversionServiceImpl.class);
33:
34: /**
35: * @see org.kuali.kfs.service.ConciseXmlDocumentConversionService#getDocumentForSerialization(org.kuali.core.document.Document)
36: */
37: public Document getDocumentForSerialization(Document document) {
38: Document returnDocument = null;
39: if (document instanceof RequisitionDocument) {
40: returnDocument = getRequisitionDocumentForSerialization((RequisitionDocument) document);
41: } else if (document instanceof PurchaseOrderDocument) {
42: returnDocument = getPurchaseOrderDocumentForSerialization((PurchaseOrderDocument) document);
43: } else if (document instanceof PaymentRequestDocument) {
44: returnDocument = getPaymentRequestDocumentForSerialization((PaymentRequestDocument) document);
45: } else if (document instanceof CreditMemoDocument) {
46: returnDocument = getCreditMemoDocumentForSerialization((CreditMemoDocument) document);
47: }
48: return returnDocument;
49: }
50:
51: /**
52: * Returns the alternate version of the Requisition document needed for Workflow.
53: *
54: * @param document Requisition to be routed
55: * @return alternate document for Workflow
56: */
57: private Document getRequisitionDocumentForSerialization(
58: RequisitionDocument document) {
59: return new WorkflowXmlRequisitionDocument(document);
60: }
61:
62: /**
63: * Returns the alternate version of the Purchase Order document needed for Workflow.
64: *
65: * @param document Purchase Order to be routed
66: * @return alternate document for Workflow
67: */
68: private Document getPurchaseOrderDocumentForSerialization(
69: PurchaseOrderDocument document) {
70: return new WorkflowXmlPurchaseOrderDocument(document);
71: }
72:
73: /**
74: * Returns the alternate version of the Payment Request document needed for Workflow.
75: *
76: * @param document Payment Request to be routed
77: * @return alternate document for Workflow
78: */
79: private Document getPaymentRequestDocumentForSerialization(
80: PaymentRequestDocument document) {
81: return new WorkflowXmlPaymentRequestDocument(document);
82: }
83:
84: /**
85: * Returns the alternate version of the Credit Memo document needed for Workflow.
86: *
87: * @param document Credit Memo to be routed
88: * @return alternate document for Workflow
89: */
90: private Document getCreditMemoDocumentForSerialization(
91: CreditMemoDocument document) {
92: return new WorkflowXmlCreditMemoDocument(document);
93: }
94:
95: }
|