Examples of UpdateElementType


Examples of net.opengis.wfs.UpdateElementType

    public void encodeUpdate() throws IOException, SAXException, TransformerException, XpathException{
        WfsFactory wfsfac = WfsFactory.eINSTANCE;
        FilterFactory2 filterfac = CommonFactoryFinder.getFilterFactory2();
        GeometryFactory geomfac = new GeometryFactory(new PrecisionModel(10));
       
        UpdateElementType update = wfsfac.createUpdateElementType();
        PropertyType propertyType = wfsfac.createPropertyType();
        propertyType.setName(new QName("http://my.namespace","myproperty","mn"));
        update.getProperty().add(propertyType);
        update.setTypeName(new QName("http://my.namespace","mytypename","mn"));
        update.setFilter(filterfac.id( filterfac.featureId("someid")));
       
        //try with string
        propertyType.setValue("myvalue");
       
        Encoder encoder = new Encoder(new WFSConfiguration());
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        UpdateElementType updateElement = wfsfactory.createUpdateElementType();

        //<xsd:element maxOccurs="unbounded" ref="wfs:Property">
        updateElement.getProperty().addAll(node.getChildValues(PropertyType.class));

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

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

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

        //<xsd:attribute default="x-application/gml:3" name="inputFormat"
        //      type="xsd:string" use="optional">
        if (node.hasAttribute("inputFormat")) {
            updateElement.setInputFormat((String) node.getAttributeValue("inputFormat"));
        }

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

        return updateElement;
    }
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

   
    @Test
    public void testWFSTransaction() throws Exception {
        TransactionType t = WfsFactory.eINSTANCE.createTransactionType();
       
        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);
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

       
        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();
        property.setName(new QName(SF_NAMESPACE, "cat"));
        property.setValue(-48);
        update.getProperty().add(property);
       
        TransactionType transaction = wfs.createTransactionType();
        transaction.getInsert().add(insert);
        transaction.getUpdate().add(update);
        transaction.getDelete().add(delete);
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

        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();
        property.setName(new QName(SF_NAMESPACE, "cat"));
        property.setValue(-48);
        update.getProperty().add(property);

        TransactionType transaction = wfs.createTransactionType();
        transaction.getInsert().add(insert);
        transaction.getUpdate().add(update);
        transaction.getDelete().add(delete);
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

       
        TransactionType t =
            (TransactionType) OwsUtils.parameter(operation.getParameters(), TransactionType.class);
        if (t != null) {
            for (Iterator i = t.getUpdate().iterator(); i.hasNext(); ) {
                UpdateElementType up = (UpdateElementType) i.next();
                up.setTypeName(qualifyTypeName(up.getTypeName(), workspace, ns));
            }
            for (Iterator i = t.getDelete().iterator(); i.hasNext(); ) {
                DeleteElementType del = (DeleteElementType) i.next();
                del.setTypeName(qualifyTypeName(del.getTypeName(), workspace, ns));
            }
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

        }

        FilterFactory ff = CommonFactoryFinder.getFilterFactory( null );
       
        // check that all required properties have a specified value
        UpdateElementType update = (UpdateElementType) element;

        try {
            FeatureTypeInfo meta = (FeatureTypeInfo) typeInfos.values().iterator().next();
            FeatureType featureType = meta.getFeatureType();

            for (Iterator prop = update.getProperty().iterator(); prop.hasNext();) {
                PropertyType property = (PropertyType) prop.next();

                //check that valus that are non-nillable exist
                if (property.getValue() == null) {
                    String propertyName = property.getName().getLocalPart();
                    AttributeDescriptor attributeType = null;
                    PropertyDescriptor pd = featureType.getDescriptor(propertyName);
                    if(pd instanceof AttributeDescriptor) {
                        attributeType = (AttributeDescriptor) pd;
                    }
                    if ((attributeType != null) && (attributeType.getMinOccurs() > 0)) {
                        String msg = "Property '" + attributeType.getLocalName()
                            + "' is mandatory but no value specified.";
                        throw new WFSException(msg, "MissingParameterValue");
                    }
                }
               
                //check that property names are actually valid
                QName name = property.getName();
                PropertyName propertyName = null;
               
                if ( name.getPrefix() != null && !"".equals( name.getPrefix() )) {
                    propertyName = ff.property( name.getPrefix() + ":" + name.getLocalPart() );
                }
                else {
                    propertyName = ff.property( name.getLocalPart() );
                }
               
                if ( propertyName.evaluate( featureType ) == null ) {
                    String msg = "No such property: " + property.getName();
                    throw new WFSException( msg );
                }
            }
        } catch (IOException e) {
            throw new WFSTransactionException("Could not locate feature type information for "
                + update.getTypeName(), e, update.getHandle());
        }
    }
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

    }

    public void execute(EObject element, TransactionType request, Map featureStores,
        TransactionResponseType response, TransactionListener listener)
        throws WFSTransactionException {
        UpdateElementType update = (UpdateElementType) element;
        final QName elementName = update.getTypeName();
        String handle = update.getHandle();
        long updated = response.getTransactionSummary().getTotalUpdated().longValue();

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

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

        LOGGER.finer("Transaction Update:" + element);

        try {
            Filter filter = (Filter) update.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());
            if(filter != null) {
                filter = WFSReprojectionUtil.normalizeFilterCRS(filter, store.getSchema(), declaredCRS);
            } else {
                filter = Filter.INCLUDE;
            }


            AttributeDescriptor[] types = new AttributeDescriptor[update.getProperty().size()];
            String[] names = new String[update.getProperty().size()];
            Object[] values = new Object[update.getProperty().size()];

            for (int j = 0; j < update.getProperty().size(); j++) {
                PropertyType property = (PropertyType) update.getProperty().get(j);
                types[j] = store.getSchema().getDescriptor(property.getName().getLocalPart());
                names[j] = property.getName().getLocalPart();
                values[j] = property.getValue();
               
                // if geometry, it may be necessary to reproject it to the native CRS before
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

        public static UpdateElementType unadapt(Update update) {
            if (update instanceof WFS11) {
                return (UpdateElementType) update.getAdaptee();
            }

            UpdateElementType ue = WfsFactory.eINSTANCE.createUpdateElementType();
            ue.setHandle(update.getHandle());
            ue.setTypeName(update.getTypeName());
            ue.setFilter(update.getFilter());

            for (Property p : update.getUpdateProperties()) {
                ue.getProperty().add(Property.WFS11.unadapt(p));
            }
            return ue;
        }
View Full Code Here

Examples of net.opengis.wfs.UpdateElementType

     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        UpdateElementType updateElement = wfsfactory.createUpdateElementType();

        //&lt;xsd:element maxOccurs="unbounded" ref="wfs:Property"/&gt;
        updateElement.getProperty().addAll(node.getChildValues(PropertyType.class));

        //&lt;xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter"&gt;
        updateElement.setFilter((Filter) node.getChildValue(Filter.class));

        //&lt;xsd:attribute name="handle" type="xsd:string" use="optional"/&gt;
        if (node.hasAttribute("handle")) {
            updateElement.setHandle((String) node.getAttributeValue("handle"));
        }

        //&lt;xsd:attribute name="typeName" type="xsd:QName" use="required"/&gt;
        updateElement.setTypeName((QName) node.getAttributeValue("typeName"));

        return updateElement;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.