public void validate() { delegate.validate(); } }
public void validate() throws IllegalAttributeException { feature.validate(); }
public void validate() throws IllegalAttributeException { delegate.validate(); }
/** @see FeatureWriter#write() */ public void write() throws IOException { // make the feature validate against its schema before inserting/updating feature.validate(); if (isNewlyCreated(feature)) { Number newId; try { newId = insertSeRow(feature); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error inserting " + feature + ": " + e.getMessage(), e); throw e; } MutableFIDFeature mutableFidFeature = (MutableFIDFeature) feature; String id = featureType.getTypeName() + "." + newId.longValue(); mutableFidFeature.setID(id); fireAdded(mutableFidFeature); } else { try { updateRow(feature); fireChanged(feature); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error updating " + feature + ": " + e.getMessage(), e); throw e; } } }
public void validate() throws IllegalAttributeException { simpleFeature.validate(); }
public void validate() { delegate.validate(); } }
@Override public void validate() throws IllegalAttributeException { simpleFeature.validate(); }
public void validate() throws IllegalAttributeException { feature.validate(); }
public void testCreateFeatureWithLength() throws Exception { SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); // $NON-NLS-1$ builder.setName("test"); builder.length(5).add("name", String.class); SimpleFeatureType featureType = builder.buildFeatureType(); SimpleFeature feature = SimpleFeatureBuilder.build(featureType, new Object[] {"Val"}, "ID"); assertNotNull(feature); try { feature = SimpleFeatureBuilder.build(featureType, new Object[] {"Longer Than 5"}, "ID"); feature.validate(); fail("this should fail because the value is longer than 5 characters"); } catch (Exception e) { // good } }
public void testCreateFeatureWithRestriction() throws Exception { FilterFactory fac = CommonFactoryFinder.getFilterFactory(null); String attributeName = "string"; PropertyIsEqualTo filter = fac.equals(fac.property("."), fac.literal("Value")); SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); // $NON-NLS-1$ builder.setName("test"); builder.restriction(filter).add(attributeName, String.class); SimpleFeatureType featureType = builder.buildFeatureType(); SimpleFeature feature = SimpleFeatureBuilder.build(featureType, new Object[] {"Value"}, "ID"); assertNotNull(feature); try { SimpleFeature sf = SimpleFeatureBuilder.build(featureType, new Object[] {"NotValue"}, "ID"); sf.validate(); fail("PropertyIsEqualTo filter should have failed"); } catch (Exception e) { // good } }
/** * @see FeatureWriter#write() */ public void write() throws IOException { // make the feature validate against its schema before inserting/updating feature.validate(); if (isNewlyCreated(feature)) { Number newId; try { newId = insertSeRow(feature); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error inserting " + feature + ": " + e.getMessage(), e); throw e; } MutableFIDFeature mutableFidFeature = (MutableFIDFeature) feature; String id = featureType.getTypeName() + "." + newId.longValue(); mutableFidFeature.setID(id); fireAdded(mutableFidFeature); } else { try { updateRow(feature); fireChanged(feature); } catch (IOException e) { LOGGER.log(Level.WARNING, "Error updating " + feature + ": " + e.getMessage(), e); throw e; } } }