1 /* 2 * The Kuali Financial System, a comprehensive financial management system for higher education. 3 * 4 * Copyright 2005-2014 The Kuali Foundation 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 package org.kuali.kfs.sys.businessobject; 20 21 import java.io.InputStream; 22 import java.util.List; 23 24 import org.kuali.kfs.sys.document.AccountingDocument; 25 26 /** 27 * Defines an abstraction for parsing serialized <code>AccountingLines</code> 28 */ 29 public interface AccountingLineParser { 30 /** 31 * @return <code>SourceAccountingLine</code> attribute format 32 */ 33 public String[] getSourceAccountingLineFormat(); 34 35 /** 36 * @return <code>TargetAccountingLine</code> attribute format 37 */ 38 public String[] getTargetAccountingLineFormat(); 39 40 /** 41 * @param accountingLineClass 42 * @return String representation of the <code>String[]</code> attribute format with each attribute seperated by a comma. 43 */ 44 public String getExpectedAccountingLineFormatAsString(Class<? extends AccountingLine> accountingLineClass); 45 46 /** 47 * parses a comma deliminated string into an <code>SourceAccountingLine</code> by populating the attributes found in the 48 * getSourceAccountingLineFormat() 49 * 50 * @param transactionalDocument 51 * @param sourceAccountingLineString 52 * @return SourceAccountingLine 53 */ 54 public SourceAccountingLine parseSourceAccountingLine(AccountingDocument transactionalDocument, String sourceAccountingLineString); 55 56 /** 57 * parses a comma deliminated string into an <code>TargetAccountingLine</code> by populating the attributes found in the 58 * getTargetAccountingLineFormat() 59 * 60 * @param transactionalDocument 61 * @param targetAccountingLineString 62 * @return TargetAccountingLine 63 */ 64 public TargetAccountingLine parseTargetAccountingLine(AccountingDocument transactionalDocument, String targetAccountingLineString); 65 66 /** 67 * generates a list of <code>SourceAccountingLine</code> from the inputStream 68 * 69 * @param stream 70 * @param document 71 * @return List containing <code>SourceAccountingLine</code>s 72 */ 73 public List importSourceAccountingLines(String fileName, InputStream stream, AccountingDocument document); 74 75 /** 76 * generates a list of <code>TargetAccountingLine</code> from the inputStream 77 * 78 * @param stream 79 * @param document 80 * @return List containing <code>SourceAccountingLine</code>s 81 */ 82 public List importTargetAccountingLines(String fileName, InputStream stream, AccountingDocument document); 83 84 }