public SortBy sort(String propertyName, SortOrder order) { return new SortByImpl(property(propertyName), order); }
String attribute = element.substring(0, element.length() - 2); clauses.add( new SortByImpl( FeatureUtilities.DEFAULT_FILTER_FACTORY.property( attribute), String attribute = element.substring(0, element.length() - 2); clauses.add( new SortByImpl( FeatureUtilities.DEFAULT_FILTER_FACTORY.property( attribute), if (crsAttribute != null) { SortBy sort = new SortByImpl( FeatureUtilities.DEFAULT_FILTER_FACTORY.property(crsAttribute), SortOrder.ASCENDING);
final List<SortBy> clauses = new ArrayList<SortBy>(1); clauses.add( new SortByImpl( FeatureUtilities.DEFAULT_FILTER_FACTORY.property( CoverageSlice.Attributes.LOCATION),
new SortByImpl( FeatureUtilities.DEFAULT_FILTER_FACTORY.property(locationAttributeName), SortOrder.ASCENDING));
SortBy sortBy = new SortByImpl(propertyName, SortOrder.ASCENDING); SortBy sortBy = new SortByImpl(propertyName, SortOrder.DESCENDING);
new SortByImpl[] {new SortByImpl(propertyName, SortOrder.ASCENDING)};
new SortByImpl( filterFac.property(att), sortBy.getSortOrder())); sort.add(new SortByImpl(filterFac.property(att), SortOrder.ASCENDING)); jQuery.addId(att);
public SortBy sort(String propertyName, SortOrder order) { return new SortByImpl( property( propertyName ), order ); }
public SortBy sort(String propertyName, SortOrder order) { return new SortByImpl( property( propertyName ), order ); }
public void testUniqueWithLimitOnVisitor() throws Exception { if (!dataStore.getSQLDialect().isLimitOffsetSupported() || !dataStore.getSQLDialect().isAggregatedSortSupported("distinct")) { return; } FilterFactory ff = dataStore.getFilterFactory(); PropertyName p = ff.property(aname("stringProperty")); UniqueVisitor v = new MyUniqueVisitor(p); v.setPreserveOrder(true); v.setStartIndex(0); v.setMaxFeatures(2); Query q = new Query(tname("ft1")); q.setSortBy(new SortBy[] {new SortByImpl(p, SortOrder.ASCENDING)}); dataStore.getFeatureSource(tname("ft1")).accepts(q, v, null); assertFalse(visited); Set result = v.getResult().toSet(); assertEquals(2, result.size()); assertEquals("one", result.iterator().next()); }
public void testUniqueWithLimitOffsetOnVisitor() throws Exception { if (!dataStore.getSQLDialect().isLimitOffsetSupported() || !dataStore.getSQLDialect().isAggregatedSortSupported("distinct")) { return; } FilterFactory ff = dataStore.getFilterFactory(); PropertyName p = ff.property(aname("stringProperty")); UniqueVisitor v = new MyUniqueVisitor(p); v.setPreserveOrder(true); v.setStartIndex(1); v.setMaxFeatures(2); Query q = new Query(tname("ft1")); q.setSortBy(new SortBy[] {new SortByImpl(p, SortOrder.ASCENDING)}); dataStore.getFeatureSource(tname("ft1")).accepts(q, v, null); assertFalse(visited); Set result = v.getResult().toSet(); assertEquals(2, result.size()); assertEquals("two", result.iterator().next()); }
public void testStoreChecksVisitorLimits() throws Exception { if (!dataStore.getSQLDialect().isLimitOffsetSupported() || !dataStore.getSQLDialect().isAggregatedSortSupported("distinct")) { return; } FilterFactory ff = dataStore.getFilterFactory(); PropertyName p = ff.property(aname("stringProperty")); UniqueVisitor v = new MyUniqueVisitor(p) { @Override public boolean hasLimits() { // forced to return true, to check that the JDBCDataStore // asks the visitor if it has limits, and if answered true // it ignores query limits return true; } }; v.setPreserveOrder(true); Query q = new Query(tname("ft1")); q.setMaxFeatures(1); q.setSortBy(new SortBy[] {new SortByImpl(p, SortOrder.ASCENDING)}); dataStore.getFeatureSource(tname("ft1")).accepts(q, v, null); assertFalse(visited); Set result = v.getResult().toSet(); assertEquals(3, result.size()); assertEquals("one", result.iterator().next()); }
new SortByImpl( FeatureUtilities.DEFAULT_FILTER_FACTORY.property( timeDimension.getStartAttribute()), new SortByImpl( FeatureUtilities.DEFAULT_FILTER_FACTORY.property( elevationDimension.getStartAttribute()),
@Override public Query adaptQuery(Query query) { Filter filter = query.getFilter(); if (filter != null && !Filter.INCLUDE.equals(filter)) { query.setFilter((Filter) filter.accept(new MDQueryableFilterVisitor(), null)); } SortBy[] sortBy = query.getSortBy(); if (sortBy != null && sortBy.length > 0) { for (int i = 0; i < sortBy.length; i++) { SortBy sb = sortBy[i]; if (!SortBy.NATURAL_ORDER.equals(sb) && !SortBy.REVERSE_ORDER.equals(sb)) { sortBy[i] = new SortByImpl( MDQueryableFilterVisitor.property(sb.getPropertyName()), sb.getSortOrder()); } } query.setSortBy(sortBy); } return query; }
@Override public Query adaptQuery(Query query) { Filter filter = query.getFilter(); if (filter != null && !Filter.INCLUDE.equals(filter)) { Filter qualified = (Filter) filter.accept(NSS_QUALIFIER, null); Filter extended = (Filter) qualified.accept(PATH_EXTENDER, null); query.setFilter(extended); } SortBy[] sortBy = query.getSortBy(); if (sortBy != null && sortBy.length > 0) { CSWPropertyPathExtender extender = new CSWPropertyPathExtender(); for (int i = 0; i < sortBy.length; i++) { SortBy sb = sortBy[i]; if (!SortBy.NATURAL_ORDER.equals(sb) && !SortBy.REVERSE_ORDER.equals(sb)) { PropertyName name = sb.getPropertyName(); PropertyName extended = extender.extendProperty(name, FF, NAMESPACES); sortBy[i] = new SortByImpl(extended, sb.getSortOrder()); } } query.setSortBy(sortBy); } return query; }
query.setPropertyNames(Arrays.asList(attribute)); final SortBy[] sortBy=new SortBy[]{ new SortByImpl( FeatureUtilities.DEFAULT_FILTER_FACTORY.property(attribute), SortOrder.ASCENDING
@Test public void testSortDescend() throws IOException { Query queryImage = new Query("Record"); queryImage.setFilter(FF.equals(FF.property("dc:type/dc:value", CSWRecordDescriptor.NAMESPACES), FF.literal("http://purl.org/dc/dcmitype/Image"))); queryImage.setSortBy(new SortBy[] {new SortByImpl(FF.property("dc:title/dc:value", CSWRecordDescriptor.NAMESPACES), SortOrder.DESCENDING)}); FeatureCollection records = store.getRecords(queryImage, Transaction.AUTO_COMMIT); // there are only 3 records with Image type assertEquals(3, records.size()); // check they were sorted final List<String> values = collectElement(records, "title"); assertEquals(3, values.size()); assertEquals("Vestibulum massa purus", values.get(0)); assertEquals("Lorem ipsum dolor sit amet", values.get(1)); assertEquals("Lorem ipsum", values.get(2)); }
@Test public void testSortAscend() throws IOException { Query queryImage = new Query("Record"); queryImage.setFilter(FF.equals(FF.property("dc:type/dc:value", CSWRecordDescriptor.NAMESPACES), FF.literal("http://purl.org/dc/dcmitype/Image"))); queryImage.setSortBy(new SortBy[] {new SortByImpl(FF.property("dc:title/dc:value", CSWRecordDescriptor.NAMESPACES), SortOrder.ASCENDING)}); FeatureCollection records = store.getRecords(queryImage, Transaction.AUTO_COMMIT); // there are only 3 records with Image type assertEquals(3, records.size()); // check they were sorted final List<String> values = collectElement(records, "title"); assertEquals(3, values.size()); assertEquals("Lorem ipsum", values.get(0)); assertEquals("Lorem ipsum dolor sit amet", values.get(1)); assertEquals("Vestibulum massa purus", values.get(2)); }
unmappedSortBy[i] = new SortByImpl((PropertyName) expr, sortby.getSortOrder());
Filter typeDataset = FF.equals(FF.property("dc:type/dc:value", CSWRecordDescriptor.NAMESPACES), FF.literal("http://purl.org/dc/dcmitype/Dataset")); query.setFilter(typeDataset); query.setSortBy(new SortBy[] {new SortByImpl(FF.property("dc:subject/dc:value", CSWRecordDescriptor.NAMESPACES), SortOrder.ASCENDING)});