org.opengis.filter.Id Java Examples
The following examples show how to use
org.opengis.filter.Id.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchFeatureCommandTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 6 votes |
@Test @DirtiesContext // @todo need to check why this is necessary, otherwise next test fails? (GetVectorTileCommandTest) // probably cause by directly using the command service which has an injected security context public void createFilterTest() throws Exception { SearchFeatureRequest request = new SearchFeatureRequest(); request.setLayerId(LAYER_ID); request.setCrs("EPSG:4326"); SearchCriterion searchCriterion = new SearchCriterion(); Filter filter; // needs to be FidFilter when equals test on id searchCriterion.setAttributeName(ID_ATTRIBUTE); searchCriterion.setOperator("="); searchCriterion.setValue("'1'"); request.setCriteria(new SearchCriterion[] {searchCriterion}); filter = searchFeatureCommand.createFilter(request, LAYER_ID); Assert.assertTrue(filter instanceof Id); // but *not* when other test searchCriterion.setAttributeName(ID_ATTRIBUTE); searchCriterion.setOperator("like"); searchCriterion.setValue("'%a%'"); request.setCriteria(new SearchCriterion[] {searchCriterion}); filter = searchFeatureCommand.createFilter(request, LAYER_ID); Assert.assertFalse(filter instanceof Id); }
Example #2
Source File: ElasticCapabilities.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
public ElasticCapabilities() { super(new ElasticFilterCapabilities()); addAll(LOGICAL_OPENGIS); addAll(SIMPLE_COMPARISONS_OPENGIS); addType(PropertyIsNull.class); addType(PropertyIsBetween.class); addType(Id.class); addType(IncludeFilter.class); addType(ExcludeFilter.class); addType(PropertyIsLike.class); // spatial filters addType(BBOX.class); addType(Contains.class); //addType(Crosses.class); addType(Disjoint.class); //addType(Equals.class); addType(Intersects.class); //addType(Overlaps.class); //addType(Touches.class); addType(Within.class); addType(DWithin.class); addType(Beyond.class); //temporal filters addType(After.class); addType(Before.class); addType(Begins.class); addType(BegunBy.class); addType(During.class); addType(Ends.class); addType(EndedBy.class); addType(TContains.class); addType(TEquals.class); }
Example #3
Source File: FilterToElastic.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
/** * Encodes an Id filter * * @param filter the * */ public Object visit(Id filter, Object extraData) { final List<String> idList = new ArrayList<>(); for (final Identifier id : filter.getIdentifiers()) { idList.add(id.toString()); } queryBuilder = ImmutableMap.of("ids", ImmutableMap.of("values", idList)); return extraData; }
Example #4
Source File: ElasticFilterTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testId() { final Id filter = ff.id(ff.featureId("id")); Map<String,Object> expected = ImmutableMap.of("ids", ImmutableMap.of("values", ImmutableList.of("id"))); builder.visit(filter, null); assertTrue(builder.createCapabilities().fullySupports(filter)); assertEquals(expected, builder.getQueryBuilder()); }
Example #5
Source File: ElasticFeatureFilterIT.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testGetFeaturesWithIdFilter() throws Exception { init(); FilterFactory ff = dataStore.getFilterFactory(); Id id = ff.id(new HashSet<>(Arrays.asList(ff.featureId("01"), ff.featureId("07")))); SimpleFeatureCollection features = featureSource.getFeatures(id); assertEquals(2, features.size()); }
Example #6
Source File: FilterToCQLToolTest.java From geowave with Apache License 2.0 | 5 votes |
@Test public void tesFid() { final FilterFactoryImpl factory = new FilterFactoryImpl(); final Id f = factory.id(new FeatureIdImpl("123-abc")); final String ss = ECQL.toCQL(f); System.out.println(ss); assertTrue(ss.contains("'123-abc'")); }
Example #7
Source File: CriteriaVisitor.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
/** {@inheritDoc} */ @Override public Object visit(Id filter, Object userData) { String idName; try { idName = featureModel.getEntityMetadata().getIdentifierPropertyName(); } catch (LayerException e) { log.warn("Cannot read idName, defaulting to 'id'", e); idName = HIBERNATE_ID; } Collection<?> c = (Collection<?>) castLiteral(filter.getIdentifiers(), idName); return Restrictions.in(idName, c); }
Example #8
Source File: FilterServiceTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Test public void testParseFidFilter() throws GeomajasException { Filter f1 = filterService.parseFilter("IN( 1 )"); Filter f2 = filterService.parseFilter("a.@id = 1"); Assert.assertTrue(f1 instanceof Id); Assert.assertTrue(f2 instanceof PropertyIsEqualTo); PropertyIsEqualTo piet = (PropertyIsEqualTo)f2; Assert.assertTrue(piet.getExpression1() instanceof PropertyName); Assert.assertEquals("a/@id",((PropertyName)piet.getExpression1()).getPropertyName()); }
Example #9
Source File: FieldConfigBaseTest.java From sldeditor with GNU General Public License v3.0 | 4 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.config.FieldConfigBase#populateField(java.lang.String)}. */ @Test public void testPopulateFieldString() { FieldIdEnum expectedFieldId = FieldIdEnum.NAME; String expectedLabel = "test label"; TestFieldConfigBase field = new TestFieldConfigBase( new FieldConfigCommonData( String.class, expectedFieldId, expectedLabel, false, false)); field.populateField(""); field.setTestValue(expectedFieldId, ""); field.populateField(42); field.setTestValue(expectedFieldId, 42); assertEquals(0, field.getIntValue()); field.populateField(3.142); field.setTestValue(expectedFieldId, 3.142); assertTrue(Math.abs(field.getDoubleValue()) < 0.0001); field.populateField(ZonedDateTime.now()); field.populateField((ReferencedEnvelope) null); field.setTestValue(expectedFieldId, (ReferencedEnvelope) null); field.populateField((Id) null); field.populateField((TimePeriod) null); field.populateField((ProcessFunction) null); assertNull(field.getProcessFunction()); field.populateField(true); field.setTestValue(expectedFieldId, true); assertEquals(false, field.getBooleanValue()); field.populateField((ColorMap) null); field.setTestValue(expectedFieldId, (ColorMap) null); assertNull(field.getColourMap()); field.populateField((List<FeatureTypeConstraint>) null); field.setTestValue(expectedFieldId, (List<FeatureTypeConstraint>) null); assertNull(field.getFeatureTypeConstraint()); field.populateField((Font) null); assertNull(field.getFont()); field.setTestValue(expectedFieldId, (Expression) null); assertNull(field.getEnumValue()); }
Example #10
Source File: ExtractGeometryFilterVisitor.java From geowave with Apache License 2.0 | 4 votes |
@Override public Object visit(final Id filter, final Object data) { return new ExtractGeometryFilterVisitorResult(infinity(), null); }
Example #11
Source File: ExtractTimeFilterVisitor.java From geowave with Apache License 2.0 | 4 votes |
@Override public Object visit(final Id filter, final Object data) { return new TemporalConstraints(); }
Example #12
Source File: FieldConfigValuePopulateInterface.java From sldeditor with GNU General Public License v3.0 | 2 votes |
/** * Populate field. * * @param value the value */ public void populateField(Id value);
Example #13
Source File: FieldConfigPopulate.java From sldeditor with GNU General Public License v3.0 | 2 votes |
/** * Populate string field, overridden if necessary. * * @param value the value */ @Override public void populateField(Id value) { // Do nothing }