Package com.esri.gpt.catalog.search

Examples of com.esri.gpt.catalog.search.SearchConfig


  }

  // search configuration
  Node ndSearch = (Node) xpath.evaluate("catalog/search", root,
      XPathConstants.NODE);
  SearchConfig sCfg = appConfig.getCatalogConfiguration().getSearchConfig();
  sCfg.setSearchConfigNode(ndSearch);
  if (ndSearch != null) {
    sCfg.setResultsReviewsShown(
        Val.chkStr(xpath.evaluate("@searchResultsReviewsShown", ndSearch)));
    sCfg.setResultsPerPage(xpath.evaluate("@searchResultsPerPage", ndSearch));
    sCfg.setMaxSavedSearches(xpath.evaluate("@maxSavedSearches", ndSearch));
    sCfg.setCswProfile(
        Val.chkStr(xpath.evaluate("@cswServletUrlProfile", ndSearch),"urn:ogc:CSW:2.0.2:HTTP:OGCCORE:ESRI:GPT"));
    sCfg.setSearchUri(xpath.evaluate("@cswServletUrl", ndSearch));
    sCfg.setTimeOut(xpath.evaluate("@searchTimeoutMillisecs", ndSearch));
    sCfg.setDistributedSearchMaxSelectedSites(
        Val.chkStr(xpath.evaluate("@distributedSearchMaxSelectedSites",
            ndSearch)));
    sCfg.setDistributedSearchTimeoutMillisecs(
        Val.chkStr(xpath.evaluate("@distributedSearchTimeoutMillisecs",
            ndSearch)));
       
    sCfg.setAllowExternalSearch(Val.chkBool(xpath.evaluate(
        "@allowExternalSiteSearch", ndSearch), false));
    sCfg.setAllowTemporalSearch(Val.chkBool(xpath.evaluate("@allowTemporalSearch",ndSearch),false));
    sCfg.setJsfSuffix(Val.chkStr(xpath.evaluate(
        "@jsfSuffix", ndSearch)));
    sCfg.setGptToCswXsltPath(xpath.evaluate("@gpt2cswXslt", ndSearch));
    sCfg.setMapViewerUrl(Val.chkStr(xpath.evaluate("@mapViewerUrl", ndSearch),""));
    sCfg.validate();
  }


  NodeList nodes = (NodeList) xpath.evaluate(
      "catalog/search/repositories/repository",
      root, XPathConstants.NODESET);
  NodeList nodeList = nodes;
  LinkedHashMap<String, Map<String, String>> sFactory =
      new LinkedHashMap<String, Map<String, String>>();
  Map<String, String> attributes =
      new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
  /*attributes.put("key", "local");
  attributes.put("class", "com.esri.gpt.catalog.search.SearchEngineLocal");
  attributes.put("resourceKey", "catalog.search.searchSite.defaultsite");
  attributes.put("labelResourceKey", "catalog.search.searchSite.defaultsite");
  attributes.put("abstractResourceKey", "catalog.search.searchSite.defaultsite.abstract");
  sFactory.put("local", attributes);*/
  for (int i = 0; nodeList != null && i < nodeList.getLength(); i++) {
    ndSearch = nodeList.item(i);
    attributes =
        new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    NamedNodeMap nnm = ndSearch.getAttributes();
    for (int j = 0; nnm != null && j < nnm.getLength(); j++) {
      Node nd = nnm.item(j);
      String key = Val.chkStr(nd.getNodeName());
      String value = Val.chkStr(nd.getNodeValue());
      attributes.put(key, value);
      if (key.equalsIgnoreCase("RESOURCEKEY")) {
        attributes.put("RESOURCEKEY", value);
      }
      if (key.equalsIgnoreCase("labelResourceKey")) {
        attributes.put("labelResourceKey", value);
      }
      if (key.equalsIgnoreCase("abstractResourceKey")) {
        attributes.put("abstractResourceKey", value);
      }
    }
    NodeList params = (NodeList) xpath.evaluate("parameter",
        ndSearch, XPathConstants.NODESET);
    for (int k = 0; params != null && k < params.getLength(); k++) {
      String key = xpath.evaluate("@key", params.item(k));
      String value = xpath.evaluate("@value", params.item(k));
      attributes.put(Val.chkStr(key), Val.chkStr(value));
    }

    String key = Val.chkStr(xpath.evaluate("@key", ndSearch));
    sFactory.put(key, attributes);

  }
  sCfg.setSearchFactoryRepos(sFactory);

  // Mapviewer
  ArrayList<MapViewerConfigs> mapViewerConfigs =
      new ArrayList<MapViewerConfigs>();
  nodes = (NodeList) xpath.evaluate("catalog/mapViewer/instance", root,
      XPathConstants.NODESET);
  for (int j = 0; nodes != null && j < nodes.getLength(); j++) {
    MapViewerConfigs mvConfigs = new MapViewerConfigs();
    Node nd = nodes.item(j);
    mvConfigs.setClassName(Val.chkStr(xpath.evaluate("@className", nd),"com.esri.gpt.catalog.search.MapViewerFlex"));
    mvConfigs.setUrl(xpath.evaluate("@url", nd));
    NodeList pNodeList = (NodeList) xpath.evaluate("parameter", nd, XPathConstants.NODESET);
    for (int k = 0; pNodeList != null && k < pNodeList.getLength(); k++) {
      String key = xpath.evaluate("@key", pNodeList.item(k));
      String value = xpath.evaluate("@value", pNodeList.item(k));
      if (key != null || value != null) {
        mvConfigs.addParameter(key, value);
      }
    }
    mapViewerConfigs.add(mvConfigs);

  }
  sCfg.setMapViewerInstances(mapViewerConfigs);

  // Lucene configuration
  Node ndLucene = (Node) xpath.evaluate("catalog/lucene", root, XPathConstants.NODE);
  if (ndLucene != null) {
    CatalogConfiguration cfg = appConfig.getCatalogConfiguration();
View Full Code Here


// constructors ================================================================
/** Default constructor. */
public CatalogConfiguration() {
  super();
  setArcImsCatalog(new ImsCatalog());
  setSearchConfig(new SearchConfig());
  getConfiguredTocs();
}
View Full Code Here

/**
* Gets the style attribute for the save search control.
* @return the style
*/
public String getSaveSearchStyle() {
  SearchConfig cfg = extractRequestContext().getCatalogConfiguration().getSearchConfig();
  int nMax = cfg.getMaxSavedSearches();
  if (this.savedSearches.size() >= nMax) {
    return "display: none;";
  } else {
    return "";
  }
View Full Code Here

* Gets the search config.
*
* @return the search config
*/
public SearchConfig getSearchConfig() {
  SearchConfig cfg =
    extractRequestContext().getCatalogConfiguration().getSearchConfig();
  return cfg;
}
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.search.SearchConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.