public BigInteger getTotalInserted() { return eGet(adaptee, "transactionSummary.totalInserted", BigInteger.class); }
public void setTotalDeleted(BigInteger deleted) { eSet(adaptee, "transactionSummary.totalDeleted", deleted); }
public static TransactionResponseType unadapt(TransactionResponse response) { if (response instanceof WFS11) { return (TransactionResponseType) response.getAdaptee(); } return null; } }
@Test public void testDelete() throws Exception { // the plugin swaps the filter with id > 102 String xml = DELETE_ROAD_102; Document dom = postAsDOM("wfs", xml); // print(dom); assertXpathEvaluatesTo("0", "//wfs:totalInserted", dom); assertXpathEvaluatesTo("0", "//wfs:totalUpdated", dom); assertXpathEvaluatesTo("4", "//wfs:totalDeleted", dom); // check the plugin reports assertTrue(plugin.beforeCommitCalled); assertTrue(plugin.committed); assertTrue(plugin.dataStoreChanged); assertEquals(0, plugin.result.getTotalInserted().intValue()); assertEquals(0, plugin.result.getTotalUpdated().intValue()); assertEquals(4, plugin.result.getTotalDeleted().intValue()); // check the one surviving road segment has id 102 Document roadSegments = getAsDOM( "wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=cite:RoadSegments"); // print(roadSegments); assertXpathEvaluatesTo("1", "count(//cite:RoadSegments)", roadSegments); assertXpathEvaluatesTo("102", "//cite:RoadSegments/cite:FID", roadSegments); }
LOGGER.finer("Transaction Insert:" + insert); long inserted = response.getTotalInserted().longValue(); FeatureId fid = fids.removeFirst(); response.addInsertedFeature(insert.getHandle(), fid); response.setTotalInserted(BigInteger.valueOf(inserted));
result.setHandle(request.getHandle()); result.addAction( e.getCode() != null ? e.getCode() : "InvalidParameterValue", e.getLocator(), List insertedFeatures = result.getInsertedFeatures(); if (insertedFeatures != null && insertedFeatures.isEmpty()) { result.addInsertedFeature(null, filterFactory.featureId("none"));
String handle = update.getHandle(); long updated = response.getTotalUpdated().longValue(); iterator.close(); response.addUpdatedFeatures(handle, changedIds); response.setTotalUpdated(BigInteger.valueOf(updated));
String handle = delete.getHandle(); long deleted = response.getTotalDeleted().longValue(); response.setTotalDeleted(BigInteger.valueOf(deleted));
response.setTotalReplaced(BigInteger.valueOf(replaced.size())); response.addReplacedFeatures(replace.getHandle(), replaced);
@Test public void testDelete() throws Exception { // the plugin swaps the filter with id > 102 String xml = DELETE_ROAD_102; Document dom = postAsDOM("wfs", xml); // print(dom); assertXpathEvaluatesTo("0", "//wfs:totalInserted", dom); assertXpathEvaluatesTo("0", "//wfs:totalUpdated", dom); assertXpathEvaluatesTo("4", "//wfs:totalDeleted", dom); // check the plugin reports assertTrue(plugin.beforeCommitCalled); assertTrue(plugin.committed); assertTrue(plugin.dataStoreChanged); assertEquals(0, plugin.result.getTotalInserted().intValue()); assertEquals(0, plugin.result.getTotalUpdated().intValue()); assertEquals(4, plugin.result.getTotalDeleted().intValue()); // check the one surviving road segment has id 102 Document roadSegments = getAsDOM( "wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=cite:RoadSegments"); // print(roadSegments); assertXpathEvaluatesTo("1", "count(//cite:RoadSegments)", roadSegments); assertXpathEvaluatesTo("102", "//cite:RoadSegments/cite:FID", roadSegments); }
@Test public void testReplaceWithInsert() throws Exception { // the plugin will remove all elements and replace it with an insert plugin.beforeTransaction = TransactionCallbackTester::replaceWithFixedRoadsInsert; String xml = DELETE_ROAD_102; Document dom = postAsDOM("wfs", xml); // print(dom); assertXpathEvaluatesTo("1", "//wfs:totalInserted", dom); assertXpathEvaluatesTo("0", "//wfs:totalUpdated", dom); assertXpathEvaluatesTo("0", "//wfs:totalDeleted", dom); // check the plugin reports assertTrue(plugin.beforeCommitCalled); assertTrue(plugin.committed); assertTrue(plugin.dataStoreChanged); assertEquals(1, plugin.result.getTotalInserted().intValue()); assertEquals(0, plugin.result.getTotalUpdated().intValue()); assertEquals(0, plugin.result.getTotalDeleted().intValue()); // check the new feature is there Document roadSegments = getAsDOM( "wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=cite:RoadSegments"); // print(roadSegments); assertXpathEvaluatesTo("6", "count(//cite:RoadSegments)", roadSegments); assertXpathEvaluatesTo( "New Road", "//cite:RoadSegments[cite:FID = 107]/cite:NAME", roadSegments); }
public BigInteger getTotalDeleted() { return eGet(adaptee, "transactionSummary.totalDeleted", BigInteger.class); }
public void setTotalInserted(BigInteger inserted) { eSet(adaptee, "transactionSummary.totalInserted", inserted); }
/** * WFS transaction operation. * * @param request The transaction request. * @return A transaction response instance. * @throws WFSException Any service exceptions. */ public TransactionResponseType transaction(TransactionType request) throws WFSException { Transaction transaction = new Transaction(getServiceInfo(), catalog, context); transaction.setFilterFactory(filterFactory); return (TransactionResponseType) transaction.transaction(new TransactionRequest.WFS11(request)).getAdaptee(); }
@Test public void testReplaceWithUpdate() throws Exception { // the plugin will remove all elements and replace it with a fixed delete on road 106 plugin.beforeTransaction = TransactionCallbackTester::replaceWithFixedRoadsUpdate; String xml = DELETE_ROAD_102; Document dom = postAsDOM("wfs", xml); // print(dom); assertXpathEvaluatesTo("0", "//wfs:totalInserted", dom); assertXpathEvaluatesTo("1", "//wfs:totalUpdated", dom); assertXpathEvaluatesTo("0", "//wfs:totalDeleted", dom); // check the plugin reports assertTrue(plugin.beforeCommitCalled); assertTrue(plugin.committed); assertTrue(plugin.dataStoreChanged); assertEquals(0, plugin.result.getTotalInserted().intValue()); assertEquals(1, plugin.result.getTotalUpdated().intValue()); assertEquals(0, plugin.result.getTotalDeleted().intValue()); // check the new feature is there Document roadSegments = getAsDOM( "wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=cite:RoadSegments"); // print(roadSegments); assertXpathEvaluatesTo("5", "count(//cite:RoadSegments)", roadSegments); assertXpathEvaluatesTo( "Clean Road", "//cite:RoadSegments[cite:FID = 106]/cite:NAME", roadSegments); }
public List getInsertedFeatures() { return eGet(adaptee, "insertResults.feature", List.class); }
public void setTotalUpdated(BigInteger updated) { eSet(adaptee, "transactionSummary.totalUpdated", updated); }
public TransactionResponseType transaction(TransactionType request) throws WFSException { Transaction tx = new Transaction(getServiceInfo(), getCatalog(), context); tx.setFilterFactory(filterFactory); return (TransactionResponseType) tx.transaction(new TransactionRequest.WFS20(request)).getAdaptee(); }
@Test public void testReplaceWithDelete() throws Exception { // the plugin will remove all elements and replace it with a fixed delete on road 106 plugin.beforeTransaction = TransactionCallbackTester::replaceWithFixedRoadsDelete; String xml = DELETE_ROAD_102; Document dom = postAsDOM("wfs", xml); // print(dom); assertXpathEvaluatesTo("0", "//wfs:totalInserted", dom); assertXpathEvaluatesTo("0", "//wfs:totalUpdated", dom); assertXpathEvaluatesTo("1", "//wfs:totalDeleted", dom); // check the plugin reports assertTrue(plugin.beforeCommitCalled); assertTrue(plugin.committed); assertTrue(plugin.dataStoreChanged); assertEquals(0, plugin.result.getTotalInserted().intValue()); assertEquals(0, plugin.result.getTotalUpdated().intValue()); assertEquals(1, plugin.result.getTotalDeleted().intValue()); // check the new feature is there Document roadSegments = getAsDOM( "wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=cite:RoadSegments"); // print(roadSegments); assertXpathEvaluatesTo("4", "count(//cite:RoadSegments)", roadSegments); assertXpathEvaluatesTo("0", "count(//cite:RoadSegments[cite:FID = 106])", roadSegments); } }
public BigInteger getTotalUpdated() { return eGet(adaptee, "transactionSummary.totalUpdated", BigInteger.class); }