org.geotools.data.Query.setNamespace()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.geotools.data.Query.setNamespace方法的一些代码示例,展示了Query.setNamespace的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setNamespace方法的具体详情如下:
包路径:org.geotools.data.Query
类名称:Query
方法名:setNamespace

Query.setNamespace介绍

[英]Set the namespace of the feature type to be queried.
[中]设置要查询的要素类型的命名空间。

代码示例

代码示例来源:origin: geotools/geotools

private Query namedQuery(Filter filter, int countLimit, boolean isJoining, Hints hints) {
  Query query = isJoining ? new JoiningQuery() : new Query();
  if (getName().getNamespaceURI() != null) {
    try {
      query.setNamespace(new URI(getName().getNamespaceURI()));
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }
  query.setTypeName(getName().getLocalPart());
  query.setFilter(filter);
  query.setMaxFeatures(countLimit);
  query.setHints(hints);
  return query;
}

代码示例来源:origin: org.geotools/gt-app-schema

private Query namedQuery(Filter filter, int countLimit, boolean isJoining) {
  Query query = isJoining ? new JoiningQuery() : new Query();
  if (getName().getNamespaceURI() != null) {
    try {
      query.setNamespace(new URI(getName().getNamespaceURI()));
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }
  query.setTypeName(getName().getLocalPart());
  query.setFilter(filter);
  query.setMaxFeatures(countLimit);
  return query;
}

代码示例来源:origin: org.geoserver.csw/csw-core

q.setSortBy(query.getSortBy());
try {
  q.setNamespace(new URI(typeName.getNamespaceURI()));
} catch (URISyntaxException e) { }

代码示例来源:origin: org.geoserver.csw/gs-csw-core

q.setSortBy(query.getSortBy());
try {
  q.setNamespace(new URI(typeName.getNamespaceURI()));
} catch (URISyntaxException e) {

代码示例来源:origin: org.geoserver.csw/csw-api

@Test
public void testNamespaceSupport() throws IOException, URISyntaxException {
  AbstractCatalogStore store = new AbstractCatalogStore() {
    {
      support(CSWRecordDescriptor.getInstance());
      support(GSRecordDescriptor.getInstance());
    }
    
    @Override
    public FeatureCollection getRecordsInternal(RecordDescriptor rd, RecordDescriptor rdOutput,
        Query q, Transaction t) throws IOException {
      if(rd == GSRecordDescriptor.getInstance()) {
        return new MemoryFeatureCollection(GSRecordDescriptor.getInstance().getFeatureType());
      } else {
        throw new RuntimeException("Was expecting the geoserver record descriptor");
      }
    }
  };
  
  RecordDescriptor[] descriptors = store.getRecordDescriptors();
  assertEquals(2, descriptors.length);
  assertEquals(CSWRecordDescriptor.getInstance(), descriptors[0]);
  assertEquals(GSRecordDescriptor.getInstance(), descriptors[1]);
  Query query = new Query("Record");
  query.setNamespace(new URI(GSRecordDescriptor.GS_NAMESPACE));
  FeatureCollection records = store.getRecords(query, Transaction.AUTO_COMMIT, null);
  assertEquals(GSRecordDescriptor.getInstance().getFeatureType(), records.getSchema());
}

相关文章