Skip to content
This repository was archived by the owner on Mar 18, 2020. It is now read-only.

Commit 663816a

Browse files
lsituVivianChu
authored andcommitted
Refactor codes to use the generic ark url prefix.
1 parent e065bff commit 663816a

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/edu/ucsd/library/xdre/web/CollectionStatusReportController.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,15 @@ private Map<String, String> lookupCollectionsByEventType(
219219
* @throws Exception
220220
*/
221221
private List<String> lookupRecordsByEventIds(DAMSClient damsClient, List<Map<String, String>> events) throws Exception {
222+
String arkUrlPrefix = Constants.DAMS_ARK_URL_BASE + "/" + Constants.ARK_ORG + "/";
223+
222224
List<String> records = new ArrayList<>();
223225
for (Map<String, String> event : events) {
224226
String eventId = event.get("e");
225-
int idx = eventId.lastIndexOf("/");
226227
// Escape special characters for SPARQL
227-
if (idx >= 0) {
228-
String eventArk = eventId.substring(eventId.lastIndexOf("/") + 1);
229-
eventId = eventId.substring(0, eventId.lastIndexOf("/") + 1) + StringEscapeUtils.escapeJava(eventArk);
228+
if (eventId.startsWith(arkUrlPrefix)) {
229+
String eventArk = eventId.substring(arkUrlPrefix.length());
230+
eventId = arkUrlPrefix + StringEscapeUtils.escapeJava(eventArk);
230231
} else {
231232
eventId = StringEscapeUtils.escapeJava(eventId);
232233
}

0 commit comments

Comments
 (0)