Package org.dspace.storage.rdbms

Examples of org.dspace.storage.rdbms.TableRow


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

                // Check the cache
                WorkspaceItem wi = (WorkspaceItem) context.fromCache(
                        WorkspaceItem.class, row.getIntColumn("workspace_item_id"));

                // not in cache? turn row into workspaceitem
                if (wi == null)
                {
                    wi = new WorkspaceItem(context, row);
View Full Code Here


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

                // Check the cache
                WorkspaceItem wi = (WorkspaceItem) context.fromCache(
                        WorkspaceItem.class, row.getIntColumn("workspace_item_id"));

                // not in cache? turn row into workspaceitem
                if (wi == null)
                {
                    wi = new WorkspaceItem(context, row);
View Full Code Here

            throws BrowseException
    {
        try
        {
            boolean rowUpdated = false;
            TableRow row = DatabaseManager.findByUnique(context, table, "item_id", itemID);

            // If the item does not exist in the table, return that it couldn't be found
            if (row == null)
                return false;

            // Iterate through all the sort values
            Iterator itra = sortCols.keySet().iterator();
            while (itra.hasNext())
            {
                Integer key = (Integer) itra.next();

                // Generate the appropriate column name
                String column = "sort_" + key.toString();

                // Create the value that will be written in to the column
                String newValue = utils.truncateSortValue( (String) sortCols.get(key) );

                // Check the column exists - if it doesn't, something has gone seriously wrong
                if (!row.hasColumn(column))
                    throw new BrowseException("Column '" + column + "' does not exist in table " + table);

                // Get the existing value from the column
                String oldValue = row.getStringColumn(column);

                // If the new value differs from the old value, update the column and flag that the row has changed
                if (oldValue != null && !oldValue.equals(newValue))
                {
                    row.setColumn(column, newValue);
                    rowUpdated = true;
                }
                else if (newValue != null && !newValue.equals(oldValue))
                {
                    row.setColumn(column, newValue);
                    rowUpdated = true;
                }
            }

            // We've updated the row, so save it back to the database
View Full Code Here

            tri = DatabaseManager.queryTable(context, "Community2Item",
                        "SELECT * FROM Community2Item WHERE item_id=?", itemId);

            while (tri.hasNext())
            {
                TableRow row = tri.next();
                int commId = row.getIntColumn("community_id");
                commIdList.add(commId);

                // Get the parent community, and continue to get all ancestors
                Integer parentId = getParentCommunityID(commId);
                while (parentId != null)
View Full Code Here

                    "SELECT * FROM MetadataFieldRegistry WHERE metadata_schema_id= ? " +
                    "AND element= ?  AND qualifier= ? ",
                    schemaID, element, qualifier);
        }
       
        TableRow row = null;
        try
        {
            if (tri.hasNext())
            {
                row = tri.next();
View Full Code Here

        ResultSet rs = null;

        try
        {
            con = context.getDBConnection();
            TableRow reg = DatabaseManager.row("MetadataFieldRegistry");

            String qualifierClause = "";

            if (qualifier == null)
            {
                qualifierClause = "and qualifier is null";
            }
            else
            {
                qualifierClause = "and qualifier = ?";
            }

            String query = "SELECT COUNT(*) FROM " + reg.getTable()
                + " WHERE metadata_schema_id= ? "
                + " and metadata_field_id != ? "
                + " and element= ? " + qualifierClause;

            statement = con.prepareStatement(query);
View Full Code Here

                try
                {
                    while (tri.hasNext())
                    {
                        TableRow row = tri.next();
                        int fieldID = row.getIntColumn("metadata_field_id");
                        new_id2field.put(new Integer(fieldID), new MetadataField(row));
                    }
                }
                finally
                {
View Full Code Here

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

                        // First check the cache
                        EPerson fromCache = (EPerson) myContext.fromCache(
                                EPerson.class, r.getIntColumn("eperson_id"));

                        if (fromCache != null)
                        {
                            epeople.add(fromCache);
                        }
                        else
                        {
                            epeople.add(new EPerson(myContext, r));
                        }
                    }
                }
                finally
                {
                    // close the TableRowIterator to free up resources
                    if (tri != null)
                        tri.close();
                }

                // now get Group objects
                tri = DatabaseManager.queryTable(myContext,"epersongroup",
                                "SELECT epersongroup.* FROM epersongroup, group2group WHERE " +
                                "group2group.child_id=epersongroup.eperson_group_id AND "+
                                "group2group.parent_id= ? ",
                                myRow.getIntColumn("eperson_group_id"));

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

                        // First check the cache
                        Group fromCache = (Group) myContext.fromCache(Group.class,
                                r.getIntColumn("eperson_group_id"));

                        if (fromCache != null)
                        {
                            groups.add(fromCache);
                        }
View Full Code Here

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

                // First check the cache
                Bitstream fromCache = (Bitstream) context.fromCache(
                        Bitstream.class, r.getIntColumn("bitstream_id"));

                if (fromCache != null)
                {
                    bitstreams.add(fromCache);
                }
View Full Code Here

        if (fromCache != null)
        {
            return fromCache;
        }

        TableRow row = DatabaseManager.find(context, "bundle", id);

        if (row == null)
        {
            if (log.isDebugEnabled())
            {
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.