|
@@ -1,40 +1,40 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.orsup; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.logger.*; |
5 |
|
- |
import org.litesoft.orsup.base.*; |
6 |
|
- |
import org.litesoft.util.*; |
7 |
|
- |
|
8 |
|
- |
import java.io.*; |
9 |
|
- |
|
10 |
|
- |
public class DB_Import extends DB_ImportSupport { |
11 |
|
- |
protected static Logger sLogger = LoggerFactory.getLogger( DB_Import.class ); |
12 |
|
- |
|
13 |
|
- |
public static void importCSV( File pDir, String... pFileNames ) |
14 |
|
- |
throws IOException { |
15 |
|
- |
importCSV( pDir, FileUtils.filesToReaders( pDir, pFileNames ) ); |
16 |
|
- |
} |
17 |
|
- |
|
18 |
|
- |
/** |
19 |
|
- |
* @param pReferenceDir may be null: dir from which to resolve file references in readers |
20 |
|
- |
* @param pReaders one or more readers from which to load data |
21 |
|
- |
* |
22 |
|
- |
* @throws IOException |
23 |
|
- |
*/ |
24 |
|
- |
public static void importCSV( File pReferenceDir, Reader... pReaders ) |
25 |
|
- |
throws IOException { |
26 |
|
- |
UnfilteringFinder zFinder = DataStoreLocator.get().getUnfilteredFinder(); |
27 |
|
- |
|
28 |
|
- |
new ImportFromMap().process( sLogger, zFinder, pReferenceDir, new ImportToMap().process( sLogger, zFinder, pReaders ).getLineMap() ); |
29 |
|
- |
} |
30 |
|
- |
|
31 |
|
- |
public static Object importCSVtoMemo( Reader... pReaders ) |
32 |
|
- |
throws IOException { |
33 |
|
- |
return new ImportToMap().process( sLogger, DataStoreLocator.get().getUnfilteredFinder(), pReaders ); |
34 |
|
- |
} |
35 |
|
- |
|
36 |
|
- |
public static void importCSVfromMemo( File pReferenceDir, Object pCSVtoMemo ) |
37 |
|
- |
throws IOException { |
38 |
|
- |
new ImportFromMap().process( sLogger, DataStoreLocator.get().getUnfilteredFinder(), pReferenceDir, ((ImportToMap) pCSVtoMemo).getLineMap() ); |
39 |
|
- |
} |
40 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.orsup; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.logger.*; |
|
5 |
+ |
import org.litesoft.orsup.base.*; |
|
6 |
+ |
import org.litesoft.util.*; |
|
7 |
+ |
|
|
8 |
+ |
import java.io.*; |
|
9 |
+ |
|
|
10 |
+ |
public class DB_Import extends DB_ImportSupport { |
|
11 |
+ |
protected static Logger sLogger = LoggerFactory.getLogger( DB_Import.class ); |
|
12 |
+ |
|
|
13 |
+ |
public static void importCSV( File pDir, String... pFileNames ) |
|
14 |
+ |
throws IOException { |
|
15 |
+ |
importCSV( pDir, FileUtils.filesToReaders( pDir, pFileNames ) ); |
|
16 |
+ |
} |
|
17 |
+ |
|
|
18 |
+ |
/** |
|
19 |
+ |
* @param pReferenceDir may be null: dir from which to resolve file references in readers |
|
20 |
+ |
* @param pReaders one or more readers from which to load data |
|
21 |
+ |
* |
|
22 |
+ |
* @throws IOException |
|
23 |
+ |
*/ |
|
24 |
+ |
public static void importCSV( File pReferenceDir, Reader... pReaders ) |
|
25 |
+ |
throws IOException { |
|
26 |
+ |
UnfilteringFinder zFinder = DataStoreLocator.get().getUnfilteredFinder(); |
|
27 |
+ |
|
|
28 |
+ |
new ImportFromMap().process( sLogger, zFinder, pReferenceDir, new ImportToMap().process( sLogger, zFinder, pReaders ).getLineMap() ); |
|
29 |
+ |
} |
|
30 |
+ |
|
|
31 |
+ |
public static Object importCSVtoMemo( Reader... pReaders ) |
|
32 |
+ |
throws IOException { |
|
33 |
+ |
return new ImportToMap().process( sLogger, DataStoreLocator.get().getUnfilteredFinder(), pReaders ); |
|
34 |
+ |
} |
|
35 |
+ |
|
|
36 |
+ |
public static void importCSVfromMemo( File pReferenceDir, Object pCSVtoMemo ) |
|
37 |
+ |
throws IOException { |
|
38 |
+ |
new ImportFromMap().process( sLogger, DataStoreLocator.get().getUnfilteredFinder(), pReferenceDir, ((ImportToMap) pCSVtoMemo).getLineMap() ); |
|
39 |
+ |
} |
|
40 |
+ |
} |