Package org.fao.geonet

Examples of org.fao.geonet.GeonetContext


  //---
  //--------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);

    SearchManager searchMan = gc.getBean(SearchManager.class);

    Element elData  = SearchDefaults.getDefaultSearch(context, params);
    String  sRemote = elData.getChildText(Geonet.SearchResult.REMOTE);
    boolean remote  = sRemote != null && sRemote.equals(Geonet.Text.ON);
View Full Code Here


    // Load document and check namespace
    if (tsXml.getNamespacePrefix().equals("rdf")
        && tsXml.getName().equals("RDF")) {

      GeonetContext gc = (GeonetContext) context
          .getHandlerContext(Geonet.CONTEXT_NAME);
      ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);

      // copy to directory according to type
      String path = thesaurusMan.buildThesaurusFilePath(fname, type, dir);
      File newFile = new File(path);
      Xml.writeResponse(new Document(tsXml), new FileOutputStream(
View Full Code Here

                    "the 'translation' element of the config-summary.xml must be of the form nameOfTranslator:TranslatorParam");
        }
        String type = parts[0];
        final String param = parts[1];

        final GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);

        Translator translator;
        if (type.equals("codelist")) {
                return new CodeListTranslator(gc.getBean(SchemaManager.class), langCode, param);
        } else if (type.equals("db")) {
            translator = JeevesCacheManager.findInTenSecondCache(key, new Callable<Translator>() {
                public Translator call() {
                    try {
                        return new DbDescTranslator(context.getApplicationContext(), langCode, param);
View Full Code Here

  //---------------------------------------------------------------------------

  @SuppressWarnings("unchecked")
  private Header buildHeader(ServiceContext context, int id, String prefix) throws Exception
  {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    SchemaManager   sm = gc.getBean(SchemaManager.class);

        final Metadata metadata = gc.getBean(MetadataRepository.class).findOne(id);

    //--- maybe the metadata has been removed

    if (metadata == null) {
      return null;
View Full Code Here

   * To return only results summary, set summaryOnly parameter to 1.
   * Default is 0 (ie.results and summary).
   *
   */
  public Element exec(Element params, ServiceContext context) throws Exception {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);

    SearchManager searchMan = gc.getBean(SearchManager.class);

    Element elData  = SearchDefaults.getDefaultSearch(context, params);
    String  sRemote = elData.getChildText(Geonet.SearchResult.REMOTE);
    boolean remote  = sRemote != null && sRemote.equals(Geonet.Text.ON);

View Full Code Here

public class DeleteElement implements Service {
    public void init(String appPath, ServiceConfig params) throws Exception {
    }

    public Element exec(Element params, ServiceContext context) throws Exception {
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        UserSession session = context.getUserSession();

        // Retrieve thesaurus
        String sThesaurusName = Util.getParam(params, "pThesaurus");
        ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);
        Thesaurus thesaurus = thesaurusMan.getThesaurusByName(sThesaurusName);

        // Optional keyword info - if none, selection is used
        String code = Util.getParam(params, "id", "");
View Full Code Here

  //---
  //--------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);

    return gc.getBean(org.fao.geonet.kernel.oaipmh.OaiPmhDispatcher.class).dispatch(params, context);
  }
View Full Code Here

    KeywordsSearcher searcher = null;
   
    boolean newSearch = Util.getParam(params, "pNewSearch").equals("true");
    if (newSearch) {     
      // perform the search and save search result into session
      GeonetContext gc = (GeonetContext) context
          .getHandlerContext(Geonet.CONTEXT_NAME);
      ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);

            if(Log.isDebugEnabled("KeywordsManager")) Log.debug("KeywordsManager","Creating new keywords searcher");
      searcher = new KeywordsSearcher(context, thesaurusMan);
      searcher.search(context.getLanguage(), params);
      searcher.sortResults(KeywordSort.defaultLabelSorter(SortDirection.DESC));
View Full Code Here

  /*
   * TODO
   */
  public Element exec(Element params, ServiceContext context)
      throws Exception {
    GeonetContext gc = (GeonetContext) context
        .getHandlerContext(Geonet.CONTEXT_NAME);

    String ref = Util.getParam(params, Params.REF);
    String oldid = Util.getParam(params, "oldid");
    String newid = Util.getParam(params, "newid");
    String namespace = Util.getParam(params, "namespace");
    String thesaType = Util.getParam(params, "refType");

    ThesaurusManager manager = gc.getBean(ThesaurusManager.class);
    Thesaurus thesaurus = manager.getThesaurusByName(ref);

    if (!(oldid.equals(newid))) {
      if (thesaurus.isFreeCode(null, newid)) {
        thesaurus.updateCodeByURI(oldid, newid);
View Full Code Here

  //---
  //--------------------------------------------------------------------------

  public Element serviceSpecificExec(Element params, ServiceContext context) throws Exception
  {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    DataManager   dm = gc.getBean(DataManager.class);
    UserSession   us = context.getUserSession();

    String id = Utils.getIdentifierFromParameters(params, context);
    boolean update = Util.getParam(params, Params.UPDATEONLY, "false").equals("true");
View Full Code Here

TOP

Related Classes of org.fao.geonet.GeonetContext

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.