001: /*
002: * Copyright 2006-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.purap.service;
017:
018: import java.io.ByteArrayOutputStream;
019: import java.util.ArrayList;
020: import java.util.List;
021:
022: import org.kuali.core.bo.Note;
023: import org.kuali.core.util.KualiDecimal;
024: import org.kuali.module.purap.bo.PurchaseOrderQuoteStatus;
025: import org.kuali.module.purap.bo.PurchaseOrderVendorQuote;
026: import org.kuali.module.purap.document.PurchaseOrderDocument;
027: import org.kuali.module.purap.document.RequisitionDocument;
028:
029: /**
030: * Defines methods that must be implemented by classes providing a PurchaseOrderService.
031: */
032: public interface PurchaseOrderService {
033:
034: /**
035: * Saves the document without doing validation by invoking the saveDocument method of documentService.
036: *
037: * @param document The purchase order document to be saved.
038: */
039: public void saveDocumentNoValidation(PurchaseOrderDocument document);
040:
041: /**
042: * Creates an automatic purchase order document using the given requisition document
043: *
044: * @param reqDocument The requisition document that this method will use to create the Automated Purchase Order (APO).
045: */
046: public void createAutomaticPurchaseOrderDocument(
047: RequisitionDocument reqDocument);
048:
049: /**
050: * Creates a PurchaseOrderDocument from given RequisitionDocument. Both documents need to be saved after this method is called.
051: *
052: * @param reqDocument The requisition document that this method will use to create the purchase order.
053: * @param newSessionUserId The session user id that we'll use to invoke the performLogicWithFakedUserSession method of
054: * PurapService.
055: * @param contractManagerCode The contract manager code that we'll need to set on the purchase order.
056: * @return The purchase order document object that is created by this method.
057: */
058: public PurchaseOrderDocument createPurchaseOrderDocument(
059: RequisitionDocument reqDocument, String newSessionUserId,
060: Integer contractManagerCode);
061:
062: /**
063: * Creates and saves the purchase order change document (for example, PurchaseOrderAmendmentDocument) based on an existing
064: * purchase order document.
065: *
066: * @param documentNumber The document number of the existing purchase order document from which we try to create a new change
067: * document.
068: * @param docType The document type of the new change document.
069: * @param newDocumentStatusCode The status code that we want to set on the existing purchase order document after the new change
070: * document is created.
071: * @return The resulting new purchase order change document created by this method.
072: */
073: public PurchaseOrderDocument createAndSavePotentialChangeDocument(
074: String documentNumber, String docType,
075: String newDocumentStatusCode);
076:
077: /**
078: * Creates and routes the purchase order change document (for example, PurchaseOrderCloseDocument) based on an existing purchase
079: * order document.
080: *
081: * @param documentNumber The document number of the existing purchase order document from which we try to create a new change
082: * document.
083: * @param docType The document type of the new change document.
084: * @param annotation The annotation that we'll use to invoke the routeDocument method of DocumentService.
085: * @param adhocRoutingRecipients The adhocRoutingRecipients that we'll use to invoke the routeDocument method of
086: * DocumentService.
087: * @param newDocumentStatusCode The status code that we want to set on the existing purchase order document after the new change
088: * document is created.
089: * @return The resulting new purchase order change document created by this method.
090: */
091: public PurchaseOrderDocument createAndRoutePotentialChangeDocument(
092: String documentNumber, String docType, String annotation,
093: List adhocRoutingRecipients, String newDocumentStatusCode);
094:
095: /**
096: * Obtains the internal purchasing dollar limit amount for a purchase order document.
097: *
098: * @param po The purchase order document for which this method is obtaining the internal purchasing dollar limit.
099: * @return The internal purchasing dollar limit for the given purchase order document.
100: */
101: public KualiDecimal getInternalPurchasingDollarLimit(
102: PurchaseOrderDocument po);
103:
104: public boolean printPurchaseOrderQuoteRequestsListPDF(
105: PurchaseOrderDocument po, ByteArrayOutputStream baosPDF);
106:
107: public boolean printPurchaseOrderQuotePDF(PurchaseOrderDocument po,
108: PurchaseOrderVendorQuote povq, ByteArrayOutputStream baosPDF);
109:
110: /**
111: * Creates and displays the pdf document for the purchase order, sets the transmit dates, calls the
112: * takeAllActionsForGivenCriteria method in PurApWorkflowIntegrationService to perform all the workflow related steps that are
113: * necessary as part of the document initial print transmission and then performs the setup of initial of open document of the
114: * purchase order.
115: *
116: * @param documentNumber The document number of the purchase order document that we want to perform the first transmit.
117: * @param baosPDF The ByteArrayOutputStream object that was passed in from the struts action so that we could display the pdf on
118: * the browser.
119: */
120: public void performPurchaseOrderFirstTransmitViaPrinting(
121: String documentNumber, ByteArrayOutputStream baosPDF);
122:
123: /**
124: * Generates and displays the purchase order pdf by invoking the generatePurchaseOrderPdf method of the PrintService.
125: *
126: * @param documentNumber The document number of the purchase order document that we want to print the pdf.
127: * @param baosPDF The ByteArrayOutputStream object that we'll use to display the pdf on the browser.
128: */
129: public void performPrintPurchaseOrderPDFOnly(String documentNumber,
130: ByteArrayOutputStream baosPDF);
131:
132: /**
133: * Generates and displays the purchase order retransmit pdf by invoking the generatePurchaseOrderPdfForRetransmission method of
134: * the PrintService.
135: *
136: * @param po The purchase order document to be retransmitted.
137: * @param baosPDF The ByteArrayOutputStream object that we'll use to display the pdf on the browser.
138: */
139: public void retransmitPurchaseOrderPDF(PurchaseOrderDocument po,
140: ByteArrayOutputStream baosPDF);
141:
142: /**
143: * Performs the steps needed to complete the newly approved purchase order document, which consists of setting the current and
144: * pending indicators for the purchase order document and if the status is not pending transmission, then calls the
145: * attemptsSetupOfInitialOpenOfDocument to set the statuses, the initial open date and save the document.
146: *
147: * @param po The newly approved purchase order document that we want to complete.
148: */
149: public void completePurchaseOrder(PurchaseOrderDocument po);
150:
151: /**
152: * Obtains the purchase order document whose current indicator is true, given a purchase order id which is the
153: * purapDocumentIdentifier.
154: *
155: * @param id The po id (purapDocumentIdentifier) that we'll use to retrieve the current purchase order document.
156: * @return The current purchase order document (the po whose current indicator is true).
157: */
158: public PurchaseOrderDocument getCurrentPurchaseOrder(Integer id);
159:
160: /**
161: * Obtains the purchase order document given the document number.
162: *
163: * @param documentNumber The document number of the purchase order that we want to retrieve.
164: * @return The purchase order document whose document number is the given document number.
165: */
166: public PurchaseOrderDocument getPurchaseOrderByDocumentNumber(
167: String documentNumber);
168:
169: /**
170: * Sets the current and pending indicators of the new purchase order and the old purchase order as well as its status, then save
171: * the purchase order.
172: *
173: * @param newPO The new purchase order document that has been approved.
174: */
175: public void setCurrentAndPendingIndicatorsForApprovedPODocuments(
176: PurchaseOrderDocument newPO);
177:
178: /**
179: * Sets the current and pending indicators of the new purchase order and the old purchase order as well as their statuses, then
180: * save the purchase order.
181: *
182: * @param newPO The new purchase order document that has been disapproved.
183: */
184: public void setCurrentAndPendingIndicatorsForDisapprovedChangePODocuments(
185: PurchaseOrderDocument newPO);
186:
187: /**
188: * Sets the current and pending indicators of the new purchase order and the old purchase order as well as their statuses, then
189: * save the purchase order.
190: *
191: * @param newPO The new purchase order document that has been canceled.
192: */
193: public void setCurrentAndPendingIndicatorsForCancelledChangePODocuments(
194: PurchaseOrderDocument newPO);
195:
196: /**
197: * Sets the current and pending indicators of the new purchase order and the old purchase order as well as their statuses, then
198: * save the purchase order.
199: *
200: * @param newPO The new purchase order reopen document that has been canceled.
201: */
202: public void setCurrentAndPendingIndicatorsForCancelledReopenPODocuments(
203: PurchaseOrderDocument newPO);
204:
205: /**
206: * Sets the current and pending indicators of the new purchase order and the old purchase order as well as their statuses, then
207: * save the purchase order.
208: *
209: * @param newPO The new purchase order reopen document that has been disapproved.
210: */
211: public void setCurrentAndPendingIndicatorsForDisapprovedReopenPODocuments(
212: PurchaseOrderDocument newPO);
213:
214: /**
215: * Sets the current and pending indicators of the new purchase order and the old purchase order as well as their statuses, then
216: * save the purchase order
217: *
218: * @param newPO The new purchase order remove hold document that has been canceled.
219: */
220: public void setCurrentAndPendingIndicatorsForCancelledRemoveHoldPODocuments(
221: PurchaseOrderDocument newPO);
222:
223: /**
224: * Sets the current and pending indicators of the new purchase order and the old purchase order as well as their statuses, then
225: * save the purchase order.
226: *
227: * @param newPO The new purchase order remove hold document that has been disapproved.
228: */
229: public void setCurrentAndPendingIndicatorsForDisapprovedRemoveHoldPODocuments(
230: PurchaseOrderDocument newPO);
231:
232: /**
233: * Obtains the oldest purchase order given the purchase order object to be used to search, then calls the updateNotes method to
234: * set the notes on the oldest purchase order and finally return the oldest purchase order.
235: *
236: * @param po The current purchase order object from which we want to obtain the oldest purchase order.
237: * @param documentBusinessObject The documentBusinessObject of the current purchase order object.
238: * @return The oldest purchase order whose purchase order id is the same as the current purchase order's id.
239: */
240: public PurchaseOrderDocument getOldestPurchaseOrder(
241: PurchaseOrderDocument po,
242: PurchaseOrderDocument documentBusinessObject);
243:
244: /**
245: * Obtains all the notes that belong to this purchase order given the purchase order id.
246: *
247: * @param id The purchase order id (purapDocumentIdentifier).
248: * @return The list of notes that belong to this purchase order.
249: */
250: public ArrayList<Note> getPurchaseOrderNotes(Integer id);
251:
252: public ArrayList<PurchaseOrderQuoteStatus> getPurchaseOrderQuoteStatusCodes();
253:
254: /**
255: * Update the purchase order document with the appropriate status for pending first transmission if the transmission method code
256: * is PRINT, or set the purchase order status to OPEN, set the initial open date and save the purchase order if the transmission
257: * method code is not PRINT and the hasActionRequestForDocumentTransmission is false.
258: *
259: * @param po The purchase order document whose status to be updated.
260: * @param hasActionRequestForDocumentTransmission boolean true if this purchase order has action request for document
261: * transmission.
262: */
263: public void setupDocumentForPendingFirstTransmission(
264: PurchaseOrderDocument po,
265: boolean hasActionRequestForDocumentTransmission);
266: }
|