Revision 5344
Added by berkley almost 14 years ago
IdentifierManager.java | ||
---|---|---|
254 | 254 |
int rev = 0; |
255 | 255 |
|
256 | 256 |
String query = "select guid, docid, rev from " + type + " where guid = ?"; |
257 |
System.out.println("query: " + query + " for params: (" + guid + ")"); |
|
257 | 258 |
|
258 | 259 |
DBConnection dbConn = null; |
259 | 260 |
int serialNumber = -1; |
... | ... | |
301 | 302 |
// Parse the localId into scope and rev parts |
302 | 303 |
AccessionNumber acc = new AccessionNumber(localId, "NOACTION"); |
303 | 304 |
String docid = acc.getDocid(); |
304 |
int rev = (new Integer(acc.getRev()).intValue()); |
|
305 |
int rev = 1; |
|
306 |
if(acc.getRev() != null) |
|
307 |
{ |
|
308 |
rev = (new Integer(acc.getRev()).intValue()); |
|
309 |
} |
|
305 | 310 |
|
306 | 311 |
// Get a database connection from the pool |
307 | 312 |
dbConn = |
... | ... | |
309 | 314 |
serialNumber = dbConn.getCheckOutSerialNumber(); |
310 | 315 |
|
311 | 316 |
// Execute the insert statement |
312 |
String query = "insert into " + type + " (guid, docid, rev) values (?, ?, ?)"; |
|
317 |
String query = "insert into " + type + " (guid, docid, rev) values (?, ?, ?)"; |
|
318 |
System.out.println("query: " + query + " for params: (" + guid + ", " + docid + ", " + rev + ")"); |
|
313 | 319 |
PreparedStatement stmt = dbConn.prepareStatement(query); |
314 | 320 |
stmt.setString(1, guid); |
315 | 321 |
stmt.setString(2, docid); |
... | ... | |
318 | 324 |
|
319 | 325 |
stmt.close(); |
320 | 326 |
} catch (SQLException e) { |
327 |
e.printStackTrace(); |
|
321 | 328 |
logMetacat.error("SQL error while creating a mapping to the system metadata identifier: " |
322 | 329 |
+ e.getMessage()); |
323 | 330 |
} catch (NumberFormatException e) { |
331 |
e.printStackTrace(); |
|
324 | 332 |
logMetacat.error("NumberFormat error while creating a mapping to the system metadata identifier: " |
325 | 333 |
+ e.getMessage()); |
326 | 334 |
} catch (AccessionNumberException e) { |
335 |
e.printStackTrace(); |
|
327 | 336 |
logMetacat.error("AccessionNumber error while creating a mapping to the system metadata identifier: " |
328 | 337 |
+ e.getMessage()); |
329 | 338 |
} finally { |
Also available in: Unified diff
getting getSystemMetadata to work