1 /*
2 * Copyright 2007 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.sys.businessobject;
17
18 import java.io.InputStream;
19 import java.util.List;
20
21 import org.kuali.ole.sys.document.AccountingDocument;
22
23 /**
24 * Defines an abstraction for parsing serialized <code>AccountingLines</code>
25 */
26 public interface AccountingLineParser {
27 /**
28 * @return <code>SourceAccountingLine</code> attribute format
29 */
30 public String[] getSourceAccountingLineFormat();
31
32 /**
33 * @return <code>TargetAccountingLine</code> attribute format
34 */
35 public String[] getTargetAccountingLineFormat();
36
37 /**
38 * @param accountingLineClass
39 * @return String representation of the <code>String[]</code> attribute format with each attribute seperated by a comma.
40 */
41 public String getExpectedAccountingLineFormatAsString(Class<? extends AccountingLine> accountingLineClass);
42
43 /**
44 * parses a comma deliminated string into an <code>SourceAccountingLine</code> by populating the attributes found in the
45 * getSourceAccountingLineFormat()
46 *
47 * @param transactionalDocument
48 * @param sourceAccountingLineString
49 * @return SourceAccountingLine
50 */
51 public SourceAccountingLine parseSourceAccountingLine(AccountingDocument transactionalDocument, String sourceAccountingLineString);
52
53 /**
54 * parses a comma deliminated string into an <code>TargetAccountingLine</code> by populating the attributes found in the
55 * getTargetAccountingLineFormat()
56 *
57 * @param transactionalDocument
58 * @param targetAccountingLineString
59 * @return TargetAccountingLine
60 */
61 public TargetAccountingLine parseTargetAccountingLine(AccountingDocument transactionalDocument, String targetAccountingLineString);
62
63 /**
64 * generates a list of <code>SourceAccountingLine</code> from the inputStream
65 *
66 * @param stream
67 * @param document
68 * @return List containing <code>SourceAccountingLine</code>s
69 */
70 public List importSourceAccountingLines(String fileName, InputStream stream, AccountingDocument document);
71
72 /**
73 * generates a list of <code>TargetAccountingLine</code> from the inputStream
74 *
75 * @param stream
76 * @param document
77 * @return List containing <code>SourceAccountingLine</code>s
78 */
79 public List importTargetAccountingLines(String fileName, InputStream stream, AccountingDocument document);
80
81 }