Package net.opengis.wfs

Examples of net.opengis.wfs.InsertElementType


            for (Iterator i = t.getDelete().iterator(); i.hasNext(); ) {
                DeleteElementType del = (DeleteElementType) i.next();
                del.setTypeName(qualifyTypeName(del.getTypeName(), workspace, ns));
            }
            for (Iterator i = t.getInsert().iterator(); i.hasNext();) {
                InsertElementType in = (InsertElementType) i.next();
               
                //in the insert case the objects are gt feature types which are not mutable
                // so we just check them and throw an exception if a name does not match
                for (Iterator j = in.getFeature().iterator(); j.hasNext(); ) {
                    Feature f = (Feature) j.next();
                    Name n = f.getType().getName();
                    if (n.getNamespaceURI() != null && !ns.getURI().equals(n.getNamespaceURI())) {
                        throw new WFSException("No such feature type " + n);
                    }
View Full Code Here


        public static InsertElementType unadapt(Insert insert) {
            if (insert instanceof WFS11) {
                return (InsertElementType) insert.getAdaptee();
            }

            InsertElementType ie = WfsFactory.eINSTANCE.createInsertElementType();
            ie.setHandle(insert.getHandle());
            ie.getFeature().addAll(insert.getFeatures());

            return ie;
        }
View Full Code Here

     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        InsertElementType insertElement = wfsfactory.createInsertElementType();

        //features
        insertElement.getFeature().addAll(node.getChildValues(SimpleFeature.class));

        //handle
        if (node.hasAttribute("handle")) {
            insertElement.setHandle((String) node.getAttributeValue("handle"));
        }

        //NOTE: officially this is not supported for wfs 1.0, but we support it
        // here as an extension to wfs 1.0, also since its not actualy in the
        // schema it comes to us as a string, not a uri
        //<xsd:attribute name="srsName" type="xsd:anyURI" use="optional">
        if (node.hasAttribute("srsName")) {
            String srsName = (String) node.getAttributeValue("srsName");
            insertElement.setSrsName(new URI(srsName));
        }
        return insertElement;
    }
View Full Code Here

        return insertElement;
    }
   
    public Object getProperty(Object object, QName name)
        throws Exception {
        InsertElementType insert = (InsertElementType) object;
   
        if (GML._Feature.equals(name)) {
            return insert.getFeature();
        }
   
        return super.getProperty(object, name);
    }
View Full Code Here

     * @generated modifiable
     */
    @SuppressWarnings("unchecked")
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        InsertElementType insertElement = wfsfactory.createInsertElementType();

        //<xsd:choice>
        //   <xsd:element ref="gml:_FeatureCollection"/>
        //   <xsd:sequence>
        //       <xsd:element maxOccurs="unbounded" ref="gml:_Feature"/>
        //   </xsd:sequence>
        //</xsd:choice>
        if (node.hasChild(FeatureCollection.class)) {
            SimpleFeatureCollection fc = (SimpleFeatureCollection) node.getChildValue(FeatureCollection.class);
            insertElement.getFeature().addAll(DataUtilities.list(fc));
        } else if (node.hasChild(SimpleFeature.class)) {
            insertElement.getFeature().addAll(node.getChildValues(SimpleFeature.class));
        }

        //<xsd:attribute default="GenerateNew" name="idgen"
        //    type="wfs:IdentifierGenerationOptionType" use="optional">
        if (node.hasAttribute("idgen")) {
            insertElement.setIdgen((IdentifierGenerationOptionType) node.getAttributeValue("idgen"));
        }

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

        //<xsd:attribute default="text/xml; subtype=gml/3.1.1"
        //     name="inputFormat" type="xsd:string" use="optional">
        if (node.hasAttribute("inputFormat")) {
            insertElement.setInputFormat((String) node.getAttributeValue("inputFormat"));
        }

        //<xsd:attribute name="srsName" type="xsd:anyURI" use="optional">
        if (node.hasAttribute("srsName")) {
            insertElement.setSrsName((URI) node.getAttributeValue("srsName"));
        }

        return insertElement;
    }
View Full Code Here

        // build the transaction
        QName restricted = new QName(SF_NAMESPACE, "restricted");
        WfsFactory wfs = WfsFactory.eINSTANCE;
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        InsertElementType insert = wfs.createInsertElementType();
        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"))));
View Full Code Here

        // build the transaction
        QName restricted = new QName(SF_NAMESPACE, "restricted");
        WfsFactory wfs = WfsFactory.eINSTANCE;
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
       
        InsertElementType insert = wfs.createInsertElementType();
        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"))));
       
View Full Code Here

    }

    @Test
    public void testWFSTransactionInsert() throws Exception {
        TransactionType t = WfsFactory.eINSTANCE.createTransactionType();
        InsertElementType ie = WfsFactory.eINSTANCE.createInsertElementType();
        t.getInsert().add(ie);

        //ie.setSrsName(new URI("epsg:4326"));

        BoundingBox expected = new ReferencedEnvelope(53.73,40, -60,-95.1193,CRS.decode("EPSG:4326"));
       
        SimpleFeatureType ft = createNiceMock(SimpleFeatureType.class);
        expect(ft.getTypeName()).andReturn("acme:foo").anyTimes();
        replay(ft);
       
        SimpleFeature f = createNiceMock(SimpleFeature.class);
        expect(f.getBounds()).andReturn(expected).anyTimes();
        expect(f.getType()).andReturn(ft).anyTimes();
        replay(f);

        ie.getFeature().add(f);

        Operation op = op("Transaction", "WFS", "1.1.0", t);
        callback.operationDispatched(new Request(), op);
       
        assertEquals("acme:foo", data.getResources().get(0));
View Full Code Here

        return insertElement;
    }

    public Object getProperty(Object object, QName name)
        throws Exception {
        InsertElementType insert = (InsertElementType) object;

        if (GML._Feature.equals(name)) {
            return insert.getFeature();
        }

        return super.getProperty(object, name);
    }
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);
View Full Code Here

TOP

Related Classes of net.opengis.wfs.InsertElementType

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.