Package org.opengis.feature.type

Examples of org.opengis.feature.type.PropertyDescriptor


        // get list of descriptors from types and all supertypes
        List<PropertyDescriptor> descriptors = descriptors(parentType);

        // find matching descriptor
        for (Iterator<PropertyDescriptor> it = descriptors.iterator(); it.hasNext();) {
            PropertyDescriptor d = it.next();
            if (d.getName().equals(name)) {
                return d;
            }
        }

        // nothing found, perhaps polymorphism?? let's loop again
        for (Iterator<PropertyDescriptor> it = descriptors.iterator(); it.hasNext();) {
            List<AttributeDescriptor> substitutionGroup = (List<AttributeDescriptor>) it.next()
                    .getUserData().get("substitutionGroup");
            if (substitutionGroup != null) {
                for (Iterator<AttributeDescriptor> it2 = substitutionGroup.iterator(); it2
                        .hasNext();) {
                    AttributeDescriptor d = it2.next();
                    if (d.getName().equals(name)) { // BINGOOO !!
                        return d;
                    }
                }
            }
        }
View Full Code Here


        // get list of descriptors from types and all supertypes
        List<PropertyDescriptor> descriptors = descriptors(parentType);

        // find matching descriptor
        for (Iterator<PropertyDescriptor> it = descriptors.iterator(); it.hasNext();) {
            PropertyDescriptor d = it.next();
            if (d.getName().getLocalPart().equals(name)) {
                return d;
            }
        }

        // nothing found, perhaps polymorphism?? let's loop again
        for (Iterator<PropertyDescriptor> it = descriptors.iterator(); it.hasNext();) {
            List<AttributeDescriptor> substitutionGroup = (List<AttributeDescriptor>) it.next()
                    .getUserData().get("substitutionGroup");
            if (substitutionGroup != null) {
                for (Iterator<AttributeDescriptor> it2 = substitutionGroup.iterator(); it2
                        .hasNext();) {
                    AttributeDescriptor d = it2.next();
                    if (d.getName().getLocalPart().equals(name)) { // BINGOOO !!
                        return d;
                    }
                }
            }
        }
View Full Code Here

     *             inherently unsafe.
     */
    @Deprecated
    public PropertyDescriptor getDescriptor(String name) {
        requireDescriptors();
        PropertyDescriptor result = getDescriptor(new NameImpl(name));
        if (result == null) {
            result = getDescriptor(new NameImpl(getName().getNamespaceURI(), name));
            if (result == null) {
                for (PropertyDescriptor pd : descriptors) {
                    if (pd.getName().getLocalPart().equals(name)) {
View Full Code Here

        if (visited) {
            return;
        }
       
        if(attributeClass == null) {
            PropertyDescriptor desc = (PropertyDescriptor) expr.evaluate(feature.getType());
            attributeClass = desc.getType().getBinding();
            if(accumulator == null) {
                accumulator = getAccumulator(attributeClass);
            }
        }
View Full Code Here

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

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

        // create a variable "attributes" which his a list of all the
        // attributes, but at the same time, is a map keyed by name
        Map<String, Object> attributeMap = new LinkedHashMap<String, Object>();
        Collection<PropertyDescriptor> descriptors = ft.getDescriptors();
        for (Iterator<PropertyDescriptor> it = descriptors.iterator(); it.hasNext();) {
            PropertyDescriptor descr = it.next();

            Map<String, Object> attribute = new HashMap<String, Object>();
            attribute.put("name", descr.getName().getLocalPart());
            attribute.put("namespace", getNamespace( descr.getName()));
            attribute.put("prefix", getPrefix(descr.getName()) );
            attribute.put("type", descr.getType().getBinding().getName());
            attribute.put("isGeometry", Boolean.valueOf(Geometry.class.isAssignableFrom(descr.getType().getBinding())));

            attributeMap.put(descr.getName().toString(), attribute);
        }

        // build up the result, feature type is represented by its name an
        // attributes
        SimpleHash map = new SimpleHash();
View Full Code Here

         */
        public Set entrySet() {
            if (entrySet == null) {
                entrySet = new LinkedHashSet<MapEntry>();
                final ComplexType featureType = feature.getType();
                PropertyDescriptor attributeDescr = featureType.getDescriptor(attributeName);
                Property property = feature.getProperty(attributeName);
               
                if (property == null) {
                    //maybe polymorphism? let's try
                    @SuppressWarnings("unchecked")
                    List<AttributeDescriptor> substitutionGroup = (List<AttributeDescriptor>) attributeDescr.getUserData().get("substitutionGroup");
                    if (substitutionGroup != null){
                        Iterator<AttributeDescriptor> it = substitutionGroup.iterator();
                        while (property==null && it.hasNext()) {
                             property = feature.getProperty(it.next().getName());
                        }
                        if (property!=null) {
                            attributeDescr = property.getDescriptor();
                        }
                    }   
                }
               
                entrySet.add(new MapEntry<Object, Object>("isComplex", property instanceof ComplexAttribute));

                Object value = null;
                if (property instanceof ComplexAttribute) {
                    value = buildComplex((ComplexAttribute)property);
                }
                else if (property!=null) {
                    value = property.getValue();
                }
               
                entrySet.add(new DeferredValueEntry("value", value));
                entrySet.add(new MapEntry<Object, Object>("name", attributeName.getLocalPart()));
                entrySet.add(new MapEntry<Object, Object>("namespace", getNamespace(attributeName)));
                entrySet.add(new MapEntry<Object, Object>("prefix", getPrefix(attributeName)));
               
                if (attributeDescr.getType() instanceof ComplexType) {
                    entrySet.add(new MapEntry<Object, Object>("type", buildType( (ComplexType) attributeDescr.getType())));
                } else {
                    entrySet.add(new MapEntry<Object, Object>("type", attributeDescr.getType().getBinding().getName()));
                }
               
                Object rawValue = value == null ? "" : value;               
                boolean isGeometry = Geometry.class.isAssignableFrom(attributeDescr.getType().getBinding());
                entrySet.add(new MapEntry<Object, Object>("isGeometry", Boolean.valueOf(isGeometry)));
                entrySet.add(new MapEntry<Object, Object>("rawValue", rawValue));
                  
               
            }
View Full Code Here

                    Iterator<PropertyDescriptor> descriptors = fc.getSchema().getDescriptors().iterator();
                   
                    // dump attributes
                    int j = 0;
                    while (descriptors.hasNext()) {
                        PropertyDescriptor desc = descriptors.next();
                       
                        if (desc.getName().getLocalPart().startsWith("FEATURE_LINK")) {
                            // skip temporary attributes
                            continue;
                        }
                        if (j > 0) {
                            w.write(",");
                        }
                        j++;
                        // Multi valued properties aren't supported, only for SF0 for now
                        Collection<Property> values = f.getProperties(desc.getName());
                        if (values.size() > 1) {
                            throw new UnsupportedOperationException(
                                    "Multi valued properties aren't supported with CSV format!");
                        }
View Full Code Here

    protected void updateAttributeStats(DataAttribute attribute) throws IOException {
        FeatureTypeInfo featureType = GeoServerApplication.get().getCatalog().getFeatureType(featureTypeId);
        FeatureSource fs = featureType.getFeatureSource(null, null);
       
        // check we can compute min and max
        PropertyDescriptor pd = fs.getSchema().getDescriptor(attribute.getName());
        Class<?> binding = pd.getType().getBinding();
        if(pd == null || !Comparable.class.isAssignableFrom(binding) || Geometry.class.isAssignableFrom(binding)) {
            return;
        }
       
        // grab the feature collection and run the min/max visitors (this will move the
View Full Code Here

TOP

Related Classes of org.opengis.feature.type.PropertyDescriptor

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.