001: /*
002: * Copyright 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.labor.service;
017:
018: import java.io.IOException;
019: import java.io.OutputStream;
020: import java.util.Iterator;
021: import java.util.List;
022:
023: import org.kuali.core.web.ui.Column;
024: import org.kuali.module.gl.bo.CorrectionChangeGroup;
025: import org.kuali.module.gl.util.CorrectionDocumentEntryMetadata;
026: import org.kuali.module.gl.util.CorrectionDocumentUtils;
027: import org.kuali.module.labor.bo.LaborOriginEntry;
028: import org.kuali.module.labor.document.LaborCorrectionDocument;
029:
030: /**
031: * Defines methods that must be implemented by classes providing a LaborCorrectionDocumentServiceImpl.
032: */
033: public interface LaborCorrectionDocumentService {
034: public final static String CORRECTION_TYPE_MANUAL = "M";
035: public final static String CORRECTION_TYPE_CRITERIA = "C";
036: public final static String CORRECTION_TYPE_REMOVE_GROUP_FROM_PROCESSING = "R";
037:
038: public final static String SYSTEM_DATABASE = "D";
039: public final static String SYSTEM_UPLOAD = "U";
040:
041: /**
042: * When passed into {@link #retrievePersistedInputOriginEntries(CorrectionDocument, int)} and
043: * {@link #retrievePersistedOutputOriginEntries(CorrectionDocument, int)} as the int parameter, this will signify that there is
044: * no abort threshold (i.e. the methods should return all of the persisted rows, regardless of number of rows.
045: */
046: public final static int UNLIMITED_ABORT_THRESHOLD = CorrectionDocumentUtils.RECORD_COUNT_FUNCTIONALITY_LIMIT_IS_UNLIMITED;
047:
048: /**
049: * Find and return correctionChangeGroup with document number and Group Number
050: *
051: * @param docId, i
052: * @return
053: */
054: public CorrectionChangeGroup findByDocumentNumberAndCorrectionChangeGroupNumber(
055: String docId, int i);
056:
057: /**
058: * Find and return correctionChange with document number and Group Number
059: *
060: * @param docId, i
061: * @return list of correctionChange
062: */
063: public List findByDocumentHeaderIdAndCorrectionGroupNumber(
064: String docId, int i);
065:
066: /**
067: * Find and return list of correctionCriteria with document number and Group Number
068: *
069: * @param docId, i
070: * @return
071: */
072: public List findByDocumentNumberAndCorrectionGroupNumber(
073: String docId, int i);
074:
075: /**
076: * Find and return laborCorrectionDocument with document number
077: *
078: * @param docId, i
079: * @return
080: */
081: public LaborCorrectionDocument findByCorrectionDocumentHeaderId(
082: String docId);
083:
084: /**
085: * Returns metadata to help render columns in the LLCP. Do not modify this list or the contents in this list.
086: *
087: * @param docId
088: * @return
089: */
090: public List<Column> getTableRenderColumnMetadata(String docId);
091:
092: /**
093: * This method persists an Iterator of input origin entries for a document that is in the initiated or saved state
094: *
095: * @param document an initiated or saved document
096: * @param entries
097: */
098: public void persistInputOriginEntriesForInitiatedOrSavedDocument(
099: LaborCorrectionDocument document,
100: Iterator<LaborOriginEntry> entries);
101:
102: /**
103: * @see org.kuali.module.labor.service.LaborCorrectionDocumentService#removePersistedInputOriginEntriesForInitiatedOrSavedDocument(org.kuali.module.labor.document.LaborCorrectionDocument)
104: */
105: public void removePersistedInputOriginEntries(
106: LaborCorrectionDocument document);
107:
108: /**
109: * @see org.kuali.module.labor.service.LaborCorrectionDocumentService#removePersistedInputOriginEntriesForInitiatedOrSavedDocument(org.kuali.module.labor.document.LaborCorrectionDocument)
110: */
111: public void removePersistedInputOriginEntries(String docId);
112:
113: /**
114: * Retrieves input origin entries that have been persisted for this document
115: *
116: * @param document the document
117: * @param abortThreshold if the file exceeds this number of rows, then null is returned. {@link UNLIMITED_ABORT_THRESHOLD}
118: * signifies that there is no limit
119: * @return the list, or null if there are too many origin entries
120: * @throws RuntimeException several reasons, primarily relating to underlying persistence layer problems
121: */
122: public List<LaborOriginEntry> retrievePersistedInputOriginEntries(
123: LaborCorrectionDocument document, int abortThreshold);
124:
125: /**
126: * Returns true if the system is storing input origin entries for this class. Note that this does not mean that there's at least
127: * one input origin entry record persisted for this document, but merely returns true if and only if the underlying persistence
128: * mechanism has a record of this document's origin entries. See the docs for the implementations of this method for more
129: * implementation specific details.
130: *
131: * @param document
132: * @return
133: */
134: public boolean areInputOriginEntriesPersisted(
135: LaborCorrectionDocument document);
136:
137: /**
138: * Writes out the persisted input origin entries in an {@link OutputStream} in a flat file format
139: *
140: * @param document
141: * @param out an open and ready output stream
142: * @throws IOException
143: * @throws RuntimeException several reasons, including if the entries are not persisted
144: */
145: public void writePersistedInputOriginEntriesToStream(
146: LaborCorrectionDocument document, OutputStream out)
147: throws IOException;
148:
149: /**
150: * This method persists an Iterator of input origin entries for a document that is in the initiated or saved state
151: *
152: * @param document an initiated or saved document
153: * @param entries
154: */
155: public void persistOutputLaborOriginEntriesForInitiatedOrSavedDocument(
156: LaborCorrectionDocument document,
157: Iterator<LaborOriginEntry> entries);
158:
159: /**
160: * @see org.kuali.module.labor.service.LaborCorrectionDocumentService#removePersistedOutputOriginEntriesForInitiatedOrSavedDocument(org.kuali.module.labor.document.CorrectionDocument)
161: */
162: public void removePersistedOutputOriginEntries(
163: LaborCorrectionDocument document);
164:
165: /**
166: * @see org.kuali.module.labor.service.LaborCorrectionDocumentService#removePersistedOutputOriginEntriesForInitiatedOrSavedDocument(org.kuali.module.labor.document.CorrectionDocument)
167: */
168: public void removePersistedOutputOriginEntries(String docId);
169:
170: /**
171: * Retrieves output origin entries that have been persisted for this document
172: *
173: * @param document the document
174: * @param abortThreshold if the file exceeds this number of rows, then null is returned. {@link UNLIMITED_ABORT_THRESHOLD}
175: * signifies that there is no limit
176: * @return the list, or null if there are too many origin entries
177: * @throws RuntimeException several reasons, primarily relating to underlying persistence layer problems
178: */
179: public List<LaborOriginEntry> retrievePersistedOutputOriginEntries(
180: LaborCorrectionDocument document, int abortThreshold);
181:
182: /**
183: * Retrieves input origin entries that have been persisted for this document in an iterator. Implementations of this method may
184: * choose to implement this method in a way that consumes very little memory.
185: *
186: * @param document the document
187: * @return the iterator
188: * @throws RuntimeException several reasons, primarily relating to underlying persistence layer problems
189: */
190: public Iterator<LaborOriginEntry> retrievePersistedInputOriginEntriesAsIterator(
191: LaborCorrectionDocument document);
192:
193: /**
194: * Retrieves output origin entries that have been persisted for this document in an iterator. Implementations of this method may
195: * choose to implement this method in a way that consumes very little memory.
196: *
197: * @param document the document
198: * @return the iterator
199: * @throws RuntimeException several reasons, primarily relating to underlying persistence layer problems
200: */
201: public Iterator<LaborOriginEntry> retrievePersistedOutputOriginEntriesAsIterator(
202: LaborCorrectionDocument document);
203:
204: /**
205: * Returns true if the system is storing output origin entries for this class. Note that this does not mean that there's at
206: * least one output origin entry record persisted for this document, but merely returns true if and only if the underlying
207: * persistence mechanism has a record of this document's origin entries. See the docs for the implementations of this method for
208: * more implementation specific details.
209: *
210: * @param document
211: * @return
212: */
213: public boolean areOutputOriginEntriesPersisted(
214: LaborCorrectionDocument document);
215:
216: /**
217: * Writes out the persisted output origin entries in an {@link OutputStream} in a flat file format\
218: *
219: * @param document
220: * @param out axn open and ready output stream
221: * @throws IOException
222: * @throws RuntimeException several reasons, including if the entries are not persisted
223: */
224: public void writePersistedOutputOriginEntriesToStream(
225: LaborCorrectionDocument document, OutputStream out)
226: throws IOException;
227:
228: /**
229: * Saves the input and output origin entry groups for a document prior to saving the document
230: *
231: * @param document
232: * @param LaborCorrectionDocumentEntryMetadata
233: */
234: public void persistOriginEntryGroupsForDocumentSave(
235: LaborCorrectionDocument document,
236: CorrectionDocumentEntryMetadata correctionDocumentEntryMetadata);
237: }
|