mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
Merge pull request #3067 from atmire/w2p-74727_Nullpointer-workflow-item-after-submitter-delete
NullPointerException occurs when accessing WorkflowItem after deleting the Submitter
This commit is contained in:
@@ -162,6 +162,11 @@ public class WorkflowItemBuilder extends AbstractBuilder<XmlWorkflowItem, XmlWor
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorkflowItemBuilder withSubmitter(EPerson ePerson) {
|
||||||
|
workspaceItem.getItem().setSubmitter(ePerson);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public WorkflowItemBuilder withTitle(final String title) {
|
public WorkflowItemBuilder withTitle(final String title) {
|
||||||
return setMetadataSingleValue(MetadataSchemaEnum.DC.getName(), "title", null, title);
|
return setMetadataSingleValue(MetadataSchemaEnum.DC.getName(), "title", null, title);
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,9 @@ public abstract class AInprogressItemConverter<T extends InProgressSubmission,
|
|||||||
witem.setId(obj.getID());
|
witem.setId(obj.getID());
|
||||||
witem.setCollection(collection != null ? converter.toRest(collection, projection) : null);
|
witem.setCollection(collection != null ? converter.toRest(collection, projection) : null);
|
||||||
witem.setItem(converter.toRest(item, projection));
|
witem.setItem(converter.toRest(item, projection));
|
||||||
|
if (submitter != null) {
|
||||||
witem.setSubmitter(converter.toRest(submitter, projection));
|
witem.setSubmitter(converter.toRest(submitter, projection));
|
||||||
|
}
|
||||||
|
|
||||||
// 1. retrieve the submission definition
|
// 1. retrieve the submission definition
|
||||||
// 2. iterate over the submission section to allow to plugin additional
|
// 2. iterate over the submission section to allow to plugin additional
|
||||||
|
@@ -33,6 +33,7 @@ import org.dspace.app.rest.test.AbstractControllerIntegrationTest;
|
|||||||
import org.dspace.builder.CollectionBuilder;
|
import org.dspace.builder.CollectionBuilder;
|
||||||
import org.dspace.builder.CommunityBuilder;
|
import org.dspace.builder.CommunityBuilder;
|
||||||
import org.dspace.builder.EPersonBuilder;
|
import org.dspace.builder.EPersonBuilder;
|
||||||
|
import org.dspace.builder.WorkflowItemBuilder;
|
||||||
import org.dspace.builder.WorkspaceItemBuilder;
|
import org.dspace.builder.WorkspaceItemBuilder;
|
||||||
import org.dspace.content.Collection;
|
import org.dspace.content.Collection;
|
||||||
import org.dspace.content.Community;
|
import org.dspace.content.Community;
|
||||||
@@ -52,9 +53,9 @@ import org.dspace.versioning.service.VersioningService;
|
|||||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||||
|
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,6 +69,8 @@ public class DeleteEPersonSubmitterIT extends AbstractControllerIntegrationTest
|
|||||||
protected WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance()
|
protected WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance()
|
||||||
.getWorkspaceItemService();
|
.getWorkspaceItemService();
|
||||||
protected XmlWorkflowService xmlWorkflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService();
|
protected XmlWorkflowService xmlWorkflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService();
|
||||||
|
protected XmlWorkflowItemService xmlWorkflowItemService = XmlWorkflowServiceFactory.getInstance()
|
||||||
|
.getXmlWorkflowItemService();
|
||||||
protected VersioningService versioningService = VersionServiceFactory.getInstance().getVersionService();
|
protected VersioningService versioningService = VersionServiceFactory.getInstance().getVersionService();
|
||||||
|
|
||||||
protected RequestItemAuthorExtractor requestItemAuthorExtractor =
|
protected RequestItemAuthorExtractor requestItemAuthorExtractor =
|
||||||
@@ -303,11 +306,7 @@ public class DeleteEPersonSubmitterIT extends AbstractControllerIntegrationTest
|
|||||||
.andExpect(status().isNotFound());
|
.andExpect(status().isNotFound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
/**
|
|
||||||
* TODO: This test currently fails with a status 500
|
|
||||||
*/
|
|
||||||
public void testWorkflowItemSubmitterDelete() throws Exception {
|
public void testWorkflowItemSubmitterDelete() throws Exception {
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
|
|
||||||
@@ -316,15 +315,13 @@ public class DeleteEPersonSubmitterIT extends AbstractControllerIntegrationTest
|
|||||||
.withWorkflowGroup(1, workflowUser)
|
.withWorkflowGroup(1, workflowUser)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
WorkspaceItem wsi = WorkspaceItemBuilder.createWorkspaceItem(context, collection)
|
XmlWorkflowItem workflowItem = WorkflowItemBuilder.createWorkflowItem(context, collection)
|
||||||
.withSubmitter(submitter)
|
.withSubmitter(submitter)
|
||||||
.withTitle("Test Item")
|
.withTitle("Test Item")
|
||||||
.withIssueDate("2019-03-06")
|
.withIssueDate("2019-03-06")
|
||||||
.withSubject("ExtraEntry")
|
.withSubject("ExtraEntry")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
|
||||||
|
|
||||||
String token = getAuthToken(admin.getEmail(), password);
|
String token = getAuthToken(admin.getEmail(), password);
|
||||||
getClient(token).perform(get("/api/workflow/workflowitems/" + workflowItem.getID()))
|
getClient(token).perform(get("/api/workflow/workflowitems/" + workflowItem.getID()))
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isOk());
|
||||||
|
Reference in New Issue
Block a user