david-PC\david
2018-06-12 f240ac3ccd37c541cab2c21cfc433d3510999a3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package frame.file.office;
 
 
import java.util.List;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
 
import com.sun.org.apache.regexp.internal.recompile;
 
import frame.file.FileIO;
import frame.file.FileIOContainer;
import frame.file.FileIOItem;
import frame.file.office.excel.ExcelLoaders;
import frame.util.Util;
 
public class LoadManager {
    
    private Logger logger;
    private String ioCode;
    private FileIO fileIO;
    
    public LoadManager() {
        
        this.logger  = LoggerFactory.getLogger(this.getClass());
    }
    
    public LoadManager(String ioCode) {
        this.ioCode = ioCode;
        fileIO = FileIOContainer.get(ioCode);
        this.logger  = LoggerFactory.getLogger(this.getClass());
    }
    
    public boolean execute() throws Exception {
        boolean isSuccess = true;
        
        if (fileIO == null) {
            if (Util.isEmptyStr(ioCode)) {
                throw new Exception("no iocode ");
            }
            else {
                fileIO = FileIOContainer.get(ioCode);
                if (fileIO == null) {
                    throw new Exception("no iocode mapping in FileioContainer");
                }
                doExecute();
            }
        }
        else {
            doExecute();
        }
        
        return isSuccess;
    }
    
    private void doExecute() {
        
        List<FileIOItem> importList = fileIO.getItemList(FileIOTypeCode.Import);
        for (FileIOItem fileIOItem : importList) {
            ExcelLoaders.load(fileIOItem)
        }
        List<FileIOItem> dbList = fileIO.getItemList(FileIOTypeCode.Db);
        List<FileIOItem> outputList = fileIO.getItemList(FileIOTypeCode.Output);
    }
 
    public String getIoCode() {
        return ioCode;
    }
 
    public void setIoCode(String ioCode) {
        this.ioCode = ioCode;
    }
    
    
}