Package org.dspace.storage.rdbms

Examples of org.dspace.storage.rdbms.TableRow


            return ownCollection;
        }
        else
        {
            // is a template item?
            TableRow qResult = DatabaseManager.querySingle(ourContext,
                       "SELECT collection_id FROM collection " +
                       "WHERE template_item_id = ?",getID());
            if (qResult != null)
            {
                Collection collection = Collection.find(ourContext,qResult.getIntColumn("collection_id"));
                return collection;
            }
            return null;
        }
    }
View Full Code Here


            try
            {
                if (!r.hasNext())
                {
                    // Not subscribed, so add them
                    TableRow row = DatabaseManager.create(context, "subscription");
                    row.setColumn("eperson_id", eperson.getID());
                    row.setColumn("collection_id", collection.getID());
                    DatabaseManager.update(context, row);

                    log.info(LogManager.getHeader(context, "subscribe",
                            "eperson_id=" + eperson.getID() + ",collection_id="
                                    + collection.getID()));
View Full Code Here

        try
        {
            while (tri.hasNext())
            {
                TableRow row = tri.next();

                collections.add(Collection.find(context, row
                        .getIntColumn("collection_id")));
            }
        }
        finally
        {
View Full Code Here

        try
        {
            // Go through the list collating subscriptions for each e-person
            while (tri.hasNext())
            {
                TableRow row = tri.next();

                // Does this row relate to the same e-person as the last?
                if ((currentEPerson == null)
                        || (row.getIntColumn("eperson_id") != currentEPerson
                                .getID()))
                {
                    // New e-person. Send mail for previous e-person
                    if (currentEPerson != null)
                    {

                        try
                        {
                            sendEmail(context, currentEPerson, collections, test);
                        }
                        catch (MessagingException me)
                        {
                            log.error("Failed to send subscription to eperson_id="
                                    + currentEPerson.getID());
                            log.error(me);
                        }
                    }

                    currentEPerson = EPerson.find(context, row
                            .getIntColumn("eperson_id"));
                    collections = new ArrayList();
                }

                collections.add(Collection.find(context, row
                        .getIntColumn("collection_id")));
            }
        }
        finally
        {
View Full Code Here

            // now run the query
            tri = DatabaseManager.query(context, query, params);

            if (tri.hasNext())
            {
                TableRow row = tri.next();
                return (int) row.getLongColumn("num");
            }
            else
            {
                return 0;
            }
View Full Code Here

            String query = "SELECT max(" + column + ") FROM " + table + " WHERE item_id = ?";

            Object[] params = { new Integer(itemID) };
            tri = DatabaseManager.query(context, query, params);

            TableRow row;
            if (tri.hasNext())
            {
                row = tri.next();
                return row.getStringColumn("max");
            }
            else
            {
                return null;
            }
View Full Code Here

        {
            tri = DatabaseManager.query(context, selectPrimaryBitstreamID, itemId, bundleName);

            if (tri.hasNext())
            {
                TableRow row = tri.next();
                int bid = row.getIntColumn("primary_bitstream_id");
                return Bitstream.find(context, bid);
            }
        }
        finally
        {
View Full Code Here

        try
        {
            tri = DatabaseManager.query(context, selectFirstBitstreamID, itemId, bundleName);
            if (tri.hasNext())
            {
                TableRow row = tri.next();
                int bid = row.getIntColumn("bitstream_id");
                return Bitstream.find(context, bid);
            }
        }
        finally
        {
View Full Code Here

        try
        {
            tri = DatabaseManager.query(context, selectNamedBitstreamID, itemId, bundleName, fileName);
            if (tri.hasNext())
            {
                TableRow row = tri.next();
                int bid = row.getIntColumn("bitstream_id");
                return Bitstream.find(context, bid);
            }
        }
        finally
        {
View Full Code Here

        try
        {
            // Process results of query into HarvestedItemInfo objects
            while (tri.hasNext())
            {
                TableRow row = tri.next();

                /**
                 * If we are looking for public-only items, we need to scan all objects
                 * for permissions in order to properly calculate the offset
                 */
                if ((!nonAnon) && (index < offset))
                {
                    HarvestedItemInfo itemInfo = new HarvestedItemInfo();
                    itemInfo.itemID = row.getIntColumn("resource_id");
                    itemInfo.item = Item.find(context, itemInfo.itemID);
                    Group[] authorizedGroups = AuthorizeManager.getAuthorizedGroups(context, itemInfo.item, Constants.READ);
                        boolean added = false;
                        for (int i = 0; i < authorizedGroups.length; i++)
                        {
                            if ((authorizedGroups[i].getID() == 0) && (!added))
                            {
                                added = true;
                            }
                        }
                        if (!added)
                        {
                            offset++;
                        }
                }

                /*
                 * This conditional ensures that we only process items within any
                 * constraints specified by 'offset' and 'limit' parameters.
                 */
                else if ((index >= offset) && ((limit == 0) || (itemCounter < limit)))
                {
                    HarvestedItemInfo itemInfo = new HarvestedItemInfo();

                    itemInfo.context = context;
                    itemInfo.handle = row.getStringColumn("handle");
                    itemInfo.itemID = row.getIntColumn("resource_id");
                    itemInfo.datestamp = row.getDateColumn("last_modified");
                    itemInfo.withdrawn = row.getBooleanColumn("withdrawn");

                    if (collections)
                    {
                        fillCollections(context, itemInfo);
                    }
View Full Code Here

TOP

Related Classes of org.dspace.storage.rdbms.TableRow

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.