Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 0 additions & 132 deletions dspace-api/src/main/java/org/dspace/api/DSpaceApi.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.dspace.eperson.EPerson;
import org.dspace.eperson.service.GroupService;
import org.dspace.event.Event;
import org.dspace.handle.service.HandleService;
import org.dspace.identifier.Identifier;
import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.service.IdentifierService;
Expand Down Expand Up @@ -78,6 +79,8 @@ public class InstallItemServiceImpl implements InstallItemService {
protected VersioningService versioningService;
@Autowired(required = true)
protected VersionHistoryService versionHistoryService;
@Autowired(required = true)
protected HandleService handleService;

Logger log = LogManager.getLogger(InstallItemServiceImpl.class);

Expand Down Expand Up @@ -116,6 +119,11 @@ public Item installItem(Context c, InProgressSubmission is,
item = finishItem(c, item, is);

fixRelationMetadata(c, item);
try {
handleService.updateHandleMetadata(c, item);
} catch (IOException e) {
log.error(String.format("Couldn't update handle metadata for item with id %s", item.getID().toString()), e);
}
Comment thread
kuchtiak-ufal marked this conversation as resolved.

// As this is a BRAND NEW item, as a final step we need to remove the
// submitter item policies created during deposit and replace them with
Expand Down
91 changes: 0 additions & 91 deletions dspace-api/src/main/java/org/dspace/handle/AbstractPIDService.java

This file was deleted.

21 changes: 21 additions & 0 deletions dspace-api/src/main/java/org/dspace/handle/EpicHandleField.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.handle;

/**
* Enum with fields used for EPIC handle creation and update. These fields are used as keys in the map of parameters
*/
public enum EpicHandleField {
TITLE,
REPOSITORY,
SUBMITDATE,
REPORTEMAIL,
DATASETNAME,
DATASETVERSION,
QUERY
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
Expand Down Expand Up @@ -56,17 +57,19 @@ public static Response createHandle(String pidServiceURL,
.post(Entity.json(jsonData));
}

public static Response createNewHandleWithSuffix(String pidServiceURL,
String prefix,
String suffix,
String jsonData) {
return putHandle(pidServiceURL, prefix, suffix, jsonData, Map.of("If-None-Match", "*"));
}

public static Response updateHandle(String pidServiceURL, String prefix, String suffix, String jsonData) {
URI uri;
try {
uri = new URI(pidServiceURL);
} catch (URISyntaxException e) {
return invalidUriResponse();
}
return putHandle(pidServiceURL, prefix, suffix, jsonData, null);
}

return client.target(uri).path(prefix).path(suffix)
.request(MediaType.APPLICATION_JSON)
.put(Entity.json(jsonData));
public static Response updateExistingHandle(String pidServiceURL, String prefix, String suffix, String jsonData) {
return putHandle(pidServiceURL, prefix, suffix, jsonData, Map.of("If-Match", "*"));
}

public static Response deleteHandle(String pidServiceURL, String prefix, String suffix) {
Expand Down Expand Up @@ -137,6 +140,25 @@ public static Response getHandle(String pidServiceURL, String prefix, String suf
.get();
}

private static Response putHandle(String pidServiceURL,
String prefix,
String suffix,
String jsonData,
Map<String, String> headers) {
URI uri;
try {
uri = new URI(pidServiceURL);
} catch (URISyntaxException e) {
return invalidUriResponse();
}

Invocation.Builder req = client.target(uri).path(prefix).path(suffix).request(MediaType.APPLICATION_JSON);
if (headers != null) {
headers.forEach(req::header);
}
return req.put(Entity.json(jsonData));
}

private static Response invalidUriResponse() {
return Response.status(400, "invalid ePIC PID Service URL").build();
}
Expand Down
Loading
Loading