Project

General

Profile

« Previous | Next » 

Revision 6908

make more generic so that a custom list of IDs can be passed in.

View differences:

src/edu/ucsb/nceas/metacat/admin/upgrade/GenerateSystemMetadata.java
65 65
        boolean downloadData = true;
66 66

  
67 67
        try {
68
			generateMissingSystemMetadata(includeOre, downloadData);
68
        	//get the list of ids with no SM
69
            //List<String> idList = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true);
70
            List<String> idList = DBUtil.getAllDocidsByType(null, true);
71
            Collections.sort(idList);
72

  
73
            // generate based on this list
74
			generateSystemMetadata(idList, includeOre, downloadData);
69 75
		} catch (Exception e) {
70 76
			String msg = "Problem generating missing system metadata: " + e.getMessage();
71 77
			log.error(msg, e);
......
98 104
     * @throws McdbDocNotFoundException 
99 105
     * @throws ServiceFailure 
100 106
     */
101
    public void generateMissingSystemMetadata(boolean includeOre, boolean downloadData) 
107
    public void generateSystemMetadata(List<String> idList, boolean includeOre, boolean downloadData) 
102 108
    throws ServiceFailure, McdbDocNotFoundException, PropertyNotFoundException, InvalidToken, NotAuthorized, 
103 109
    NotFound, NotImplemented, InvalidRequest, NoSuchAlgorithmException, AccessionNumberException, SQLException 
104 110
    {
105
        //get the list of ids with no SM
106
        //List<String> idList = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true);
107
        List<String> idList = DBUtil.getAllDocidsByType(null, true);
108
        Collections.sort(idList);
111
        
109 112
        for (String localId : idList) { 
110 113
            //for each id, add a system metadata doc
111 114
        	try {
112
        		log.debug("generating missing system metadata for " + localId);
113
        		generateMissingSystemMetadata(localId, includeOre, downloadData);
115
        		log.debug("generating system metadata for " + localId);
116
        		generateSystemMetadata(localId, includeOre, downloadData);
114 117
        	} catch (Exception e) {
115 118
				log.error("Error generating system metadata for: " + localId, e);
116 119
			}
117 120
        }
118
        log.info("done generating missing system metadata");
121
        log.info("done generating system metadata");
119 122
    }
120 123
    
121 124
    /**
......
141 144
     * @throws McdbDocNotFoundException 
142 145
     * @throws InvalidSystemMetadata 
143 146
     */
144
    public void generateMissingSystemMetadata(String localId, boolean includeOre, boolean downloadData) 
147
    public void generateSystemMetadata(String localId, boolean includeOre, boolean downloadData) 
145 148
    throws ServiceFailure, McdbDocNotFoundException, PropertyNotFoundException, InvalidToken, NotAuthorized,
146 149
    NotFound, NotImplemented, InvalidRequest, NoSuchAlgorithmException, AccessionNumberException, SQLException, InvalidSystemMetadata 
147 150
    {
148
    	log.debug("generateMissingSystemMetadata() called.");
151
    	log.debug("generateSystemMetadata() called.");
149 152
    	log.debug("Creating SystemMetadata for localId " + localId);
150 153
        SystemMetadata sm = null;
151 154

  
......
154 157
        	sm = SystemMetadataFactory.createSystemMetadata(localId, includeOre, downloadData);
155 158
        } catch (Exception e1) {
156 159
        	e1.printStackTrace();
157
        	ServiceFailure sf = new ServiceFailure("00","Exception in generateMissingSystemMetadata: " +
160
        	ServiceFailure sf = new ServiceFailure("00","Exception in generateSystemMetadata: " +
158 161
        			e1.getMessage());
159 162
        	sf.setStackTrace(e1.getStackTrace());
160 163
        	throw sf;

Also available in: Unified diff