Project

General

Profile

« Previous | Next » 

Revision 6416

Added by rnahf over 12 years ago

fixed logic wrt localID and docid. Implemented new method in IdentifierManager to getAllGUIDs from identifier table for implementation of loadAllKeys in ObjectPathMapLoader.

View differences:

IdentifierManager.java
643 643
     * @return a list of all local ids in metacat
644 644
     */
645 645
    public List<String> getAllLocalIds()
646
       throws Exception
646
    // seems to be an unnecessary and restrictive throw -rnahf 13-Sep-2011
647
    //    throws Exception
647 648
    {
648 649
        Vector<String> ids = new Vector<String>();
649 650
        String sql = "select docid from xml_documents";
......
678 679
        return ids;
679 680
    }
680 681
    
682
    
681 683
    /**
684
     * return a listing of all guids in the object store
685
     * @return a list of all GUIDs in metacat
686
     */
687
    public List<String> getAllGUIDs()
688
    {
689
        Vector<String> guids = new Vector<String>();
690
        String sql = "select guid from identifier";
691
        DBConnection dbConn = null;
692
        int serialNumber = -1;
693
        try 
694
        {
695
            // Get a database connection from the pool
696
            dbConn = DBConnectionPool.getDBConnection("IdentifierManager.getAllGUIDs");
697
            serialNumber = dbConn.getCheckOutSerialNumber();
698

  
699
            // Execute the insert statement
700
            PreparedStatement stmt = dbConn.prepareStatement(sql);
701
            ResultSet rs = stmt.executeQuery();
702
            while (rs.next()) 
703
            {
704
                String guid = rs.getString(1);
705
                guids.add(guid);
706
            } 
707
            stmt.close();
708
        } 
709
        catch (SQLException e) 
710
        {
711
            logMetacat.error("Error while retrieving the guid: " 
712
                    + e.getMessage());
713
        } 
714
        finally 
715
        {
716
            // Return database connection to the pool
717
            DBConnectionPool.returnDBConnection(dbConn, serialNumber);
718
        }
719
        return guids;
720
    }
721
    
722
    
723
    
724
    /**
682 725
     * returns a list of system metadata-only guids since the given date
683 726
     * @return a list of system ids in metacat that do not correspond to objects
684 727
     * TODO: need to check which server they are on
......
743 786
        } catch (McdbDocNotFoundException e) {
744 787
        	// try system metadata only
745 788
        	try {
746
        		idExists = systemMetadataExisits(guid);
789
        		idExists = systemMetadataExists(guid);
747 790
            } catch (McdbDocNotFoundException e2) {
748 791
            	idExists = false;
749 792
            }
......
859 902
        return guid;
860 903
    }
861 904
    
862
    public boolean systemMetadataExisits(String guid)
905
    public boolean systemMetadataExists(String guid)
863 906
			throws McdbDocNotFoundException {
864 907
		logMetacat.debug("looking up system metadata for guid " + guid);
865 908
		boolean exists = false;

Also available in: Unified diff