Package org.opengis.feature

Examples of org.opengis.feature.ComplexAttribute


        feature = filteredResults.features().next();
        assertEquals("gu.25678", feature.getIdentifier().toString());
        Collection<Property> properties = feature.getProperties(Types.typeName(GMLNS, "name"));
        assertTrue(properties.size() == 3);
        Iterator<Property> propIterator = properties.iterator();
        ComplexAttribute complexAttribute;
        Collection<? extends Property> values;
        // first
        complexAttribute = (ComplexAttribute) propIterator.next();
        values = complexAttribute.getValue();
        assertEquals(1, values.size());
        assertEquals("Yaugher Volcanic Group 1",
                GML3EncodingUtils.getSimpleContent(complexAttribute));
        // second
        complexAttribute = (ComplexAttribute) propIterator.next();
        values = complexAttribute.getValue();
        assertEquals(1, values.size());
        assertEquals("Yaugher Volcanic Group 2",
                GML3EncodingUtils.getSimpleContent(complexAttribute));
        // third
        complexAttribute = (ComplexAttribute) propIterator.next();
        values = complexAttribute.getValue();
        assertEquals(1, values.size());
        assertEquals("-Py",
                GML3EncodingUtils.getSimpleContent(complexAttribute));
        /**
         * Same case as above, but the multi-valued property is feature chained
View Full Code Here


    public void testLeafComplexAttribute() {
        Collection<Property> attributes = new ArrayList<Property>();
        AttributeDescriptor descriptor = new AttributeDescriptorImpl(XSSchema.STRING_TYPE,
                ComplexFeatureConstants.SIMPLE_CONTENT, 1, 1, true, (Object) null);
        attributes.add(new AttributeImpl("rini", descriptor, null));
        ComplexAttribute gmlName = new ComplexAttributeImpl(attributes, GMLSchema.CODETYPE_TYPE, null);
        String nameString = Converters.convert(gmlName, String.class);
        assertEquals("rini", nameString);
    }
View Full Code Here

    public void testParentComplexAttribute() {
        Collection<Property> attributes = new ArrayList<Property>();
        AttributeDescriptor descriptor = new AttributeDescriptorImpl(XSSchema.STRING_TYPE,
                ComplexFeatureConstants.SIMPLE_CONTENT, 1, 1, true, (Object) null);
        attributes.add(new AttributeImpl("rini", descriptor, null));
        ComplexAttribute gmlName = new ComplexAttributeImpl(attributes, GMLSchema.CODETYPE_TYPE, null);
       
        Collection<Property> parentAttributes = new ArrayList<Property>();
        parentAttributes.add(gmlName);
        ComplexAttribute parentAtt = new ComplexAttributeImpl(parentAttributes, GMLSchema.ABSTRACTFEATURETYPE_TYPE, null);
        String nameString = Converters.convert(parentAtt, String.class);
       
        assertEquals(parentAtt.toString(), nameString);
        assertNotSame("rini", nameString);
    }
View Full Code Here

            assertEquals(null, at.getIdentifier());
            assertEquals(new NameImpl(FeatureChainingTest.GSMLNS, "observationMethod"), at.getName());
            assertEquals(new NameImpl(FeatureChainingTest.GSMLNS, "CGI_TermValuePropertyType"), at.getDescriptor()
                    .getType().getName());

            ComplexAttribute ob = getNestedComplexValueForAttribute(at);
            assertEquals(null, ob.getIdentifier());
            assertEquals(new NameImpl(FeatureChainingTest.GSMLNS, "CGI_TermValue"), ob.getName());
            assertEquals(new NameImpl(FeatureChainingTest.GSMLNS, "CGI_TermValueType"), ob.getDescriptor().getType()
                    .getName());

            ComplexAttribute ob2 = getNestedComplexValueForAttribute(ob);
            assertEquals(null, ob2.getIdentifier());
            assertEquals(new NameImpl(FeatureChainingTest.GSMLNS, "value"), ob2.getName());
            assertEquals(new NameImpl(CGINS, "CodeWithAuthorityType"), ob2
                    .getDescriptor().getType().getName());
            assertEquals("CONSTANT", getValueForAttribute(ob2));
            assertEquals("gsv:NameSpace", getUserDataForAttribute(ob2, new NameImpl("codeSpace")));
        }
View Full Code Here

                Feature feature = features.next();
                String fId = feature.getIdentifier().getID();
                String recodedName = VALUE_MAP.get(fId);
                // gml[3]: <OCQL>Recode(STRING, 'string_one', 'a', 'string_two', 'b', 'string_three',
                // 'c')</OCQL>
                ComplexAttribute complexAttribute = (ComplexAttribute) ff.property("gml:name[3]")
                        .evaluate(feature);
                String value = Converters.convert(GML3EncodingUtils.getSimpleContent(complexAttribute),
                        String.class);
                assertEquals(recodedName, value);
            }
View Full Code Here

            while (features.hasNext()) {
                Feature feature = features.next();
                String fId = feature.getIdentifier().getID();
                // gml[2]: <OCQL>Vocab(URN_ID,
                // 'src/test/java/org/geotools/filter/test-data/minoc_lithology_mapping.properties')</OCQL>
                ComplexAttribute complexAttribute = (ComplexAttribute) ff.property("gml:name[2]")
                        .evaluate(feature);
                String value = Converters.convert(GML3EncodingUtils.getSimpleContent(complexAttribute),
                        String.class);
                assertEquals(VALUE_MAP.get(fId), value);
            }
View Full Code Here

            // </AttributeMapping>
            // 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

        descriptor = attribute.getDescriptor();
        type = attribute.getType();

        if (attribute instanceof ComplexAttribute) {
            ComplexAttribute complex = (ComplexAttribute) attribute;
            Collection properties = (Collection) complex.getValue();
            for (Iterator itr = properties.iterator(); itr.hasNext();) {
                Property property = (Property) itr.next();
                if (property instanceof Attribute) {
                    Attribute att = (Attribute) property;
                    add(att.getIdentifier() == null ? null : att.getIdentifier().toString(), att
View Full Code Here

    public Object getProperty(Object object, QName name) throws Exception {
        if (GML._Feature.equals(name)) {
            if (object instanceof SimpleFeature) {
                return object;
            } else if (object instanceof FeatureImpl) {
                ComplexAttribute complex = (ComplexAttribute) object;
                Identifier ident = complex.getIdentifier();
                if (ident == null) {
                    return object;
                }
                String id;
                if (ident instanceof FeatureId) {
View Full Code Here

     *      org.w3c.dom.Element)
     */
    @Override
    public Element encode(Object object, Document document, Element value) throws Exception {
        if (object instanceof ComplexAttribute) {
            ComplexAttribute complex = (ComplexAttribute) object;
            checkXlinkHref(complex);
            GML3EncodingUtils.encodeClientProperties(complex, value);
            GML3EncodingUtils.encodeSimpleContent(complex, document, value);
        }
        return value;
View Full Code Here

TOP

Related Classes of org.opengis.feature.ComplexAttribute

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.