diff --git a/dspace-api/src/main/java/org/dspace/script2externalservices/CreateWorkspaceItemWithExternalSource.java b/dspace-api/src/main/java/org/dspace/script2externalservices/CreateWorkspaceItemWithExternalSource.java index 2872ee19d12..7f8cf9e0772 100644 --- a/dspace-api/src/main/java/org/dspace/script2externalservices/CreateWorkspaceItemWithExternalSource.java +++ b/dspace-api/src/main/java/org/dspace/script2externalservices/CreateWorkspaceItemWithExternalSource.java @@ -37,6 +37,7 @@ import org.dspace.content.MetadataValue; import org.dspace.content.WorkspaceItem; import org.dspace.content.dto.MetadataValueDTO; +import org.dspace.content.packager.PackageUtils; import org.dspace.core.Context; import org.dspace.discovery.DiscoverQuery; import org.dspace.discovery.DiscoverQuery.SORT_ORDER; @@ -287,6 +288,8 @@ private int fillWorkspaceItems(Context context, int record, LiveImportDataProvid if (!exist(dataObject.getMetadata())) { WorkspaceItem wsItem = externalDataService.createWorkspaceItemFromExternalDataObject(context, dataObject, this.collection); + Item itemFromWs = wsItem.getItem(); + PackageUtils.addDepositLicense(context, null, itemFromWs, wsItem.getCollection()); for (List metadataList : metadataValueToAdd(wsItem.getItem())) { addMetadata(wsItem.getItem(), metadataList); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/CreateWorkspaceItemFromExternalServiceIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/CreateWorkspaceItemFromExternalServiceIT.java index 79253dcc6de..19100f72233 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/CreateWorkspaceItemFromExternalServiceIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/CreateWorkspaceItemFromExternalServiceIT.java @@ -8,6 +8,7 @@ package org.dspace.app.rest; import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.notNullValue; @@ -199,6 +200,8 @@ public void creatingWorkspaceItemImportedFromScopusTest() throws Exception { + ".traditionalpageone['dc.identifier.scopus'][0].value", is(scopus2R.getValue()))) .andExpect(jsonPath("$._embedded.workflowitems[1].sections" + ".traditionalpageone['dc.identifier.doi'][0].value", is(doi2R.getValue()))) + .andExpect(jsonPath("$._embedded.workflowitems[0].sections.license.url", + containsString("/api/core/bitstreams/"))) .andExpect(jsonPath("$.page.totalElements", is(2))); }