View Javadoc
1   /*
2    * Copyright 2005-2006 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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.ole.gl.dataaccess;
17  
18  import java.util.Collection;
19  import java.util.Iterator;
20  import java.util.Map;
21  
22  import org.kuali.ole.gl.businessobject.OriginEntryFull;
23  import org.kuali.ole.gl.businessobject.OriginEntryGroup;
24  import org.kuali.ole.gl.businessobject.OriginEntryInformation;
25  import org.kuali.rice.core.api.util.type.KualiDecimal;
26  
27  /**
28   *
29   */
30  public interface OriginEntryDao {
31      /**
32       * Sort origin entries by document id
33       */
34      public static final int SORT_DOCUMENT = 1;
35      /**
36       * Sort origin entries by account number
37       */
38      public static final int SORT_ACCOUNT = 2;
39      /**
40       * Sort origin entries by standard report order (by document type code and system origination code)
41       */
42      public static final int SORT_REPORT = 3;
43      /**
44       * 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)
45       */
46      public static final int SORT_LISTING_REPORT = 4;
47  
48      /**
49       * Get the total amount of transactions in a group
50       * @param the id of the origin entry group to total
51       * @param isCredit whether the total should be of credits or not
52       * @return the sum of all queried origin entries
53       */
54      public KualiDecimal getGroupTotal(Integer groupId, boolean isCredit);
55  
56      /**
57       * Counts the number of entries in a group
58       * @param the id of an origin entry group
59       * @return the count of the entries in that group
60       */
61      public Integer getGroupCount(Integer groupId);
62  
63      /**
64       * Counts of rows of all the origin entry groups
65       *
66       * @return iterator of Object[] {[BigDecimal id,BigDecimal count]}
67       */
68      public Iterator getGroupCounts();
69  
70      /**
71       * Delete an entry
72       *
73       * @param oe Entry to delete
74       */
75      public void deleteEntry(OriginEntryInformation oe);
76  
77      /**
78       * Return an iterator to all document keys reference by origin entries in a given group
79       *
80       * @param oeg Group the origin entry group to find entries in, by origin entry
81       * @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
82       */
83      public Iterator getDocumentsByGroup(OriginEntryGroup oeg);
84  
85      /**
86       * Return an iterator to all the entries in a group
87       *
88       * @param oeg the origin entry group to get entries in
89       * @param sort the Sort Order (one of the Sort Orders defined by the SORT_ constants defined in this class)
90       * @return Iterator of entries in the specified group
91       */
92      public <T> Iterator<T> getEntriesByGroup(OriginEntryGroup oeg, int sort);
93  
94      /**
95       * 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
96       *
97       * @param groups a Collection of groups to remove bad entries in
98       * @return an Iterator of no good, won't use, bad balance entries
99       */
100     public Iterator<OriginEntryFull> getBadBalanceEntries(Collection groups);
101 
102     /**
103      * Collection of entries that match criteria
104      *
105      * @param searchCriteria Map of field, value pairs
106      * @return collection of entries
107      */
108     public Collection<OriginEntryFull> getMatchingEntriesByCollection(Map searchCriteria);
109 
110     /**
111      * Iterator of entries that match criteria
112      *
113      * @param searchCriteria Map of field, value pairs
114      * @return collection of entries
115      */
116     public Iterator getMatchingEntries(Map searchCriteria);
117 
118     /**
119      * Delete entries that match criteria
120      *
121      * @param searchCriteria Map of field, value pairs
122      */
123     public void deleteMatchingEntries(Map searchCriteria);
124 
125     /**
126      * Delete all the groups in the list. This will delete the entries. The OriginEntryGroupDao has a method to delete the groups
127      *
128      * @param groups a Collection of Origin Entry Groups to delete entries in
129      */
130     public void deleteGroups(Collection<OriginEntryGroup> groups);
131 
132     /**
133      * Finds an entry for the given entryId, or returns a newly created on
134      *
135      * @param entryId an entry id to find an entry for
136      * @return the entry for the given entry id, or a newly created entry
137      */
138     public OriginEntryFull getExactMatchingEntry(Integer entryId);
139 
140     /**
141      * get the summarized information of the entries that belong to the entry groups with the given group ids
142      *
143      * @param groupIdList the ids of origin entry groups
144      * @return a set of summarized information of the entries within the specified groups
145      */
146     public Iterator getSummaryByGroupId(Collection groupIdList);
147 
148     /**
149      * This method should only be used in unit tests. It loads all the gl_origin_entry_t rows in memory into a collection. This
150      * won't scale for production.
151      *
152      * @return a Collection with every single origin entry in the database
153      */
154     public Collection testingGetAllEntries();
155 
156     /**
157      * get the summarized information of poster input entries that belong to the entry groups with the given group id list
158      *
159      * @param groups the origin entry groups
160      * @return a set of summarized information of poster input entries within the specified groups
161      */
162     public Iterator getPosterOutputSummaryByGroupId(Collection groups);
163 
164 }