Package org.geoserver.wfs

Examples of org.geoserver.wfs.TransactionEvent


   public List encodeHistory(List history) throws Exception{
        List entries = new ArrayList();

        Iterator it = history.iterator();
        while(it.hasNext()){
            TransactionEvent e = (TransactionEvent) it.next();
            //SyncItem item = (SyncItem)it.next();
           
            SyndEntry entry = new SyndEntryImpl();
            entry.setTitle("Feature A");
            entry.setLink("http://geoserver.org/a");
View Full Code Here


    public List getHistoryList(String layername){
        List matches = new ArrayList();
        Iterator it = myHistory.iterator();

        while (it.hasNext()){
            TransactionEvent e = (TransactionEvent) it.next();
            if ( e.getLayerName().equals( layername ) ) {
                matches.add( e );
            }
        }
       
        return matches;
View Full Code Here

            Filter updatedFilter = filterFactory.id(updatedIds);
            Filter deletedFilter = filterFactory.id(deletedIds);

            // notify pre-update and pre-delete
           
            listener.dataStoreChange(new TransactionEvent(TransactionEventType.PRE_UPDATE, layerName,
                    vstore.getFeatures(updatedFilter), rollback));
            listener.dataStoreChange(new TransactionEvent(TransactionEventType.PRE_DELETE, layerName,
                    vstore.getFeatures(deletedFilter), rollback));

            // now do the actual rollback
            try {
                vstore.rollback(version, (Filter) rollback.getFilter(), users);
            } catch (Exception e) {
                throw new WFSTransactionException("Could not perform the rollback", e, rollback
                        .getHandle());
            }

            // notify post update and post insert
            listener.dataStoreChange(new TransactionEvent(TransactionEventType.POST_INSERT, layerName,
                    vstore.getFeatures(insertedFilter)));
            listener.dataStoreChange(new TransactionEvent(TransactionEventType.POST_UPDATE, layerName,
                    vstore.getFeatures(updatedFilter)));

            // update summary information
            response.getTransactionSummary().setTotalInserted(BigInteger.valueOf(inserted));
            response.getTransactionSummary().setTotalUpdated(BigInteger.valueOf(updated));
View Full Code Here

        SimpleFeatureCollection updated = createNiceMock(SimpleFeatureCollection.class);
        SimpleFeatureCollection deleted = createNiceMock(SimpleFeatureCollection.class);
        replay(inserted, updated, deleted);

        TransactionType t = WfsFactory.eINSTANCE.createTransactionType();
        TransactionEvent e1 = new TransactionEvent(TransactionEventType.PRE_INSERT,
            TransactionRequest.adapt(t), PRIMITIVEGEOFEATURE, inserted);
        TransactionEvent e2 = new TransactionEvent(TransactionEventType.PRE_UPDATE,
            TransactionRequest.adapt(t), PRIMITIVEGEOFEATURE, updated);
        TransactionEvent e3 = new TransactionEvent(TransactionEventType.PRE_DELETE,
            TransactionRequest.adapt(t), PRIMITIVEGEOFEATURE, deleted);

        ScriptTransactionPlugin plugin = new ScriptTransactionPlugin(scriptMgr);
        plugin.dataStoreChange(e1);
        plugin.dataStoreChange(e2);
View Full Code Here

    }

    @Test
    public void testDataStoreChangeDoesNotPropagateExceptions() {

        TransactionEvent event = mock(TransactionEvent.class);
        when(event.getSource()).thenThrow(new RuntimeException("fake"));
        try {
            listener.dataStoreChange(event);
        } catch (RuntimeException e) {
            fail("Exception should have been eaten to prevent the transaction from failing due to a gwc integration error");
        }
View Full Code Here

        }
    }

    @Test
    public void testDataStoreChangeOfNoInterest() {
        TransactionEvent event = mock(TransactionEvent.class);
        when(event.getSource()).thenReturn(new Object());
        listener.dataStoreChange(event);

        verify(event, times(1)).getLayerName();
        verify(event, times(1)).getType();
        verify(event, times(1)).getSource();
View Full Code Here

    @Test
    public void testDataStoreChangePostInsert() {

        InsertElementType insert = mock(InsertElementType.class);
        TransactionEvent event = mock(TransactionEvent.class);

        QName layerName = new QName("testType");
        when(event.getLayerName()).thenReturn(layerName);
        when(event.getSource()).thenReturn(insert);
        when(event.getType()).thenReturn(TransactionEventType.POST_INSERT);

        listener.dataStoreChange(event);
        // no need to do anything at post insert, bounds computed at pre_insert
        verifyNoMoreInteractions(mediator);
    }
View Full Code Here

    @Test
    public void testDataStoreChangeDoesNotAffectTileLayer() {

        InsertElementType insert = mock(InsertElementType.class);
        TransactionEvent event = mock(TransactionEvent.class);

        QName layerName = new QName("testType");
        when(event.getLayerName()).thenReturn(layerName);
        when(event.getSource()).thenReturn(insert);
        when(event.getType()).thenReturn(TransactionEventType.PRE_INSERT);

        when(
                mediator.getTileLayersByFeatureType(eq(layerName.getNamespaceURI()),
                        eq(layerName.getLocalPart()))).thenReturn(Collections.EMPTY_SET);
View Full Code Here

            ReferencedEnvelope affectedBounds) {

        TransactionType transaction = mock(TransactionType.class);
        when(transaction.getExtendedProperties()).thenReturn(extendedProperties);

        TransactionEvent event = mock(TransactionEvent.class);

        when(event.getRequest()).thenReturn(transaction);

        QName layerName = new QName("testType");
        when(event.getLayerName()).thenReturn(layerName);

        InsertElementType insert = mock(InsertElementType.class);

        when(event.getSource()).thenReturn(insert);
        when(event.getType()).thenReturn(TransactionEventType.PRE_INSERT);

        when(
                mediator.getTileLayersByFeatureType(eq(layerName.getNamespaceURI()),
                        eq(layerName.getLocalPart()))).thenReturn(

        ImmutableSet.of("theLayer", "theGroup"));

        SimpleFeatureCollection affectedFeatures = mock(SimpleFeatureCollection.class);
        when(affectedFeatures.getBounds()).thenReturn(affectedBounds);
        when(event.getAffectedFeatures()).thenReturn(affectedFeatures);

        listener.dataStoreChange(event);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.wfs.TransactionEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.