Package org.dspace.storage.rdbms

Examples of org.dspace.storage.rdbms.TableRow


            // Chuck 'em in the itemInfo object
            itemInfo.collectionHandles = new LinkedList();

            while (colRows.hasNext())
            {
                TableRow r = colRows.next();
                itemInfo.collectionHandles.add(r.getStringColumn("handle"));
            }
        }
        finally
        {
            if (colRows != null)
View Full Code Here


        // Grab rows from DB
        TableRowIterator tri = DatabaseManager.queryTable(context,"MetadataSchemaRegistry",
                "SELECT * FROM MetadataSchemaRegistry WHERE namespace= ? ",
                namespace);

        TableRow row = null;
        try
        {
            if (tri.hasNext())
            {
                row = tri.next();
View Full Code Here

        PreparedStatement statement = null;
        ResultSet rs = null;

        try
        {
            TableRow reg = DatabaseManager.row("MetadataSchemaRegistry");

            String query = "SELECT COUNT(*) FROM " + reg.getTable() + " " +
                    "WHERE metadata_schema_id != ? " +
                    "AND namespace= ? ";

            statement = con.prepareStatement(query);
            statement.setInt(1,schemaID);
View Full Code Here

        PreparedStatement statement = null;
        ResultSet rs = null;

        try
        {
            TableRow reg = DatabaseManager.row("MetadataSchemaRegistry");

            String query = "SELECT COUNT(*) FROM " + reg.getTable() + " " +
                    "WHERE metadata_schema_id != ? " +
                    "AND short_id = ? ";

            statement = con.prepareStatement(query);
            statement.setInt(1,schemaID);
View Full Code Here

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

                        MetadataSchema s = new MetadataSchema(row);
                        new_id2schema.put(new Integer(s.schemaID), s);
                        new_name2schema.put(s.name, s);
                    }
View Full Code Here

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

                        // Check the item mappings to see if it contains this mapping
                        boolean itemIsMapped = false;
                        int trDistinctID = tr.getIntColumn("distinct_id");
                        for (int i = 0; i < distinctIDs.length; i++)
                        {
                            // Found this mapping
                            if (distinctIDs[i] == trDistinctID)
                            {
                                // Flag it, and remove (-1) from the item mappings
                                itemIsMapped = true;
                                distinctIDs[i] = -1;
                            }
                        }

                        // The item is no longer mapped to this community, so remove the database record
                        if (!itemIsMapped)
                            DatabaseManager.delete(context, tr);
                    }
                }
                finally
                {
                    tri.close();
                }
            }

            // Any remaining mappings need to be added to the database
            for (int i = 0; i < distinctIDs.length; i++)
            {
                if (distinctIDs[i] > -1)
                {
                    TableRow row = DatabaseManager.create(context, table);
                    row.setColumn("item_id", itemID);
                    row.setColumn("distinct_id", distinctIDs[i]);
                    DatabaseManager.update(context, row);
                }
            }
        }
        catch (SQLException e)
View Full Code Here

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

                        // Check the item mappings to see if it contains this community mapping
                        boolean itemIsMapped = false;
                        int trCommID = tr.getIntColumn("community_id");
                        for (int i = 0; i < commID.length; i++)
                        {
                            // Found this community
                            if (commID[i] == trCommID)
                            {
                                // Flag it, and remove (-1) from the item mappings
                                itemIsMapped = true;
                                commID[i] = -1;
                            }
                        }

                        // The item is no longer mapped to this community, so remove the database record
                        if (!itemIsMapped)
                            DatabaseManager.delete(context, tr);
                    }
                }
                finally
                {
                    tri.close();
                }
            }

            // Any remaining mappings need to be added to the database
            for (int i = 0; i < commID.length; i++)
            {
                if (commID[i] > -1)
                {
                    TableRow row = DatabaseManager.create(context, "Communities2Item");
                    row.setColumn("item_id", itemID);
                    row.setColumn("community_id", commID[i]);
                    DatabaseManager.update(context, row);
                }
            }
        }
        catch (SQLException e)
View Full Code Here

    public static void add(Context context, int groupID, int wsItemID, int policy)
        throws SQLException, AuthorizeException
    {
        // make a table row in the database table, and update with the relevant
        // details
        TableRow row = DatabaseManager.create(context,
                            "epersongroup2workspaceitem");
        row.setColumn("workspace_item_id", wsItemID);
        row.setColumn("eperson_group_id", groupID);
        DatabaseManager.update(context,row);
       
        // If a default policy type has been requested, apply the policies using
        // the DSpace API for doing so
        if (policy != POLICY_NONE)
View Full Code Here

            log.debug("insertDistinctRecord: table=" + table + ",value=" + value+ ",sortValue=" + sortValue);
        }
       
        try
        {
            TableRow dr = DatabaseManager.create(context, table);
            dr.setColumn("value", utils.truncateValue(value));
            dr.setColumn("sort_value", utils.truncateSortValue(sortValue));
            if (authority != null)
            {
                dr.setColumn("authority", utils.truncateValue(authority,100));
            }
            int distinctID = dr.getIntColumn("id");
            dr.setColumn("distinct_id", distinctID);
            DatabaseManager.update(context, dr);
           
           
            if (log.isDebugEnabled())
            {
View Full Code Here

            throws BrowseException
    {
        try
        {
            // create us a row in the index
            TableRow row = DatabaseManager.create(context, table);
           
            // set the primary information for the index
            row.setColumn("item_id", itemID);
           
            // now set the columns for the other sort values
            Iterator itra = sortCols.keySet().iterator();
            while (itra.hasNext())
            {
                Integer key = (Integer) itra.next();
                String nValue = (String) sortCols.get(key);
                row.setColumn("sort_" + key.toString(), utils.truncateSortValue(nValue));
            }
           
            DatabaseManager.update(context, row);
        }
        catch (SQLException e)
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.