Examples of ItemIterator


Examples of org.dspace.content.ItemIterator

                }
            }
        }
       
        // add all items
        ItemIterator items = collection.getAllItems();
        while (items.hasNext())
        {
            String id = RDFUtil.generateIdentifier(context, items.next());
            if (id != null)
            {
                for (String link : collection2item)
                {
                    m.add(m.createResource(myId),
View Full Code Here

Examples of org.dspace.content.ItemIterator

            String... attributes)
            throws IdentifierNotFoundException, IdentifierNotResolvableException
    {
        log.debug("resolve {}", identifier);

        ItemIterator found;
        try {
            found = Item.findByMetadataField(context,
                    MD_SCHEMA, DOI_ELEMENT, DOI_QUALIFIER,
                    idToDOI(identifier));
        } catch (IdentifierException | SQLException | AuthorizeException | IOException ex) {
            log.error(ex.getMessage());
            throw new IdentifierNotResolvableException(ex);
        }
        try {
            if (!found.hasNext())
            {
                throw new IdentifierNotFoundException("No object bound to " + identifier);
            }
            Item found1 = found.next();
            if (found.hasNext())
            {
                log.error("More than one object bound to {}!", identifier);
            }
            log.debug("Resolved to {}", found1);
            return found1;
View Full Code Here

Examples of org.dspace.content.ItemIterator

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

Examples of org.dspace.content.ItemIterator

     */
    @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

Examples of org.dspace.content.ItemIterator

            AuthorizeException, IOException
    {

        Context ctx = new Context();
        ctx.setIgnoreAuthorization(true);
        ItemIterator iter = Item.findAll(ctx);

        Properties props = new Properties();

        File processed = new File("license.processed");

        if (processed.exists())
        {
            props.load(new FileInputStream(processed));
        }

        int i = 0;

        try
        {
            while (iter.hasNext())
            {
                if (i == 100)
                {
                    props.store(new FileOutputStream(processed),
                                    "processed license files, remove to restart processing from scratch");
                    i = 0;
                }

                Item item = (Item) iter.next();
                log.info("checking: " + item.getID());
                if (!props.containsKey("I" + item.getID()))
                {
                    handleItem(item);
                    log.info("processed: " + item.getID());
View Full Code Here

Examples of org.dspace.content.ItemIterator

            }
        }
        else if (dso.getType() == Constants.COLLECTION)
        {
            Collection collection = (Collection)dso;
            ItemIterator ii = collection.getItems();
            while (ii.hasNext())
            {
                //add a child <div> for each item in collection
                Item item = ii.next();
                Div childDiv = makeChildDiv(getObjectTypeString(item), item, params);
                if(childDiv!=null)
                {
                    div0.getContent().add(childDiv);
                }
View Full Code Here

Examples of org.dspace.content.ItemIterator

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

            Collection[] collections = Collection.findAll(context);
            for (Collection collection : collections)
View Full Code Here

Examples of org.dspace.content.ItemIterator

                switch (dso.getType())
                {
                    case Constants.COLLECTION :
                        //Also find all Items in this Collection and disseminate
                        Collection collection = (Collection) dso;
                        ItemIterator iterator = collection.getItems();
                        while(iterator.hasNext())
                        {
                            Item item = iterator.next();

                            //disseminate all items (recursively!)
                            String childFileName = pkgDirectory + PackageUtils.getPackageName(item, fileExtension);
                            disseminateAll(context, item, params, new File(childFileName));
                        }
View Full Code Here

Examples of org.dspace.content.ItemIterator

        }
    }

    protected void updateItems(AuthorityValue authority) {
        try {
            ItemIterator itemIterator = Item.findByMetadataFieldAuthority(context, authority.getField(), authority.getId());
            while (itemIterator.hasNext()) {
                Item next = itemIterator.next();
                List<Metadatum> metadata = next.getMetadata(authority.getField(), authority.getId());
                authority.updateItem(next, metadata.get(0)); //should be only one
                List<Metadatum> metadataAfter = next.getMetadata(authority.getField(), authority.getId());
                if (!metadata.get(0).value.equals(metadataAfter.get(0).value)) {
                    print.println("Updated item with handle " + next.getHandle());
View Full Code Here

Examples of org.dspace.content.ItemIterator

        {
            if (! tr.run(coll))
            {
                return false;
            }
            ItemIterator iter = coll.getItems();
            while (iter.hasNext())
            {
                if (! tr.run(iter.next()))
                {
                    return false;
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.