Revision 43362
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultEditableFeatureAttributeDescriptor.java | ||
---|---|---|
266 | 266 |
|
267 | 267 |
public EditableFeatureAttributeDescriptor setIsAutomatic(boolean isAutomatic) { |
268 | 268 |
this.isAutomatic = isAutomatic; |
269 |
if( isAutomatic ) { |
|
270 |
this.setHidden(true); |
|
271 |
} |
|
269 | 272 |
return this; |
270 | 273 |
} |
271 | 274 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java | ||
---|---|---|
124 | 124 |
this.geometrySubType = Geometry.SUBTYPES.UNKNOWN; |
125 | 125 |
this.additionalInfo = null; |
126 | 126 |
this.isAutomatic = false; |
127 |
this.hidden = false; |
|
127 | 128 |
} |
128 | 129 |
|
129 | 130 |
protected DefaultFeatureAttributeDescriptor( |
... | ... | |
172 | 173 |
this.indexed = other.indexed; |
173 | 174 |
this.isIndexAscending = other.isIndexAscending; |
174 | 175 |
this.allowIndexDuplicateds = other.allowIndexDuplicateds; |
176 |
this.hidden = other.hidden; |
|
175 | 177 |
} |
176 | 178 |
|
177 | 179 |
@Override |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/JDBCStoreParameters.java | ||
---|---|---|
25 | 25 |
package org.gvsig.fmap.dal.store.jdbc; |
26 | 26 |
|
27 | 27 |
import java.text.MessageFormat; |
28 |
import org.apache.commons.lang3.StringUtils; |
|
28 | 29 |
|
29 | 30 |
import org.gvsig.fmap.dal.store.db.DBStoreParameters; |
30 | 31 |
|
... | ... | |
238 | 239 |
* @return |
239 | 240 |
*/ |
240 | 241 |
public String tableID() { |
241 |
if (this.getSchema() == null || this.getSchema() == "") {
|
|
242 |
if ( StringUtils.isEmpty(this.getSchema()) ) {
|
|
242 | 243 |
return escapeName(this.getTable()); |
243 | 244 |
} |
244 | 245 |
return escapeName(this.getSchema()) + "." + escapeName(this.getTable()); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/operations/PerformChangesOperation.java | ||
---|---|---|
65 | 65 |
public final Object perform(Connection conn) throws DataException { |
66 | 66 |
if (featureTypesChanged.hasNext()) { |
67 | 67 |
FeatureStoreProvider.FeatureTypeChanged item = featureTypesChanged.next(); |
68 |
this.performUpdateTable(conn, tableName, item.getSource(), item.getTarget()); |
|
68 |
this.performUpdateTable(conn, dbName, schemaName, tableName, item.getSource(), item.getTarget());
|
|
69 | 69 |
typeChanged = true; |
70 | 70 |
} else { |
71 | 71 |
typeChanged = false; |
... | ... | |
82 | 82 |
return true; |
83 | 83 |
} |
84 | 84 |
|
85 |
public void performDeletes(Connection conn,
|
|
85 |
protected JDBCSQLBuilderBase buildDeleteSQL(
|
|
86 | 86 |
String database, |
87 | 87 |
String schema, |
88 | 88 |
String table, |
89 |
FeatureType type, |
|
90 |
Iterator<FeatureReferenceProviderServices> deleteds) throws DataException { |
|
91 |
|
|
92 |
JDBCSQLBuilderBase sqlbuilder = this.createSQLBuilder(); |
|
89 |
FeatureType type |
|
90 |
) { |
|
91 |
JDBCSQLBuilderBase sqlbuilder = createSQLBuilder(); |
|
93 | 92 |
sqlbuilder.delete().table().database(database).schema(schema).name(table); |
94 | 93 |
for (FeatureAttributeDescriptor attr : type) { |
95 | 94 |
if (attr.isPrimaryKey()) { |
... | ... | |
104 | 103 |
if (!sqlbuilder.delete().has_where() ) { |
105 | 104 |
throw new RuntimeException("Operation requires missing pk"); |
106 | 105 |
} |
106 |
return sqlbuilder; |
|
107 |
} |
|
107 | 108 |
|
109 |
public void performDeletes(Connection conn, |
|
110 |
String database, |
|
111 |
String schema, |
|
112 |
String table, |
|
113 |
FeatureType type, |
|
114 |
Iterator<FeatureReferenceProviderServices> deleteds) throws DataException { |
|
115 |
|
|
116 |
JDBCSQLBuilderBase sqlbuilder = buildDeleteSQL(database, schema, table, type); |
|
117 |
|
|
108 | 118 |
PreparedStatement st = null; |
109 | 119 |
String sql = sqlbuilder.delete().toString(); |
110 | 120 |
try { |
... | ... | |
131 | 141 |
JDBCUtils.closeQuietly(st); |
132 | 142 |
} |
133 | 143 |
} |
134 |
|
|
135 |
public void performInserts(Connection conn,
|
|
144 |
|
|
145 |
protected JDBCSQLBuilderBase buildInsertSQL(
|
|
136 | 146 |
String database, |
137 | 147 |
String schema, |
138 | 148 |
String table, |
139 |
FeatureType type,
|
|
140 |
Iterator<FeatureProvider> inserteds) throws DataException {
|
|
149 |
FeatureType type |
|
150 |
) {
|
|
141 | 151 |
JDBCSQLBuilderBase sqlbuilder = createSQLBuilder(); |
142 | 152 |
|
143 | 153 |
sqlbuilder.insert().table().database(database).schema(schema).name(table); |
144 | 154 |
for (FeatureAttributeDescriptor attr : type) { |
155 |
if( attr.isAutomatic() ) { |
|
156 |
continue; |
|
157 |
} |
|
145 | 158 |
if (attr.getType() == DataTypes.GEOMETRY) { |
146 | 159 |
sqlbuilder.insert().column().name(attr.getName()).with_value( |
147 | 160 |
sqlbuilder.parameter(attr.getName()).as_geometry_variable().srs( |
... | ... | |
154 | 167 |
); |
155 | 168 |
} |
156 | 169 |
} |
170 |
return sqlbuilder; |
|
171 |
} |
|
157 | 172 |
|
173 |
public void performInserts(Connection conn, |
|
174 |
String database, |
|
175 |
String schema, |
|
176 |
String table, |
|
177 |
FeatureType type, |
|
178 |
Iterator<FeatureProvider> inserteds) throws DataException { |
|
179 |
JDBCSQLBuilderBase sqlbuilder = buildInsertSQL(database, schema, table, type); |
|
180 |
|
|
158 | 181 |
PreparedStatement st; |
159 | 182 |
String sql = sqlbuilder.insert().toString(); |
160 | 183 |
try { |
... | ... | |
177 | 200 |
} |
178 | 201 |
} |
179 | 202 |
|
180 |
public void performUpdates(Connection conn,
|
|
203 |
protected JDBCSQLBuilderBase buildUpdateSQL(
|
|
181 | 204 |
String database, |
182 | 205 |
String schema, |
183 | 206 |
String table, |
184 |
FeatureType type, |
|
185 |
Iterator<FeatureProvider> updateds) throws DataException { |
|
207 |
FeatureType type |
|
208 |
) { |
|
209 |
JDBCSQLBuilderBase sqlbuilder = createSQLBuilder(); |
|
186 | 210 |
|
187 |
JDBCSQLBuilderBase sqlbuilder = this.createSQLBuilder(); |
|
188 | 211 |
sqlbuilder.update().table().database(database).schema(schema).name(table); |
189 | 212 |
for (FeatureAttributeDescriptor attr : type) { |
190 | 213 |
if (attr.isPrimaryKey()) { |
... | ... | |
211 | 234 |
if (!sqlbuilder.update().has_where() ) { |
212 | 235 |
throw new RuntimeException("Operation requires missing pk"); |
213 | 236 |
} |
237 |
return sqlbuilder; |
|
238 |
} |
|
239 |
|
|
240 |
public void performUpdates(Connection conn, |
|
241 |
String database, |
|
242 |
String schema, |
|
243 |
String table, |
|
244 |
FeatureType type, |
|
245 |
Iterator<FeatureProvider> updateds) throws DataException { |
|
214 | 246 |
|
247 |
JDBCSQLBuilderBase sqlbuilder = buildUpdateSQL(database, schema, table, type); |
|
248 |
|
|
215 | 249 |
PreparedStatement st = null; |
216 | 250 |
String sql = sqlbuilder.update().toString(); |
217 | 251 |
try { |
... | ... | |
230 | 264 |
} |
231 | 265 |
} |
232 | 266 |
|
233 |
public void performUpdateTable(Connection conn, |
|
267 |
protected JDBCSQLBuilderBase buildUpdateTableSQL( |
|
268 |
String database, |
|
269 |
String schema, |
|
234 | 270 |
String table, |
235 | 271 |
FeatureType original, |
236 |
FeatureType target) throws DataException { |
|
272 |
FeatureType target |
|
273 |
) { |
|
274 |
JDBCSQLBuilderBase sqlbuilder = createSQLBuilder(); |
|
275 |
sqlbuilder.update().table().database(database).schema(schema).name(table); |
|
237 | 276 |
|
238 |
SQLBuilderBase sqlbuilder = createSQLBuilder(); |
|
239 |
sqlbuilder.update().table().name(table); |
|
240 |
|
|
241 | 277 |
for (FeatureAttributeDescriptor attrOrgiginal : original) { |
242 | 278 |
FeatureAttributeDescriptor attrTarget = target.getAttributeDescriptor( |
243 | 279 |
attrOrgiginal.getName() |
... | ... | |
273 | 309 |
); |
274 | 310 |
} |
275 | 311 |
} |
312 |
return sqlbuilder; |
|
313 |
} |
|
314 |
|
|
315 |
public void performUpdateTable(Connection conn, |
|
316 |
String database, |
|
317 |
String schema, |
|
318 |
String table, |
|
319 |
FeatureType original, |
|
320 |
FeatureType target) throws DataException { |
|
321 |
|
|
322 |
SQLBuilderBase sqlbuilder = buildUpdateTableSQL(null, null, table, original, target); |
|
276 | 323 |
Statement st = null; |
277 | 324 |
try { |
278 | 325 |
st = conn.createStatement(); |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/impl/DefaultEditingNotificationManager.java | ||
---|---|---|
241 | 241 |
|
242 | 242 |
for (FeatureAttributeDescriptor attrDesc : attributeDescriptors) { |
243 | 243 |
if ( attrDesc.isAutomatic() ) { |
244 |
break;
|
|
244 |
continue;
|
|
245 | 245 |
} |
246 | 246 |
if ( (attrDesc.isPrimaryKey() || !attrDesc.allowNull()) |
247 | 247 |
&& feature.get(attrDesc.getName()) == null ) { |
... | ... | |
287 | 287 |
); |
288 | 288 |
dialog.show(WindowManager.MODE.DIALOG); |
289 | 289 |
if( dialog.getAction() == WindowManager_v2.BUTTON_OK ) { |
290 |
this.userCancelValue = true; |
|
291 |
} else { |
|
292 | 290 |
form.fetch((EditableFeature) feature); |
293 | 291 |
this.userCancelValue = false; |
292 |
} else { |
|
293 |
this.userCancelValue = true; |
|
294 | 294 |
} |
295 | 295 |
|
296 | 296 |
} catch (Exception ex) { |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/featureform/swing/impl/DefaultJFeatureForm.java | ||
---|---|---|
35 | 35 |
|
36 | 36 |
@Override |
37 | 37 |
public void setStore(FeatureStore store) { |
38 |
if( this.store.equals(store) ) {
|
|
38 |
if( java.util.Objects.equals(this.store, store) ) {
|
|
39 | 39 |
return; |
40 | 40 |
} |
41 | 41 |
this.store = store; |
Also available in: Unified diff