propertyFields.add(p.getName().toString()); String propName = prop.getName().toString(); if (propertyFields.contains(propName)) { Object binding = prop.getType().getBinding(); LOG.debug("Property {} of feature {} could not be interpreted as int, skipping", prop.getName().toString(), ft.getId()); continue;
/** We can handle *one* case and one case only */ public boolean canHandle(Object object, String xpath, Class target) { if (object instanceof Property) { Property property = (Property) object; final Name name = property.getName(); if (name != null) { return name.getLocalPart().equals(xpath); } else { // A property with no name? this is probably a place holder // or Null Object (such as Diff.NULL). return false; } } return false; }
public Collection<Property> getProperties(String name) { List<Property> matches = new ArrayList<Property>(); for (Iterator p = properties().iterator(); p.hasNext(); ) { Property property = (Property) p.next(); if (property.getName().getLocalPart().equals(name)) { matches.add(property); } } return matches; }
public Collection<Property> getProperties(Name name) { List<Property> matches = new ArrayList<Property>(); for (Iterator p = getValue().iterator(); p.hasNext(); ) { Property property = (Property) p.next(); if (property.getName().equals(name)) { matches.add(property); } } return matches; }
public Property getProperty(String name) { for (Iterator p = getValue().iterator(); p.hasNext(); ) { Property property = (Property) p.next(); if (property.getName().getLocalPart().equals(name)) { return property; } } return null; }
public Property getProperty(Name name) { for (Iterator p = properties().iterator(); p.hasNext(); ) { Property property = (Property) p.next(); if (property.getName().equals(name)) { return property; } } return null; }
ArrayList<Property> properties = new ArrayList<Property>(); for (Property prop : feature.getProperties()) { if (!ComplexFeatureConstants.FEATURE_CHAINING_LINK_NAME.equals(prop.getName())) { properties.add(prop);
private void applySingleUpdate( QName remoteTypeName, SimpleFeature feature, TransactionRequest transactionRequest) throws IOException { // so bad, this is going to update a lot of unnecessary properties. We'd need to make // DiffContentFeatureWriter's live and current attributes protected and extend write so that // it records the truly modified attributes instead Collection<Property> properties = feature.getProperties(); List<QName> propertyNames = new ArrayList<QName>(); List<Object> newValues = new ArrayList<Object>(); for (Property p : properties) { QName attName = new QName(remoteTypeName.getNamespaceURI(), p.getName().getLocalPart()); Object attValue = p.getValue(); propertyNames.add(attName); newValues.add(attValue); } Filter updateFilter = dataStore.getFilterFactory().id(Collections.singleton(feature.getIdentifier())); Update update = transactionRequest.createUpdate( remoteTypeName, propertyNames, newValues, updateFilter); transactionRequest.add(update); }
/** * 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; }
final Set<Name> destAttributes = new HashSet<>(); for (Property prop : destProps) { destAttributes.add(prop.getName());
} else if (p.getName().equals(ComplexFeatureConstants.FEATURE_CHAINING_LINK_NAME)) {
Property nestedProp = nestedPropList.iterator().next(); if (Types.isGeometryType(descriptor.getType()) || nestedProp.getName().equals(descriptor.getName())) { convertedValue = nestedProp.getValue(); } else {
/** * Perform a "deep copy" an existing feature resuling in a duplicate of any geometry attributes. * * <p>This method is scary, expensive and will result in a deep copy of Geometry which may take * a significant amount of memory/time to perform. * * @param original Content * @return copy */ public static SimpleFeature deep(SimpleFeature original) { if (original == null) return null; SimpleFeatureBuilder builder = new SimpleFeatureBuilder(original.getFeatureType()); for (Property property : original.getProperties()) { Object value = property.getValue(); try { Object copy = value; if (value instanceof Geometry) { Geometry geometry = (Geometry) value; copy = geometry.copy(); } builder.set(property.getName(), copy); } catch (Exception e) { throw new IllegalAttributeException( (AttributeDescriptor) property.getDescriptor(), value, e); } } return builder.buildFeature(original.getID()); }
public Property getProperty(Name name) { for ( Iterator p = properties().iterator(); p.hasNext(); ) { Property property = (Property) p.next(); if ( property.getName().equals( name ) ) { return property; } } return null; }
public Collection<Property> getProperties(Name name) { List<Property> matches = new ArrayList<Property>(); for ( Iterator p = getValue().iterator(); p.hasNext(); ) { Property property = (Property) p.next(); if ( property.getName().equals( name ) ) { matches.add( property ); } } return matches; }
public Collection<Property> getProperties(String name) { List<Property> matches = new ArrayList<Property>(); for ( Iterator p = properties().iterator(); p.hasNext(); ) { Property property = (Property) p.next(); if ( property.getName().getLocalPart().equals( name ) ) { matches.add( property ); } } return matches; }
public Property getProperty(String name) { for ( Iterator p = getValue().iterator(); p.hasNext(); ) { Property property = (Property) p.next(); if ( property.getName().getLocalPart().equals( name ) ) { return property; } } return null; }
private void encodeProperty(Feature f, Property p) { if (p.getType() == CSWRecordDescriptor.SIMPLE_LITERAL) { encodeSimpleLiteral(p); } else if (CSWRecordDescriptor.RECORD_BBOX_NAME.equals(p.getName())) { // skip it for the moment, it is constrained to be last } else { throw new IllegalArgumentException( "Don't know how to encode property " + p + " in record " + f); } }
private void writeAttributes(String layer, String ownerHandle, SimpleFeature f) throws IOException { // TODO Auto-generated method stub for ( Property p : f.getProperties()) { Name name = p.getName(); LOGGER.warning(" attr: " + name.getLocalPart() + " = " + p.getValue()); if (!(p.getValue() instanceof Geometry)) { writeAttribute(layer, ownerHandle, name.getLocalPart(), p.getValue()); } } }