001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.kfs.module.bc.document.service;
017    
018    import java.io.ByteArrayOutputStream;
019    import java.io.IOException;
020    import java.io.InputStream;
021    import java.util.List;
022    
023    import org.kuali.rice.kim.bo.Person;
024    
025    import com.lowagie.text.DocumentException;
026    
027    /**
028     * Describes services related to budget construction request import
029     * 
030     */
031    public interface BudgetRequestImportService {
032        
033        /**
034         * Takes an import request file (either monthly or annual) and creates the BudgetConstructionMove objects for each line of the file.
035         * If any errors are encounterd, file processing stops.
036         * If no errors are encountered an empty list is returned.
037         * 
038         * @param fileImportStream
039         * @param fieldSeperator
040         * @param textDelimiter
041         * @param fileType
042         * @return list of errors encountered during file processing
043         * @throws IOException
044         */
045        public List processImportFile (InputStream fileImportStream, String principalId, String fieldSeperator, String textDelimiter, String fileType, Integer budgetYear) throws IOException;
046        
047        /**
048         * Generates the log file
049         * 
050         * @param errorMessages
051         * @param baos
052         * @throws DocumentException
053         */
054        public void generatePdf(List<String> errorMessages, ByteArrayOutputStream baos) throws DocumentException;
055        
056        /**
057         * Checks the imported request records for valid data. Sets error codes on invalid records.
058         * 
059         * @return true if no data validation errors were found. false otherwise
060         * 
061         */
062        public List<String> validateData(Integer budgetYear, String principalId);
063        
064        /**
065         * Loads all budget request records that do not have error codes
066         * 
067         * @return
068         */
069        public List<String> loadBudget(Person user, String fileType, Integer budgetYear) throws Exception;
070    
071    }
072