01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.kfs.bo;
17:
18: import java.io.InputStream;
19: import java.util.List;
20:
21: import org.kuali.kfs.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(
42: Class<? extends AccountingLine> accountingLineClass);
43:
44: /**
45: * parses a comma deliminated string into an <code>SourceAccountingLine</code> by populating the attributes found in the
46: * getSourceAccountingLineFormat()
47: *
48: * @param transactionalDocument
49: * @param sourceAccountingLineString
50: * @return SourceAccountingLine
51: */
52: public SourceAccountingLine parseSourceAccountingLine(
53: AccountingDocument transactionalDocument,
54: 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(
65: AccountingDocument transactionalDocument,
66: String targetAccountingLineString);
67:
68: /**
69: * generates a list of <code>SourceAccountingLine</code> from the inputStream
70: *
71: * @param stream
72: * @param document
73: * @return List containing <code>SourceAccountingLine</code>s
74: */
75: public List importSourceAccountingLines(String fileName,
76: InputStream stream, AccountingDocument document);
77:
78: /**
79: * generates a list of <code>TargetAccountingLine</code> from the inputStream
80: *
81: * @param stream
82: * @param document
83: * @return List containing <code>SourceAccountingLine</code>s
84: */
85: public List importTargetAccountingLines(String fileName,
86: InputStream stream, AccountingDocument document);
87:
88: }
|