Package org.opengis.filter.expression

Examples of org.opengis.filter.expression.PropertyName


        assertEquals(l, f.getParameters().get(0));
        assertEquals(pn, f.getParameters().get(1));
    }
    public void testCatenateThree() {
        Literal l1 = ff.literal("http://test?param=");
        PropertyName pn = ff.property("intAttribute");
        Literal l2 = ff.literal("&param2=foo");
        Expression cat = ExpressionExtractor.catenateExpressions(Arrays.asList(l1, pn, l2));
        assertTrue(cat instanceof Function);
        Function f = (Function) cat;
        assertEquals("Concatenate", f.getName());
View Full Code Here


            for (AttributeMapping attMapping : mapping.getAttributeMappings()) {
                final StepList targetSteps = attMapping.getTargetXPath();
                boolean alreadyAdded = false;

                if (includeMandatory) {
                    PropertyName targetProp = namespaceAwareFilterFactory.property(targetSteps
                            .toString());
                    Object descr = targetProp.evaluate(targetDescriptor.getType());
                    if (descr instanceof PropertyDescriptor) {
                        if (((PropertyDescriptor) descr).getMinOccurs() >= 1) {
                            selectedMapping.add(attMapping);
                            selectedProperties.put(attMapping, new ArrayList<PropertyName>());
                            alreadyAdded = true;
View Full Code Here

     * @generated modifiable
     */
    public Object parse(ElementInstance instance, Node node, Object value)
        throws Exception {
        //TODO: crs
        PropertyName propertyName = (PropertyName) node.getChildValue(PropertyName.class);
        Envelope box = (Envelope) node.getChildValue(Envelope.class);
       
        if (box instanceof ReferencedEnvelope) {
          return factory.bbox(propertyName == null?  factory.property("") : propertyName, (ReferencedEnvelope) box);         
        }
        else {
          String name = null;
            if ( propertyName != null ) {
                name = propertyName.getPropertyName();
            }
            //JD: this is a bit hackish, we know that "" means default geometry
            // in SimpleFeaturePropertyAccessor, so instead of dying here set
            // to empty string to mean defualt geometry
            // TODO: come up with something a bit more concrete
View Full Code Here

        PropertyIsEqualTo equal = (PropertyIsEqualTo) thing;
        assertTrue(equal.getExpression1() instanceof PropertyName);
        assertTrue(equal.getExpression2() instanceof Literal);

        PropertyName name = (PropertyName) equal.getExpression1();
        assertEquals("testString", name.getPropertyName());

        Literal literal = (Literal) equal.getExpression2();
        assertEquals("2", literal.toString());
    }
View Full Code Here

       DWithin filter = (DWithin) parser.parse(new ByteArrayInputStream(xml.getBytes()));
       assertNotNull(filter);
      
       //Asserting the Property Name
       assertNotNull(filter.getExpression1());
       PropertyName propName = (PropertyName) filter.getExpression1();
       String name = propName.getPropertyName();
       assertEquals("the_geom", name);
      
       //Asserting the Geometry
       assertNotNull(filter.getExpression2());
       Literal geom = (Literal) filter.getExpression2();
View Full Code Here

        return factory.property(xpath);
    }

    public Element encode(Object object, Document document, Element value)
        throws Exception {
        PropertyName propertyName = (PropertyName) object;

        if (propertyName.getPropertyName() != null) {
            value.appendChild(document.createTextNode(propertyName.getPropertyName()));
        }

        return value;
    }
View Full Code Here

       
        Query query = new Query();
        query.setCoordinateSystemReproject(reprojection);
       
        Filter filter;
        PropertyName propertyName = filterFac.property(this.nestedTargetXPath.toString());
        filter = filterFac.equals(propertyName, filterFac.literal(foreignKeyValue));             
        query.setFilter(filter);
       
        if (selectedProperties!=null && !selectedProperties.isEmpty()) {
            selectedProperties = new ArrayList<PropertyName>(selectedProperties);
View Full Code Here

                final StepList targetSteps = entry.getTargetXPath();

                boolean addThis = false;

                if (includeMandatory) {
                    PropertyName targetProp = filterFac.property(targetSteps.toString(),
                            mapping.getNamespaces());
                    Object descr = targetProp.evaluate(targetDescriptor.getType());
                    if (descr instanceof PropertyDescriptor) {
                        if (((PropertyDescriptor) descr).getMinOccurs() >= 1) {
                            addThis = true;
                        }
                    }
                }

                if (!addThis) {
                    for (PropertyName requestedProperty : requestedProperties) {
                        StepList requestedPropertySteps;
                        if (requestedProperty.getNamespaceContext() == null) {
                            requestedPropertySteps = XPath.steps(targetDescriptor, requestedProperty.getPropertyName(),
                                    mapping.getNamespaces());
                        } else {
                            requestedPropertySteps = XPath.steps(targetDescriptor, requestedProperty.getPropertyName(),
                                        requestedProperty.getNamespaceContext());
                        }

                        if (requestedPropertySteps == null ? matchProperty(
                                requestedProperty.getPropertyName(), targetSteps) : matchProperty(
                                requestedPropertySteps, targetSteps)) {
                            addThis = true;
                            break;
                        }
                    }
                }

                if (addThis) {
                    final Expression sourceExpression = entry.getSourceExpression();
                    final Expression idExpression = entry.getIdentifierExpression();
                    // NC - include client properties
                    final Collection<Expression> clientProperties = entry.getClientProperties()
                            .values();

                    FilterAttributeExtractor extractor = new FilterAttributeExtractor();
                    sourceExpression.accept(extractor, null);
                    idExpression.accept(extractor, null);

                    // RA - include function parameters in linkField
                    if (entry instanceof NestedAttributeMapping) {
                        final Expression linkFieldExpression = ((NestedAttributeMapping) entry).nestedFeatureType;
                        linkFieldExpression.accept(extractor, null);
                    }

                    Iterator<Expression> it = clientProperties.iterator();
                    while (it.hasNext()) {
                        it.next().accept(extractor, null);
                    }
                    Set<String> exprAtts = extractor.getAttributeNameSet();

                    for (String mappedAtt : exprAtts) {
                        if (!mappedAtt.equals("Expression.NIL")) { // NC - ignore Nil Expression
                            if (mappedType == null) {
                                // web service backend.. no underlying simple feature
                                // so just assume that it exists..
                                requestedSurrogateProperties.add(filterFac.property(mappedAtt));
                            } else {
                                PropertyName propExpr = filterFac.property(mappedAtt);
                                Object object = propExpr.evaluate(mappedType);
                                AttributeDescriptor mappedAttribute = (AttributeDescriptor) object;
                                if (mappedAttribute != null) {
                                    requestedSurrogateProperties.add(filterFac.property(mappedAtt));
                                } else {
                                    LOGGER.info("mapped type does not contains property "
View Full Code Here

    Geometry geom = null;

    if (geomName == null) {
      geomName = ""; // ie default geometry
    }
    PropertyName property = ff.property(geomName);
    return (Geometry) property.evaluate(feature, Geometry.class);
  }
View Full Code Here

                    if (currStepDescriptor == null) {
                        // need to take the non easy way, may be the instance has a
                        // value for this step with a different name, of a derived
                        // type of the one declared in the parent type
                        String prefixedStepName = currStep.toString();
                        PropertyName name = FF.property(prefixedStepName);
                        Attribute child = (Attribute) name.evaluate(parent);
                        if (child != null) {
                            currStepDescriptor = child.getDescriptor();
                        }
                    }
                } else {
                    AttributeDescriptor actualDescriptor;
                    if (null == attributeName.getNamespaceURI()) {
                        actualDescriptor = (AttributeDescriptor) Types.findDescriptor(parentType, attributeName.getLocalPart());
                    } else {
                        actualDescriptor = (AttributeDescriptor) Types.findDescriptor(parentType, attributeName);
                    }

                    if (actualDescriptor != null) {
                        int minOccurs = actualDescriptor.getMinOccurs();
                        int maxOccurs = actualDescriptor.getMaxOccurs();
                        boolean nillable = actualDescriptor.isNillable();
                        if (actualDescriptor instanceof GeometryDescriptor) {
                            // important to maintain CRS information encoding
                            if (Geometry.class.isAssignableFrom(targetNodeType.getBinding())) {
                                if (!(targetNodeType instanceof GeometryType)) {
                                    targetNodeType = new GeometryTypeImpl(targetNodeType.getName(),
                                            targetNodeType.getBinding(), crs != null ? crs
                                                    : ((GeometryDescriptor) actualDescriptor)
                                                            .getCoordinateReferenceSystem(),
                                            targetNodeType.isIdentified(), targetNodeType
                                                    .isAbstract(),
                                            targetNodeType.getRestrictions(), targetNodeType
                                                    .getSuper(), targetNodeType.getDescription());
                                }
                                currStepDescriptor = descriptorFactory.createGeometryDescriptor(
                                        (GeometryType) targetNodeType, attributeName, minOccurs,
                                        maxOccurs, nillable, null);
                            } else {
                                throw new IllegalArgumentException("Can't set targetNodeType: "
                                        + targetNodeType.toString() + " for attribute mapping: "
                                        + attributeName + " as it is not a Geometry type!");
                            }
                        } else {
                            currStepDescriptor = descriptorFactory.createAttributeDescriptor(
                                    targetNodeType, attributeName, minOccurs, maxOccurs, nillable,
                                    null);
                        }
                    }
                }

                if (currStepDescriptor == null) {
                    StringBuffer parentAtts = new StringBuffer();
                    Collection properties = parentType.getDescriptors();
                    for (Iterator it = properties.iterator(); it.hasNext();) {
                        PropertyDescriptor desc = (PropertyDescriptor) it.next();
                        Name name = desc.getName();
                        parentAtts.append(name.getNamespaceURI());
                        parentAtts.append("#");
                        parentAtts.append(name.getLocalPart());
                        if (it.hasNext()) {
                            parentAtts.append(", ");
                        }
                    }
                    throw new IllegalArgumentException(currStep
View Full Code Here

TOP

Related Classes of org.opengis.filter.expression.PropertyName

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.