Item newItem = addItem(c, mycollection, sourceDir, newItemName, null);
Item newItem = addItem(c, mycollection, sourceDir, newItemName, oldHandle, null);
    private void replaceItems( Context c, Collection mycollection, String sourceDir, String mapFile )        throws Exception    {        // read in HashMap first, to get list of handles & source dirs        HashMap myhash = readMapFile( mapFile );                // for each handle, re-import the item, discard the new handle        // and re-assign the old handle        Iterator i = myhash.keySet().iterator();        ArrayList itemsToDelete = new ArrayList();                while( i.hasNext() )        {            // get the old handle            String newItemName = (String)i.next();            String oldHandle   = (String)myhash.get(newItemName);            System.out.println("\tReplacing:  " + oldHandle);            // add new item, locate old one            Item oldItem = (Item)HandleManager.resolveToObject(c, oldHandle);            Item newItem = addItem(c, mycollection, sourceDir, newItemName, null);            String newHandle = HandleManager.findHandle(c, newItem);            // discard the new handle - FIXME: database hack            String myquery =                "DELETE FROM handle WHERE resource_type_id=" +                Constants.ITEM + " AND resource_id=" + newItem.getID();            DatabaseManager.updateQuery(c, myquery );            // re-assign the old handle one to the new item            myquery = "UPDATE handle set resource_id=" +                        newItem.getID() +                        " WHERE handle.handle LIKE '" + oldHandle + "'";            DatabaseManager.updateQuery(c, myquery );            // schedule item for demolition            itemsToDelete.add( oldItem );                      }                        // now run through again, deleting items (do this last to avoid disasters!)        // (this way deletes only happen if there have been no errors previously)         i = itemsToDelete.iterator();                while( i.hasNext() )        {            removeItem(c, (Item)i.next());        }    }