Package org.fao.geonet.kernel

Examples of org.fao.geonet.kernel.ThesaurusManager$InitThesauriTableTask


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

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);
    String THESAURUS_DIR = thesaurusMan.getThesauriDirectory();
     
    Element thesauriList = new Element("thesaurusList");
 
    String type = Util.getParam(params, Params.TYPE, _initType );
   
View Full Code Here


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

        String fname = Util.getParam(params, Params.REF);
        String activated = Util.getParam(params, "activated");

        ThesaurusManager tm = gc.getBean(ThesaurusManager.class);
        Thesaurus t = tm.getThesaurusByName(fname);

        if (t != null) {
            // Save activated status in the database
            final ThesaurusActivationRepository thesaurusRepository = context.getBean(ThesaurusActivationRepository.class);
View Full Code Here

        KeywordsSearcher searcher = (KeywordsSearcher) session
          .getProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT);
        kb = searcher.getKeywordFromResultsById(id);
      }else{
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);
        KeywordsSearcher searcher = new KeywordsSearcher(context, thesaurusMan);
       
        kb = searcher.searchById(uri, ref, lang);
       
      }
      // Add info needed by thesaurus.edit
      elResp.addContent(new Element("prefLab").setText(kb.getDefaultValue()));
      elResp.addContent(new Element("definition").setText(kb.getDefaultDefinition()));

      elResp.addContent(new Element("relCode").setText(kb.getRelativeCode()));
      elResp.addContent(new Element("nsCode").setText(kb.getNameSpaceCode()));
      if (kb.getCoordEast() != null) {
                elResp.addContent(new Element("east").setText(kb.getCoordEast()));
            }
      if (kb.getCoordWest() != null) {
                elResp.addContent(new Element("west").setText(kb.getCoordWest()));
            }
      if (kb.getCoordSouth() != null) {
                elResp.addContent(new Element("south").setText(kb.getCoordSouth()));
            }
      if (kb.getCoordNorth() != null) {
                elResp.addContent(new Element("north").setText(kb.getCoordNorth()));
            }
     

      modeType   = "edit";
      uri     = kb.getRelativeCode();
    } else {
      elResp.addContent(new Element("nsCode").setText("#"));
    }
   
   
    // Only if consult (ie. external thesaurus) search for related concept
    if (mode.equals("consult")){
      ArrayList<KeywordRelation> reqType = new ArrayList<KeywordRelation>();
      reqType.add(KeywordRelation.BROADER);
      reqType.add(KeywordRelation.NARROWER);
      reqType.add(KeywordRelation.RELATED);
     
      GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
      ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);
      KeywordsSearcher searcherBNR = new KeywordsSearcher(context, thesaurusMan);
     
      for (int i = 0; i <= reqType.size() - 1; i++) {
        searcherBNR.searchForRelated(uri, ref, reqType.get(i), lang);
     
View Full Code Here

   
    if (!fname.endsWith(".rdf")){
      fname = fname + ".rdf";
    }
   
    ThesaurusManager tm = gc.getBean(ThesaurusManager.class);

    String filePath = tm.buildThesaurusFilePath(fname, type, dname);
   
    File rdfFile = new File(filePath);
        final String siteURL = context.getBean(SettingManager.class).getSiteURL(context);
        Thesaurus thesaurus = new Thesaurus(context.getApplicationContext(), fname, tname, tnamespace, type, dname, rdfFile, siteURL, false);
    tm.addThesaurus(thesaurus, true);

    // Save activated status in the database
        ThesaurusActivation activation = new ThesaurusActivation();
        activation.setActivated(Constants.toBoolean_fromYNChar(activated.charAt(0)));
        activation.setId(fname);
View Full Code Here

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

        String fname = Util.getParam(params, Params.REF);
       

        ThesaurusManager tm = gc.getBean(ThesaurusManager.class);
        Thesaurus t = tm.getThesaurusByName(fname);

        if (t != null) {
            t.clear();
        } else {
            // Thesaurus does not exist
View Full Code Here

    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(
          newFile));

            final String siteURL = context.getBean(SettingManager.class).getSiteURL(context);
            Thesaurus gst = new Thesaurus(context.getApplicationContext(), fname, type, dir, newFile, siteURL);
      thesaurusMan.addThesaurus(gst, false);
    } else {
      IO.delete(rdfFile, false, Geonet.THESAURUS);
      throw new Exception("Unknown format (Must be in SKOS format).");
    }
View Full Code Here

        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", "");

        if ("".equals(code)) {
View Full Code Here

    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

    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);
      }else{
View Full Code Here

    String uuid = Util.getParam(params, Params.UUID);
    String type = Util.getParam(params, "type");
    String activated = Util.getParam(params, "activated", "y");

    ThesaurusManager tm = gc.getBean(ThesaurusManager.class);
   

    String theKey = tm.createUpdateThesaurusFromRegister(uuid, type, context);

    Thesaurus gst = tm.getThesaurusByName(theKey);
    String fname = gst.getFname();

        final ThesaurusActivationRepository activationRepository = context.getBean(ThesaurusActivationRepository.class);

        final ThesaurusActivation activation = new ThesaurusActivation();
View Full Code Here

TOP

Related Classes of org.fao.geonet.kernel.ThesaurusManager$InitThesauriTableTask

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.