Sorry for my english, I hope you can understand ;) I'am using geotools 8.4 version. I try to copy all features from SDE Table(TEST.DBO.MM_SOURCE) to another SDE Table(TEST.DBO.MM_TEST). All features are copied correctly, but they are not stored in main table (TEST.DBO.MM_TEST). When I open ArcMap, edit some feature in TEST.DBO.MM_TEST and save, all features are back in main table. Both SDE tables are registered as versioned and moving edits to base. What I must do to store all features in main table?
Here is my java code:
String server = "localhost";
String port = "5151";
String database = "Test";
String user = "sa";
String password = "sa";
String version = "dbo.Default";
connector = new SDEConnector();
connector.setConnectionParameters(server, port, database, user, password, version);
connector.connect();
SimpleFeatureStore dataStore =
(SimpleFeatureStore) connector.getDataStore().getFeatureSource("TEST.DBO.MM_TEST");
SimpleFeatureCollection fc1 = connector.getFeatureCollection("TEST.DBO.MM_SOURCE")
SimpleFeatureCollection fc2 = dataStore.getFeatures();
SimpleFeatureIterator iterator = fc1.features();
while (iterator.hasNext()) {
SimpleFeature feature = iterator.next();
Geometry geometry = (Geometry) feature.getDefaultGeometry();
SimpleFeatureBuilder builder = new SimpleFeatureBuilder(fc2.getSchema());
builder.set("Shape", geometry);
builder.set("P1", feature.getAttribute("P1"));
builder.set("P2", feature.getAttribute("P2"));
builder.set("Source_OID", 829023);
builder.set("Marker", 10);
SimpleFeature sf = builder.buildFeature(null);
// SimpleFeature sf = builder.buildFeature(builder.createDefaultFeatureId());
List<SimpleFeature> list = new ArrayList<SimpleFeature>();
list.add(sf);
dataStore.addFeatures(DataUtilities.collection(list));
}
iterator.close();
time = System.currentTimeMillis() - time;
System.out.println(time);