org.geoserver.catalog.Keyword.setVocabulary()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(122)

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

Keyword.setVocabulary介绍

暂无

代码示例

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

/**
 * Helper method that adds some tests keywords to a layer group. The provided layer group name
 * should not be NULL, if the layer group cannot be found an exception will be throw.
 */
protected void addKeywordsToLayerGroup(String layerGroupName) {
  // create a list of keywords
  List<KeywordInfo> keywords = new ArrayList<>();
  Keyword keyword1 = new Keyword("keyword1");
  keyword1.setLanguage("en");
  keyword1.setVocabulary("vocabulary1");
  keywords.add(keyword1);
  Keyword keyword2 = new Keyword("keyword2");
  keyword2.setLanguage("pt");
  keyword2.setVocabulary("vocabulary2");
  keywords.add(keyword2);
  // add keywords to a layer group
  LayerGroupInfo layerGroup = getCatalog().getLayerGroupByName(layerGroupName);
  if (layerGroup == null) {
    // targeted layer group doesn't exists
    throw new RuntimeException(
        String.format("Layer group '%s' doesn't exists.", layerGroupName));
  }
  layerGroup.getKeywords().addAll(keywords);
  getCatalog().save(layerGroup);
}

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

@org.junit.Test
public void testKeywordVocab() throws Exception {
  FeatureTypeInfo lines = getFeatureTypeInfo(MockData.LINES);
  Keyword kw = new Keyword("foo");
  kw.setVocabulary("bar");
  lines.getKeywords().add(kw);
  getCatalog().save(lines);
  WMSInfo wms = getGeoServer().getService(WMSInfo.class);
  kw = new Keyword("baz");
  kw.setVocabulary("bar");
  wms.getKeywords().add(kw);
  getGeoServer().save(wms);
  String linesName = MockData.LINES.getPrefix() + ":" + MockData.LINES.getLocalPart();
  Document doc = getAsDOM("wms?service=WMS&request=getCapabilities&version=1.3.0", true);
  String xpath =
      "//wms:Layer[wms:Name='"
          + linesName
          + "']/wms:KeywordList/wms:Keyword[@vocabulary='bar']";
  assertXpathExists(xpath, doc);
  assertXpathEvaluatesTo("foo", xpath, doc);
  xpath = "//wms:Service/wms:KeywordList/wms:Keyword[@vocabulary='bar']";
  assertXpathExists(xpath, doc);
  assertXpathEvaluatesTo("baz", xpath, doc);
}

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

keyword1.setVocabulary("vocabulary1");
Keyword keyword2 = new Keyword("keyword2");
keyword2.setLanguage("pt");
keyword2.setVocabulary("vocabulary2");

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

keyword1.setVocabulary("vocabulary1");
Keyword keyword2 = new Keyword("keyword2");
keyword2.setLanguage("pt");
keyword2.setVocabulary("vocabulary2");

相关文章