Package org.opengis.feature.type

Examples of org.opengis.feature.type.PropertyType


            nestedAttContents.add(nestedAtt);
            attribute.setValue(nestedAttContents);
           
            return nestedAtt;
        } else {
          PropertyType simpleContentType = getSimpleContentType((AttributeType) simpleContent.getType());
            Object convertedValue = FF.literal(value).evaluate(value,
                    simpleContentType.getBinding());
          simpleContent.setValue(convertedValue);
          return attribute;
        }       
    }
View Full Code Here


     * @param type the AttributeType
     *
     * @return an int indicating the max length of field in characters, or ANY_LENGTH
     */
    public static int getFieldLength( PropertyDescriptor descriptor ) {
        PropertyType type = descriptor.getType();
        Integer length = null;
        while( type != null ){
            // TODO: We should really go through all the restrictions and find
            // the minimum of all the length restrictions; for now we assume an
            // override behavior.
            for ( Filter f : type.getRestrictions()) {
                Integer filterLength = null;
                try {
                    if(f == null) {
                        continue;
                    }
                    if (f instanceof PropertyIsLessThan) {
                        BinaryComparisonOperator cf =  (BinaryComparisonOperator) f;
                        if (cf.getExpression1() instanceof LengthFunction) {
                            filterLength = cf.getExpression2().evaluate(null, Integer.class) - 1;
                        }
                    } else if (f instanceof PropertyIsLessThanOrEqualTo) {
                        BinaryComparisonOperator cf =  (BinaryComparisonOperator) f;
                        if (cf.getExpression1() instanceof LengthFunction) {
                            filterLength = cf.getExpression2().evaluate(null, Integer.class);
                        }
                    } else if(f instanceof PropertyIsGreaterThan) {
                        BinaryComparisonOperator cf =  (BinaryComparisonOperator) f;
                        if (cf.getExpression2() instanceof LengthFunction) {
                            filterLength = cf.getExpression1().evaluate(null, Integer.class) - 1;
                        }
                    } else if (f instanceof PropertyIsGreaterThanOrEqualTo) {
                        BinaryComparisonOperator cf =  (BinaryComparisonOperator) f;
                        if (cf.getExpression2() instanceof LengthFunction) {
                            filterLength = cf.getExpression1().evaluate(null, Integer.class);
                        }
                    }
                } catch (NullPointerException e) {
                    // was not an integer eh? Continue, worst case we'll return ANY_LENGTH
                }
               
                if(filterLength != null) {
                    if(length == null || filterLength < length) {
                        length = filterLength;
                    }
                }
            }
            type = type.getSuper();
        }
       
        return length != null ? length : ANY_LENGTH;
    }
View Full Code Here

            //attributes
            for (Iterator i = type.getUserData().entrySet().iterator(); i.hasNext(); ) {
               Map.Entry entry = (Map.Entry) i.next();
               Name n = (Name) entry.getKey();
               PropertyDescriptor pd = (PropertyDescriptor) entry.getValue();
               PropertyType pdType = pd.getType();
              
               String pdTypeName = pdType.getName().getLocalPart().toUpperCase() +
                            "_TYPE";
               if (ns2import.containsKey(pdType.getName().getNamespaceURI())) {
                    String importClassName = (String) ns2import.get(pdType.getName().getNamespaceURI());
                    pdTypeName = importClassName + "." + pdTypeName;
               }
               String pdName = "new NameImpl(\"" + pd.getName().getNamespaceURI() +
                            "\",\"" + pd.getName().getLocalPart() + "\")";
          
View Full Code Here

       
            if (!type.getUserData().isEmpty()) {
                //attributes
                for (Map.Entry<Object, Object> entry : type.getUserData().entrySet()) {
                    PropertyDescriptor pd = (PropertyDescriptor) entry.getValue();
                    PropertyType pdType = pd.getType();
                    String pdTypeName = pdType.getName().getLocalPart().toUpperCase() +
                        "_TYPE";
                    if (ns2import.containsKey(pdType.getName().getNamespaceURI())) {
                        String importClassName = (String) ns2import.get(pdType.getName().getNamespaceURI());
                        pdTypeName = importClassName + "." + pdTypeName;
                    }
                    String pdName = "new NameImpl(\"" + pd.getName().getNamespaceURI() +
                        "\",\"" + pd.getName().getLocalPart() + "\")";
          
View Full Code Here

    }

    public Object getImmediateNode() {

        //first try regular way
        PropertyType pt = descriptor.getType();
        if (pt instanceof ComplexType) {
            ComplexType ct = (ComplexType) pt;
            PropertyDescriptor ad = ct.getDescriptor("@" + name.getLocalPart());
            if (ad != null) {
                return ad;
View Full Code Here

     
    if (!(other instanceof PropertyType)) {
      return false;
    }
   
    PropertyType prop = (PropertyType) other;
   
    if (!Utilities.equals(name,prop.getName())) {
      return false;
    }

    if (!Utilities.equals(binding, prop.getBinding())) {
        return false;
    }
   
    if (isAbstract != prop.isAbstract()) {
      return false;
    }

    if (!equals(getRestrictions(), prop.getRestrictions())) {
      return false;
    }
   
    if (!Utilities.equals(superType, prop.getSuper())) {
        return false;
    }
   
    if (!Utilities.equals(description,prop.getDescription())) {
      return false;
    }

    return true;
  }
View Full Code Here

    boolean found=false;
    final Collection<PropertyDescriptor> descriptors = layer.getDescriptors();
    for(PropertyDescriptor descriptor: descriptors){
     
      //get the type
      final PropertyType type=descriptor.getType();
      if(type.getBinding().isAssignableFrom(GridCoverage2D.class)||type.getBinding().isAssignableFrom(AbstractGridCoverage2DReader.class))
      {
        found=true;
        break;
      }
     
View Full Code Here

        return sampleShape;
    }

    public static boolean isGridLayer(final SimpleFeatureType layer) {
    for(PropertyDescriptor descriptor : layer.getDescriptors()){
      final PropertyType type = descriptor.getType();
      if (type.getBinding().isAssignableFrom(AbstractGridCoverage2DReader.class)) {
        return true;
      }
    }

        return false;
View Full Code Here

    boolean found=false;
    final Collection<PropertyDescriptor> descriptors = layer.getDescriptors();
    for(PropertyDescriptor descriptor: descriptors){
     
      //get the type
      final PropertyType type=descriptor.getType();
      if(type.getBinding().isAssignableFrom(GridCoverage2D.class)||type.getBinding().isAssignableFrom(GridCoverage2DReader.class))
      {
        found=true;
        break;
      }
     
View Full Code Here

TOP

Related Classes of org.opengis.feature.type.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.