1 | |
package org.jtheque.films.controllers.impl; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
import org.jtheque.core.managers.view.able.controller.AbstractController; |
20 | |
import org.jtheque.films.controllers.able.IImportController; |
21 | |
import org.jtheque.films.services.impl.utils.file.imports.ImportManager; |
22 | |
import org.jtheque.films.services.impl.utils.file.jt.FileFilterFactory; |
23 | |
import org.jtheque.films.utils.Constants.Files.FileType; |
24 | |
import org.jtheque.films.view.able.IImportView; |
25 | |
import org.jtheque.utils.io.FileException; |
26 | |
|
27 | |
import javax.annotation.Resource; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | public final class ImportController extends AbstractController implements IImportController { |
35 | |
private FileType fileType; |
36 | |
|
37 | |
@Resource |
38 | |
private IImportView importView; |
39 | |
|
40 | |
@Override |
41 | |
public void openImportView(FileType fileType) { |
42 | 0 | this.fileType = fileType; |
43 | |
|
44 | 0 | getView().sendMessage("filter", FileFilterFactory.getFileFilter(fileType)); |
45 | 0 | displayView(); |
46 | 0 | } |
47 | |
|
48 | |
@Override |
49 | |
public void importData(String filePath) throws FileException { |
50 | 0 | ImportManager.importFrom(fileType, filePath); |
51 | 0 | } |
52 | |
|
53 | |
@Override |
54 | |
public IImportView getView() { |
55 | 0 | return importView; |
56 | |
} |
57 | |
} |