Merge branch 'main' into contract-pr-222-primary-bitstream-on-bundle-support

This commit is contained in:
Nona Luypaert
2023-06-02 09:03:00 +02:00
13 changed files with 330 additions and 63 deletions

View File

@@ -11,6 +11,9 @@ import java.io.Serializable;
import java.util.Map;
import org.apache.commons.lang3.BooleanUtils;
import org.dspace.content.InProgressSubmission;
import org.dspace.content.WorkspaceItem;
import org.hibernate.proxy.HibernateProxyHelper;
/**
* Class representing configuration for a single step within an Item Submission
@@ -173,6 +176,38 @@ public class SubmissionStepConfig implements Serializable {
return visibilityOutside;
}
/**
* Check if given submission section object is hidden for the current submission scope
*
* @param obj the InProgressSubmission to check
* @return true if the submission section is hidden, false otherwise
*/
public boolean isHiddenForInProgressSubmission(InProgressSubmission obj) {
String scopeToCheck = getScope(obj);
if (scope == null || scopeToCheck == null) {
return false;
}
String visibility = getVisibility();
String visibilityOutside = getVisibilityOutside();
if (scope.equalsIgnoreCase(scopeToCheck)) {
return "hidden".equalsIgnoreCase(visibility);
} else {
return visibilityOutside == null || "hidden".equalsIgnoreCase(visibilityOutside);
}
}
private String getScope(InProgressSubmission obj) {
if (HibernateProxyHelper.getClassWithoutInitializingProxy(obj).equals(WorkspaceItem.class)) {
return "submission";
}
return "workflow";
}
/**
* Get the number of this step in the current Submission process config.
* Step numbers start with #0 (although step #0 is ALWAYS the special

View File

@@ -27,13 +27,14 @@ import org.dspace.versioning.Version;
import org.dspace.versioning.VersionHistory;
import org.dspace.versioning.service.VersionHistoryService;
import org.dspace.versioning.service.VersioningService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Marsa Haoua
* @author Pascal-Nicolas Becker (dspace at pascal dash becker dot de)
*/
public class VersionedDOIIdentifierProvider extends DOIIdentifierProvider {
public class VersionedDOIIdentifierProvider extends DOIIdentifierProvider implements InitializingBean {
/**
* log4j category
*/
@@ -49,6 +50,19 @@ public class VersionedDOIIdentifierProvider extends DOIIdentifierProvider {
@Autowired(required = true)
protected VersionHistoryService versionHistoryService;
/**
* After all the properties are set check that the versioning is enabled
*
* @throws Exception throws an exception if this isn't the case
*/
@Override
public void afterPropertiesSet() throws Exception {
if (!configurationService.getBooleanProperty("versioning.enabled", true)) {
throw new RuntimeException("the " + VersionedDOIIdentifierProvider.class.getName() +
" is enabled, but the versioning is disabled.");
}
}
@Override
public String mint(Context context, DSpaceObject dso) throws IdentifierException {
return mint(context, dso, this.filter);

View File

@@ -35,6 +35,7 @@ import org.dspace.versioning.Version;
import org.dspace.versioning.VersionHistory;
import org.dspace.versioning.service.VersionHistoryService;
import org.dspace.versioning.service.VersioningService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -45,7 +46,7 @@ import org.springframework.stereotype.Component;
* @author Pascal-Nicolas Becker (dspace at pascal dash becker dot de)
*/
@Component
public class VersionedHandleIdentifierProvider extends IdentifierProvider {
public class VersionedHandleIdentifierProvider extends IdentifierProvider implements InitializingBean {
/**
* log4j category
*/
@@ -71,6 +72,19 @@ public class VersionedHandleIdentifierProvider extends IdentifierProvider {
@Autowired(required = true)
protected ContentServiceFactory contentServiceFactory;
/**
* After all the properties are set check that the versioning is enabled
*
* @throws Exception throws an exception if this isn't the case
*/
@Override
public void afterPropertiesSet() throws Exception {
if (!configurationService.getBooleanProperty("versioning.enabled", true)) {
throw new RuntimeException("the " + VersionedHandleIdentifierProvider.class.getName() +
" is enabled, but the versioning is disabled.");
}
}
@Override
public boolean supports(Class<? extends Identifier> identifier) {
return Handle.class.isAssignableFrom(identifier);

View File

@@ -30,6 +30,7 @@ import org.dspace.versioning.Version;
import org.dspace.versioning.VersionHistory;
import org.dspace.versioning.service.VersionHistoryService;
import org.dspace.versioning.service.VersioningService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -39,7 +40,8 @@ import org.springframework.stereotype.Component;
* @author Ben Bosman (ben at atmire dot com)
*/
@Component
public class VersionedHandleIdentifierProviderWithCanonicalHandles extends IdentifierProvider {
public class VersionedHandleIdentifierProviderWithCanonicalHandles extends IdentifierProvider
implements InitializingBean {
/**
* log4j category
*/
@@ -65,6 +67,19 @@ public class VersionedHandleIdentifierProviderWithCanonicalHandles extends Ident
@Autowired(required = true)
private ItemService itemService;
/**
* After all the properties are set check that the versioning is enabled
*
* @throws Exception throws an exception if this isn't the case
*/
@Override
public void afterPropertiesSet() throws Exception {
if (!configurationService.getBooleanProperty("versioning.enabled", true)) {
throw new RuntimeException("the " + VersionedHandleIdentifierProviderWithCanonicalHandles.class.getName() +
" is enabled, but the versioning is disabled.");
}
}
@Override
public boolean supports(Class<? extends Identifier> identifier) {
return Handle.class.isAssignableFrom(identifier);

View File

@@ -23,6 +23,7 @@
<name-map collection-handle="123456789/qualdrop-test" submission-name="qualdroptest"/>
<name-map collection-handle="123456789/typebind-test" submission-name="typebindtest"/>
<name-map collection-handle="123456789/accessCondition-not-discoverable" submission-name="accessConditionNotDiscoverable"/>
<name-map collection-handle="123456789/test-hidden" submission-name="test-hidden"/>
</submission-map>
@@ -54,7 +55,6 @@
<heading></heading>
<processing-class>org.dspace.app.rest.submit.step.CollectionStep</processing-class>
<type>collection</type>
<scope visibility="hidden" visibilityOutside="hidden">submission</scope>
</step-definition>
<step-definition id="traditionalpageone" mandatory="true">
<heading>submit.progressbar.describe.stepone</heading>
@@ -149,6 +149,34 @@
<processing-class>org.dspace.app.rest.submit.step.ShowIdentifiersStep</processing-class>
<type>identifiers</type>
</step-definition>
<step-definition id="test-outside-workflow-hidden" mandatory="true">
<heading>submit.progressbar.describe.stepone</heading>
<processing-class>org.dspace.app.rest.submit.step.DescribeStep</processing-class>
<type>submission-form</type>
<scope visibilityOutside="hidden">workflow</scope>
</step-definition>
<step-definition id="test-outside-submission-hidden" mandatory="true">
<heading>submit.progressbar.describe.stepone</heading>
<processing-class>org.dspace.app.rest.submit.step.DescribeStep</processing-class>
<type>submission-form</type>
<scope visibilityOutside="hidden">submission</scope>
</step-definition>
<step-definition id="test-never-hidden" mandatory="true">
<heading></heading>
<processing-class>org.dspace.app.rest.submit.step.CollectionStep</processing-class>
<type>collection</type>
</step-definition>
<step-definition id="test-always-hidden" mandatory="true">
<heading></heading>
<processing-class>org.dspace.app.rest.submit.step.CollectionStep</processing-class>
<type>collection</type>
<scope visibility="hidden" visibilityOutside="hidden">submission</scope>
</step-definition>
</step-definitions>
<!-- The submission-definitions map lays out the detailed definition of -->
@@ -222,6 +250,13 @@
<step id="notDiscoverable"/>
</submission-process>
<submission-process name="test-hidden">
<step id="test-outside-workflow-hidden"/>
<step id="test-outside-submission-hidden"/>
<step id="test-never-hidden"/>
<step id="test-always-hidden"/>
</submission-process>
</submission-definitions>
</item-submission>

View File

@@ -436,6 +436,35 @@ it, please enter the types and the actual numbers or codes.</hint>
</field>
</row>
</form>
<form name="test-outside-workflow-hidden">
<row>
<field>
<dc-schema>dc</dc-schema>
<dc-element>title</dc-element>
<dc-qualifier></dc-qualifier>
<repeatable>false</repeatable>
<label>Title</label>
<input-type>onebox</input-type>
<required>Field required</required>
</field>
</row>
</form>
<form name="test-outside-submission-hidden">
<row>
<field>
<dc-schema>dc</dc-schema>
<dc-element>type</dc-element>
<dc-qualifier></dc-qualifier>
<repeatable>false</repeatable>
<label>Type</label>
<input-type>onebox</input-type>
<required>Field required</required>
</field>
</row>
</form>
</form-definitions>

View File

@@ -189,6 +189,10 @@ public class WorkspaceItemBuilder extends AbstractBuilder<WorkspaceItem, Workspa
return addMetadataValue(MetadataSchemaEnum.DC.getName(),"description", "abstract", subject);
}
public WorkspaceItemBuilder withType(final String type) {
return addMetadataValue(MetadataSchemaEnum.DC.getName(),"type", null, type);
}
public WorkspaceItemBuilder grantLicense() {
Item item = workspaceItem.getItem();
String license;

View File

@@ -86,6 +86,10 @@ public abstract class AInprogressItemConverter<T extends InProgressSubmission,
for (SubmissionSectionRest sections : def.getPanels()) {
SubmissionStepConfig stepConfig = submissionSectionConverter.toModel(sections);
if (stepConfig.isHiddenForInProgressSubmission(obj)) {
continue;
}
/*
* First, load the step processing class (using the current
* class loader)

View File

@@ -257,10 +257,10 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
Matchers.containsString("page=1"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=5"), Matchers.containsString("size=1"))))
Matchers.containsString("page=6"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$.page.size", is(1)))
.andExpect(jsonPath("$.page.totalElements", is(6)))
.andExpect(jsonPath("$.page.totalPages", is(6)))
.andExpect(jsonPath("$.page.totalElements", is(7)))
.andExpect(jsonPath("$.page.totalPages", is(7)))
.andExpect(jsonPath("$.page.number", is(0)));
getClient(tokenAdmin).perform(get("/api/config/submissiondefinitions")
@@ -268,7 +268,7 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
.param("page", "1"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("accessConditionNotDiscoverable")))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("test-hidden")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=0"), Matchers.containsString("size=1"))))
@@ -285,8 +285,8 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page="), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$.page.size", is(1)))
.andExpect(jsonPath("$.page.totalElements", is(6)))
.andExpect(jsonPath("$.page.totalPages", is(6)))
.andExpect(jsonPath("$.page.totalElements", is(7)))
.andExpect(jsonPath("$.page.totalPages", is(7)))
.andExpect(jsonPath("$.page.number", is(1)));
getClient(tokenAdmin).perform(get("/api/config/submissiondefinitions")
@@ -294,7 +294,7 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
.param("page", "2"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("languagetestprocess")))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("accessConditionNotDiscoverable")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=0"), Matchers.containsString("size=1"))))
@@ -309,10 +309,10 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
Matchers.containsString("page=2"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=5"), Matchers.containsString("size=1"))))
Matchers.containsString("page=6"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$.page.size", is(1)))
.andExpect(jsonPath("$.page.totalElements", is(6)))
.andExpect(jsonPath("$.page.totalPages", is(6)))
.andExpect(jsonPath("$.page.totalElements", is(7)))
.andExpect(jsonPath("$.page.totalPages", is(7)))
.andExpect(jsonPath("$.page.number", is(2)));
getClient(tokenAdmin).perform(get("/api/config/submissiondefinitions")
@@ -320,7 +320,7 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
.param("page", "3"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("qualdroptest")))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("languagetestprocess")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=0"), Matchers.containsString("size=1"))))
@@ -335,10 +335,10 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
Matchers.containsString("page=3"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=5"), Matchers.containsString("size=1"))))
Matchers.containsString("page=6"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$.page.size", is(1)))
.andExpect(jsonPath("$.page.totalElements", is(6)))
.andExpect(jsonPath("$.page.totalPages", is(6)))
.andExpect(jsonPath("$.page.totalElements", is(7)))
.andExpect(jsonPath("$.page.totalPages", is(7)))
.andExpect(jsonPath("$.page.number", is(3)));
getClient(tokenAdmin).perform(get("/api/config/submissiondefinitions")
@@ -346,7 +346,7 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
.param("page", "4"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("extractiontestprocess")))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("qualdroptest")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=0"), Matchers.containsString("size=1"))))
@@ -361,11 +361,37 @@ public class SubmissionDefinitionsControllerIT extends AbstractControllerIntegra
Matchers.containsString("page=4"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=5"), Matchers.containsString("size=1"))))
Matchers.containsString("page=6"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$.page.size", is(1)))
.andExpect(jsonPath("$.page.totalElements", is(6)))
.andExpect(jsonPath("$.page.totalPages", is(6)))
.andExpect(jsonPath("$.page.totalElements", is(7)))
.andExpect(jsonPath("$.page.totalPages", is(7)))
.andExpect(jsonPath("$.page.number", is(4)));
getClient(tokenAdmin).perform(get("/api/config/submissiondefinitions")
.param("size", "1")
.param("page", "5"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissiondefinitions[0].id", is("extractiontestprocess")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=0"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.prev.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=4"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.next.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=6"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.self.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=5"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissiondefinitions?"),
Matchers.containsString("page=6"), Matchers.containsString("size=1"))))
.andExpect(jsonPath("$.page.size", is(1)))
.andExpect(jsonPath("$.page.totalElements", is(7)))
.andExpect(jsonPath("$.page.totalPages", is(7)))
.andExpect(jsonPath("$.page.number", is(5)));
}
}

View File

@@ -67,13 +67,13 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
.andExpect(content().contentType(contentType))
//The configuration file for the test env includes 6 forms
.andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(8)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(1)))
.andExpect(jsonPath("$.page.number", is(0)))
.andExpect(
jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL + "config/submissionforms")))
//The array of submissionforms should have a size of 8
.andExpect(jsonPath("$._embedded.submissionforms", hasSize(equalTo(8))))
.andExpect(jsonPath("$._embedded.submissionforms", hasSize(equalTo(10))))
;
}
@@ -84,12 +84,12 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", equalTo(8)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(1)))
.andExpect(jsonPath("$.page.number", is(0)))
.andExpect(jsonPath("$._links.self.href", Matchers.startsWith(REST_SERVER_URL
+ "config/submissionforms")))
.andExpect(jsonPath("$._embedded.submissionforms", hasSize(equalTo(8))));
.andExpect(jsonPath("$._embedded.submissionforms", hasSize(equalTo(10))));
}
@Test
@@ -696,10 +696,10 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
Matchers.containsString("page=1"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(8)))
.andExpect(jsonPath("$.page.totalPages", equalTo(4)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.number", is(0)));
getClient(tokenAdmin).perform(get("/api/config/submissionforms")
@@ -707,8 +707,8 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
.param("page", "1"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("languagetest")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("qualdroptest")))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("test-outside-workflow-hidden")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("languagetest")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
@@ -723,10 +723,10 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
Matchers.containsString("page=2"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(8)))
.andExpect(jsonPath("$.page.totalPages", equalTo(4)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.number", is(1)));
getClient(tokenAdmin).perform(get("/api/config/submissionforms")
@@ -734,8 +734,8 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
.param("page", "2"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("traditionalpagetwo")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("sampleauthority")))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("test-outside-submission-hidden")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("qualdroptest")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
@@ -747,10 +747,10 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
Matchers.containsString("page=2"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(8)))
.andExpect(jsonPath("$.page.totalPages", equalTo(4)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.number", is(2)));
getClient(tokenAdmin).perform(get("/api/config/submissionforms")
@@ -758,7 +758,8 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
.param("page", "3"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("traditionalpageone")))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("traditionalpagetwo")))
.andExpect(jsonPath("$._embedded.submissionforms[1].id", is("sampleauthority")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
@@ -770,10 +771,33 @@ public class SubmissionFormsControllerIT extends AbstractControllerIntegrationTe
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(8)))
.andExpect(jsonPath("$.page.totalPages", equalTo(4)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.number", is(3)));
getClient(tokenAdmin).perform(get("/api/config/submissionforms")
.param("size", "2")
.param("page", "4"))
.andExpect(status().isOk())
.andExpect(content().contentType(contentType))
.andExpect(jsonPath("$._embedded.submissionforms[0].id", is("traditionalpageone")))
.andExpect(jsonPath("$._links.first.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=0"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.prev.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=3"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.self.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$._links.last.href", Matchers.allOf(
Matchers.containsString("/api/config/submissionforms?"),
Matchers.containsString("page=4"), Matchers.containsString("size=2"))))
.andExpect(jsonPath("$.page.size", is(2)))
.andExpect(jsonPath("$.page.totalElements", equalTo(10)))
.andExpect(jsonPath("$.page.totalPages", equalTo(5)))
.andExpect(jsonPath("$.page.number", is(4)));
}
}

View File

@@ -2122,4 +2122,35 @@ public class WorkflowItemRestRepositoryIT extends AbstractControllerIntegrationT
WorkflowItemBuilder.deleteWorkflowItem(idRef.get());
}
}
@Test
public void testWorkflowWithHiddenSections() throws Exception {
context.turnOffAuthorisationSystem();
parentCommunity = CommunityBuilder.createCommunity(context)
.withName("Parent Community")
.build();
Collection collection = CollectionBuilder.createCollection(context, parentCommunity, "123456789/test-hidden")
.withName("Collection 1")
.withWorkflowGroup(1, eperson)
.build();
XmlWorkflowItem workflowItem = WorkflowItemBuilder.createWorkflowItem(context, collection)
.withTitle("Workflow Item")
.build();
context.restoreAuthSystemState();
getClient(getAuthToken(admin.getEmail(), password))
.perform(get("/api/workflow/workflowitems/" + workflowItem.getID()))
.andExpect(status().isOk())
.andExpect(jsonPath("$.sections.test-outside-workflow-hidden").exists())
.andExpect(jsonPath("$.sections.test-outside-submission-hidden").doesNotExist())
.andExpect(jsonPath("$.sections.test-never-hidden").exists())
.andExpect(jsonPath("$.sections.test-always-hidden").doesNotExist());
}
}

View File

@@ -8566,4 +8566,41 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
)));
}
@Test
public void testSubmissionWithHiddenSections() throws Exception {
context.turnOffAuthorisationSystem();
parentCommunity = CommunityBuilder.createCommunity(context)
.withName("Parent Community")
.build();
Collection collection = CollectionBuilder.createCollection(context, parentCommunity, "123456789/test-hidden")
.withName("Collection 1")
.build();
WorkspaceItem workspaceItem = WorkspaceItemBuilder.createWorkspaceItem(context, collection)
.withTitle("Workspace Item")
.withIssueDate("2023-01-01")
.withType("book")
.build();
context.restoreAuthSystemState();
String adminToken = getAuthToken(admin.getEmail(), password);
getClient(adminToken)
.perform(get("/api/submission/workspaceitems/" + workspaceItem.getID()))
.andExpect(status().isOk())
.andExpect(jsonPath("$.sections.test-outside-workflow-hidden").doesNotExist())
.andExpect(jsonPath("$.sections.test-outside-submission-hidden").exists())
.andExpect(jsonPath("$.sections.test-never-hidden").exists())
.andExpect(jsonPath("$.sections.test-always-hidden").doesNotExist());
// Deposit the item
getClient(adminToken).perform(post("/api/workflow/workflowitems")
.content("/api/submission/workspaceitems/" + workspaceItem.getID())
.contentType(textUriContentType))
.andExpect(status().isCreated());
}
}

View File

@@ -79,7 +79,6 @@
<heading></heading>
<processing-class>org.dspace.app.rest.submit.step.CollectionStep</processing-class>
<type>collection</type>
<scope visibility="hidden" visibilityOutside="hidden">submission</scope>
</step-definition>
<!-- The following set of DescribeStep <step-definition>s all point to forms (of the same name) which are