Package org.dspace.browse

Examples of org.dspace.browse.IndexBrowse


            BrowseIndex bi = BrowseIndex.getBrowseIndex(plugInBrowserIndex);
            // now start up a browse engine and get it to do the work for us
            BrowseEngine be = new BrowseEngine(context);
           
            // we need to assure that the right names will be present in the browse
            IndexBrowse ib = new IndexBrowse(context);
            int count = 1;
            for (ResearcherPage rp : rps)
            {
                String authKey = ResearcherPageUtils
                        .getPersistentIdentifier(rp);
                log.debug("work on " + rp.getFullName() + "[staffno "
                        + rp.getSourceID() + "] with identifier " + authKey
                        + " (" + count + " of " + rps.size() + ")");
                // set up a BrowseScope and start loading the values into it
                BrowserScope scope = new BrowserScope(context);
                scope.setBrowseIndex(bi);
                // scope.setOrder(order);
                scope.setFilterValue(authKey);
                scope.setAuthorityValue(authKey);
                scope.setResultsPerPage(Integer.MAX_VALUE);
                scope.setBrowseLevel(1);

                BrowseInfo binfo = be.browse(scope);
                log.debug("Find " + binfo.getResultCount()
                        + "item(s) for the reseracher " + authKey);
                Item[] items = binfo.getItemResults(context);
                for (Item item : items)
                {
                    DSIndexer.indexContent(context, item, true);
                    ib.indexItem(item);
                }
            }
            context.commit();
            context.clearCache();
        }
View Full Code Here


                {
                    toCollection.addItem(item);
                    // FIXME Exception handling
                    try
                    {
                      IndexBrowse ib = new IndexBrowse(context);
                      ib.indexItem(item);
                    }
                    catch (BrowseException bex)
                    {
                      throw new UIException("Unable to process browse", bex);
                    }
View Full Code Here

                {
                    toCollection.removeItem(item);
                    // FIXME Exception handling
                    try
                    {
                      IndexBrowse ib = new IndexBrowse(context);
                      ib.indexItem(item);
                    }
                    catch (BrowseException bex)
                    {
                      throw new UIException("Unable to process browse", bex);
                    }
View Full Code Here

        EPerson eperson = EPerson.findByEmail(context, email);
          context.setCurrentUser(eperson);
        context.turnOffAuthorisationSystem();
       
        ItemIterator it = collection.getAllItems();
        IndexBrowse ib = new IndexBrowse(context);
        int i=0;
        while (it.hasNext()) {
          i++;
          Item item = it.next();
          System.out.println("Deleting: " + item.getHandle());
          ib.itemRemoved(item);
          collection.removeItem(item);
          // commit every 50 items
          if (i%50 == 0) {
            context.commit();
            i=0;
View Full Code Here

        {
            if("clean-database.sql".equals(argv[0]))
            {
                try
                {
                    IndexBrowse browse = new IndexBrowse();
                    browse.setDelete(true);
                    browse.setExecute(true);
                    browse.clearDatabase();
                }
                catch (BrowseException e)
                {
                    log.error(e.getMessage(),e);
                    throw new RuntimeException(e.getMessage(),e);
                }
               
                DatabaseManager.loadSql(getScript(argv[0]));
               
            }
            else
            {
               
                DatabaseManager.loadSql(getScript(argv[0]));
               
                try
                {
                    IndexBrowse browse = new IndexBrowse();
                    browse.setRebuild(true);
                    browse.setExecute(true);
                    browse.initBrowse();
                }
                catch (BrowseException e)
                {
                    log.error(e.getMessage(),e);
                    throw new RuntimeException(e.getMessage(),e);
View Full Code Here

         **/
//               FIXME: there is an exception handling problem here
        try
        {
//               Remove from indicies
            IndexBrowse ib = new IndexBrowse(ourContext);
            ib.itemRemoved(this);
        }
        catch (BrowseException e)
        {
            log.error("caught exception: ", e);
            throw new SQLException(e.getMessage());
View Full Code Here

         **/
//               FIXME: there is an exception handling problem here
        try
        {
//               Remove from indices
            IndexBrowse ib = new IndexBrowse(ourContext);
            ib.itemRemoved(this);
        }
        catch (BrowseException e)
        {
            log.error("caught exception: ", e);
            throw new SQLException(e.getMessage(), e);
View Full Code Here

        try
        {
          while (items.hasNext())
          {
            Item item = items.next();
            IndexBrowse ib = new IndexBrowse(ourContext);
           
            if (item.isOwningCollection(this))
            {
              // the collection to be deletd is the owning collection, thus remove
              // the item from all collections it belongs to
              Collection[] collections = item.getCollections();
              for (int i=0; i< collections.length; i++)
              {
                //notify Browse of removing item.
                ib.itemRemoved(item);
                // Browse.itemRemoved(ourContext, itemId);
                collections[i].removeItem(item);
              }
             
            }
            // the item was only mapped to this collection, so just remove it
            else
            {
              //notify Browse of removing item mapping.
              ib.indexItem(item);
              // Browse.itemChanged(ourContext, item);
              removeItem(item);
            }
          }
        }
View Full Code Here

        try
        {
          while (items.hasNext())
          {
            Item item = items.next();
            IndexBrowse ib = new IndexBrowse(ourContext);

            if (item.isOwningCollection(this))
            {
              // the collection to be deleted is the owning collection, thus remove
              // the item from all collections it belongs to
              Collection[] collections = item.getCollections();
              for (int i=0; i< collections.length; i++)
              {
                //notify Browse of removing item.
                ib.itemRemoved(item);
                // Browse.itemRemoved(ourContext, itemId);
                collections[i].removeItem(item);
              }

            }
            // the item was only mapped to this collection, so just remove it
            else
            {
              //notify Browse of removing item mapping.
              ib.indexItem(item);
              // Browse.itemChanged(ourContext, item);
              removeItem(item);
            }
          }
        }
View Full Code Here

            if (consumerList.contains("browse"))
            {
                log.info("Reindexing all content in DBMS Browse tables");
                // Rebuild browse tables to perform a full index
                // (recreating tables as needed)
                IndexBrowse indexer = new IndexBrowse(context);
                indexer.setRebuild(true);
                indexer.setExecute(true);
                indexer.initBrowse();
                // Since the browse index is in the DB, we must commit & close context
                context.complete();
                log.info("Reindexing is complete");
            }
        }
View Full Code Here

TOP

Related Classes of org.dspace.browse.IndexBrowse

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.