Package net.opengis.wfs

Examples of net.opengis.wfs.DeleteElementType


    @Test
    public void encodeDelete() throws IOException, SAXException, TransformerException, XpathException{
        WfsFactory wfsfac = WfsFactory.eINSTANCE;
        FilterFactory2 filterfac = CommonFactoryFinder.getFilterFactory2();
               
        DeleteElementType delete = wfsfac.createDeleteElementType();
        delete.setFilter(filterfac.id( filterfac.featureId("someid")));
       
        Encoder encoder = new Encoder(new WFSConfiguration());
        //System.out.println(encoder.encodeAsString(delete, WFS.Delete));
        Document doc = encoder.encodeAsDOM(delete, WFS.Delete);
        XMLAssert.assertXpathEvaluatesTo("someid", "//wfs:Delete/ogc:Filter/ogc:FeatureId/@fid", doc);       
View Full Code Here


    @Test
    public void encodeDelete() throws IOException, SAXException, TransformerException, XpathException{
        WfsFactory wfsfac = WfsFactory.eINSTANCE;
        FilterFactory2 filterfac = CommonFactoryFinder.getFilterFactory2();
               
        DeleteElementType delete = wfsfac.createDeleteElementType();
        delete.setFilter(filterfac.id( filterfac.featureId("someid")));
       
        Encoder encoder = new Encoder(new WFSConfiguration());
        //System.out.println(encoder.encodeAsString(delete, WFS.Delete));
        Document doc = encoder.encodeAsDOM(delete, WFS.Delete);
        XMLAssert.assertXpathEvaluatesTo("someid", "//wfs:Delete/ogc:Filter/ogc:FeatureId/@fid", doc);       
View Full Code Here

     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        DeleteElementType deleteElement = wfsfactory.createDeleteElementType();

        //<xsd:element maxOccurs="1" minOccurs="1" ref="ogc:Filter">
        deleteElement.setFilter((Filter) node.getChildValue(Filter.class));

        //<xsd:attribute name="handle" type="xsd:string" use="optional"/>
        if (node.hasAttribute("handle")) {
            deleteElement.setHandle((String) node.getAttributeValue("handle"));
        }

        //<xsd:attribute name="typeName" type="xsd:QName" use="required"/>
        deleteElement.setTypeName((QName) node.getAttributeValue(QName.class));

        return deleteElement;
    }
View Full Code Here

        PostDiffType postDiff = new PostDiffType();
        postDiff.setFromVersion(-1);
        postDiff.setToVersion(3);
        postDiff.setTypeName(typeName);
        TransactionType changes = WfsFactory.eINSTANCE.createTransactionType();
        DeleteElementType delete = WfsFactory.eINSTANCE.createDeleteElementType();
        delete.setTypeName(typeName);
        delete.setFilter(removeFilter);
        changes.getDelete().add(delete);
        postDiff.setTransaction(changes);
       
        // create mock objects that will check the calls are flowing as expected
        GSSClient client = createMock(GSSClient.class);
View Full Code Here

        GetDiffResponseType gdr = new GetDiffResponseType();
        gdr.setFromVersion(-1);
        gdr.setFromVersion(6);
        gdr.setTypeName(typeName);
        TransactionType changes = WfsFactory.eINSTANCE.createTransactionType();
        DeleteElementType delete = WfsFactory.eINSTANCE.createDeleteElementType();
        delete.setTypeName(typeName);
        Id removeFilter = ff.id(singleton(ff.featureId("restricted.c15e76ab-e44b-423e-8f85-f6d9927b878a")));
        delete.setFilter(removeFilter);
        changes.getDelete().add(delete);
        gdr.setTransaction(changes);
       
        // create mock objects that will check the calls are flowing as expected
        GSSClient client = createMock(GSSClient.class);
View Full Code Here

       
        UpdateElementType ue = WfsFactory.eINSTANCE.createUpdateElementType();
        ue.setTypeName(new QName("http://acme.org", "foo", "acme"));
        t.getUpdate().add(ue);
       
        DeleteElementType de = WfsFactory.eINSTANCE.createDeleteElementType();
        de.setTypeName(new QName("http://acme.org", "bar", "acme"));
        t.getDelete().add(de);
       
        Operation op = op("Transaction", "WFS", "1.0.0", t);
        callback.operationDispatched(new Request(), op);
       
View Full Code Here

        SimpleFeatureType ft = DataUtilities.createType("restricted", "cat:java.lang.Long,the_geom:Polygon");
        Geometry polygon = new WKTReader().read("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))");
        SimpleFeature f = SimpleFeatureBuilder.build(ft, new Object[] {123, polygon}, "restricted.105");
        insert.getFeature().add(f);
       
        DeleteElementType delete = wfs.createDeleteElementType();
        delete.setTypeName(restricted);
        delete.setFilter(ff.id(Collections.singleton(ff.featureId("restricted.23"))));
       
        UpdateElementType update = wfs.createUpdateElementType();
        update.setTypeName(restricted);
        update.setFilter(ff.id(Collections.singleton(ff.featureId("restricted.21"))));
        PropertyType property = wfs.createPropertyType();
View Full Code Here

        Geometry polygon = new WKTReader().read("POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))");
        SimpleFeature f = SimpleFeatureBuilder.build(ft, new Object[] { 123, polygon },
                "restricted.105");
        insert.getFeature().add(f);

        DeleteElementType delete = wfs.createDeleteElementType();
        delete.setTypeName(restricted);
        delete.setFilter(ff.id(Collections.singleton(ff.featureId("restricted.23"))));

        UpdateElementType update = wfs.createUpdateElementType();
        update.setTypeName(restricted);
        update.setFilter(ff.id(Collections.singleton(ff.featureId("restricted.21"))));
        PropertyType property = wfs.createPropertyType();
View Full Code Here

        if (!getInfo().getServiceLevel().getOps().contains(WFSInfo.Operation.TRANSACTION_DELETE)) {
            throw new WFSException("Transaction Delete support is not enabled");
        }

        // check that a filter was specified
        DeleteElementType delete = (DeleteElementType) element;

        if ((delete.getFilter() == null) || Filter.INCLUDE.equals(delete.getFilter())) {
            throw new WFSTransactionException("Must specify filter for delete",
                "MissingParameterValue");
        }
    }
View Full Code Here

    }

    public void execute(EObject element, TransactionType request, Map featureStores,
        TransactionResponseType response, TransactionListener listener)
        throws WFSTransactionException {
        DeleteElementType delete = (DeleteElementType) element;
        QName elementName = delete.getTypeName();
        String handle = delete.getHandle();
        long deleted = response.getTransactionSummary().getTotalDeleted().longValue();

        SimpleFeatureStore store = DataUtilities.simple((FeatureStore) featureStores.get(elementName));

        if (store == null) {
            throw new WFSException("Could not locate FeatureStore for '" + elementName + "'");
        }

        String typeName = store.getSchema().getTypeName();
        LOGGER.finer("Transaction Delete:" + element);

        try {
            Filter filter = (Filter) delete.getFilter();
           
            // make sure all geometric elements in the filter have a crs, and that the filter
            // is reprojected to store's native crs as well
            CoordinateReferenceSystem declaredCRS = WFSReprojectionUtil.getDeclaredCrs(
                    store.getSchema(), request.getVersion());
            filter = WFSReprojectionUtil.normalizeFilterCRS(filter, store.getSchema(), declaredCRS);
           
            // notify listeners
            TransactionEvent event = new TransactionEvent(TransactionEventType.PRE_DELETE,
                    elementName, store.getFeatures(filter));
            event.setSource( delete );
            listener.dataStoreChange( event );

            // compute damaged area
            Envelope damaged = store.getBounds(new Query(
                        delete.getTypeName().getLocalPart(), filter));

            if (damaged == null) {
                damaged = store.getFeatures(filter).getBounds();
            }
View Full Code Here

TOP

Related Classes of net.opengis.wfs.DeleteElementType

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.