Revision 43891 branches/org.gvsig.desktop-2018a/org.gvsig.desktop.plugin/org.gvsig.geodb.app/org.gvsig.geodb.app.mainplugin/src/main/java/org/gvsig/geodb/vectorialdb/wizard/WizardDB.java
WizardDB.java | ||
---|---|---|
34 | 34 |
import java.util.Map; |
35 | 35 |
import java.util.Map.Entry; |
36 | 36 |
|
37 |
import javax.swing.DefaultListModel; |
|
38 | 37 |
import javax.swing.JComboBox; |
39 | 38 |
import javax.swing.JOptionPane; |
40 | 39 |
import javax.swing.JPanel; |
... | ... | |
46 | 45 |
import javax.swing.event.ListSelectionEvent; |
47 | 46 |
import javax.swing.event.ListSelectionListener; |
48 | 47 |
|
49 |
import org.apache.commons.collections.map.HashedMap; |
|
50 | 48 |
import org.apache.commons.lang3.text.WordUtils; |
51 | 49 |
import org.cresques.cts.IProjection; |
52 | 50 |
import org.slf4j.Logger; |
... | ... | |
70 | 68 |
import org.gvsig.fmap.dal.DataServerExplorerPool; |
71 | 69 |
import org.gvsig.fmap.dal.DataServerExplorerPoolEntry; |
72 | 70 |
import org.gvsig.fmap.dal.DataStoreParameters; |
71 |
import org.gvsig.fmap.dal.DataTypes; |
|
73 | 72 |
import org.gvsig.fmap.dal.exception.DataException; |
73 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
74 | 74 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
75 | 75 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorer; |
76 | 76 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters; |
77 | 77 |
import org.gvsig.fmap.dal.store.db.DBStoreParameters; |
78 |
import org.gvsig.fmap.geom.Geometry; |
|
79 |
import org.gvsig.fmap.mapcontext.BaseCreateLayerParameters; |
|
80 |
import org.gvsig.fmap.mapcontext.MapContextManager.CreateLayerParameters; |
|
78 | 81 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
79 | 82 |
import org.gvsig.fmap.mapcontrol.MapControl; |
80 | 83 |
import org.gvsig.geodb.ExtDB_Spatial; |
... | ... | |
194 | 197 |
PrepareContext context = this.getPrepareDataStoreContext(); |
195 | 198 |
DBStoreParameters storeParams; |
196 | 199 |
List<TableDocument> tabledocs |
197 |
= new ArrayList<TableDocument>(tables.length);
|
|
200 |
= new ArrayList<>(tables.length); |
|
198 | 201 |
for ( TablesListItem table : tables ) { |
199 |
storeParams = getParameterForTable(table); |
|
202 |
CreateLayerParameters layerParams = getParameterForTable(table); |
|
203 |
storeParams = (DBStoreParameters) layerParams.getDataParameters(); |
|
200 | 204 |
|
201 |
try { |
|
202 |
storeParams = (DBStoreParameters) appGvSIGMan |
|
203 |
.prepareOpenDataStoreParameters(storeParams, context); |
|
204 |
} catch (Exception e2) { |
|
205 |
NotificationManager.addError(e2); |
|
206 |
continue; |
|
207 |
} |
|
208 |
|
|
209 | 205 |
UserTableSettingsPanel userTableSettingsPanel = table |
210 | 206 |
.getUserTableSettingsPanel(); |
211 | 207 |
|
... | ... | |
228 | 224 |
|
229 | 225 |
document = (TableDocument) ProjectManager.getInstance().createDocument(TableManager.TYPENAME, docName); |
230 | 226 |
document.setStore(store); |
231 |
// project.add(document); |
|
232 | 227 |
tabledocs.add(document); |
233 | 228 |
} |
234 | 229 |
return tabledocs; |
235 | 230 |
} |
236 | 231 |
|
237 |
protected DBStoreParameters getParameterForTable(TablesListItem table) {
|
|
232 |
protected CreateLayerParameters getParameterForTable(TablesListItem table) {
|
|
238 | 233 |
DBStoreParameters parameters = table.getParameters(); |
239 | 234 |
|
240 |
UserTableSettingsPanel userTableSettingsPanel = table |
|
241 |
.getUserTableSettingsPanel(); |
|
235 |
UserTableSettingsPanel userTableSettingsPanel = table.getUserTableSettingsPanel(); |
|
242 | 236 |
|
243 | 237 |
String fidField = userTableSettingsPanel.getIdFieldName(); |
244 | 238 |
//IF is a multiple PK, remove the {} symbols |
... | ... | |
251 | 245 |
.getUserSelectedFields(pkFields, null); |
252 | 246 |
|
253 | 247 |
if ( userTableSettingsPanel.isSqlActive() ) { |
254 |
String whereClause = userTableSettingsPanel |
|
255 |
.getWhereClause(); |
|
248 |
String whereClause = userTableSettingsPanel.getWhereClause(); |
|
256 | 249 |
parameters.setBaseFilter(whereClause); |
257 | 250 |
} else { |
258 | 251 |
parameters.setBaseFilter(""); |
... | ... | |
260 | 253 |
|
261 | 254 |
parameters.setFields(fields); |
262 | 255 |
|
263 |
return parameters; |
|
256 |
BaseCreateLayerParameters layerParameters = new BaseCreateLayerParameters( |
|
257 |
parameters, |
|
258 |
false, |
|
259 |
null |
|
260 |
); |
|
264 | 261 |
|
262 |
return layerParameters; |
|
263 |
|
|
265 | 264 |
} |
266 | 265 |
|
267 | 266 |
@SuppressWarnings({"rawtypes", "unchecked"}) |
... | ... | |
665 | 664 |
for ( int i = 0; i < count; i++ ) { |
666 | 665 |
TablesListItem item = selected[i]; |
667 | 666 |
|
668 |
dbParameters[i] = getParameterForTable(item);
|
|
667 |
dbParameters[i] = (DBStoreParameters) getParameterForTable(item).getDataParameters();
|
|
669 | 668 |
} |
670 | 669 |
|
671 | 670 |
return dbParameters;// layerArrayToGroup(all_layers, groupName); |
... | ... | |
725 | 724 |
} |
726 | 725 |
return p.getMessage(); |
727 | 726 |
} |
728 |
|
|
729 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
727 |
|
|
728 |
} |
Also available in: Unified diff