Package it.eng.spagobi.commons.utilities.indexing

Examples of it.eng.spagobi.commons.utilities.indexing.LuceneIndexer


        String name = SingletonConfig.getInstance().getConfigValue("INDEX_INITIALIZATION.name");
        //first checks if iindex exists
        File idxFile = new File(location+name);
        if(!idxFile.exists()){
          logger.debug("Creating index");
          LuceneIndexer indexer = new LuceneIndexer();
          try {
          indexer.createIndex(idxFile);
        } catch (CorruptIndexException e) {
          logger.error("Index corrupted "+e.getMessage(), e);
        } catch (IOException e) {
          logger.error(e.getMessage(), e);
        }
View Full Code Here


    SbiObjects exportedObj = null;
    try {
      List exportedBIObjs = importer.getAllExportedSbiObjects(sessionExpDB, "SbiObjects", "label");
      Iterator iterSbiObjs = exportedBIObjs.iterator();
     
        LuceneIndexer indexer = new LuceneIndexer();
       
      while (iterSbiObjs.hasNext()) {
        exportedObj = (SbiObjects) iterSbiObjs.next();
        Integer expId = exportedObj.getBiobjId();
        Integer existingObjId = null;
        Map objIdAss = metaAss.getBIobjIDAssociation();
        Set objIdAssSet = objIdAss.keySet();
        if (objIdAssSet.contains(expId) && !overwrite) {
          metaLog.log("Exported biobject "+exportedObj.getName()+" not inserted" +
          " because it has the same label of an existing biobject");
          continue;
        } else {
          existingObjId = (Integer) objIdAss.get(expId);
        }

        SbiObjects obj = null;
        if (existingObjId != null) {
          logger.info("The document with label:[" + exportedObj.getLabel() + "] is just present. It will be updated.");
          metaLog.log("The document with label = [" + exportedObj.getLabel() + "] will be updated.");
          obj = ImportUtilities.modifyExistingSbiObject(exportedObj, sessionCurrDB, existingObjId);
          ImportUtilities.associateWithExistingEntities(obj, exportedObj, sessionCurrDB, importer, metaAss);
          sessionCurrDB.update(obj);
        } else {
          obj = ImportUtilities.makeNewSbiObject(exportedObj);
          ImportUtilities.associateWithExistingEntities(obj, exportedObj, sessionCurrDB, importer, metaAss);
          // insert document
          Integer newId = (Integer) sessionCurrDB.save(obj);
          metaLog.log("Inserted new biobject " + obj.getName());
          metaAss.insertCoupleBIObj(expId, newId);
        }
        // manage object template
        insertObjectTemplate(obj, exportedObj.getBiobjId());
        // manage sub_object here
        insertSubObject(obj, exportedObj);
        // manage snapshot here
        insertSnapshot(obj, exportedObj);
        // insert object into folders tree
        importFunctObject(exportedObj.getBiobjId());
        // puts parameters into object
        importBIObjPar(exportedObj.getBiobjId());
        // puts dependencies into object
        importObjParUse(exportedObj.getBiobjId());

        commit();

        //updates lucene index
          BIObjectDAOHibImpl daoObj = (BIObjectDAOHibImpl)DAOFactory.getBIObjectDAO();
          BIObject biObj = daoObj.toBIObject(obj);
        indexer.addBiobjToIndex(biObj);

        // TODO controllare che fa questo e se serve!!!
        //updateSubObject(obj, exportedObj.getBiobjId());
      }
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of it.eng.spagobi.commons.utilities.indexing.LuceneIndexer

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.