Package org.dspace.content

Examples of org.dspace.content.ItemIterator


  {
    int count_native = 0;
    int count_import = 0;
   
    // get all items from that collection
        ItemIterator iterator = collection.getItems();

        try
        {
            // iterate through the items in this collection, and count how many
            // are native, and how many are imports, and which collections they
            // came from
            while (iterator.hasNext())
            {
                Item item = iterator.next();

                if (item.isOwningCollection(collection))
                    count_native++;
                else
                    count_import++;
            }
        }
        finally
        {
            if (iterator != null)
                iterator.close();
        }
       
        int[] counts = new int[2];
        counts[0] = count_native;
        counts[1] = count_import;
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) {
View Full Code Here

                applyFiltersCommunity(c, topLevelCommunities[i]);
        }
        else
        {
            //otherwise, just find every item and process
            ItemIterator i = Item.findAll(c);
            try
            {
                while (i.hasNext() && processed < max2Process)
                {
                    applyFiltersItem(c, i.next());
                }
            }
            finally
            {
                if (i != null)
                    i.close();
            }
        }
    }
View Full Code Here

                                              throws Exception
    {
        //only apply filters if collection not in skip-list
        if(!inSkipList(collection.getHandle()))
        {
            ItemIterator i = collection.getItems();
            try
            {
                while (i.hasNext() && processed < max2Process)
                {
                    applyFiltersItem(c, i.next());
                }
            }
            finally
            {
                if (i != null)
                    i.close();
            }
        }
    }
View Full Code Here

  {

    ArrayList<Item> items = new ArrayList<Item>();
   
    // get all items from that collection
        ItemIterator iterator = collection.getItems();
        try
        {
            while (iterator.hasNext())
            {
                Item item = iterator.next();

                if (! item.isOwningCollection(collection))
                    items.add(item);
            }
        }
        finally
        {
            if (iterator != null)
                iterator.close();
        }
       
        return items;
  }
View Full Code Here

           
            ArrayList itemmd = new ArrayList();
            if(dso.getType() == Constants.ITEM)
            {
               itemmd.add(dso.getID());
               exporter = new MetadataExport(context, new ItemIterator(context, itemmd),true);
            }
            else if(dso.getType() == Constants.COLLECTION)
            {
               Collection collection = (Collection)dso;
               ItemIterator toExport = collection.getAllItems();
               exporter = new MetadataExport(context, toExport,true);
            }
            else if(dso.getType() == Constants.COMMUNITY)
            {
               exporter = new MetadataExport(context, (Community)dso, false);
View Full Code Here

     * @param context
     * @param force
     */
    public void updateIndex(Context context, boolean force) {
        try {
            ItemIterator items = null;
            try {
                for (items = Item.findAll(context); items.hasNext();) {
                    Item item = (Item) items.next();
                    indexContent(context, item, force);
                    item.decache();
                }
            } finally {
                if (items != null) {
                    items.close();
                }
            }

            Collection[] collections = Collection.findAll(context);
            for (int i = 0; i < collections.length; i++) {
View Full Code Here

                    }
                }
            }
            else
            {
                ItemIterator ii = Item.findByMetadataField(context, lift_schema, lift_element, lift_qualifier, Item.ANY);
                while (ii.hasNext())
                {
                    if (processOneItem(context, ii.next(), line, now))
                        status = 1;
                }
            }
            log.debug("Cache size at end = "+context.getCacheSize());
            context.complete();
View Full Code Here

     */
    @Override
    protected DAVResource[] children() throws SQLException
    {
        Vector result = new Vector();
        ItemIterator ii = this.collection.getItems();
        try
        {
            while (ii.hasNext())
            {
                Item item = ii.next();
                result.add(new DAVItem(this.context, this.request, this.response,
                        makeChildPath(item), item));
            }
        }
        finally
        {
            if (ii != null)
                ii.close();
        }
       
        return (DAVResource[]) result.toArray(new DAVResource[result.size()]);
    }
View Full Code Here

        try {
            context = new Context();
            UserRequestParams uparams = refreshParams(context);

            List<Object> entities = new ArrayList<Object>();
            ItemIterator items = Item.findAll(context);
            while (items.hasNext()) {
                entities.add(new ItemEntity(items.next(), context, uparams));
            }

            return entities;
        } catch (SQLException ex) {
            throw new EntityException("Internal server error", "SQL error", 500);
View Full Code Here

TOP

Related Classes of org.dspace.content.ItemIterator

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.