Examples of StepList


Examples of org.geotools.data.complex.filter.XPathUtil.StepList

        } else {
            final AttributeDescriptor targetDescriptor = mapping.getTargetFeature();
            selectedMapping = new ArrayList<AttributeMapping>();

            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;
                        }
                    }
                }

                for (PropertyName requestedProperty : propertyNames) {
                    StepList requestedPropertySteps;                   
                    if (requestedProperty.getNamespaceContext() == null) {
                        requestedPropertySteps = XPath.steps(targetDescriptor, requestedProperty.getPropertyName(),
                                namespaces);
                    } else {
                        requestedPropertySteps = XPath.steps(targetDescriptor, requestedProperty.getPropertyName(),
                                    requestedProperty.getNamespaceContext());
                    }
                    if (requestedPropertySteps == null ? AppSchemaDataAccess.matchProperty(
                            requestedProperty.getPropertyName(), targetSteps) : AppSchemaDataAccess
                            .matchProperty(requestedPropertySteps, targetSteps)) {
                        if (!alreadyAdded) {
                            selectedMapping.add(attMapping);
                            selectedProperties.put(attMapping, new ArrayList<PropertyName>());
                            alreadyAdded = true;
                        }
                        if (requestedPropertySteps != null
                                && requestedPropertySteps.size() > targetSteps.size()) {
                            List<PropertyName> pnList = selectedProperties.get(attMapping);
                            StepList subProperty = requestedPropertySteps.subList(
                                    targetSteps.size(), requestedPropertySteps.size());
                            pnList.add(filterFac.property(subProperty.toString(),
                                    requestedProperty.getNamespaceContext()));
                        }
                    }
                }
            }
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

                // web service backend doesn't support getSchema()
                mappedType = null;
            }

            for (final AttributeMapping entry : attMappings) {
                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(),
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

    }
   
    private List<Expression> unrollProperty (PropertyName property, final FeatureTypeMapping mapping) {
       
        final AttributeDescriptor targetDescriptor = mapping.getTargetFeature();
        StepList propertySteps = XPath.steps(targetDescriptor, property.getPropertyName(), mapping.getNamespaces());
  
        return mapping.findMappingsFor(propertySteps, true);
    }
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

    }
   
    public Object visit(PropertyName expression, Object notUsed) {
       
        // break into single steps
        StepList exprSteps = XPath.steps(mappings.getTargetFeature(), expression.getPropertyName(), this.mappings.getNamespaces());

        if (exprSteps.containsPredicate()) {
            postStack.push(expression);
            return null;
        }
       
        List<Expression> matchingMappings = mappings.findMappingsFor(exprSteps, false);
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

        // exception for FEATURE_LINK attributes
        Iterator<AttributeMapping> mappings = mapping.getAttributeMappings().iterator();
        AttributeMapping rootMapping = null;
        while (mappings.hasNext()) {
            AttributeMapping att = mappings.next();
            StepList xpath = att.getTargetXPath();
            if (XPath.equals(elementName, xpath)) {
                if (rootMapping != null) {
                    throw new RuntimeException("Duplicate AttributeMapping for: '" + elementName
                            + "' is found in FeatureTypeMapping '" + elementName + "'!");
                }
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

        Expression fidExpression = null;

        for (Iterator it = mappings.getAttributeMappings().iterator(); it.hasNext();) {
            AttributeMapping attMapping = (AttributeMapping) it.next();
            StepList targetXPath = attMapping.getTargetXPath();
            if (targetXPath.size() > 1) {
                continue;
            }

            Step step = (Step) targetXPath.get(0);
            QName stepName = step.getName();
            if (namespace.equals(stepName.getNamespaceURI())) {
                if (name.equals(stepName.getLocalPart())) {
                    fidExpression = attMapping.getIdentifierExpression();
                    break;
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

        NamespaceSupport namespaces = mappings.getNamespaces();
        AttributeDescriptor root = mappings.getTargetFeature();

        List<NestedAttributeMapping> nestedMappings = mappings.getNestedMappings();
        // break into single steps
        StepList simplifiedSteps = XPath.steps(root, targetXPath, namespaces);

        List<Expression> matchingMappings = mappings.findMappingsFor(simplifiedSteps, false);

        if (!nestedMappings.isEmpty()) {
            // means some attributes are mapped separately in feature chaining
            for (NestedAttributeMapping nestedMapping : nestedMappings) {
                if (simplifiedSteps.startsWith(nestedMapping.getTargetXPath())) {
                    matchingMappings.add(new NestedAttributeExpression(simplifiedSteps,
                            nestedMapping));
                }
            }
        }
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

            // As there can be multiple nodes of mo:composition in this case, we need to retrieve
            // all of them
            AttributeExpressionImpl attribExpression = ((AttributeExpressionImpl) expression);
            String xpath = attribExpression.getPropertyName();
            ComplexAttribute sourceFeature = (ComplexAttribute) sourceFeatureInput;
            StepList xpathSteps = XPath.steps(sourceFeature.getDescriptor(), xpath, namespaces);
            return getProperties(sourceFeature, xpathSteps);
        }
        return expression.evaluate(sourceFeatureInput);
    }
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

    protected Attribute setAttributeValue(Attribute target, String id, final Object source,
            final AttributeMapping attMapping, Object values, StepList inputXpath, List<PropertyName> selectedProperties) throws IOException {

        final Expression sourceExpression = attMapping.getSourceExpression();
        final AttributeType targetNodeType = attMapping.getTargetNodeInstance();
        StepList xpath = inputXpath == null ? attMapping.getTargetXPath().clone() : inputXpath;

        Map<Name, Expression> clientPropsMappings = attMapping.getClientProperties();
        boolean isNestedFeature = attMapping.isNestedAttribute();
       
        if (id == null && Expression.NIL != attMapping.getIdentifierExpression()) {
View Full Code Here

Examples of org.geotools.data.complex.filter.XPathUtil.StepList

                    .getMappingByName((Name) mappingName);
            List<AttributeMapping> polymorphicMappings = fTypeMapping.getAttributeMappings();
            AttributeDescriptor attDescriptor = fTypeMapping.getTargetFeature();
            AttributeType type = attDescriptor.getType();
            Name polymorphicTypeName = attDescriptor.getName();
            StepList prefixedXpath = xpath.clone();
            prefixedXpath.add(new Step(new QName(polymorphicTypeName.getNamespaceURI(),
                    polymorphicTypeName.getLocalPart(), this.namespaces
                            .getPrefix(polymorphicTypeName.getNamespaceURI())), 1));
            if (!fTypeMapping.getFeatureIdExpression().equals (Expression.NIL)) {
                id = fTypeMapping.getFeatureIdExpression().evaluate(source, String.class);
            }
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.