Revision 9628
Added by Jing Tao over 8 years ago
src/edu/ucsb/nceas/metacat/IdentifierManager.java | ||
---|---|---|
986 | 986 |
Identifier pid = null; |
987 | 987 |
if(sid != null && sid.getValue() != null && !sid.getValue().trim().equals("")) { |
988 | 988 |
logMetacat.debug("getting pid of the head version for matching the sid: " + sid.getValue()); |
989 |
String sql = "select guid from systemMetadata where series_id = ? order by date_uploaded DESC"; |
|
989 |
String sql = "select guid, obsoleted_by, obsoletes from systemMetadata where series_id = ? order by date_uploaded DESC";
|
|
990 | 990 |
DBConnection dbConn = null; |
991 | 991 |
int serialNumber = -1; |
992 | 992 |
PreparedStatement stmt = null; |
... | ... | |
1007 | 1007 |
{ |
1008 | 1008 |
while(hasNext) { |
1009 | 1009 |
String guidStr = rs.getString(1); |
1010 |
String obsoletedByStr = rs.getString(2); |
|
1011 |
String obsoetesStr = rs.getString(3); |
|
1010 | 1012 |
Identifier guid = new Identifier(); |
1011 | 1013 |
guid.setValue(guidStr); |
1012 | 1014 |
if(first) { |
1013 | 1015 |
firstOne = guid; |
1014 | 1016 |
first =false; |
1015 | 1017 |
} |
1016 |
SystemMetadata sysmeta = HazelcastService.getInstance().getSystemMetadataMap().get(guid); |
|
1017 |
if(sysmeta.getObsoletedBy() == null) { |
|
1018 |
//SystemMetadata sysmeta = HazelcastService.getInstance().getSystemMetadataMap().get(guid); |
|
1019 |
//if(sysmeta.getObsoletedBy() == null) { |
|
1020 |
if(obsoletedByStr == null || obsoletedByStr.trim().equals("")) { |
|
1018 | 1021 |
//type 1 end |
1019 | 1022 |
logMetacat.debug(""+guidStr+" is a type 1 end for sid "+sid.getValue()); |
1020 | 1023 |
pid = guid; |
1021 | 1024 |
endsCount++; |
1022 | 1025 |
} else { |
1023 |
Identifier obsoletedBy = sysmeta.getObsoletedBy(); |
|
1026 |
//Identifier obsoletedBy = sysmeta.getObsoletedBy(); |
|
1027 |
Identifier obsoletedBy = new Identifier(); |
|
1028 |
obsoletedBy.setValue(obsoletedByStr); |
|
1024 | 1029 |
SystemMetadata obsoletedBySysmeta = HazelcastService.getInstance().getSystemMetadataMap().get(obsoletedBy); |
1025 | 1030 |
if(obsoletedBySysmeta != null) { |
1026 | 1031 |
Identifier sidInObsoletedBy = obsoletedBySysmeta.getSeriesId(); |
Also available in: Unified diff
In the getHeadPID method, we got the field obsoletedBy from the systemmetadata table rather than the hazelcast service.