001: /*
002: * Copyright 2005-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.gl.service;
017:
018: import java.io.BufferedOutputStream;
019: import java.sql.Date;
020: import java.util.Collection;
021: import java.util.Iterator;
022: import java.util.List;
023: import java.util.Map;
024:
025: import org.kuali.module.gl.bo.OriginEntryFull;
026: import org.kuali.module.gl.bo.OriginEntryGroup;
027: import org.kuali.module.gl.bo.Transaction;
028: import org.kuali.module.gl.util.LedgerEntryHolder;
029: import org.kuali.module.gl.util.OriginEntryStatistics;
030: import org.kuali.module.gl.util.PosterOutputSummaryEntry;
031:
032: /**
033: * An interface of methods to interact with Origin Entries
034: */
035: public interface OriginEntryService {
036:
037: /**
038: * Get statistics from a group
039: * @param groupId the id of a group of origin entries
040: * @return a collection of OriginEntryStatistics
041: */
042: public OriginEntryStatistics getStatistics(Integer groupId);
043:
044: /**
045: * Copy a set of entries into a new group
046: *
047: * @param date the date that the copied entries should list as their post date
048: * @param sourceCode the source code of the origin entry group to create
049: * @param valid whether the new group should be considered valid
050: * @param process whether the new group should be ready to be processed
051: * @param scrub whether the new group should be processed by the scrubber
052: * @param entries a Collection of entries to copy
053: * @return a new origin entry full of copied entries
054: */
055: public OriginEntryGroup copyEntries(Date date, String sourceCode,
056: boolean valid, boolean process, boolean scrub,
057: Collection<OriginEntryFull> entries);
058:
059: /**
060: * Copy a set of entries into a new group. This method can use less space than the method that takes in a collection, because
061: * iterators can be implemented to load data one chunk at a time, similar to how java ResultSets work.
062: *
063: * @param date the date that the copied entries should list as their post date
064: * @param sourceCode the source code of the origin entry group to create
065: * @param valid whether the new group should be considered valid
066: * @param process whether the new group should be ready to be processed
067: * @param scrub whether the new group should be processed by the scrubber
068: * @param entries a Iterator of entries to copy
069: * @return a new origin entry full of copied entries
070: */
071: public OriginEntryGroup copyEntries(Date date, String sourceCode,
072: boolean valid, boolean process, boolean scrub,
073: Iterator<OriginEntryFull> entries);
074:
075: /**
076: * Delete entry
077: *
078: * @param oe Entry to delete
079: */
080: public void delete(OriginEntryFull oe);
081:
082: /**
083: * This returns all of distinct primary key sets of documents that created origin entries that exist
084: * in the given origin entry group. It returns this information in OriginEntryFull objects
085: * that just don't have any other information besides the document keys (doc number, doc type code,
086: * and origination code) filled in.
087: *
088: * @param oeg the group with the origin entries to get the documents of
089: * @return Collection to qualifying documents
090: */
091: public Collection<OriginEntryFull> getDocumentsByGroup(
092: OriginEntryGroup oeg);
093:
094: /**
095: * Return all entries for a group sorted by account number for the error
096: *
097: * @param oeg an origin entry group to get entries from
098: * @return an Iterator of origin entries sorted by account number
099: */
100: public Iterator<OriginEntryFull> getEntriesByGroupAccountOrder(
101: OriginEntryGroup oeg);
102:
103: /**
104: * Return all entries for a group sorted for display on the pending entry report.
105: *
106: * @param oeg a origin entry group to get entries from
107: * @return an Iterator of origin entries sorted in the order needed for an origin entry report (fiscal year, chart, account, sub account, object, sub object)
108: */
109: public Iterator<OriginEntryFull> getEntriesByGroupReportOrder(
110: OriginEntryGroup oeg);
111:
112: /**
113: * Return all entries for a group sorted across the columns in report from left to right.
114: *
115: * @param oeg an origin entry group to get entries from
116: * @return an Iterator of origin entries sorted in the proper order
117: */
118: public Iterator<OriginEntryFull> getEntriesByGroupListingReportOrder(
119: OriginEntryGroup oeg);
120:
121: /**
122: * Return all entries for the groups where the balance type is empty
123: *
124: * @param groups a Collection of groups to look through all the entries of
125: * @return an Iterator of entries without balance types
126: */
127: public Iterator<OriginEntryFull> getBadBalanceEntries(
128: Collection groups);
129:
130: /**
131: * Return all the entries in a specific group
132: *
133: * @param oeg Group used to select entries
134: * @return Iterator to all the entires
135: */
136: public Iterator<OriginEntryFull> getEntriesByGroup(
137: OriginEntryGroup oeg);
138:
139: /**
140: * Return all the entries for a specific document in a specific group
141: *
142: * @param oeg an origin entry group to find entries in
143: * @param documentNumber the document number of entries to select
144: * @param documentTypeCode the document type of entries to select
145: * @param originCode the origination code of entries to select
146: * @return iterator to all the qualifying entries
147: */
148: public Iterator<OriginEntryFull> getEntriesByDocument(
149: OriginEntryGroup oeg, String documentNumber,
150: String documentTypeCode, String originCode);
151:
152: /**
153: * Take a generic transaction and save it as an origin entry in a specific group
154: *
155: * @param tran transaction to save
156: * @param group group to save the transaction
157: */
158: public void createEntry(Transaction tran, OriginEntryGroup group);
159:
160: /**
161: * Save an origin entry
162: *
163: * @param entry the entry to save
164: */
165: public void save(OriginEntryFull entry);
166:
167: /**
168: * Export all origin entries in a group to a flat text file
169: *
170: * @param filename Filename to save the text
171: * @param groupId Group to save
172: */
173: public void exportFlatFile(String filename, Integer groupId);
174:
175: /**
176: * Load a flat file of transations into the origin entry table (creating a new origin entry group in the process)
177: *
178: * @param filename Filename with the text
179: * @param groupSourceCode Source of the new group
180: * @param valid Valid flag for new group
181: * @param processed Process flag for new group
182: * @param scrub Scrub flag for new group
183: */
184: public void loadFlatFile(String filename, String groupSourceCode,
185: boolean valid, boolean processed, boolean scrub);
186:
187: /**
188: * Write all of the origin entries in a group to an output stream
189: *
190: * @param groupId the id of the origin entry group to get entries from
191: * @param bw the output stream to dump the entries as text to
192: */
193: public void flatFile(Integer groupId, BufferedOutputStream bw);
194:
195: /**
196: * writes out a list of origin entries to an output stream.
197: *
198: * @param entries an Iterator of entries to save as text
199: * @param bw the output stream to write origin entries to
200: */
201: public void flatFile(Iterator<OriginEntryFull> entries,
202: BufferedOutputStream bw);
203:
204: /**
205: * get the summarized information of the entries that belong to the entry groups with the given group id list
206: *
207: * @param groupIdList the origin entry groups
208: * @return a set of summarized information of the entries within the specified group
209: */
210: public LedgerEntryHolder getSummaryByGroupId(Collection groupIdList);
211:
212: /**
213: * Finds all origin entries matching certain criteria; basically a catch-all origin entry search
214: *
215: * @param searchCriteria the criteria to be used in forming a query
216: * @return a Collection of qualifying origin entries
217: */
218: public Collection<OriginEntryFull> getMatchingEntriesByCollection(
219: Map searchCriteria);
220:
221: /**
222: * Retrieves a list of origin entries that are in a given group
223: *
224: * @param groupId the id of the group to get all entries from
225: * @return a List of Origin Entries
226: */
227: public List<OriginEntryFull> getEntriesByGroupId(Integer groupId);
228:
229: /**
230: * Returns the entry with the given id
231: *
232: * @param entryId the id of the entry to retrieve
233: * @return the origin entry if found, or null otherwise
234: */
235: public OriginEntryFull getExactMatchingEntry(Integer entryId);
236:
237: /**
238: * get the summarized information of poster input entries that belong to the entry groups with the given group id list
239: *
240: * @param groupIdList the origin entry groups
241: * @return a map of summarized information of poster input entries within the specified groups
242: */
243: public Map<String, PosterOutputSummaryEntry> getPosterOutputSummaryByGroupId(
244: Collection groupIdList);
245:
246: /**
247: * Get count of transactions in a group
248: * @param groupId the group to get the count of entries from
249: * @return a count of entries
250: */
251: public Integer getGroupCount(Integer groupId);
252: }
|