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.sql.Date;
019: import java.util.List;
020:
021: import org.kuali.core.exceptions.UserNotFoundException;
022: import org.kuali.core.util.KualiDecimal;
023: import org.kuali.module.purap.bo.ItemType;
024: import org.kuali.module.purap.bo.PurApItem;
025: import org.kuali.module.purap.document.PurchasingAccountsPayableDocument;
026:
027: import edu.iu.uis.eden.exception.WorkflowException;
028:
029: /**
030: * Defines methods that must be implemented by classes providing a PurapService.
031: */
032: public interface PurapService {
033:
034: /**
035: * Update the status for the given Purchasing/Accounts Payable document
036: *
037: * @param document
038: * @param statusToSet
039: * @return
040: */
041: public boolean updateStatus(
042: PurchasingAccountsPayableDocument document,
043: String statusToSet);
044:
045: /**
046: * Retrieve list of views for given identifier
047: *
048: * @param clazz
049: * @param accountsPayablePurchasingDocumentLinkIdentifier
050: * @return List of views for given identifier
051: */
052: public List getRelatedViews(Class clazz,
053: Integer accountsPayablePurchasingDocumentLinkIdentifier);
054:
055: /**
056: * Add the allowed below the line items to the given document
057: *
058: * @param document PurchasingAccountsPayableDocument
059: */
060: public void addBelowLineItems(
061: PurchasingAccountsPayableDocument document);
062:
063: /**
064: * Retrieves the below the line items allowed from the parameter table for the given document
065: *
066: * @param document PurchasingAccountsPayableDocument
067: * @return Array list of below the line items
068: */
069: public String[] getBelowTheLineForDocument(
070: PurchasingAccountsPayableDocument document);
071:
072: /**
073: * Retrieve the below the line item for a doc by item type (unknown result if multiple of same below the line item
074: * type)
075: *
076: * @param document the document
077: * @param iT the itemType
078: * @return below the line item by item type
079: */
080: public PurApItem getBelowTheLineByType(
081: PurchasingAccountsPayableDocument document, ItemType iT);
082:
083: /**
084: * Determine whether a given date is in the past.
085: *
086: * @param compareDate An SQL date (not a DateFormatter date, or a util Date)
087: * @return True if the given date is before today.
088: */
089: public boolean isDateInPast(Date compareDate);
090:
091: /**
092: * Determine whether a given date is more than a given number of days away from the current date.
093: *
094: * @param compareDate An SQL date (not a DateFormatter date, or a util Date)
095: * @param daysAway An int, positive for future days, negative for past days
096: * @return True if the given date is more than the given number of days away in either direction.
097: */
098: public boolean isDateMoreThanANumberOfDaysAway(Date compareDate,
099: int daysAway);
100:
101: /**
102: * We are obliged not to simply use a dateDiff and compare the result to 365, because we have to worry about leap years.
103: *
104: * @param compareDate An SQL date (not a DateFormatter date, or a util Date)
105: * @return True if the date given for comparison is more than a year in the past, not including today.
106: */
107: public boolean isDateAYearBeforeToday(Date compareDate);
108:
109: /**
110: * Retrieve the Automatic Purchase Order Limit amount based first on the derived contract limit (see
111: * {@link org.kuali.module.vendor.service.VendorService#getApoLimitFromContract(Integer, String, String)}) and if that is null
112: * then based on the {@link org.kuali.module.purap.bo.OrganizationParameter} associated with the given 'chart' and 'org' values.
113: *
114: * @param vendorContractGeneratedIdentifier
115: * @param chart chart code to use when looking up limit amount on {@link org.kuali.module.vendor.bo.VendorContract} and
116: * {@link org.kuali.module.purap.bo.OrganizationParameter}
117: * @param org organization code to use when looking up limit amount on {@link org.kuali.module.vendor.bo.VendorContract} and
118: * {@link org.kuali.module.purap.bo.OrganizationParameter}
119: * @return a KualiDecimal if a valid limit amount is found or null if one is not found
120: */
121: public KualiDecimal getApoLimit(
122: Integer vendorContractGeneratedIdentifier, String chart,
123: String org);
124:
125: /**
126: * Determines if full entry mode has ended for this Purchasing/Accounts Payable document.
127: *
128: * @param purapDocument PurchasingAccountsPayableDocument
129: * @return a boolean to indicate if document has completed full entry mode
130: */
131: public boolean isFullDocumentEntryCompleted(
132: PurchasingAccountsPayableDocument purapDocument);
133:
134: /**
135: * Performs all the actions on an update document.
136: *
137: * @param purapDocument PurchasingAccountsPayableDocument
138: */
139: public void performLogicForFullEntryCompleted(
140: PurchasingAccountsPayableDocument purapDocument);
141:
142: /**
143: * Create a close or reopen purchase order document.
144: *
145: * @param purapDocument PurchasingAccountsPayableDocument
146: */
147: public void performLogicForCloseReopenPO(
148: PurchasingAccountsPayableDocument purapDocument);
149:
150: /**
151: * Performs the given logic with the given fake user id. Need this to control the user.
152: *
153: * @param requiredUniversalUserPersonUserId
154: * @param logicToRun
155: * @param objects
156: * @return
157: * @throws UserNotFoundException
158: * @throws WorkflowException
159: * @throws Exception
160: */
161: public Object performLogicWithFakedUserSession(
162: String requiredUniversalUserPersonUserId,
163: LogicContainer logicToRun, Object... objects)
164: throws UserNotFoundException, WorkflowException, Exception;
165:
166: /**
167: * Sort the below the line elements of the given document
168: *
169: * @param document PurchasingAccountsPayableDocument to be sorted
170: */
171: public void sortBelowTheLine(
172: PurchasingAccountsPayableDocument document);
173: }
|