Revision 10247
Added by Chris Jones over 7 years ago
src/edu/ucsb/nceas/metacat/MetacatHandler.java | ||
---|---|---|
1389 | 1389 |
*/ |
1390 | 1390 |
private String generateOutputName(String docid, |
1391 | 1391 |
Hashtable<String, String[]> params, DocumentImpl doc) { |
1392 |
SystemMetadata sysMeta = null; |
|
1393 |
String guid = null; |
|
1394 |
int rev = -1; |
|
1395 |
String fileName = null; |
|
1396 |
|
|
1397 |
// First, if SystemMetadata.fileName is present, use it |
|
1398 |
try { |
|
1399 |
rev = Integer.valueOf(DocumentUtil.getRevisionStringFromString(docid)).intValue(); |
|
1400 |
docid = DocumentUtil.getDocIdFromAccessionNumber(docid); |
|
1401 |
if (rev > 0 ) { |
|
1402 |
guid = IdentifierManager.getInstance().getGUID(docid, rev); |
|
1403 |
if ( guid != null ) { |
|
1404 |
sysMeta = IdentifierManager.getInstance().getSystemMetadata(guid); |
|
1405 |
if ( sysMeta != null ) { |
|
1406 |
fileName = sysMeta.getFileName(); |
|
1407 |
} |
|
1408 |
} |
|
1409 |
} |
|
1410 |
} catch (McdbDocNotFoundException e) { |
|
1411 |
logMetacat.debug("Couldn't find the given docid: " + e.getMessage()); |
|
1412 |
|
|
1413 |
} |
|
1414 |
|
|
1415 |
if (fileName != null ) { |
|
1416 |
return fileName; |
|
1417 |
} |
|
1418 |
|
|
1419 |
// Otherwise, generate a name |
|
1392 | 1420 |
String outputname = null; |
1393 | 1421 |
// check for the existence of a metadatadocid parameter, |
1394 | 1422 |
// if this is sent, then send a filename which contains both |
Also available in: Unified diff
Change MetacatHandler.generateOutputName() to use the SystemMetadata.fileName value when it is available. Needs testing.
refs https://projects.ecoinformatics.org/ecoinfo/issues/7187