svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.geodb.app / org.gvsig.geodb.app.mainplugin / src / main / java / org / gvsig / geodb / WizardDBTabular.java @ 45650
History | View | Annotate | Download (1.84 KB)
1 | 44533 | jjdelcerro | package org.gvsig.geodb; |
---|---|---|---|
2 | |||
3 | import java.util.ArrayList; |
||
4 | import java.util.List; |
||
5 | import org.gvsig.app.ApplicationLocator; |
||
6 | import org.gvsig.app.ApplicationManager; |
||
7 | import org.gvsig.app.prepareAction.PrepareContextView; |
||
8 | import org.gvsig.app.project.documents.table.TableDocument; |
||
9 | import org.gvsig.app.project.documents.table.TableManager; |
||
10 | import org.gvsig.fmap.dal.DALLocator; |
||
11 | import org.gvsig.fmap.dal.DataManager; |
||
12 | import org.gvsig.fmap.dal.feature.FeatureStore; |
||
13 | import org.gvsig.fmap.dal.store.db.DBStoreParameters; |
||
14 | |||
15 | /**
|
||
16 | *
|
||
17 | * @author jjdelcerro
|
||
18 | */
|
||
19 | public class WizardDBTabular extends AbstractWizardDB { |
||
20 | |||
21 | public WizardDBTabular() {
|
||
22 | super();
|
||
23 | } |
||
24 | |||
25 | @Override
|
||
26 | protected boolean requireGeometry() { |
||
27 | return false; |
||
28 | } |
||
29 | |||
30 | @Override
|
||
31 | public Object executeWizard() { |
||
32 | DataManager man = DALLocator.getDataManager(); |
||
33 | ApplicationManager application = ApplicationLocator.getManager(); |
||
34 | |||
35 | List<TableDocument> tabledocs= new ArrayList<>(); |
||
36 | for ( TableInfo tableInfo : this.getTablesInformation() ) { |
||
37 | if (!tableInfo.isSelected()) {
|
||
38 | continue;
|
||
39 | } |
||
40 | DBStoreParameters storeParams = tableInfo.getParameters(); |
||
41 | FeatureStore store; |
||
42 | try {
|
||
43 | store = (FeatureStore) man.openStore( |
||
44 | storeParams.getDataStoreName(), |
||
45 | storeParams |
||
46 | ); |
||
47 | } catch (Exception e) { |
||
48 | LOGGER.warn("Can't open store ", e);
|
||
49 | return null; |
||
50 | } |
||
51 | TableDocument document = (TableDocument) application.getProjectManager().createDocument( |
||
52 | TableManager.TYPENAME, |
||
53 | tableInfo.getDocumentName() |
||
54 | ); |
||
55 | document.setStore(store); |
||
56 | tabledocs.add(document); |
||
57 | } |
||
58 | return tabledocs;
|
||
59 | } |
||
60 | |||
61 | |||
62 | } |