org.geoserver.catalog.Keyword类的使用及代码示例

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

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

Keyword介绍

暂无

代码示例

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

@Override
public Object fromString(String str) {
  Matcher m = RE.matcher(str);
  if (!m.matches()) {
    throw new IllegalArgumentException(
        String.format("%s does not match regular expression: %s", str, RE));
  }
  KeywordInfo kw = new Keyword(m.group(1));
  if (m.group(2) != null) {
    kw.setLanguage(m.group(2));
  }
  if (m.group(3) != null) {
    kw.setVocabulary(m.group(3));
  }
  return kw;
}

代码示例来源: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: stackoverflow.com

if (stem != null) {
 Keyword keyword = find(keywords, new Keyword(stem.replaceAll("-0", "-")));
 keyword.add(term.replaceAll("-0", "-"));

代码示例来源: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: geoserver/geoserver

if (keywords != null) {
  for (String kw : keywords) {
    service.getKeywords().add(new Keyword(kw));

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

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

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

continue;
ftinfo.getKeywords().add(new Keyword(kw));

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

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

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

cinfo.setName(specifiedName);
  cinfo.setTitle(specifiedName);
  cinfo.getKeywords().add(new Keyword(specifiedName));
} else {
  String name = reader.getGridCoverageNames()[0];
  cinfo.setName(name);
  cinfo.setTitle(name);
  cinfo.getKeywords().add(new Keyword(name));
cinfo.getKeywords().add(new Keyword("WCS"));
cinfo.getKeywords().add(new Keyword(format.getName()));

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

@Test
public void testFullTextSearchAddedKeyword() {
  ft.getKeywords().add(new Keyword("air_temp"));
  ft.getKeywords().add(new Keyword("temperatureAir"));
  l.setResource(ft);
  addLayer();
  LayerInfo lproxy = catalog.getLayer(l.getId());
  FeatureTypeInfo ftproxy = (FeatureTypeInfo) lproxy.getResource();
  ftproxy.getKeywords().add(new Keyword("newKeyword"));
  catalog.save(ftproxy);
  Filter filter = Predicates.fullTextSearch("newKeyword");
  assertEquals(newHashSet(ftproxy), asSet(catalog.list(FeatureTypeInfo.class, filter)));
  assertEquals(newHashSet(lproxy), asSet(catalog.list(LayerInfo.class, filter)));
}

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

coverage.setDescription(cInfoReader.description());
for (String kw : cInfoReader.keywords()) {
  coverage.getKeywords().add(new Keyword(kw));

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

@Test
public void testMetadataFromFeatueSource() throws Exception {
  CatalogBuilder cb = new CatalogBuilder(getCatalog());
  cb.setStore(cb.buildDataStore("fooStore"));
  FeatureType ft = createMock(FeatureType.class);
  expect(ft.getName()).andReturn(new NameImpl("foo")).anyTimes();
  expect(ft.getCoordinateReferenceSystem()).andReturn(null).anyTimes();
  expect(ft.getGeometryDescriptor()).andReturn(null).anyTimes();
  replay(ft);
  ResourceInfo rInfo = createMock(ResourceInfo.class);
  expect(rInfo.getTitle()).andReturn("foo title");
  expect(rInfo.getDescription()).andReturn("foo description");
  expect(rInfo.getKeywords())
      .andReturn(new LinkedHashSet<String>(Arrays.asList("foo", "bar", "baz", "")))
      .anyTimes();
  replay(rInfo);
  FeatureSource fs = createMock(FeatureSource.class);
  expect(fs.getSchema()).andReturn(ft).anyTimes();
  expect(fs.getInfo()).andReturn(rInfo).anyTimes();
  expect(fs.getName()).andReturn(ft.getName()).anyTimes();
  replay(fs);
  FeatureTypeInfo ftInfo = cb.buildFeatureType(fs);
  assertEquals("foo title", ftInfo.getTitle());
  assertEquals("foo description", ftInfo.getDescription());
  assertTrue(ftInfo.getKeywords().contains(new Keyword("foo")));
  assertTrue(ftInfo.getKeywords().contains(new Keyword("bar")));
  assertTrue(ftInfo.getKeywords().contains(new Keyword("baz")));
}

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

for (String kw : layer.getKeywords()) {
  if (kw != null) {
    wli.getKeywords().add(new Keyword(kw));

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

for (String kw : layer.getKeywords()) {
  if (kw != null) {
    wli.getKeywords().add(new Keyword(kw));

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

expect(r.getKeywords()).andReturn((List) Arrays.asList(new Keyword(name))).anyTimes();
expect(r.isEnabled()).andReturn(true).anyTimes();
expect(r.isAdvertised()).andReturn(true).anyTimes();

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

coverage.setEnabled(true);
coverage.getAlias().add("alias");
coverage.getKeywords().add(new Keyword("key"));
MetadataLinkInfoImpl metadataLink = new MetadataLinkInfoImpl();
metadataLink.setAbout("about");

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

ft2 = catalog.getFeatureType(ft2.getId());
ft3 = catalog.getFeatureType(ft3.getId());
ft1.getKeywords().add(new Keyword("keyword1"));
ft1.getKeywords().add(new Keyword("keyword2"));
ft1.getKeywords().add(new Keyword("ft1"));
ft1.setDescription("ft1 description");
catalog.save(ft1);
ft2.getKeywords().add(new Keyword("keyword1"));
ft2.getKeywords().add(new Keyword("keyword1"));
ft2.setDescription("ft2");
catalog.save(ft2);
ft3.getKeywords().add(new Keyword("ft3"));
ft3.getKeywords().add(new Keyword("ft3"));
ft3.setDescription("FT3");
catalog.save(ft3);
        factory.literal(new Keyword("keyword1")),
        factory.property("keywords"),
        true,
        factory.literal(new Keyword("keyword1")),
        factory.property("keywords"),
        true,
        factory.literal(new Keyword("keyword1")),
        factory.property("keywords"),
        true,
values.add(new Keyword("keyword1"));

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

@Test
public void testFullTextSearchKeywords() {
  ft.getKeywords().add(new Keyword("air_temp"));
  ft.getKeywords().add(new Keyword("temperatureAir"));
  cv.getKeywords().add(new Keyword("dwpt_dprs"));
  cv.getKeywords().add(new Keyword("temperatureDewpointDepression"));

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

featureType.setAbstract(ftInfoReader.abstrct());
for (String kw : ftInfoReader.keywords()) {
  featureType.getKeywords().add(new Keyword(kw));

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

@Test
public void testAddFeatureType() {
  assertTrue(catalog.getFeatureTypes().isEmpty());
  addFeatureType();
  assertEquals(1, catalog.getFeatureTypes().size());
  FeatureTypeInfo ft2 = catalog.getFactory().createFeatureType();
  try {
    catalog.add(ft2);
    fail("adding with no name should throw exception");
  } catch (Exception e) {
  }
  ft2.setName("ft2Name");
  try {
    catalog.add(ft2);
    fail("adding with no store should throw exception");
  } catch (Exception e) {
  }
  ft2.setStore(ds);
  ft2.getKeywords().add(new Keyword("keyword"));
  catalog.add(ft2);
  FeatureTypeInfo ft3 = catalog.getFactory().createFeatureType();
  ft3.setName("ft3Name");
  try {
    catalog.getFeatureTypes().add(ft3);
    fail("adding directly should throw an exception");
  } catch (Exception e) {
  }
}

相关文章