Package net.opengis.wfs

Examples of net.opengis.wfs.PropertyType


    public boolean canHandle(Object object) {
        return object instanceof PropertyType;
    }

    public List properties(Object object, XSDElementDeclaration element) {
        PropertyType property = (PropertyType) object;

        List properties = new ArrayList(2);

        //the Name particle we can use as is
        properties.add(new Object[] {
                Schemas.getChildElementParticle(element.getType(), "Name", false),
                property.getName()
            });

        //the Value particle we must retype

        //first guess its type
        QName newTypeName = guessValueType(property.getValue());
        XSDTypeDefinition type = (newTypeName != null) ? index.getTypeDefinition(newTypeName) : null;

        if (type != null) {
            //create a new particle based on the new type
            XSDElementDeclaration value = XSDFactory.eINSTANCE.createXSDElementDeclaration();
            value.setName("Value");
            value.setTypeDefinition(type);

            XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
            particle.setMinOccurs(1);
            particle.setMaxOccurs(1);
            particle.setContent(value);

            properties.add(new Object[] { particle, property.getValue() });
        } else {
            //coudl not determine new type, just fall back to xs:anyType
            Object[] p = new Object[] {
                    Schemas.getChildElementParticle(element.getType(), "Value", false),
                    property.getValue()
                };
            properties.add(p);
        }

        return properties;
View Full Code Here


        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);
View Full Code Here

        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);
View Full Code Here

        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 "
View Full Code Here

            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
                // update
                if (values[j] instanceof Geometry ) {
                    Geometry geometry = (Geometry) values[j];
View Full Code Here

        public QName getName() {
            return eGet(adaptee, "name", QName.class);
        }

        public static PropertyType unadapt(Property property) {
            PropertyType p = WfsFactory.eINSTANCE.createPropertyType();
            p.setName(property.getName());
            p.setValue(property.getValue());
            return p;
        }
View Full Code Here

    public boolean canHandle(Object object) {
        return object instanceof PropertyType;
    }

    public List properties(Object object, XSDElementDeclaration element) {
        PropertyType property = (PropertyType) object;

        List properties = new ArrayList(2);

        //the Name particle we can use as is
        properties.add(new Object[] {
                Schemas.getChildElementParticle(element.getType(), "Name", false),
                property.getName()
            });

        //the Value particle we must retype

        //first guess its type
        QName newTypeName = guessValueType(property.getValue());
        XSDTypeDefinition type = (newTypeName != null) ? index.getTypeDefinition(newTypeName) : null;

        if (type != null) {
            //create a new particle based on the new type
            XSDElementDeclaration value = XSDFactory.eINSTANCE.createXSDElementDeclaration();
            value.setName("Value");
            value.setTypeDefinition(type);

            XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
            particle.setMinOccurs(1);
            particle.setMaxOccurs(1);
            particle.setContent(value);

            properties.add(new Object[] { particle, property.getValue() });
        } else {
            //coudl not determine new type, just fall back to xs:anyType
            Object[] p = new Object[] {
                    Schemas.getChildElementParticle(element.getType(), "Value", false),
                    property.getValue()
                };
            properties.add(p);
        }

        return properties;
View Full Code Here

     *
     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        PropertyType property = wfsfactory.createPropertyType();

        //&lt;xsd:element name="Name" type="xsd:string"&gt;
        String name = (String) node.getChildValue("Name");

        //turn into qname
        QName qName = (QName) new XSQNameBinding(namespaceContext).parse(null, name);
        property.setName(qName);

        //&lt;xsd:element minOccurs="0" name="Value"&gt;
        if (node.hasChild("Value")) {
            Object object = node.getChildValue("Value");

            //check for a map
            if (object instanceof Map) {
                Map map = (Map) object;

                //this means a complex element parsed by xs:AnyType binding
                // try to pull out some text
                if (!map.isEmpty()) {
                    //first check for some text
                    if (map.containsKey(null)) {
                        property.setValue(map.get(null));
                    } else {
                        //perhaps some other value
                        property.setValue(map.values().iterator().next());
                    }
                }
            } else {
                property.setValue(object);
            }
        }

        return property;
    }
View Full Code Here

     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        //TODO: much of this method is duplicated in the 1.1.0 binding, it
        // would be nice if we could sync them up somewhow....
        PropertyType property = wfsfactory.createPropertyType();

        //&lt;xsd:element name="Name" type="xsd:QName"&gt;
        property.setName((QName) node.getChildValue(QName.class));

        //&lt;xsd:element minOccurs="0" name="Value"&gt;
        if (node.hasChild("Value")) {
            Object object = node.getChildValue("Value");

            //check for a map
            if (object instanceof Map) {
                Map map = (Map) object;

                //this means a complex element parsed by xs:AnyType binding
                // try to pull out some text
                if (!map.isEmpty()) {
                    //first check for some text
                    if (map.containsKey(null)) {
                        property.setValue(map.get(null));
                    } else {
                        //perhaps some other value
                        property.setValue(map.values().iterator().next());
                    }
                }
            } else {
                property.setValue(object);
            }
        }

        return property;
    }
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of net.opengis.wfs.PropertyType

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.