for (Property prop : feature.getProperties()) { if (!ComplexFeatureConstants.FEATURE_CHAINING_LINK_NAME.equals(prop.getName())) { properties.add(prop);
for (Iterator itr = feature.getProperties().iterator(); itr.hasNext(); ) { Attribute att = (Attribute) itr.next(); if (att instanceof GeometryAttribute) {
/** * Only used for Joining, to make sure that rows with different foreign id's aren't interpreted * as one feature and merged. */ public List<Object> getIdValues(Object source) { List<Object> ids = new ArrayList<Object>(); Expression idExpression = mapping.getFeatureIdExpression(); if (Expression.NIL.equals(idExpression) || idExpression instanceof Literal) { // GEOT-4554: if idExpression is not specified, should use PK if (source instanceof Feature) { for (Property p : ((Feature) source).getProperties()) { if (p.getName() .getLocalPart() .startsWith(JoiningJDBCFeatureSource.PRIMARY_KEY)) { ids.add(p.getValue()); } } } } else { FilterAttributeExtractor extractor = new FilterAttributeExtractor(); idExpression.accept(extractor, null); for (String att : extractor.getAttributeNameSet()) { ids.add(peekValue(source, namespaceAwareFilterFactory.property(att))); } } if (foreignIds != null) { ids.addAll(getForeignIdValues(source)); } return ids; }
/** * Perform the visitation of an individual Feature. * * @param feature The Feature to explore. */ protected void walker(Feature feature) { handler.handleFeature(feature); for (Property property : feature.getProperties()) { Class<?> binding = property.getType().getBinding(); // recurse if attribute type is another collection if (FeatureCollection.class.isAssignableFrom(binding)) { walker((FeatureCollection) property.getValue()); // } else if (type instanceof FeatureType) { } else if (Feature.class.isAssignableFrom(binding)) { // recurse if attribute type is another feature walker((Feature) property.getValue()); } else { // normal handling handler.handleAttribute(property.getDescriptor(), property.getValue()); } } handler.endFeature(feature); }
(Collection<Property>) guFeature.getProperties(EXPOSURE_COLOR); for (Property nestedProperty : feature.getProperties("value")) { realValues.add( ((Property) ((Collection) nestedProperty.getValue()).iterator().next()) nestedTermValues = (Collection<Property>) guFeature.getProperties(OUTCROP_CHARACTER); realValues.clear(); for (Property nestedProperty : feature.getProperties("value")) { realValues.add( ((Property) ((Collection) nestedProperty.getValue()).iterator().next())
/** * Test mapping multi-valued simple properties still works. * * @throws Exception */ @Test public void testMultiValuedSimpleProperties() throws Exception { FeatureIterator<Feature> iterator = ccFeatures.features(); while (iterator.hasNext()) { Feature next = iterator.next(); Collection<Property> names = next.getProperties("name"); // these are gml:name and gsml:name, so count twice if (next.getIdentifier().toString().equals("cc.1")) { // see ControlledConcept.properties where id = cc.1 assertEquals(6, names.size()); } else { // see ControlledConcept.properties where id = cc.2 assertEquals(2, names.size()); } } iterator.close(); }
continue; Collection<Property> featureProperties = feature.getProperties(propertyName); xsdElementDeclaration.getName()); if (!unsubstPropertyNames.contains(substPropertyName)) { featureProperties = feature.getProperties(substPropertyName); if (featureProperties.size() > 0) {
while (cpIterator.hasNext()) { Feature cpFeature = (Feature) cpIterator.next(); Collection<Property> lithologies = cpFeature.getProperties(LITHOLOGY); if (cpFeature.getIdentifier().toString().equals("cp.167775491936278812")) { lithologyIds.add(fId); Feature lithology = featureList.get(fId); assertEquals(nestedFeature.getProperties(), lithology.getProperties());
nestedGuFeatures = (Collection<Property>) mfFeature.getProperties(NESTED_LINK); assertEquals(guIds.length, nestedGuFeatures.size()); Collection<Property> guProperties = guFeature.getProperties(); assertEquals(nestedGuFeature.getProperties(), guProperties); nestedCpFeatures = (Collection<Property>) guFeature.getProperties("composition"); assertEquals(cpIds.length, nestedCpFeatures.size()); Collection<Property> cpProperties = cpFeature.getProperties(); assertEquals(nestedCpFeature.getProperties(), cpProperties);
String guId = guFeature.getIdentifier().toString(); String[] mfIds = guToOccurrenceMap.get(guId).split(";"); Collection<Property> properties = guFeature.getProperties(OCCURENCE);
while (iterator.hasNext()) { Feature next = iterator.next(); Collection<Property> children = next.getProperties("nestedFeature"); if (next.getIdentifier().toString().equals("cc.1")) { while (iterator.hasNext()) { Feature next = iterator.next(); Collection<Property> children = next.getProperties("nestedFeature"); if (next.getIdentifier().toString().equals("cc.2")) {
private Optional<Property> findCountryName(final Feature feature, final List<String> alternateNames) { final List<String> lowerCaseAlternateNames = alternateNames.stream() .map(String::toLowerCase).collect(Collectors.toList()); return feature.getProperties().stream().filter(property -> lowerCaseAlternateNames .contains(property.getName().getURI().toLowerCase())).findFirst(); }
String geomName = "sample_time_position"; Collection compactTimes = feature.getProperties(compactTimeValuePairName); assertNotNull(compactTimes); assertEquals(1, compactTimes.size()); assertNotNull(value.getValue()); Collection geomProperties = feature.getProperties(geomName); assertNotNull(geomProperties); assertEquals(1, geomProperties.size());
public Object evaluate(Object object) { Feature feature = (Feature) object; List<Object> list = new ArrayList<Object>(feature.getProperties().size()); for (Property p : feature.getProperties()) { if (p.getDescriptor().getType() == CSWRecordDescriptor.SIMPLE_LITERAL) { Object value = ((ComplexAttribute) p).getProperty("value").getValue(); list.add(value); } } return list; }
Collection<Property> properties = feature.getProperties(Types.typeName(GMLNS, "name")); assertTrue(properties.size() == 3); Iterator<Property> propIterator = properties.iterator(); properties = feature.getProperties(Types.typeName(GSMLNS, "exposureColor")); assertTrue(properties.size() == 2); propIterator = properties.iterator();
@Override public void visit(Feature feature) { // has the id ComplexAttribute id = (ComplexAttribute) feature.getProperty("identifier"); assertNotNull(id); String value = (String) id.getProperty("value").getValue(); values.add(value); // only has the id assertEquals(1, feature.getProperties().size()); } }, null);
private void assertRecordElement(Feature f, String elementName, Object... values) { AttributeDescriptor identifierDescriptor = CSWRecordDescriptor.getDescriptor(elementName); Collection<Property> propertyList = f.getProperties(identifierDescriptor.getName()); Property[] properties = (Property[]) propertyList.toArray(new Property[propertyList.size()]); assertEquals(properties.length, values.length); for (int i = 0; i < properties.length; i++) { ComplexAttribute cad = (ComplexAttribute) properties[i]; assertEquals(identifierDescriptor, cad.getDescriptor()); assertEquals(values[i], cad.getProperty(CSWRecordDescriptor.SIMPLE_LITERAL_VALUE).getValue()); } }
@Test public void TestCatFeatureObject() { RevFeature feature = RevFeatureBuilder.build(points1); CharSequence desc = geogig.command(CatObject.class).setObject(Suppliers.ofInstance(feature)) .call(); String[] lines = desc.toString().split("\n"); assertEquals(points1.getProperties().size() + 2, lines.length); assertEquals(FieldType.STRING.name() + "\tStringProp1_1", lines[2]); assertEquals(FieldType.INTEGER.name() + "\t1000", lines[3]); assertEquals(FieldType.POINT.name() + "\tPOINT (1 1)", lines[4]); }
@Test public void TestCatFeatureObject() { RevFeature feature = RevFeature.builder().build(points1); CharSequence desc = geogig.command(CatObject.class).setObject(Suppliers.ofInstance(feature)) .call(); String[] lines = desc.toString().split("\n"); assertEquals(points1.getProperties().size() + 2, lines.length); assertEquals(FieldType.STRING.name() + "\tStringProp1_1", lines[2]); assertEquals(FieldType.INTEGER.name() + "\t1000", lines[3]); assertEquals(FieldType.POINT.name() + "\tPOINT (1 1)", lines[4]); }
@Test public void TestCatFeatureObject() { RevFeatureBuilder rfb = new RevFeatureBuilder(); RevFeature feature = rfb.build(points1); CharSequence desc = geogit.command(CatObject.class) .setObject(Suppliers.ofInstance(feature)).call(); String[] lines = desc.toString().split("\n"); assertEquals(points1.getProperties().size() + 2, lines.length); assertEquals(FieldType.STRING.name() + "\tStringProp1_1", lines[2]); assertEquals(FieldType.INTEGER.name() + "\t1000", lines[3]); assertEquals(FieldType.POINT.name() + "\tPOINT (1 1)", lines[4]); }