mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Merge remote-tracking branch 'upstream/main' into w2p-117126_automated-discovery-test-latest-main
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.app.mediafilter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -37,8 +38,9 @@ import org.dspace.utils.DSpace;
|
||||
* MFM: -v verbose outputs all extracted text to STDOUT; -f force forces all
|
||||
* bitstreams to be processed, even if they have been before; -n noindex does not
|
||||
* recreate index after processing bitstreams; -i [identifier] limits processing
|
||||
* scope to a community, collection or item; and -m [max] limits processing to a
|
||||
* maximum number of items.
|
||||
* scope to a community, collection or item; -m [max] limits processing to a
|
||||
* maximum number of items; -fd [fromdate] takes only items starting from this date,
|
||||
* filtering by last_modified in the item table.
|
||||
*/
|
||||
public class MediaFilterScript extends DSpaceRunnable<MediaFilterScriptConfiguration> {
|
||||
|
||||
@@ -60,6 +62,7 @@ public class MediaFilterScript extends DSpaceRunnable<MediaFilterScriptConfigura
|
||||
private String[] filterNames;
|
||||
private String[] skipIds = null;
|
||||
private Map<String, List<String>> filterFormats = new HashMap<>();
|
||||
private LocalDate fromDate = null;
|
||||
|
||||
public MediaFilterScriptConfiguration getScriptConfiguration() {
|
||||
return new DSpace().getServiceManager()
|
||||
@@ -112,6 +115,10 @@ public class MediaFilterScript extends DSpaceRunnable<MediaFilterScriptConfigura
|
||||
skipIds = commandLine.getOptionValues('s');
|
||||
}
|
||||
|
||||
if (commandLine.hasOption('d')) {
|
||||
fromDate = LocalDate.parse(commandLine.getOptionValue('d'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -215,6 +222,10 @@ public class MediaFilterScript extends DSpaceRunnable<MediaFilterScriptConfigura
|
||||
mediaFilterService.setSkipList(Arrays.asList(skipIds));
|
||||
}
|
||||
|
||||
if (fromDate != null) {
|
||||
mediaFilterService.setFromDate(fromDate);
|
||||
}
|
||||
|
||||
Context c = null;
|
||||
|
||||
try {
|
||||
|
@@ -52,6 +52,8 @@ public class MediaFilterScriptConfiguration<T extends MediaFilterScript> extends
|
||||
.build();
|
||||
options.addOption(pluginOption);
|
||||
|
||||
options.addOption("d", "fromdate", true, "Process only item from specified last modified date");
|
||||
|
||||
Option skipOption = Option.builder("s")
|
||||
.longOpt("skip")
|
||||
.hasArg()
|
||||
|
@@ -9,8 +9,11 @@ package org.dspace.app.mediafilter;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -93,6 +96,7 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
|
||||
protected boolean isVerbose = false;
|
||||
protected boolean isQuiet = false;
|
||||
protected boolean isForce = false; // default to not forced
|
||||
protected LocalDate fromDate = null;
|
||||
|
||||
protected MediaFilterServiceImpl() {
|
||||
|
||||
@@ -120,6 +124,15 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
|
||||
for (Community topLevelCommunity : topLevelCommunities) {
|
||||
applyFiltersCommunity(context, topLevelCommunity);
|
||||
}
|
||||
} else if (fromDate != null) {
|
||||
Iterator<Item> itemIterator =
|
||||
itemService.findByLastModifiedSince(
|
||||
context,
|
||||
Date.from(fromDate.atStartOfDay(ZoneId.systemDefault()).toInstant())
|
||||
);
|
||||
while (itemIterator.hasNext() && processed < max2Process) {
|
||||
applyFiltersItem(context, itemIterator.next());
|
||||
}
|
||||
} else {
|
||||
//otherwise, just find every item and process
|
||||
Iterator<Item> itemIterator = itemService.findAll(context);
|
||||
@@ -588,4 +601,9 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
|
||||
public void setLogHandler(DSpaceRunnableHandler handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFromDate(LocalDate fromDate) {
|
||||
this.fromDate = fromDate;
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package org.dspace.app.mediafilter.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -149,4 +150,6 @@ public interface MediaFilterService {
|
||||
* @param handler
|
||||
*/
|
||||
public void setLogHandler(DSpaceRunnableHandler handler);
|
||||
|
||||
public void setFromDate(LocalDate fromDate);
|
||||
}
|
||||
|
@@ -441,7 +441,7 @@ public class ItemDAOImpl extends AbstractHibernateDSODAO<Item> implements ItemDA
|
||||
public Iterator<Item> findByLastModifiedSince(Context context, Date since)
|
||||
throws SQLException {
|
||||
Query query = createQuery(context,
|
||||
"SELECT i.id FROM Item i WHERE last_modified > :last_modified ORDER BY id");
|
||||
"SELECT i.id FROM Item i WHERE lastModified > :last_modified ORDER BY id");
|
||||
query.setParameter("last_modified", since, TemporalType.TIMESTAMP);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<UUID> uuids = query.getResultList();
|
||||
|
@@ -140,13 +140,14 @@ public class XmlWorkflowCuratorServiceImpl
|
||||
item.setOwningCollection(wfi.getCollection());
|
||||
for (Task task : step.tasks) {
|
||||
curator.addTask(task.name);
|
||||
// Check whether the task is configured to be queued rather than automatically run
|
||||
if (StringUtils.isNotEmpty(step.queue)) {
|
||||
// queue attribute has been set in the FlowStep configuration: add task to configured queue
|
||||
curator.queue(c, item.getID().toString(), step.queue);
|
||||
} else {
|
||||
// Task is configured to be run automatically
|
||||
curator.curate(c, item);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(step.queue)) { // Step's tasks are to be queued.
|
||||
curator.queue(c, item.getID().toString(), step.queue);
|
||||
} else { // Step's tasks are to be run now.
|
||||
curator.curate(c, item);
|
||||
|
||||
for (Task task : step.tasks) {
|
||||
int status = curator.getStatus(task.name);
|
||||
String result = curator.getResult(task.name);
|
||||
String action = "none";
|
||||
@@ -183,14 +184,14 @@ public class XmlWorkflowCuratorServiceImpl
|
||||
}
|
||||
}
|
||||
curator.clear();
|
||||
}
|
||||
|
||||
// Record any reporting done by the tasks.
|
||||
if (reporter.length() > 0) {
|
||||
LOG.info("Curation tasks over item {} for step {} report:%n{}",
|
||||
() -> wfi.getItem().getID(),
|
||||
() -> step.step,
|
||||
() -> reporter.toString());
|
||||
// Record any reporting done by the tasks.
|
||||
if (reporter.length() > 0) {
|
||||
LOG.info("Curation tasks over item {} for step {} report:\n{}",
|
||||
() -> wfi.getItem().getID(),
|
||||
() -> step.step,
|
||||
() -> reporter.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@@ -20,6 +20,8 @@
|
||||
* </dl>
|
||||
*
|
||||
* <p>Curation requests may be run immediately or queued for batch processing.
|
||||
* See {@link TaskQueue} and its relatives, {@link Curation} and its relatives
|
||||
* for more on queued curation.
|
||||
*
|
||||
* <p>Tasks may also be attached to a workflow step, so that a set of tasks is
|
||||
* applied to each uninstalled Item which passes through that step. See
|
||||
@@ -27,5 +29,15 @@
|
||||
*
|
||||
* <p>A task may return to the Curator a status code, a final status message,
|
||||
* and an optional report character stream.
|
||||
*
|
||||
* <p>The {@link Reporter} classes absorb strings of text and preserve it in
|
||||
* various ways. A Reporter is a simple {@link Appendable} and makes no
|
||||
* assumptions about e.g. whether a string represents a complete line. If you
|
||||
* want your report formatted, insert appropriate newlines and other whitespace
|
||||
* as needed. Your tasks can emit marked-up text if you wish, but the stock
|
||||
* Reporter implementations make no attempt to render it.
|
||||
*
|
||||
* <p>Tasks may be annotated to inform the Curator of special properties. See
|
||||
* {@link Distributive}, {@link Mutative}, {@link Suspendable} etc.
|
||||
*/
|
||||
package org.dspace.curate;
|
||||
|
@@ -27,6 +27,7 @@ import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.indexobject.IndexableCollection;
|
||||
import org.dspace.discovery.indexobject.IndexableCommunity;
|
||||
@@ -109,7 +110,7 @@ public class IndexClient extends DSpaceRunnable<IndexDiscoveryScriptConfiguratio
|
||||
.getHandleService().resolveToObject(context, param);
|
||||
if (dso != null) {
|
||||
final IndexFactory indexableObjectService = IndexObjectFactoryFactory.getInstance().
|
||||
getIndexFactoryByType(String.valueOf(dso.getType()));
|
||||
getIndexFactoryByType(Constants.typeText[dso.getType()]);
|
||||
indexableObject = indexableObjectService.findIndexableObject(context, dso.getID().toString());
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,10 @@
|
||||
*/
|
||||
package org.dspace.identifier.doi;
|
||||
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.DOI_ELEMENT;
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.DOI_QUALIFIER;
|
||||
import static org.dspace.identifier.DOIIdentifierProvider.MD_SCHEMA;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -15,6 +19,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.StatusLine;
|
||||
@@ -383,6 +388,10 @@ public class DataCiteConnector
|
||||
parameters.put("hostinginstitution",
|
||||
configurationService.getProperty(CFG_HOSTINGINSTITUTION));
|
||||
}
|
||||
parameters.put("mdSchema", MD_SCHEMA);
|
||||
parameters.put("mdElement", DOI_ELEMENT);
|
||||
// Pass an empty string for qualifier if the metadata field doesn't have any
|
||||
parameters.put("mdQualifier", DOI_QUALIFIER);
|
||||
|
||||
Element root = null;
|
||||
try {
|
||||
@@ -410,7 +419,7 @@ public class DataCiteConnector
|
||||
}
|
||||
|
||||
String metadataDOI = extractDOI(root);
|
||||
if (null == metadataDOI) {
|
||||
if (StringUtils.isBlank(metadataDOI)) {
|
||||
// The DOI will be saved as metadata of dso after successful
|
||||
// registration. To register a doi it has to be part of the metadata
|
||||
// sent to DataCite. So we add it to the XML we'll send to DataCite
|
||||
|
@@ -42,8 +42,8 @@ public class CrossRefAuthorMetadataProcessor implements JsonPathMetadataProcesso
|
||||
JsonNode author = authors.next();
|
||||
String givenName = author.at("/given").textValue();
|
||||
String familyName = author.at("/family").textValue();
|
||||
if (StringUtils.isNoneBlank(givenName) && StringUtils.isNoneBlank(familyName)) {
|
||||
values.add(givenName + " " + familyName);
|
||||
if (StringUtils.isNotBlank(givenName) && StringUtils.isNotBlank(familyName)) {
|
||||
values.add(familyName.trim() + ", " + givenName.trim());
|
||||
}
|
||||
}
|
||||
return values;
|
||||
@@ -64,4 +64,4 @@ public class CrossRefAuthorMetadataProcessor implements JsonPathMetadataProcesso
|
||||
this.pathToArray = pathToArray;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ import org.jdom2.xpath.XPathFactory;
|
||||
* This contributor is able to concat multi value.
|
||||
* Given a certain path, if it contains several nodes,
|
||||
* the values of nodes will be concatenated into a single one.
|
||||
* The concrete example we can see in the file wos-responce.xml in the <abstract_text> node,
|
||||
* The concrete example we can see in the file wos-response.xml in the <abstract_text> node,
|
||||
* which may contain several <p> paragraphs,
|
||||
* this Contributor allows concatenating all <p> paragraphs. to obtain a single one.
|
||||
*
|
||||
|
@@ -50,8 +50,6 @@ metadata.bitstream.iiif-virtual.mimetype = Mime Type
|
||||
metadata.bitstream.iiif-virtual.bytes = File size
|
||||
metadata.bitstream.iiif-virtual.checksum = Checksum
|
||||
|
||||
org.dspace.app.itemexport.no-result = The DSpaceObject that you specified has no items.
|
||||
org.dspace.app.util.SyndicationFeed.no-description = No Description
|
||||
org.dspace.checker.ResultsLogger.bitstream-format = Bitstream format
|
||||
org.dspace.checker.ResultsLogger.bitstream-found = Bitstream found
|
||||
org.dspace.checker.ResultsLogger.bitstream-id = Bitstream ID
|
||||
@@ -99,9 +97,9 @@ org.dspace.checker.SimpleReporterImpl.result
|
||||
org.dspace.checker.SimpleReporterImpl.size = Size
|
||||
org.dspace.checker.SimpleReporterImpl.source = Source
|
||||
org.dspace.checker.SimpleReporterImpl.store-number = Store Number
|
||||
org.dspace.checker.SimpleReporterImpl.unchecked-bitstream-report = The following is a UN-CHECKED BITSTREAM REPORT report for
|
||||
org.dspace.checker.SimpleReporterImpl.unchecked-bitstream-report = The following is a UN-CHECKED BITSTREAM report for
|
||||
|
||||
org.dspace.content.untitled = Untitled
|
||||
org.dspace.eperson.X509Authentication.title = Enter DSpace using Web Certificate
|
||||
org.dspace.eperson.Subscribe.authors = Authors:
|
||||
org.dspace.eperson.Subscribe.id = ID:
|
||||
org.dspace.eperson.Subscribe.new-items = New Items:
|
||||
@@ -109,11 +107,10 @@ org.dspace.eperson.Subscribe.title
|
||||
org.dspace.statistics.util.LocationUtils.unknown-continent = Unknown Continent
|
||||
org.dspace.statistics.util.LocationUtils.unknown-country = Unknown Country
|
||||
org.dspace.xmlworkflow.XMLWorkflowService.untitled = Untitled
|
||||
# used by discovery (standard sort index <metadata>_sort)
|
||||
search.sort-by.dc.title_sort = Title
|
||||
# used by discovery (date sort index <metadata>_dt)
|
||||
search.sort-by.dc.date.issued_dt = Issue Date
|
||||
|
||||
org.dspace.app.itemexport.no-result = The DSpace object that you specified has no items.
|
||||
org.dspace.app.requestitem.RequestItemHelpdeskStrategy.helpdeskname = Help Desk
|
||||
org.dspace.app.util.SyndicationFeed.no-description = No Description
|
||||
|
||||
# User exposed REST API error messages
|
||||
org.dspace.app.rest.exception.RESTEmptyWorkflowGroupException.message = Refused to delete user {0} because it is the only member of the \
|
||||
|
@@ -23,11 +23,12 @@ import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.AbstractIntegrationTest;
|
||||
import org.dspace.AbstractIntegrationTestWithDatabase;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.builder.CollectionBuilder;
|
||||
import org.dspace.builder.CommunityBuilder;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
@@ -38,7 +39,6 @@ import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xmlunit.builder.DiffBuilder;
|
||||
import org.xmlunit.diff.Comparison;
|
||||
import org.xmlunit.diff.ComparisonFormatter;
|
||||
@@ -52,7 +52,7 @@ import org.xmlunit.diff.Difference;
|
||||
* @author Mark H. Wood <mwood@iupui.edu>
|
||||
*/
|
||||
public class StructBuilderIT
|
||||
extends AbstractIntegrationTest {
|
||||
extends AbstractIntegrationTestWithDatabase {
|
||||
private static final Logger log = LogManager.getLogger();
|
||||
|
||||
private static final CommunityService communityService
|
||||
@@ -79,7 +79,8 @@ public class StructBuilderIT
|
||||
* @throws IOException passed through.
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws SQLException, AuthorizeException, IOException {
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
// Clear out all communities and collections.
|
||||
context.turnOffAuthorisationSystem();
|
||||
for (Community community : communityService.findAllTop(context)) {
|
||||
@@ -285,19 +286,15 @@ public class StructBuilderIT
|
||||
* @throws org.dspace.authorize.AuthorizeException passed through.
|
||||
*/
|
||||
@Test
|
||||
public void testExportStructure()
|
||||
throws ParserConfigurationException, SAXException, IOException,
|
||||
SQLException, AuthorizeException {
|
||||
public void testExportStructure() {
|
||||
// Create some structure to test.
|
||||
context.turnOffAuthorisationSystem();
|
||||
Community community0 = communityService.create(null, context);
|
||||
communityService.setMetadataSingleValue(context, community0,
|
||||
MetadataSchemaEnum.DC.getName(), "title", null,
|
||||
null, "Top Community 0");
|
||||
Collection collection0_0 = collectionService.create(context, community0);
|
||||
collectionService.setMetadataSingleValue(context, collection0_0,
|
||||
MetadataSchemaEnum.DC.getName(), "title", null,
|
||||
null, "Collection 0.0");
|
||||
// Top level community
|
||||
Community community0 = CommunityBuilder.createCommunity(context)
|
||||
.withName("Top Community 0").build();
|
||||
// Collection below top level community
|
||||
Collection collection0_0 = CollectionBuilder.createCollection(context, community0)
|
||||
.withName("Collection 0.0").build();
|
||||
|
||||
// Export the current structure.
|
||||
System.out.println("exportStructure");
|
||||
|
@@ -24,6 +24,7 @@ import org.dspace.AbstractIntegrationTestWithDatabase;
|
||||
import org.dspace.builder.CollectionBuilder;
|
||||
import org.dspace.builder.CommunityBuilder;
|
||||
import org.dspace.builder.ItemBuilder;
|
||||
import org.dspace.builder.WorkspaceItemBuilder;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.Item;
|
||||
@@ -159,7 +160,7 @@ public class PackagerIT extends AbstractIntegrationTestWithDatabase {
|
||||
performExportScript(article.getHandle(), tempFile);
|
||||
UUID id = article.getID();
|
||||
itemService.delete(context, article);
|
||||
WorkspaceItem workspaceItem = workspaceItemService.create(context, col1, id, false, false);
|
||||
WorkspaceItem workspaceItem = WorkspaceItemBuilder.createWorkspaceItem(context, col1, id).build();
|
||||
installItemService.installItem(context, workspaceItem, "123456789/0100");
|
||||
performImportNoForceScript(tempFile);
|
||||
Iterator<Item> items = itemService.findByCollection(context, col1);
|
||||
|
@@ -12,6 +12,9 @@ import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.service.DSpaceObjectService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
@@ -51,6 +54,33 @@ public class GroupBuilder extends AbstractDSpaceObjectBuilder<Group> {
|
||||
return builder.create(context);
|
||||
}
|
||||
|
||||
public static GroupBuilder createCollectionAdminGroup(final Context context, Collection collection) {
|
||||
GroupBuilder builder = new GroupBuilder(context);
|
||||
return builder.createAdminGroup(context, collection);
|
||||
}
|
||||
|
||||
public static GroupBuilder createCollectionSubmitterGroup(final Context context, Collection collection) {
|
||||
GroupBuilder builder = new GroupBuilder(context);
|
||||
return builder.createSubmitterGroup(context, collection);
|
||||
}
|
||||
|
||||
public static GroupBuilder createCollectionDefaultReadGroup(final Context context, Collection collection,
|
||||
String typeOfGroupString, int defaultRead) {
|
||||
GroupBuilder builder = new GroupBuilder(context);
|
||||
return builder.createDefaultReadGroup(context, collection, typeOfGroupString, defaultRead);
|
||||
}
|
||||
|
||||
public static GroupBuilder createCollectionWorkflowRoleGroup(final Context context, Collection collection,
|
||||
String roleName) {
|
||||
GroupBuilder builder = new GroupBuilder(context);
|
||||
return builder.createWorkflowRoleGroup(context, collection, roleName);
|
||||
}
|
||||
|
||||
public static GroupBuilder createCommunityAdminGroup(final Context context, Community community) {
|
||||
GroupBuilder builder = new GroupBuilder(context);
|
||||
return builder.createAdminGroup(context, community);
|
||||
}
|
||||
|
||||
private GroupBuilder create(final Context context) {
|
||||
this.context = context;
|
||||
try {
|
||||
@@ -61,6 +91,54 @@ public class GroupBuilder extends AbstractDSpaceObjectBuilder<Group> {
|
||||
return this;
|
||||
}
|
||||
|
||||
private GroupBuilder createAdminGroup(final Context context, DSpaceObject container) {
|
||||
this.context = context;
|
||||
try {
|
||||
if (container instanceof Collection) {
|
||||
group = collectionService.createAdministrators(context, (Collection) container);
|
||||
} else if (container instanceof Community) {
|
||||
group = communityService.createAdministrators(context, (Community) container);
|
||||
} else {
|
||||
handleException(new IllegalArgumentException("DSpaceObject must be collection or community. " +
|
||||
"Type: " + container.getType()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return handleException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private GroupBuilder createSubmitterGroup(final Context context, Collection collection) {
|
||||
this.context = context;
|
||||
try {
|
||||
group = collectionService.createSubmitters(context, collection);
|
||||
} catch (Exception e) {
|
||||
return handleException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private GroupBuilder createDefaultReadGroup(final Context context, Collection collection,
|
||||
String typeOfGroupString, int defaultRead) {
|
||||
this.context = context;
|
||||
try {
|
||||
group = collectionService.createDefaultReadGroup(context, collection, typeOfGroupString, defaultRead);
|
||||
} catch (Exception e) {
|
||||
return handleException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private GroupBuilder createWorkflowRoleGroup(final Context context, Collection collection, String roleName) {
|
||||
this.context = context;
|
||||
try {
|
||||
group = workflowService.createWorkflowRoleGroup(context, collection, roleName);
|
||||
} catch (Exception e) {
|
||||
return handleException(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DSpaceObjectService<Group> getService() {
|
||||
return groupService;
|
||||
|
@@ -10,6 +10,7 @@ package org.dspace.builder;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.dspace.app.ldn.NotifyPatternToTrigger;
|
||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||
@@ -43,14 +44,31 @@ public class WorkspaceItemBuilder extends AbstractBuilder<WorkspaceItem, Workspa
|
||||
|
||||
public static WorkspaceItemBuilder createWorkspaceItem(final Context context, final Collection col) {
|
||||
WorkspaceItemBuilder builder = new WorkspaceItemBuilder(context);
|
||||
return builder.create(context, col);
|
||||
return builder.create(context, col, null);
|
||||
}
|
||||
|
||||
private WorkspaceItemBuilder create(final Context context, final Collection col) {
|
||||
public static WorkspaceItemBuilder createWorkspaceItem(final Context context, final Collection col, UUID uuid) {
|
||||
WorkspaceItemBuilder builder = new WorkspaceItemBuilder(context);
|
||||
return builder.create(context, col, uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create with a specific UUID (e.g. restoring items with Packager import)
|
||||
*
|
||||
* @param context DSpace context
|
||||
* @param col Parent collection
|
||||
* @param uuid Item UUID
|
||||
* @return WorkspaceItemBuilder
|
||||
*/
|
||||
private WorkspaceItemBuilder create(final Context context, final Collection col, UUID uuid) {
|
||||
this.context = context;
|
||||
|
||||
try {
|
||||
workspaceItem = workspaceItemService.create(context, col, false);
|
||||
if (uuid == null) {
|
||||
workspaceItem = workspaceItemService.create(context, col, false);
|
||||
} else {
|
||||
workspaceItem = workspaceItemService.create(context, col, uuid, false, false);
|
||||
}
|
||||
item = workspaceItem.getItem();
|
||||
} catch (Exception e) {
|
||||
return handleException(e);
|
||||
|
@@ -49,6 +49,7 @@ import org.dspace.builder.EntityTypeBuilder;
|
||||
import org.dspace.builder.ItemBuilder;
|
||||
import org.dspace.builder.RelationshipBuilder;
|
||||
import org.dspace.builder.RelationshipTypeBuilder;
|
||||
import org.dspace.builder.VersionBuilder;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.InstallItemService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
@@ -62,8 +63,6 @@ import org.dspace.discovery.SolrSearchCore;
|
||||
import org.dspace.kernel.ServiceManager;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.versioning.Version;
|
||||
import org.dspace.versioning.factory.VersionServiceFactory;
|
||||
import org.dspace.versioning.service.VersioningService;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@@ -74,8 +73,6 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
|
||||
private final RelationshipService relationshipService =
|
||||
ContentServiceFactory.getInstance().getRelationshipService();
|
||||
private final VersioningService versioningService =
|
||||
VersionServiceFactory.getInstance().getVersionService();
|
||||
private final WorkspaceItemService workspaceItemService =
|
||||
ContentServiceFactory.getInstance().getWorkspaceItemService();
|
||||
private final InstallItemService installItemService =
|
||||
@@ -84,7 +81,6 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
ContentServiceFactory.getInstance().getItemService();
|
||||
private final SolrSearchCore solrSearchCore =
|
||||
DSpaceServicesFactory.getInstance().getServiceManager().getServicesByType(SolrSearchCore.class).get(0);
|
||||
|
||||
protected Community community;
|
||||
protected Collection collection;
|
||||
protected EntityType publicationEntityType;
|
||||
@@ -291,7 +287,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create a new version of the publication //
|
||||
/////////////////////////////////////////////
|
||||
|
||||
Version newVersion = versioningService.createNewVersion(context, originalPublication);
|
||||
Version newVersion = VersionBuilder.createVersion(context, originalPublication, "test").build();
|
||||
Item newPublication = newVersion.getItem();
|
||||
assertNotSame(originalPublication, newPublication);
|
||||
|
||||
@@ -567,7 +563,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create a new version of the publication //
|
||||
/////////////////////////////////////////////
|
||||
|
||||
Version newVersion = versioningService.createNewVersion(context, originalPublication);
|
||||
Version newVersion = VersionBuilder.createVersion(context, originalPublication, "test").build();
|
||||
Item newPublication = newVersion.getItem();
|
||||
assertNotSame(originalPublication, newPublication);
|
||||
|
||||
@@ -927,7 +923,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create a new version of the person //
|
||||
////////////////////////////////////////
|
||||
|
||||
Version newVersion = versioningService.createNewVersion(context, originalPerson);
|
||||
Version newVersion = VersionBuilder.createVersion(context, originalPerson, "test").build();
|
||||
Item newPerson = newVersion.getItem();
|
||||
assertNotSame(originalPerson, newPerson);
|
||||
|
||||
@@ -1300,7 +1296,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version of publication //
|
||||
///////////////////////////////////////
|
||||
|
||||
Version newVersion = versioningService.createNewVersion(context, originalPublication);
|
||||
Version newVersion = VersionBuilder.createVersion(context, originalPublication, "test").build();
|
||||
Item newPublication = newVersion.getItem();
|
||||
assertNotSame(originalPublication, newPublication);
|
||||
|
||||
@@ -1463,7 +1459,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create a new version of the publication //
|
||||
/////////////////////////////////////////////
|
||||
|
||||
Version newVersion = versioningService.createNewVersion(context, originalPublication);
|
||||
Version newVersion = VersionBuilder.createVersion(context, originalPublication, "test").build();
|
||||
Item newPublication = newVersion.getItem();
|
||||
assertNotSame(originalPublication, newPublication);
|
||||
|
||||
@@ -1782,7 +1778,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version - volume 1.2 //
|
||||
/////////////////////////////////////
|
||||
|
||||
Item v1_2 = versioningService.createNewVersion(context, v1_1).getItem();
|
||||
Item v1_2 = VersionBuilder.createVersion(context, v1_1, "test").build().getItem();
|
||||
installItemService.installItem(context, workspaceItemService.findByItem(context, v1_2));
|
||||
context.commit();
|
||||
|
||||
@@ -1790,7 +1786,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version - issue 3.2 //
|
||||
////////////////////////////////////
|
||||
|
||||
Item i3_2 = versioningService.createNewVersion(context, i3_1).getItem();
|
||||
Item i3_2 = VersionBuilder.createVersion(context, i3_1, "test").build().getItem();
|
||||
installItemService.installItem(context, workspaceItemService.findByItem(context, i3_2));
|
||||
context.commit();
|
||||
|
||||
@@ -2316,7 +2312,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version - person 3.2 //
|
||||
/////////////////////////////////////
|
||||
|
||||
Item pe3_2 = versioningService.createNewVersion(context, pe3_1).getItem();
|
||||
Item pe3_2 = VersionBuilder.createVersion(context, pe3_1, "test").build().getItem();
|
||||
installItemService.installItem(context, workspaceItemService.findByItem(context, pe3_2));
|
||||
context.commit();
|
||||
|
||||
@@ -2324,7 +2320,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version - project 3.2 //
|
||||
//////////////////////////////////////
|
||||
|
||||
Item pr3_2 = versioningService.createNewVersion(context, pr3_1).getItem();
|
||||
Item pr3_2 = VersionBuilder.createVersion(context, pr3_1, "test").build().getItem();
|
||||
installItemService.installItem(context, workspaceItemService.findByItem(context, pr3_2));
|
||||
context.commit();
|
||||
|
||||
@@ -3056,7 +3052,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version - volume 1.2 //
|
||||
/////////////////////////////////////
|
||||
|
||||
Item v1_2 = versioningService.createNewVersion(context, v1_1).getItem();
|
||||
Item v1_2 = VersionBuilder.createVersion(context, v1_1, "test").build().getItem();
|
||||
installItemService.installItem(context, workspaceItemService.findByItem(context, v1_2));
|
||||
context.commit();
|
||||
|
||||
@@ -3064,7 +3060,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version - issue 3.2 //
|
||||
////////////////////////////////////
|
||||
|
||||
Item i3_2 = versioningService.createNewVersion(context, i3_1).getItem();
|
||||
Item i3_2 = VersionBuilder.createVersion(context, i3_1, "test").build().getItem();
|
||||
installItemService.installItem(context, workspaceItemService.findByItem(context, i3_2));
|
||||
context.commit();
|
||||
|
||||
@@ -3509,7 +3505,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create a new version of publication 1 and archive //
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
Item publication1V2 = versioningService.createNewVersion(context, publication1V1).getItem();
|
||||
Item publication1V2 = VersionBuilder.createVersion(context, publication1V1, "test").build().getItem();
|
||||
installItemService.installItem(context, workspaceItemService.findByItem(context, publication1V2));
|
||||
context.dispatchEvents();
|
||||
|
||||
@@ -3517,7 +3513,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version of person 1 //
|
||||
////////////////////////////////////
|
||||
|
||||
Item person1V2 = versioningService.createNewVersion(context, person1V1).getItem();
|
||||
Item person1V2 = VersionBuilder.createVersion(context, person1V1, "test").build().getItem();
|
||||
// update "Smith, Donald" to "Smith, D."
|
||||
itemService.replaceMetadata(
|
||||
context, person1V2, "person", "givenName", null, null, "D.",
|
||||
@@ -3853,7 +3849,7 @@ public class VersioningWithRelationshipsIT extends AbstractIntegrationTestWithDa
|
||||
// create new version of person 2 //
|
||||
////////////////////////////////////
|
||||
|
||||
Item person2V2 = versioningService.createNewVersion(context, person2V1).getItem();
|
||||
Item person2V2 = VersionBuilder.createVersion(context, person2V1, "test").build().getItem();
|
||||
Relationship rel1 = getRelationship(publication1V2, isAuthorOfPublication, person2V2);
|
||||
assertNotNull(rel1);
|
||||
rel1.setRightwardValue("Doe, Jane Jr");
|
||||
|
@@ -10,6 +10,8 @@ package org.dspace.ctask.general;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.AbstractIntegrationTestWithDatabase;
|
||||
import org.dspace.builder.CollectionBuilder;
|
||||
@@ -19,7 +21,10 @@ import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.factory.CoreServiceFactory;
|
||||
import org.dspace.curate.Curator;
|
||||
import org.dspace.identifier.IdentifierProvider;
|
||||
import org.dspace.identifier.IdentifierServiceImpl;
|
||||
import org.dspace.identifier.VersionedHandleIdentifierProviderWithCanonicalHandles;
|
||||
import org.dspace.kernel.ServiceManager;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.junit.After;
|
||||
@@ -32,10 +37,23 @@ import org.junit.Test;
|
||||
*/
|
||||
public class CreateMissingIdentifiersIT
|
||||
extends AbstractIntegrationTestWithDatabase {
|
||||
private ServiceManager serviceManager;
|
||||
private IdentifierServiceImpl identifierService;
|
||||
private static final String P_TASK_DEF
|
||||
= "plugin.named.org.dspace.curate.CurationTask";
|
||||
private static final String TASK_NAME = "test";
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
serviceManager = DSpaceServicesFactory.getInstance().getServiceManager();
|
||||
identifierService = serviceManager.getServicesByType(IdentifierServiceImpl.class).get(0);
|
||||
// Clean out providers to avoid any being used for creation of community and collection
|
||||
identifierService.setProviders(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPerform()
|
||||
throws IOException {
|
||||
@@ -67,11 +85,7 @@ public class CreateMissingIdentifiersIT
|
||||
/*
|
||||
* Now install an incompatible provider to make the task fail.
|
||||
*/
|
||||
DSpaceServicesFactory.getInstance()
|
||||
.getServiceManager()
|
||||
.registerServiceClass(
|
||||
VersionedHandleIdentifierProviderWithCanonicalHandles.class.getCanonicalName(),
|
||||
VersionedHandleIdentifierProviderWithCanonicalHandles.class);
|
||||
registerProvider(VersionedHandleIdentifierProviderWithCanonicalHandles.class);
|
||||
|
||||
curator.curate(context, item);
|
||||
System.out.format("With incompatible provider, result is '%s'.\n",
|
||||
@@ -86,4 +100,14 @@ public class CreateMissingIdentifiersIT
|
||||
super.destroy();
|
||||
DSpaceServicesFactory.getInstance().getServiceManager().getApplicationContext().refresh();
|
||||
}
|
||||
|
||||
private void registerProvider(Class type) {
|
||||
// Register our new provider
|
||||
serviceManager.registerServiceClass(type.getName(), type);
|
||||
IdentifierProvider identifierProvider =
|
||||
(IdentifierProvider) serviceManager.getServiceByName(type.getName(), type);
|
||||
|
||||
// Overwrite the identifier-service's providers with the new one to ensure only this provider is used
|
||||
identifierService.setProviders(List.of(identifierProvider));
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.kernel.ServiceManager;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -57,13 +58,30 @@ public class VersionedHandleIdentifierProviderIT extends AbstractIntegrationTest
|
||||
.build();
|
||||
}
|
||||
|
||||
@After
|
||||
@Override
|
||||
public void destroy() throws Exception {
|
||||
super.destroy();
|
||||
// After this test has finished running, refresh application context and
|
||||
// set the expected 'default' versioned handle provider back to ensure other tests don't fail
|
||||
DSpaceServicesFactory.getInstance().getServiceManager().getApplicationContext().refresh();
|
||||
}
|
||||
|
||||
private void registerProvider(Class type) {
|
||||
// Register our new provider
|
||||
serviceManager.registerServiceClass(type.getName(), type);
|
||||
IdentifierProvider identifierProvider =
|
||||
(IdentifierProvider) serviceManager.getServiceByName(type.getName(), type);
|
||||
(IdentifierProvider) DSpaceServicesFactory.getInstance().getServiceManager()
|
||||
.getServiceByName(type.getName(), type);
|
||||
if (identifierProvider == null) {
|
||||
DSpaceServicesFactory.getInstance().getServiceManager().registerServiceClass(type.getName(), type);
|
||||
identifierProvider = (IdentifierProvider) DSpaceServicesFactory.getInstance().getServiceManager()
|
||||
.getServiceByName(type.getName(), type);
|
||||
}
|
||||
|
||||
// Overwrite the identifier-service's providers with the new one to ensure only this provider is used
|
||||
identifierService = DSpaceServicesFactory.getInstance().getServiceManager()
|
||||
.getServicesByType(IdentifierServiceImpl.class).get(0);
|
||||
identifierService.setProviders(new ArrayList<>());
|
||||
identifierService.setProviders(List.of(identifierProvider));
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ import org.dspace.builder.CollectionBuilder;
|
||||
import org.dspace.builder.CommunityBuilder;
|
||||
import org.dspace.builder.EPersonBuilder;
|
||||
import org.dspace.builder.GroupBuilder;
|
||||
import org.dspace.builder.SupervisionOrderBuilder;
|
||||
import org.dspace.builder.WorkspaceItemBuilder;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
@@ -85,10 +86,10 @@ public class SupervisionOrderServiceIT extends AbstractIntegrationTestWithDataba
|
||||
.build();
|
||||
|
||||
SupervisionOrder supervisionOrderOne =
|
||||
supervisionOrderService.create(context, item, groupA);
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, item, groupA).build();
|
||||
|
||||
SupervisionOrder supervisionOrderTwo =
|
||||
supervisionOrderService.create(context, item, groupB);
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, item, groupB).build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -136,7 +137,8 @@ public class SupervisionOrderServiceIT extends AbstractIntegrationTestWithDataba
|
||||
.build();
|
||||
|
||||
SupervisionOrder supervisionOrderOne =
|
||||
supervisionOrderService.create(context, workspaceItem.getItem(), groupA);
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, workspaceItem.getItem(), groupA)
|
||||
.build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -205,9 +207,12 @@ public class SupervisionOrderServiceIT extends AbstractIntegrationTestWithDataba
|
||||
.addMember(userB)
|
||||
.build();
|
||||
|
||||
supervisionOrderService.create(context, workspaceItem.getItem(), groupA);
|
||||
supervisionOrderService.create(context, workspaceItem.getItem(), groupB);
|
||||
supervisionOrderService.create(context, workspaceItemTwo.getItem(), groupA);
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, workspaceItem.getItem(), groupA)
|
||||
.build();
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, workspaceItem.getItem(), groupB)
|
||||
.build();
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, workspaceItemTwo.getItem(), groupA)
|
||||
.build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -259,9 +264,12 @@ public class SupervisionOrderServiceIT extends AbstractIntegrationTestWithDataba
|
||||
.addMember(eperson)
|
||||
.build();
|
||||
|
||||
supervisionOrderService.create(context, workspaceItem.getItem(), groupA);
|
||||
supervisionOrderService.create(context, workspaceItem.getItem(), groupB);
|
||||
supervisionOrderService.create(context, workspaceItemTwo.getItem(), groupA);
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, workspaceItem.getItem(), groupA)
|
||||
.build();
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, workspaceItem.getItem(), groupB)
|
||||
.build();
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, workspaceItemTwo.getItem(), groupA)
|
||||
.build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -310,7 +318,8 @@ public class SupervisionOrderServiceIT extends AbstractIntegrationTestWithDataba
|
||||
.addMember(eperson)
|
||||
.build();
|
||||
|
||||
supervisionOrderService.create(context, item, groupA);
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, item, groupA)
|
||||
.build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -370,7 +379,8 @@ public class SupervisionOrderServiceIT extends AbstractIntegrationTestWithDataba
|
||||
.addMember(userB)
|
||||
.build();
|
||||
|
||||
supervisionOrderService.create(context, workspaceItem.getItem(), groupA);
|
||||
SupervisionOrderBuilder.createSupervisionOrder(context, workspaceItem.getItem(), groupA)
|
||||
.build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
|
@@ -52,6 +52,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
@LinkRest(
|
||||
name = ItemRest.THUMBNAIL,
|
||||
method = "getThumbnail"
|
||||
),
|
||||
@LinkRest(
|
||||
name = ItemRest.SUBMITTER,
|
||||
method = "getItemSubmitter"
|
||||
)
|
||||
})
|
||||
public class ItemRest extends DSpaceObjectRest {
|
||||
@@ -69,6 +73,8 @@ public class ItemRest extends DSpaceObjectRest {
|
||||
public static final String TEMPLATE_ITEM_OF = "templateItemOf";
|
||||
public static final String THUMBNAIL = "thumbnail";
|
||||
|
||||
public static final String SUBMITTER = "submitter";
|
||||
|
||||
private boolean inArchive = false;
|
||||
private boolean discoverable = false;
|
||||
private boolean withdrawn = false;
|
||||
|
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 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.app.rest.repository;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.dspace.app.rest.model.EPersonRest;
|
||||
import org.dspace.app.rest.model.ItemRest;
|
||||
import org.dspace.app.rest.projection.Projection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Context;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Link repository for "submitter" subresource of an item.
|
||||
*/
|
||||
@Component(ItemRest.CATEGORY + "." + ItemRest.PLURAL_NAME + "." + ItemRest.SUBMITTER)
|
||||
public class ItemSubmitterLinkRepository extends AbstractDSpaceRestRepository
|
||||
implements LinkRestRepository {
|
||||
|
||||
@Autowired
|
||||
ItemService itemService;
|
||||
|
||||
/**
|
||||
* Retrieve the submitter for an item.
|
||||
*
|
||||
* @param request - The current request
|
||||
* @param id - The item ID for which to retrieve the submitter
|
||||
* @param optionalPageable - optional pageable object
|
||||
* @param projection - the current projection
|
||||
* @return the submitter for the item
|
||||
*/
|
||||
@PreAuthorize("hasPermission(#id, 'ITEM', 'READ')")
|
||||
public EPersonRest getItemSubmitter(@Nullable HttpServletRequest request, UUID id,
|
||||
@Nullable Pageable optionalPageable, Projection projection) {
|
||||
try {
|
||||
Context context = obtainContext();
|
||||
Item item = itemService.find(context, id);
|
||||
if (item == null) {
|
||||
throw new ResourceNotFoundException("No such item: " + id);
|
||||
}
|
||||
|
||||
return converter.toRest(item.getSubmitter(), projection);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@@ -12,15 +12,17 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.validator.routines.EmailValidator;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -287,19 +289,24 @@ public class RequestItemRepository
|
||||
* Generate a link back to DSpace, to act on a request.
|
||||
*
|
||||
* @param token identifies the request.
|
||||
* @return URL to the item request API, with the token as request parameter
|
||||
* "token".
|
||||
* @return URL to the item request API, with /request-a-copy/{token} as the last URL segments
|
||||
* @throws URISyntaxException passed through.
|
||||
* @throws MalformedURLException passed through.
|
||||
*/
|
||||
private String getLinkTokenEmail(String token)
|
||||
public String getLinkTokenEmail(String token)
|
||||
throws URISyntaxException, MalformedURLException {
|
||||
final String base = configurationService.getProperty("dspace.ui.url");
|
||||
|
||||
URI link = new URIBuilder(base)
|
||||
.setPathSegments("request-a-copy", token)
|
||||
.build();
|
||||
// Construct the link, making sure to support sub-paths
|
||||
URIBuilder uriBuilder = new URIBuilder(base);
|
||||
List<String> segments = new LinkedList<>();
|
||||
if (StringUtils.isNotBlank(uriBuilder.getPath())) {
|
||||
segments.add(StringUtils.strip(uriBuilder.getPath(), "/"));
|
||||
}
|
||||
segments.add("request-a-copy");
|
||||
segments.add(token);
|
||||
|
||||
return link.toURL().toExternalForm();
|
||||
// Build and return the URL from segments (or throw exception)
|
||||
return uriBuilder.setPathSegments(segments).build().toURL().toExternalForm();
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* 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.app.rest.submit.step.validation;
|
||||
|
||||
import static org.dspace.app.rest.repository.WorkspaceItemRestRepository.OPERATION_PATH_SECTIONS;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.dspace.app.rest.model.ErrorRest;
|
||||
import org.dspace.app.rest.submit.SubmissionService;
|
||||
import org.dspace.app.util.DCInputsReaderException;
|
||||
import org.dspace.app.util.SubmissionStepConfig;
|
||||
import org.dspace.content.InProgressSubmission;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.license.CreativeCommonsServiceImpl;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* This class validates that the Creative Commons License has been granted for the
|
||||
* in-progress submission.
|
||||
*
|
||||
* @author Mattia Vianelli (Mattia.Vianelli@4science.com)
|
||||
*/
|
||||
public class CclicenseValidator extends AbstractValidation {
|
||||
|
||||
/**
|
||||
* Construct a Creative Commons License configuration.
|
||||
* @param configurationService DSpace configuration provided by the DI container.
|
||||
*/
|
||||
@Inject
|
||||
public CclicenseValidator(ConfigurationService configurationService) {
|
||||
this.configurationService = configurationService;
|
||||
}
|
||||
|
||||
private final ConfigurationService configurationService;
|
||||
|
||||
@Autowired
|
||||
private ItemService itemService;
|
||||
|
||||
@Autowired
|
||||
private CreativeCommonsServiceImpl creativeCommonsService;
|
||||
|
||||
public static final String ERROR_VALIDATION_CCLICENSEREQUIRED = "error.validation.cclicense.required";
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Validate the license of the item.
|
||||
* @param item The item whose cclicense is to be validated.
|
||||
* @param config The configuration for the submission step for cclicense.
|
||||
* @return A list of validation errors.
|
||||
*/
|
||||
private List<ErrorRest> validateLicense(Item item, SubmissionStepConfig config) {
|
||||
List<ErrorRest> errors = new ArrayList<>(1);
|
||||
|
||||
String licenseURI = creativeCommonsService.getLicenseURI(item);
|
||||
if (licenseURI == null || licenseURI.isBlank()) {
|
||||
addError(errors, ERROR_VALIDATION_CCLICENSEREQUIRED, "/" + OPERATION_PATH_SECTIONS + "/" + config.getId());
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
public ItemService getItemService() {
|
||||
return itemService;
|
||||
}
|
||||
|
||||
public void setItemService(ItemService itemService) {
|
||||
this.itemService = itemService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if at least one Creative Commons License is required when submitting a new Item.
|
||||
* @return true if a Creative Commons License is required setting true for the property cc.license.required.
|
||||
*/
|
||||
public Boolean isRequired() {
|
||||
return configurationService.getBooleanProperty("cc.license.required", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform validation on the item and config(ccLicense).
|
||||
* @param obj The submission to be validated.
|
||||
* @param config The configuration for the submission step for cclicense.
|
||||
* @return A list of validation errors.
|
||||
* @throws SQLException If there is a problem accessing the database.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public List<? extends ErrorRest> validate(SubmissionService submissionService,
|
||||
InProgressSubmission obj,
|
||||
SubmissionStepConfig config)
|
||||
throws DCInputsReaderException, SQLException {
|
||||
|
||||
if (this.isRequired() && obj != null && obj.getItem() != null) {
|
||||
return validateLicense(obj.getItem(), config);
|
||||
} else {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
@@ -27,6 +27,11 @@
|
||||
<property name="uploadConfigurationService" ref="uploadConfigurationService"/>
|
||||
</bean>
|
||||
|
||||
<bean name="cclicenseValidation" class="org.dspace.app.rest.submit.step.validation.CclicenseValidator">
|
||||
<property name="itemService" ref="org.dspace.content.ItemServiceImpl"/>
|
||||
<property name="name" value="cclicense"/>
|
||||
</bean>
|
||||
|
||||
<bean name="licenseValidation" class="org.dspace.app.rest.submit.step.validation.LicenseValidation">
|
||||
<property name="name" value="license"/>
|
||||
</bean>
|
||||
|
@@ -50,6 +50,7 @@ import org.dspace.builder.BundleBuilder;
|
||||
import org.dspace.builder.CollectionBuilder;
|
||||
import org.dspace.builder.CommunityBuilder;
|
||||
import org.dspace.builder.EPersonBuilder;
|
||||
import org.dspace.builder.GroupBuilder;
|
||||
import org.dspace.builder.ItemBuilder;
|
||||
import org.dspace.builder.ResourcePolicyBuilder;
|
||||
import org.dspace.content.Bitstream;
|
||||
@@ -2768,10 +2769,12 @@ public class BitstreamRestRepositoryIT extends AbstractControllerIntegrationTest
|
||||
.withEmail("col2admin@test.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
Group col1_AdminGroup = collectionService.createAdministrators(context, col1);
|
||||
Group col2_AdminGroup = collectionService.createAdministrators(context, col2);
|
||||
groupService.addMember(context, col1_AdminGroup, col1Admin);
|
||||
groupService.addMember(context, col2_AdminGroup, col2Admin);
|
||||
Group col1_AdminGroup = GroupBuilder.createCollectionAdminGroup(context, col1)
|
||||
.addMember(col1Admin)
|
||||
.build();
|
||||
Group col2_AdminGroup = GroupBuilder.createCollectionAdminGroup(context, col2)
|
||||
.addMember(col2Admin)
|
||||
.build();
|
||||
Item publicItem1 = ItemBuilder.createItem(context, col1)
|
||||
.withTitle("Test item 1")
|
||||
.build();
|
||||
@@ -2872,8 +2875,9 @@ public class BitstreamRestRepositoryIT extends AbstractControllerIntegrationTest
|
||||
.withEmail("parentComAdmin@test.com")
|
||||
.withPassword(password)
|
||||
.build();
|
||||
Group parentComAdminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
groupService.addMember(context, parentComAdminGroup, parentCommunityAdmin);
|
||||
Group parentComAdminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity)
|
||||
.addMember(parentCommunityAdmin)
|
||||
.build();
|
||||
Item publicItem1 = ItemBuilder.createItem(context, col1)
|
||||
.withTitle("Test item 1")
|
||||
.build();
|
||||
|
@@ -51,7 +51,7 @@ public class CiniiImportMetadataSourceServiceIT extends AbstractLiveImportIntegr
|
||||
InputStream ciniiRefResp2 = null;
|
||||
InputStream ciniiRefResp3 = null;
|
||||
try {
|
||||
ciniiRefResp = getClass().getResourceAsStream("cinii-responce-ids.xml");
|
||||
ciniiRefResp = getClass().getResourceAsStream("cinii-response-ids.xml");
|
||||
ciniiRefResp2 = getClass().getResourceAsStream("cinii-first.xml");
|
||||
ciniiRefResp3 = getClass().getResourceAsStream("cinii-second.xml");
|
||||
|
||||
@@ -89,7 +89,7 @@ public class CiniiImportMetadataSourceServiceIT extends AbstractLiveImportIntegr
|
||||
context.turnOffAuthorisationSystem();
|
||||
CloseableHttpClient originalHttpClient = liveImportClientImpl.getHttpClient();
|
||||
CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class);
|
||||
try (InputStream file = getClass().getResourceAsStream("cinii-responce-ids.xml")) {
|
||||
try (InputStream file = getClass().getResourceAsStream("cinii-response-ids.xml")) {
|
||||
String ciniiXmlResp = IOUtils.toString(file, Charset.defaultCharset());
|
||||
|
||||
liveImportClientImpl.setHttpClient(httpClient);
|
||||
@@ -107,31 +107,31 @@ public class CiniiImportMetadataSourceServiceIT extends AbstractLiveImportIntegr
|
||||
private ArrayList<ImportRecord> getRecords() {
|
||||
ArrayList<ImportRecord> records = new ArrayList<>();
|
||||
//define first record
|
||||
List<MetadatumDTO> metadatums = new ArrayList<MetadatumDTO>();
|
||||
List<MetadatumDTO> metadata = new ArrayList<MetadatumDTO>();
|
||||
MetadatumDTO title = createMetadatumDTO("dc", "title", null,
|
||||
"Understanding the impact of mandatory accrual accounting on management practices:"
|
||||
+ " Interpretation of Japanese local governments’ behavior");
|
||||
MetadatumDTO identifier = createMetadatumDTO("dc", "identifier", "other", "1010572092222310146");
|
||||
|
||||
metadatums.add(title);
|
||||
metadatums.add(identifier);
|
||||
metadata.add(title);
|
||||
metadata.add(identifier);
|
||||
|
||||
ImportRecord firstrRecord = new ImportRecord(metadatums);
|
||||
ImportRecord firstRecord = new ImportRecord(metadata);
|
||||
|
||||
//define second record
|
||||
List<MetadatumDTO> metadatums2 = new ArrayList<MetadatumDTO>();
|
||||
List<MetadatumDTO> metadata2 = new ArrayList<MetadatumDTO>();
|
||||
MetadatumDTO title2 = createMetadatumDTO("dc", "title", null,
|
||||
"Band structures of passive films on titanium in simulated bioliquids determined"
|
||||
+ " by photoelectrochemical response: principle governing the biocompatibility");
|
||||
MetadatumDTO language = createMetadatumDTO("dc", "language", "iso", "en");
|
||||
MetadatumDTO identifier2 = createMetadatumDTO("dc", "identifier", "other", "1050010687833449984");
|
||||
|
||||
metadatums2.add(title2);
|
||||
metadatums2.add(language);
|
||||
metadatums2.add(identifier2);
|
||||
metadata2.add(title2);
|
||||
metadata2.add(language);
|
||||
metadata2.add(identifier2);
|
||||
|
||||
ImportRecord secondRecord = new ImportRecord(metadatums2);
|
||||
records.add(firstrRecord);
|
||||
ImportRecord secondRecord = new ImportRecord(metadata2);
|
||||
records.add(firstRecord);
|
||||
records.add(secondRecord);
|
||||
return records;
|
||||
}
|
||||
|
@@ -28,9 +28,9 @@ import org.dspace.app.rest.test.AbstractControllerIntegrationTest;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.builder.CollectionBuilder;
|
||||
import org.dspace.builder.CommunityBuilder;
|
||||
import org.dspace.builder.GroupBuilder;
|
||||
import org.dspace.builder.WorkspaceItemBuilder;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
@@ -41,10 +41,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class CollectionGroupRestControllerIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
|
||||
@Autowired
|
||||
private CollectionService collectionService;
|
||||
|
||||
@Autowired
|
||||
private GroupService groupService;
|
||||
|
||||
@@ -68,7 +64,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionAdminGroupTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -81,7 +77,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionAdminGroupTestParentCommunityAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -95,7 +91,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionAdminGroupTestCollectionAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -109,7 +105,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionAdminGroupUnAuthorizedTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
collectionService.createAdministrators(context, collection);
|
||||
GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(get("/api/core/collections/" + collection.getID() + "/adminGroup"))
|
||||
@@ -119,7 +115,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionAdminGroupForbiddenTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
collectionService.createAdministrators(context, collection);
|
||||
GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -413,7 +409,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionAdminGroupTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -428,7 +424,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionAdminGroupTestParentCommunityAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -443,7 +439,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionAdminGroupTestCollectionAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -458,7 +454,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionAdminGroupUnAuthorizedTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(delete("/api/core/collections/" + collection.getID() + "/adminGroup"))
|
||||
@@ -474,7 +470,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionAdminGroupForbiddenTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -493,7 +489,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionAdminGroupNotFoundTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -512,7 +508,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionSubmittersGroupTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submitters = collectionService.createSubmitters(context, collection);
|
||||
Group submitters = GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -525,7 +521,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionSubmittersGroupTestParentCommunityAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submitters = collectionService.createSubmitters(context, collection);
|
||||
Group submitters = GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -539,7 +535,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionSubmittersGroupTestCollectionAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submitters = collectionService.createSubmitters(context, collection);
|
||||
Group submitters = GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -553,7 +549,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionSubmittersGroupUnAuthorizedTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
collectionService.createSubmitters(context, collection);
|
||||
GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup"))
|
||||
@@ -563,7 +559,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getCollectionSubmittersGroupForbiddenTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
collectionService.createSubmitters(context, collection);
|
||||
GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -860,7 +856,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionSubmitterGroupTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submittersGroup = collectionService.createSubmitters(context, collection);
|
||||
GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -875,7 +871,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionSubmittersGroupTestParentCommunityAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submittersGroup = collectionService.createSubmitters(context, collection);
|
||||
GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -890,7 +886,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionSubmittersGroupTestCollectionAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submittersGroup = collectionService.createSubmitters(context, collection);
|
||||
GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -905,7 +901,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionSubmittersGroupUnAuthorizedTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submittersGroup = collectionService.createSubmitters(context, collection);
|
||||
Group submittersGroup = GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(delete("/api/core/collections/" + collection.getID() + "/submittersGroup"))
|
||||
@@ -924,7 +920,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionSubmittersGroupForbiddenTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submittersGroup = collectionService.createSubmitters(context, collection);
|
||||
Group submittersGroup = GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -945,7 +941,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionSubmittersGroupNotFoundTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group submittersGroup = collectionService.createSubmitters(context, collection);
|
||||
GroupBuilder.createCollectionSubmitterGroup(context, collection).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -961,7 +957,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
itemGroupString, defaultItemRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -977,7 +974,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
itemGroupString, defaultItemRead).build();
|
||||
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
@@ -995,7 +993,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
itemGroupString, defaultItemRead).build();
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -1012,7 +1011,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
itemGroupString, defaultItemRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(get("/api/core/collections/" + collection.getID() + "/itemReadGroup"))
|
||||
@@ -1025,7 +1025,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
itemGroupString, defaultItemRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -1321,7 +1322,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection, itemGroupString, defaultItemRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -1345,7 +1346,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection, itemGroupString, defaultItemRead).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -1367,7 +1368,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection, itemGroupString, defaultItemRead).build();
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -1389,7 +1390,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
itemGroupString, defaultItemRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(delete("/api/core/collections/" + collection.getID() + "/itemReadGroup"))
|
||||
@@ -1408,7 +1410,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
itemGroupString, defaultItemRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -1430,7 +1433,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String itemGroupString = "ITEM";
|
||||
int defaultItemRead = Constants.DEFAULT_ITEM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, itemGroupString, defaultItemRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection, itemGroupString, defaultItemRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -1445,8 +1448,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -1462,8 +1465,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -1480,8 +1483,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -1498,8 +1501,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(get("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup"))
|
||||
@@ -1512,8 +1515,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -1811,8 +1814,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -1835,8 +1838,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -1859,8 +1862,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -1882,8 +1885,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
Group role = GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(delete("/api/core/collections/" + collection.getID() + "/bitstreamReadGroup"))
|
||||
@@ -1902,8 +1905,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
|
||||
@@ -1918,8 +1921,8 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
String bitstreamGroupString = "BITSTREAM";
|
||||
int defaultBitstreamRead = Constants.DEFAULT_BITSTREAM_READ;
|
||||
|
||||
Group role = collectionService.createDefaultReadGroup(context, collection, bitstreamGroupString,
|
||||
defaultBitstreamRead);
|
||||
GroupBuilder.createCollectionDefaultReadGroup(context, collection,
|
||||
bitstreamGroupString, defaultBitstreamRead).build();
|
||||
context.restoreAuthSystemState();
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
|
||||
@@ -1931,7 +1934,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
public void getWorkflowGroupForCollectionAndRole() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
Group group = GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -1944,7 +1947,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getWorkflowGroupForCollectionAndRoleParentCommunityAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
Group group = GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -1958,7 +1961,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getWorkflowGroupForCollectionAndRoleWrongUUIDCollectionNotFound() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -1979,7 +1982,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
public void getWorkflowGroupCommunityAdmin() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
Group group = GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
@@ -1994,7 +1997,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getWorkflowGroupCollectionAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
Group group = GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
@@ -2009,7 +2012,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getWorkflowGroupUnAuthorized() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(get("/api/core/collections/" + collection.getID() + "/workflowGroups/reviewer"))
|
||||
@@ -2019,7 +2022,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void getWorkflowGroupForbidden() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -2324,7 +2327,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionWorkflowGroupTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -2339,7 +2342,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionWorkflowGroupTestParentCommunityAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
@@ -2355,7 +2358,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionWorkflowGroupTestCollectionAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
|
||||
authorizeService.addPolicy(context, collection, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
@@ -2371,7 +2374,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionWorkflowGroupUnAuthorizedTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
Group group = GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(delete("/api/core/collections/" + collection.getID() + "/workflowGroups/reviewer"))
|
||||
@@ -2387,7 +2390,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionWorkflowGroupForbiddenTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
Group group = GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -2406,7 +2409,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionWorkflowGroupNotFoundTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group group = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -2418,7 +2421,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
|
||||
@Test
|
||||
public void deleteCollectionWorkflowGroupWithPooledTaskTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group reviewer = workflowService.createWorkflowRoleGroup(context, collection, "reviewer");
|
||||
Group reviewer = GroupBuilder.createCollectionWorkflowRoleGroup(context, collection, "reviewer").build();
|
||||
|
||||
// Submit an Item into the workflow -> moves to the "reviewer" step's pool.
|
||||
// The role must have at least one EPerson, otherwise the WSI gets archived immediately
|
||||
|
@@ -34,8 +34,6 @@ import org.dspace.builder.EPersonBuilder;
|
||||
import org.dspace.builder.GroupBuilder;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
@@ -49,19 +47,12 @@ import org.springframework.http.MediaType;
|
||||
|
||||
public class CommunityAdminGroupRestControllerIT extends AbstractControllerIntegrationTest {
|
||||
|
||||
|
||||
@Autowired
|
||||
private CommunityService communityService;
|
||||
|
||||
@Autowired
|
||||
private GroupService groupService;
|
||||
|
||||
@Autowired
|
||||
private AuthorizeService authorizeService;
|
||||
|
||||
@Autowired
|
||||
private CollectionService collectionService;
|
||||
|
||||
@Autowired
|
||||
private ConfigurationService configurationService;
|
||||
|
||||
@@ -78,7 +69,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
@Test
|
||||
public void getCommunityAdminGroupTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
Group adminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -91,7 +82,8 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
@Test
|
||||
public void getCommunityAdminGroupTestCommunityAdmin() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
Group adminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
// TODO: this should actually be "add member", not directly setting a policy, right?
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -106,7 +98,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
@Test
|
||||
public void getCommunityAdminGroupUnAuthorizedTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
communityService.createAdministrators(context, parentCommunity);
|
||||
GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(get("/api/core/communities/" + parentCommunity.getID() + "/adminGroup"))
|
||||
@@ -116,7 +108,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
@Test
|
||||
public void getCommunityAdminGroupForbiddenTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
communityService.createAdministrators(context, parentCommunity);
|
||||
GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
context.restoreAuthSystemState();
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
getClient(token).perform(get("/api/core/communities/" + parentCommunity.getID() + "/adminGroup"))
|
||||
@@ -379,7 +371,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
@Test
|
||||
public void deleteCommunityAdminGroupTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
@@ -397,7 +389,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity)
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Group adminGroup = communityService.createAdministrators(context, child1);
|
||||
GroupBuilder.createCommunityAdminGroup(context, child1).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
@@ -412,7 +404,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
@Test
|
||||
public void deleteCommunityAdminGroupUnAuthorizedTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
Group adminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(delete("/api/core/communities/" + parentCommunity.getID() + "/adminGroup"))
|
||||
@@ -429,7 +421,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
@Test
|
||||
public void deleteCommunityAdminGroupForbiddenTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
Group adminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -449,7 +441,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
@Test
|
||||
public void deleteCommunityAdminGroupNotFoundTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
@@ -462,7 +454,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminAddMembersToCommunityAdminGroupPropertySetToFalse() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
Group adminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
EPerson ePerson = EPersonBuilder.createEPerson(context).withEmail("testToAdd@test.com").build();
|
||||
configurationService.setProperty("core.authorization.community-admin.admin-group", false);
|
||||
@@ -489,7 +481,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminRemoveMembersFromCommunityAdminGroupPropertySetToFalse() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
Group adminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
EPerson ePerson = EPersonBuilder.createEPerson(context).withEmail("testToAdd@test.com").build();
|
||||
context.restoreAuthSystemState();
|
||||
@@ -526,7 +518,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminAddChildGroupToCommunityAdminGroupPropertySetToFalse() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
Group adminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
Group group = GroupBuilder.createGroup(context).withName("testGroup").build();
|
||||
configurationService.setProperty("core.authorization.community-admin.admin-group", false);
|
||||
@@ -554,7 +546,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminRemoveChildGroupFromCommunityAdminGroupPropertySetToFalse() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = communityService.createAdministrators(context, parentCommunity);
|
||||
Group adminGroup = GroupBuilder.createCommunityAdminGroup(context, parentCommunity).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
Group group = GroupBuilder.createGroup(context).withName("testGroup").build();
|
||||
context.restoreAuthSystemState();
|
||||
@@ -591,7 +583,9 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminAddChildGroupToCollectionAdminGroupSuccess() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
// TODO: Why is this test in CommunityAdmin? it seems to purely be a collection group test?
|
||||
// copy paste gone wrong and we should actually be testing for community admin group sub?
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
Group group = GroupBuilder.createGroup(context).withName("testGroup").build();
|
||||
context.restoreAuthSystemState();
|
||||
@@ -617,7 +611,9 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminRemoveChildGroupFromCollectionAdminGroupSuccess() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
// TODO: Why is this test in CommunityAdmin? it seems to purely be a collection group test?
|
||||
// copy paste gone wrong and we should actually be testing for community admin group sub?
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
Group group = GroupBuilder.createGroup(context).withName("testGroup").build();
|
||||
context.restoreAuthSystemState();
|
||||
@@ -653,7 +649,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminAddMembersToCollectionAdminGroupPropertySetToFalse() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
EPerson ePerson = EPersonBuilder.createEPerson(context).withEmail("testToAdd@test.com").build();
|
||||
configurationService.setProperty("core.authorization.community-admin.collection.admin-group", false);
|
||||
@@ -681,7 +677,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminRemoveMembersFromCollectionAdminGroupPropertySetToFalse() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
EPerson ePerson = EPersonBuilder.createEPerson(context).withEmail("testToAdd@test.com").build();
|
||||
context.restoreAuthSystemState();
|
||||
@@ -719,7 +715,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminAddChildGroupToCollectionAdminGroupPropertySetToFalse() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
Group group = GroupBuilder.createGroup(context).withName("testGroup").build();
|
||||
configurationService.setProperty("core.authorization.community-admin.collection.admin-group", false);
|
||||
@@ -748,7 +744,7 @@ public class CommunityAdminGroupRestControllerIT extends AbstractControllerInteg
|
||||
public void communityAdminRemoveChildGroupFromCollectionAdminGroupPropertySetToFalse() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
Group adminGroup = collectionService.createAdministrators(context, collection);
|
||||
Group adminGroup = GroupBuilder.createCollectionAdminGroup(context, collection).build();
|
||||
authorizeService.addPolicy(context, parentCommunity, Constants.ADMIN, eperson);
|
||||
Group group = GroupBuilder.createGroup(context).withName("testGroup").build();
|
||||
context.restoreAuthSystemState();
|
||||
|
@@ -162,7 +162,7 @@ public class CrossRefImportMetadataSourceServiceIT extends AbstractLiveImportInt
|
||||
MetadatumDTO title = createMetadatumDTO("dc", "title", null,
|
||||
"State of Awareness of Freshers’ Groups Chortkiv State"
|
||||
+ " Medical College of Prevention of Iodine Deficiency Diseases");
|
||||
MetadatumDTO author = createMetadatumDTO("dc", "contributor", "author", "L.V. Senyuk");
|
||||
MetadatumDTO author = createMetadatumDTO("dc", "contributor", "author", "Senyuk, L.V.");
|
||||
MetadatumDTO type = createMetadatumDTO("dc", "type", null, "journal-article");
|
||||
MetadatumDTO date = createMetadatumDTO("dc", "date", "issued", "2016-05-19");
|
||||
MetadatumDTO ispartof = createMetadatumDTO("dc", "relation", "ispartof",
|
||||
@@ -191,7 +191,7 @@ public class CrossRefImportMetadataSourceServiceIT extends AbstractLiveImportInt
|
||||
List<MetadatumDTO> metadatums2 = new ArrayList<MetadatumDTO>();
|
||||
MetadatumDTO title2 = createMetadatumDTO("dc", "title", null,
|
||||
"Ischemic Heart Disease and Role of Nurse of Cardiology Department");
|
||||
MetadatumDTO author2 = createMetadatumDTO("dc", "contributor", "author", "K. І. Kozak");
|
||||
MetadatumDTO author2 = createMetadatumDTO("dc", "contributor", "author", "Kozak, K. І.");
|
||||
MetadatumDTO type2 = createMetadatumDTO("dc", "type", null, "journal-article");
|
||||
MetadatumDTO date2 = createMetadatumDTO("dc", "date", "issued", "2016-05-19");
|
||||
MetadatumDTO ispartof2 = createMetadatumDTO("dc", "relation", "ispartof",
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -4696,4 +4696,124 @@ public class ItemRestRepositoryIT extends AbstractControllerIntegrationTest {
|
||||
.andExpect(jsonPath("$.status", notNullValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findSubmitterByAdminTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
//** GIVEN **
|
||||
//1. A community-collection structure with one parent community with sub-community and two collections.
|
||||
parentCommunity = CommunityBuilder.createCommunity(context)
|
||||
.withName("Parent Community")
|
||||
.build();
|
||||
Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity)
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build();
|
||||
|
||||
EPerson submitter = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("testone@mail.com")
|
||||
.withPassword(password)
|
||||
.withCanLogin(true)
|
||||
.build();
|
||||
|
||||
context.setCurrentUser(submitter);
|
||||
|
||||
//2. Three public items that are readable by Anonymous with different subjects
|
||||
Item publicItem = ItemBuilder.createItem(context, col1)
|
||||
.withTitle("Public item 1")
|
||||
.withIssueDate("2017-10-17")
|
||||
.withAuthor("Smith, Donald")
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(admin.getEmail(), password);
|
||||
|
||||
getClient(token).perform(get("/api/core/items/" + publicItem.getID())
|
||||
.param("projection", "full"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", ItemMatcher.matchFullEmbeds()));
|
||||
|
||||
getClient(token).perform(get("/api/core/items/" + publicItem.getID() + "/submitter"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.id", is(submitter.getID().toString())))
|
||||
.andExpect(jsonPath("$.email", is(submitter.getEmail())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findSubmitterWithoutReadAccessTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
parentCommunity = CommunityBuilder.createCommunity(context)
|
||||
.withName("Parent Community")
|
||||
.build();
|
||||
|
||||
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
|
||||
|
||||
EPerson submitter = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("testone@mail.com")
|
||||
.withPassword(password)
|
||||
.withCanLogin(true)
|
||||
.build();
|
||||
|
||||
context.setCurrentUser(submitter);
|
||||
|
||||
Item publicItem = ItemBuilder.createItem(context, col1)
|
||||
.withTitle("Public item 1")
|
||||
.withIssueDate("2017-10-17")
|
||||
.withAuthor("Smith, Donald")
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
String token = getAuthToken(eperson.getEmail(), password);
|
||||
|
||||
getClient(token).perform(get("/api/core/items/" + publicItem.getID())
|
||||
.param("projection", "full"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", ItemMatcher.matchFullEmbeds()));
|
||||
|
||||
// find submitter by user has no read access
|
||||
getClient(token).perform(get("/api/core/items/" + publicItem.getID() + "/submitter"))
|
||||
.andExpect(status().isNoContent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findSubmitterByAnonymousTest() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
parentCommunity = CommunityBuilder.createCommunity(context)
|
||||
.withName("Parent Community")
|
||||
.build();
|
||||
|
||||
Collection col1 = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build();
|
||||
|
||||
EPerson submitter = EPersonBuilder.createEPerson(context)
|
||||
.withEmail("testone@mail.com")
|
||||
.withPassword(password)
|
||||
.withCanLogin(true)
|
||||
.build();
|
||||
|
||||
context.setCurrentUser(submitter);
|
||||
|
||||
Item publicItem = ItemBuilder.createItem(context, col1)
|
||||
.withTitle("Public item 1")
|
||||
.withIssueDate("2017-10-17")
|
||||
.withAuthor("Smith, Donald")
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
getClient().perform(get("/api/core/items/" + publicItem.getID())
|
||||
.param("projection", "full"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$", ItemMatcher.matchFullEmbeds()));
|
||||
|
||||
getClient().perform(get("/api/core/items/" + publicItem.getID() + "/submitter"))
|
||||
.andExpect(status().isNoContent());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3306,7 +3306,7 @@ public class RelationshipRestRepositoryIT extends AbstractEntityIntegrationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findByItemsAndTypeEmptyResponceTest() throws Exception {
|
||||
public void findByItemsAndTypeEmptyResponseTest() throws Exception {
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
|
@@ -28,6 +28,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.sql.SQLException;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
@@ -55,10 +57,12 @@ import org.dspace.builder.RequestItemBuilder;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -81,6 +85,12 @@ public class RequestItemRepositoryIT
|
||||
@Autowired(required = true)
|
||||
RequestItemService requestItemService;
|
||||
|
||||
@Autowired
|
||||
ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private ConfigurationService configurationService;
|
||||
|
||||
private Collection collection;
|
||||
|
||||
private Item item;
|
||||
@@ -594,4 +604,39 @@ public class RequestItemRepositoryIT
|
||||
Class instanceClass = instance.getDomainClass();
|
||||
assertEquals("Wrong domain class", RequestItemRest.class, instanceClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that generated links include the correct base URL, where the UI URL has a subpath like /subdir
|
||||
*/
|
||||
@Test
|
||||
public void testGetLinkTokenEmailWithSubPath() throws MalformedURLException, URISyntaxException {
|
||||
RequestItemRepository instance = applicationContext.getBean(
|
||||
RequestItemRest.CATEGORY + '.' + RequestItemRest.PLURAL_NAME,
|
||||
RequestItemRepository.class);
|
||||
String currentDspaceUrl = configurationService.getProperty("dspace.ui.url");
|
||||
String newDspaceUrl = currentDspaceUrl + "/subdir";
|
||||
// Add a /subdir to the url for this test
|
||||
configurationService.setProperty("dspace.ui.url", newDspaceUrl);
|
||||
String expectedUrl = newDspaceUrl + "/request-a-copy/token";
|
||||
String generatedLink = instance.getLinkTokenEmail("token");
|
||||
// The URLs should match
|
||||
assertEquals(expectedUrl, generatedLink);
|
||||
configurationService.reloadConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that generated links include the correct base URL, with NO subpath elements
|
||||
*/
|
||||
@Test
|
||||
public void testGetLinkTokenEmailWithoutSubPath() throws MalformedURLException, URISyntaxException {
|
||||
RequestItemRepository instance = applicationContext.getBean(
|
||||
RequestItemRest.CATEGORY + '.' + RequestItemRest.PLURAL_NAME,
|
||||
RequestItemRepository.class);
|
||||
String currentDspaceUrl = configurationService.getProperty("dspace.ui.url");
|
||||
String expectedUrl = currentDspaceUrl + "/request-a-copy/token";
|
||||
String generatedLink = instance.getLinkTokenEmail("token");
|
||||
// The URLs should match
|
||||
assertEquals(expectedUrl, generatedLink);
|
||||
configurationService.reloadConfig();
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ public class WOSImportMetadataSourceServiceIT extends AbstractLiveImportIntegrat
|
||||
}
|
||||
CloseableHttpClient originalHttpClient = liveImportClientImpl.getHttpClient();
|
||||
CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class);
|
||||
try (InputStream file = getClass().getResourceAsStream("wos-responce.xml")) {
|
||||
try (InputStream file = getClass().getResourceAsStream("wos-response.xml")) {
|
||||
String wosXmlResp = IOUtils.toString(file, Charset.defaultCharset());
|
||||
|
||||
liveImportClientImpl.setHttpClient(httpClient);
|
||||
@@ -80,7 +80,7 @@ public class WOSImportMetadataSourceServiceIT extends AbstractLiveImportIntegrat
|
||||
}
|
||||
CloseableHttpClient originalHttpClient = liveImportClientImpl.getHttpClient();
|
||||
CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class);
|
||||
try (InputStream file = getClass().getResourceAsStream("wos-responce.xml")) {
|
||||
try (InputStream file = getClass().getResourceAsStream("wos-response.xml")) {
|
||||
String wosXmlResp = IOUtils.toString(file, Charset.defaultCharset());
|
||||
|
||||
liveImportClientImpl.setHttpClient(httpClient);
|
||||
@@ -136,6 +136,7 @@ public class WOSImportMetadataSourceServiceIT extends AbstractLiveImportIntegrat
|
||||
MetadatumDTO subject15 = createMetadatumDTO("dc", "subject", null, "Coding concepts");
|
||||
MetadatumDTO subject16 = createMetadatumDTO("dc", "subject", null, "Lesson design");
|
||||
MetadatumDTO subject17 = createMetadatumDTO("dc", "subject", null, "Social Sciences");
|
||||
MetadatumDTO publisher = createMetadatumDTO("dc", "publisher", null, "SPRINGER");
|
||||
MetadatumDTO other = createMetadatumDTO("dc", "identifier", "other", "WOS:000805105200003");
|
||||
metadatums.add(edition);
|
||||
metadatums.add(date);
|
||||
@@ -166,6 +167,7 @@ public class WOSImportMetadataSourceServiceIT extends AbstractLiveImportIntegrat
|
||||
metadatums.add(subject15);
|
||||
metadatums.add(subject16);
|
||||
metadatums.add(subject17);
|
||||
metadatums.add(publisher);
|
||||
metadatums.add(other);
|
||||
ImportRecord firstrRecord = new ImportRecord(metadatums);
|
||||
|
||||
@@ -205,6 +207,7 @@ public class WOSImportMetadataSourceServiceIT extends AbstractLiveImportIntegrat
|
||||
MetadatumDTO subject26 = createMetadatumDTO("dc", "subject", null, "Social Sciences");
|
||||
MetadatumDTO subject27 = createMetadatumDTO("dc", "subject", null, "Science & Technology");
|
||||
MetadatumDTO subject28 = createMetadatumDTO("dc", "subject", null, "Life Sciences & Biomedicine");
|
||||
MetadatumDTO publisher2 = createMetadatumDTO("dc", "publisher", null, "NATURE PORTFOLIO");
|
||||
MetadatumDTO other2 = createMetadatumDTO("dc", "identifier", "other", "WOS:000805100600001");
|
||||
MetadatumDTO rid = createMetadatumDTO("person", "identifier", "rid", "C-6334-2011");
|
||||
MetadatumDTO rid2 = createMetadatumDTO("person", "identifier", "rid", "B-1251-2008");
|
||||
@@ -236,6 +239,7 @@ public class WOSImportMetadataSourceServiceIT extends AbstractLiveImportIntegrat
|
||||
metadatums2.add(subject26);
|
||||
metadatums2.add(subject27);
|
||||
metadatums2.add(subject28);
|
||||
metadatums2.add(publisher2);
|
||||
metadatums2.add(other2);
|
||||
metadatums2.add(rid);
|
||||
metadatums2.add(rid2);
|
||||
|
@@ -9785,4 +9785,47 @@ ResourcePolicyBuilder.createResourcePolicy(context, null, adminGroup)
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.sections.upload.primary", is(idFirstPdf.get())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createWorkspaceWithoutCclicense_CclicenseRequired() throws Exception {
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
//1. A community-collection structure with one parent community with sub-community and one collection.
|
||||
parentCommunity = CommunityBuilder.createCommunity(context)
|
||||
.withName("Parent Community")
|
||||
.build();
|
||||
Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity)
|
||||
.withName("Sub Community")
|
||||
.build();
|
||||
Collection col1 = CollectionBuilder.createCollection(context, child1)
|
||||
.withName("Collection 1")
|
||||
.withSubmitterGroup(eperson)
|
||||
.build();
|
||||
|
||||
String authToken = getAuthToken(eperson.getEmail(), password);
|
||||
|
||||
//disable file upload mandatory
|
||||
configurationService.setProperty("webui.submit.upload.required", false);
|
||||
configurationService.setProperty("cc.license.required", true);
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
|
||||
AtomicReference<Integer> idRef = new AtomicReference<>();
|
||||
try {
|
||||
// create an empty workspaceitem explicitly in the col1, check validation on creation
|
||||
getClient(authToken).perform(post("/api/submission/workspaceitems")
|
||||
.param("owningCollection", col1.getID().toString())
|
||||
.contentType(org.springframework.http.MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isCreated())
|
||||
// cclicense is required
|
||||
.andExpect(jsonPath("$.errors[?(@.message=='error.validation.cclicense.required')]",
|
||||
contains(
|
||||
hasJsonPath("$.paths", contains(
|
||||
hasJsonPath("$", Matchers.is("/sections/cclicense"))
|
||||
)))))
|
||||
.andDo(result -> idRef.set(read(result.getResponse().getContentAsString(), "$.id")));
|
||||
} finally {
|
||||
WorkspaceItemBuilder.deleteWorkspaceItem(idRef.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -58,7 +58,8 @@ public class ItemMatcher {
|
||||
"version",
|
||||
"relationships[]",
|
||||
"templateItemOf",
|
||||
"thumbnail"
|
||||
"thumbnail",
|
||||
"submitter"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -76,7 +77,8 @@ public class ItemMatcher {
|
||||
"self",
|
||||
"version",
|
||||
"templateItemOf",
|
||||
"thumbnail"
|
||||
"thumbnail",
|
||||
"submitter"
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,10 @@
|
||||
to register DOIs anymore. Please follow and reuse the examples
|
||||
included in this file. For more information on the DataCite
|
||||
Schema, see https://schema.datacite.org. -->
|
||||
<!-- Note regarding language codes: xml:lang regional language codes require a hyphen, whereas many
|
||||
repositories use underscores when storing these language codes (e.g. en_GB, de_CH).
|
||||
This template translates all underscores to hyphens when selecting value of @lang in an attribute
|
||||
so the output will be e.g. xml:lang="en-GB", xml:lang="de-CH". -->
|
||||
|
||||
<!-- We need the prefix to determine DOIs that were minted by ourself. -->
|
||||
<xsl:param name="prefix">10.5072/dspace-</xsl:param>
|
||||
@@ -36,6 +40,10 @@
|
||||
<xsl:param name="hostinginstitution"><xsl:value-of select="$publisher" /></xsl:param>
|
||||
<!-- Please take a look into the DataCite schema documentation if you want to know how to use these elements.
|
||||
http://schema.datacite.org -->
|
||||
<!-- Metadata-field to retrieve DOI from items -->
|
||||
<xsl:param name="mdSchema">dc</xsl:param>
|
||||
<xsl:param name="mdElement">identifier</xsl:param>
|
||||
<xsl:param name="mdQualifier">uri</xsl:param>
|
||||
|
||||
<xsl:output method="xml" indent="yes" encoding="utf-8" />
|
||||
|
||||
@@ -333,15 +341,17 @@
|
||||
company as well. We have to ensure to use URIs of our prefix
|
||||
as primary identifiers only.
|
||||
-->
|
||||
<xsl:template match="dspace:field[@mdschema='dc' and @element='identifier' and @qualifier and (contains(., $prefix))]">
|
||||
<identifier identifierType="DOI">
|
||||
<xsl:if test="starts-with(string(text()), 'https://doi.org/')">
|
||||
<xsl:value-of select="substring(., 17)"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="starts-with(string(text()), 'http://dx.doi.org/')">
|
||||
<xsl:value-of select="substring(., 19)"/>
|
||||
</xsl:if>
|
||||
</identifier>
|
||||
<xsl:template match="dspace:field[@mdschema=$mdSchema and @element=$mdElement and (contains(., $prefix))]">
|
||||
<xsl:if test="(($mdQualifier and $mdQualifier != '') and @qualifier=$mdQualifier) or ((not($mdQualifier) or $mdQualifier = '') and not(@qualifier))">
|
||||
<identifier identifierType="DOI">
|
||||
<xsl:if test="starts-with(string(text()), 'https://doi.org/')">
|
||||
<xsl:value-of select="substring(., 17)"/>
|
||||
</xsl:if>
|
||||
<xsl:if test="starts-with(string(text()), 'http://dx.doi.org/')">
|
||||
<xsl:value-of select="substring(., 19)"/>
|
||||
</xsl:if>
|
||||
</identifier>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- DataCite (2) :: Creator -->
|
||||
@@ -356,20 +366,20 @@
|
||||
<!-- DataCite (3) :: Title -->
|
||||
<xsl:template match="dspace:field[@mdschema='dc' and @element='title']">
|
||||
<xsl:element name="title">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:if test="@qualifier='alternative'">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:attribute name="titleType">AlternativeTitle</xsl:attribute>
|
||||
</xsl:if>
|
||||
<!-- DSpace does include niehter a dc.title.subtitle nor a
|
||||
<!-- DSpace doesn't include a dc.title.subtitle nor a
|
||||
dc.title.translated. If necessary, please create those in the
|
||||
metadata field registry. -->
|
||||
<xsl:if test="@qualifier='subtitle'">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:attribute name="titleType">Subtitle</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="@qualifier='translated'">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:attribute name="titleType">TranslatedTitle</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="." />
|
||||
@@ -388,7 +398,7 @@
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='subject']">
|
||||
<xsl:element name="subject">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:if test="@qualifier">
|
||||
<xsl:attribute name="subjectScheme"><xsl:value-of select="@qualifier" /></xsl:attribute>
|
||||
</xsl:if>
|
||||
@@ -620,7 +630,7 @@
|
||||
-->
|
||||
<xsl:template match="//dspace:field[@mdschema='dc' and @element='description' and (@qualifier='abstract' or @qualifier='tableofcontents' or not(@qualifier))]">
|
||||
<xsl:element name="description">
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="@lang" /></xsl:attribute>
|
||||
<xsl:attribute name="xml:lang"><xsl:value-of select="translate(@lang, '_', '-')" /></xsl:attribute>
|
||||
<xsl:attribute name="descriptionType">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@qualifier='abstract'">Abstract</xsl:when>
|
||||
|
@@ -996,6 +996,11 @@ metadata.hide.person.email = true
|
||||
# dspace-angular environment configuration property submission.typeBind.field
|
||||
#submit.type-bind.field = dc.type
|
||||
|
||||
# Wheter or not we REQUIRE that the cclicense is provided
|
||||
# during the cclicense step in the submission process
|
||||
# Defaults to false; If you set to 'true', submitter needs to provide cclicense
|
||||
#cc.license.required = true
|
||||
|
||||
#### Creative Commons settings ######
|
||||
|
||||
# The url to the web service API
|
||||
|
@@ -35,6 +35,7 @@
|
||||
<entry key-ref="wos.fullName" value-ref="wosFullNameContrib"/>
|
||||
<entry key-ref="wos.subject" value-ref="wosSubjectContrib"/>
|
||||
<entry key-ref="wos.orcid" value-ref="wosOrcidContrib"/>
|
||||
<entry key-ref="wos.publisher" value-ref="wosPublisherContrib"/>
|
||||
<entry key-ref="wos.contributorEditor" value-ref="wosContributorEditorContrib"/>
|
||||
<entry key-ref="wos.wosId" value-ref="wosIdContrib"/>
|
||||
<entry key-ref="wos.rid" value-ref="wosRidContrib"/>
|
||||
|
@@ -32,14 +32,16 @@
|
||||
|
||||
<codecFactory class="solr.SchemaCodecFactory"/>
|
||||
|
||||
<!-- Use classic schema.xml & disallow programmatic changes to schema at runtime -->
|
||||
<!-- Use classic schema.xml & disallow programmatic changes to
|
||||
schema at runtime -->
|
||||
<schemaFactory class="ClassicIndexSchemaFactory"/>
|
||||
|
||||
<indexConfig>
|
||||
<ramBufferSizeMB>32</ramBufferSizeMB>
|
||||
<maxBufferedDocs>1000</maxBufferedDocs>
|
||||
<lockType>${solr.lock.type:native}</lockType>
|
||||
<!-- Set to true to "write detailed debug information from the indexing process as Solr log messages" -->
|
||||
<!-- Set to true to "write detailed debug information from the
|
||||
indexing process as Solr log messages" -->
|
||||
<infoStream>false</infoStream>
|
||||
</indexConfig>
|
||||
|
||||
@@ -48,7 +50,7 @@
|
||||
<!-- How often should commits be done automatically -->
|
||||
<autoCommit>
|
||||
<maxDocs>10000</maxDocs> <!--Commit every 10.000 documents-->
|
||||
<maxTime>${solr.autoCommit.maxTime:900000}</maxTime> <!--Default commit every 15 minutes-->
|
||||
<maxTime>${solr.autoCommit.maxTime:10000}</maxTime> <!--Ten seconds-->
|
||||
<openSearcher>true</openSearcher>
|
||||
</autoCommit>
|
||||
|
||||
@@ -62,14 +64,16 @@
|
||||
<maxBooleanClauses>${solr.max.booleanClauses:1024}</maxBooleanClauses>
|
||||
|
||||
<!-- Cache used by SolrIndexSearcher for filters (DocSets) for
|
||||
unordered sets of *all* documents that match a query. Caches results of 'fq' search param. -->
|
||||
unordered sets of *all* documents that match a
|
||||
query. Caches results of 'fq' search param. -->
|
||||
<filterCache class="solr.search.CaffeineCache"
|
||||
size="512"
|
||||
initialSize="512"
|
||||
autowarmCount="0"/>
|
||||
|
||||
<!-- Caches results of previous searches - ordered lists of document ids
|
||||
(DocList) based on a query, a sort, and the range of documents requested. -->
|
||||
<!-- Caches results of previous searches - ordered lists of
|
||||
document ids (DocList) based on a query, a sort, and the
|
||||
range of documents requested. -->
|
||||
<queryResultCache class="solr.search.CaffeineCache"
|
||||
size="512"
|
||||
initialSize="512"
|
||||
@@ -91,7 +95,8 @@
|
||||
<slowQueryThresholdMillis>1000</slowQueryThresholdMillis>
|
||||
</query>
|
||||
|
||||
<!-- Controls how the Solr HTTP RequestDispatcher responds to requests -->
|
||||
<!-- Controls how the Solr HTTP RequestDispatcher responds to
|
||||
requests -->
|
||||
<requestDispatcher handleSelect="false" >
|
||||
<requestParsers enableRemoteStreaming="true"
|
||||
multipartUploadLimitInKB="-1"
|
||||
@@ -113,7 +118,8 @@
|
||||
|
||||
<!-- Processes updates to the index -->
|
||||
<requestHandler name="/update" class="solr.UpdateRequestHandler">
|
||||
<!-- Update chain processor required by DSpace to auto generate the UUID field in solr -->
|
||||
<!-- Update chain processor required by DSpace to auto
|
||||
generate the UUID field in solr -->
|
||||
<lst name="defaults">
|
||||
<str name="update.chain">uuid</str>
|
||||
</lst>
|
||||
@@ -126,7 +132,8 @@
|
||||
</lst>
|
||||
</requestHandler>
|
||||
|
||||
<!-- Required for DSpace to ensure that unique identifiers are added to each solr document -->
|
||||
<!-- Required for DSpace to ensure that unique identifiers are
|
||||
added to each solr document -->
|
||||
<updateRequestProcessorChain name="uuid">
|
||||
<processor class="solr.UUIDUpdateProcessorFactory">
|
||||
<str name="fieldName">uid</str>
|
||||
|
Reference in New Issue
Block a user