public void set(Object object, String xpath, Object value, Class target) { throw new org.opengis.feature.IllegalAttributeException( null, value, "feature id is immutable"); } }
@Override public String toString() { String s = getClass().getName(); String message = getLocalizedMessage(); StringBuffer buf = new StringBuffer(); buf.append(s); if (message != null) { buf.append(":"); buf.append(message); } if (descriptor != null) { buf.append(":"); buf.append(descriptor.getName()); } buf.append(" value:"); buf.append(value); return buf.toString(); } }
public void update(SimpleFeature feature) { if( !filter.evaluate(feature) ) throw new IllegalArgumentException(feature+"is not affected by this update, only call update on features that" + "the Action applies to!"); String[] propNames = getPropertyNames(); for (int j = 0; j < propNames.length; j++) { try { feature.setAttribute(propNames[j], getProperty(propNames[j])); } catch (IllegalAttributeException e) { NoSuchElementException ee = new NoSuchElementException(e.getMessage()); ee.initCause(e); throw ee; } } }
WFS_1_0_0_DataStore.LOGGER.warning(e.toString()); } catch (IllegalAttributeException e) { WFS_1_0_0_DataStore.LOGGER.warning(e.toString());
public void set(Object object, String xpath, Object value, Class target) throws IllegalAttributeException { if (object instanceof Feature) { final Feature f = (Feature) object; GeometryAttribute geom; if (value instanceof GeometryAttribute) { geom = (GeometryAttribute) value; f.setDefaultGeometryProperty(geom); } else if (value instanceof Geometry) { geom = f.getDefaultGeometryProperty(); geom.setValue(value); } else { throw new IllegalArgumentException("Argument is not a geometry: " + value); } } if (object instanceof FeatureType) { throw new IllegalAttributeException(null, "feature type is immutable"); } } }
public boolean hasNext() throws IOException { if( next!=null ) return true; if( delegate==null ) return false; if ( !delegate.hasNext() ){ delegate.close(); delegate=null; delegate=nextReader(); if( delegate==null ) return false; } try{ while( next==null ){ if( !delegate.hasNext() ) return false; next=delegate.next(); if( this.foundFids.contains(next.getID()) ) next=null; } }catch( IllegalAttributeException e){ throw new IOException(e.getLocalizedMessage()); } return next!=null; }
throw new IllegalAttributeException(null, "Do not know how to deep copy " + type.getName());
throw (IOException) new IOException( e.getLocalizedMessage() );
public void set(Object object, String xpath, Object value, Class target) throws IllegalAttributeException { if (object instanceof FeatureType) { throw new IllegalAttributeException(null, "feature type is immutable"); } JXPathContext context = JXPathContext.newContext(object); Enumeration declaredPrefixes = namespaces.getDeclaredPrefixes(); while (declaredPrefixes.hasMoreElements()) { String prefix = (String) declaredPrefixes.nextElement(); String uri = namespaces.getURI(prefix); context.registerNamespace(prefix, uri); } context.setValue(xpath, value); assert value == context.getValue(xpath); } }
public void set(Object object, String xpath, Object value, Class target) { throw new org.opengis.feature.IllegalAttributeException(null, value, "feature id is immutable"); } }
public void set(Object object, String xpath, Object value, Class target) { throw new org.opengis.feature.IllegalAttributeException( null, value, "feature id is immutable"); } }
/** * 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()); }
@Override public void setAttribute(String name, Object value) { final Integer revTypeIndex = nameToRevTypeIndex.get(name); if (revTypeIndex == null) { throw new IllegalAttributeException(null, "Unknown attribute " + name); } setAttribute(revTypeIndex.intValue(), value); }
@Override public void setAttribute(String name, Object value) { final Integer revTypeIndex = nameToRevTypeIndex.get(name); if (revTypeIndex == null) { throw new IllegalAttributeException(null, "Unknown attribute " + name); } setAttribute(revTypeIndex.intValue(), value); }
@Override public void setAttribute(String name, Object value) { final Integer revTypeIndex = nameToRevTypeIndex.get(name); if (revTypeIndex == null) { throw new IllegalAttributeException(null, "Unknown attribute " + name); } Integer schemaIndex = typeToRevTypeIndex.inverse().get(revTypeIndex); setAttribute(schemaIndex, value); }
private static void processAll(Collection/* <AttributeDescriptor> */all, Collection/* * <Attribute> */content) throws IllegalAttributeException { // TODO: JD: this can be definitley be optimzed, as written its O(n^2) // for each descriptor, count occurences of each matching attribute ArrayList remaining = new ArrayList(content); for (Iterator itr = all.iterator(); itr.hasNext();) { AttributeDescriptor ad = (AttributeDescriptor) itr.next(); int min = ad.getMinOccurs(); int max = ad.getMaxOccurs(); int occurences = 0; for (Iterator citr = remaining.iterator(); citr.hasNext();) { Attribute a = (Attribute) citr.next(); if (a.getName().equals(ad.getName())) { occurences++; citr.remove(); } } if (occurences < ad.getMinOccurs() || occurences > ad.getMaxOccurs()) { throw new IllegalAttributeException(ad, "Found " + occurences + " of " + ad.getName() + " when type" + "specifies between " + min + " and " + max); } } if (!remaining.isEmpty()) { throw new IllegalAttributeException((AttributeDescriptor) remaining.iterator().next(), "Extra content found beyond the specified in the schema: " + remaining); } }
public void set(Object object, String xpath, Object value, Class target) throws IllegalAttributeException { if (object instanceof Feature) { final Feature f = (Feature) object; GeometryAttribute geom; if (value instanceof GeometryAttribute) { geom = (GeometryAttribute) value; f.setDefaultGeometryProperty(geom); } else if (value instanceof Geometry) { geom = f.getDefaultGeometryProperty(); geom.setValue(value); } else { throw new IllegalArgumentException("Argument is not a geometry: " + value); } } if (object instanceof FeatureType) { throw new IllegalAttributeException(null, "feature type is immutable"); } } }
throw new IllegalAttributeException(null, "Do not know how to deep copy " + type.getName());
public void set(Object object, String xpath, Object value, Class target) throws IllegalAttributeException { if (object instanceof FeatureType) { throw new IllegalAttributeException(null, "feature type is immutable"); } JXPathContext context = JXPathContext.newContext(object); Enumeration declaredPrefixes = namespaces.getDeclaredPrefixes(); while (declaredPrefixes.hasMoreElements()) { String prefix = (String) declaredPrefixes.nextElement(); String uri = namespaces.getURI(prefix); context.registerNamespace(prefix, uri); } context.setValue(xpath, value); assert value == context.getValue(xpath); } }
throw new IllegalAttributeException(attribute.getDescriptor(), "Type indicates empty attribute collection, content does not");