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.dao;
017:
018: import java.util.Collection;
019: import java.util.Iterator;
020: import java.util.Map;
021:
022: import org.kuali.core.util.KualiDecimal;
023: import org.kuali.module.gl.bo.OriginEntry;
024: import org.kuali.module.gl.bo.OriginEntryFull;
025: import org.kuali.module.gl.bo.OriginEntryGroup;
026:
027: /**
028: *
029: */
030: public interface OriginEntryDao {
031: /**
032: * Sort origin entries by document id
033: */
034: public static final int SORT_DOCUMENT = 1;
035: /**
036: * Sort origin entries by account number
037: */
038: public static final int SORT_ACCOUNT = 2;
039: /**
040: * Sort origin entries by standard report order (by document type code and system origination code)
041: */
042: public static final int SORT_REPORT = 3;
043: /**
044: * Sort origin entries by listing report order (by fiscal year, chart code, account number, etc.: the order you see them in in generated text files)
045: */
046: public static final int SORT_LISTING_REPORT = 4;
047:
048: /**
049: * Get the total amount of transactions in a group
050: * @param the id of the origin entry group to total
051: * @param isCredit whether the total should be of credits or not
052: * @return the sum of all queried origin entries
053: */
054: public KualiDecimal getGroupTotal(Integer groupId, boolean isCredit);
055:
056: /**
057: * Counts the number of entries in a group
058: * @param the id of an origin entry group
059: * @return the count of the entries in that group
060: */
061: public Integer getGroupCount(Integer groupId);
062:
063: /**
064: * Counts of rows of all the origin entry groups
065: *
066: * @return iterator of Object[] {[BigDecimal id,BigDecimal count]}
067: */
068: public Iterator getGroupCounts();
069:
070: /**
071: * Delete an entry
072: *
073: * @param oe Entry to delete
074: */
075: public void deleteEntry(OriginEntry oe);
076:
077: /**
078: * Return an iterator to all document keys reference by origin entries in a given group
079: *
080: * @param oeg Group the origin entry group to find entries in, by origin entry
081: * @return Iterator of java.lang.Object[] with report data about all of the distinct document numbers/type code/origination code combinations of origin entries in the group
082: */
083: public Iterator getDocumentsByGroup(OriginEntryGroup oeg);
084:
085: /**
086: * Return an iterator to all the entries in a group
087: *
088: * @param oeg the origin entry group to get entries in
089: * @param sort the Sort Order (one of the Sort Orders defined by the SORT_ constants defined in this class)
090: * @return Iterator of entries in the specified group
091: */
092: public <T> Iterator<T> getEntriesByGroup(OriginEntryGroup oeg,
093: int sort);
094:
095: /**
096: * Get bad balance entries; bad because a) they have invalid balance types, and b) because they revert the balances back to their stone age selves
097: *
098: * @param groups a Collection of groups to remove bad entries in
099: * @return an Iterator of no good, won't use, bad balance entries
100: */
101: public Iterator<OriginEntryFull> getBadBalanceEntries(
102: Collection groups);
103:
104: /**
105: * Collection of entries that match criteria
106: *
107: * @param searchCriteria Map of field, value pairs
108: * @return collection of entries
109: */
110: public Collection<OriginEntryFull> getMatchingEntriesByCollection(
111: Map searchCriteria);
112:
113: /**
114: * Iterator of entries that match criteria
115: *
116: * @param searchCriteria Map of field, value pairs
117: * @return collection of entries
118: */
119: public Iterator getMatchingEntries(Map searchCriteria);
120:
121: /**
122: * Delete entries that match criteria
123: *
124: * @param searchCriteria Map of field, value pairs
125: */
126: public void deleteMatchingEntries(Map searchCriteria);
127:
128: /**
129: * Delete all the groups in the list. This will delete the entries. The OriginEntryGroupDao has a method to delete the groups
130: *
131: * @param groups a Collection of Origin Entry Groups to delete entries in
132: */
133: public void deleteGroups(Collection<OriginEntryGroup> groups);
134:
135: /**
136: * Save origin entry
137: *
138: * @param entry entry to save
139: */
140: public void saveOriginEntry(OriginEntry entry);
141:
142: /**
143: * Finds an entry for the given entryId, or returns a newly created on
144: *
145: * @param entryId an entry id to find an entry for
146: * @return the entry for the given entry id, or a newly created entry
147: */
148: public OriginEntryFull getExactMatchingEntry(Integer entryId);
149:
150: /**
151: * get the summarized information of the entries that belong to the entry groups with the given group ids
152: *
153: * @param groupIdList the ids of origin entry groups
154: * @return a set of summarized information of the entries within the specified groups
155: */
156: public Iterator getSummaryByGroupId(Collection groupIdList);
157:
158: /**
159: * This method should only be used in unit tests. It loads all the gl_origin_entry_t rows in memory into a collection. This
160: * won't scale for production.
161: *
162: * @return a Collection with every single origin entry in the database
163: */
164: public Collection testingGetAllEntries();
165:
166: /**
167: * get the summarized information of poster input entries that belong to the entry groups with the given group id list
168: *
169: * @param groups the origin entry groups
170: * @return a set of summarized information of poster input entries within the specified groups
171: */
172: public Iterator getPosterOutputSummaryByGroupId(Collection groups);
173:
174: }
|