mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-10 11:33:11 +00:00
[CST-11044] refactoring and fixing broken ITs
This commit is contained in:
@@ -16,13 +16,12 @@ import javax.persistence.criteria.Root;
|
|||||||
import org.dspace.app.ldn.NotifyPatternToTrigger;
|
import org.dspace.app.ldn.NotifyPatternToTrigger;
|
||||||
import org.dspace.app.ldn.NotifyPatternToTrigger_;
|
import org.dspace.app.ldn.NotifyPatternToTrigger_;
|
||||||
import org.dspace.app.ldn.dao.NotifyPatternToTriggerDao;
|
import org.dspace.app.ldn.dao.NotifyPatternToTriggerDao;
|
||||||
import org.dspace.app.ldn.dao.NotifyServiceDao;
|
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.core.AbstractHibernateDAO;
|
import org.dspace.core.AbstractHibernateDAO;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link NotifyServiceDao}.
|
* Implementation of {@link NotifyPatternToTriggerDao}.
|
||||||
*
|
*
|
||||||
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
|
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
|
||||||
*/
|
*/
|
||||||
|
@@ -10,18 +10,29 @@ package org.dspace.coarnotify;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* this class represents the Configuration of Submission COAR Notify
|
||||||
|
*
|
||||||
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
|
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
|
||||||
*/
|
*/
|
||||||
public class COARNotify {
|
public class COARNotifySubmissionConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the map key of configured bean of COARNotifyConfigurationService
|
||||||
|
* in coar-notify.xml
|
||||||
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the map values of configured bean of COARNotifyConfigurationService
|
||||||
|
* in coar-notify.xml
|
||||||
|
*/
|
||||||
private List<String> patterns;
|
private List<String> patterns;
|
||||||
|
|
||||||
public COARNotify() {
|
public COARNotifySubmissionConfiguration() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public COARNotify(String id, List<String> patterns) {
|
public COARNotifySubmissionConfiguration(String id, List<String> patterns) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.patterns = patterns;
|
this.patterns = patterns;
|
||||||
@@ -36,16 +47,16 @@ public class COARNotify {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list of COAR Notify Patterns
|
* Gets the list of configured COAR Notify Patterns
|
||||||
*
|
*
|
||||||
* @return the list of COAR Notify Patterns
|
* @return the list of configured COAR Notify Patterns
|
||||||
*/
|
*/
|
||||||
public List<String> getPatterns() {
|
public List<String> getPatterns() {
|
||||||
return patterns;
|
return patterns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the list of COAR Notify Patterns
|
* Sets the list of configured COAR Notify Patterns
|
||||||
* @param patterns
|
* @param patterns
|
||||||
*/
|
*/
|
||||||
public void setPatterns(final List<String> patterns) {
|
public void setPatterns(final List<String> patterns) {
|
@@ -28,7 +28,7 @@ public class SubmissionCOARNotifyServiceImpl implements SubmissionCOARNotifyServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public COARNotify findOne(String id) {
|
public COARNotifySubmissionConfiguration findOne(String id) {
|
||||||
List<String> patterns =
|
List<String> patterns =
|
||||||
coarNotifyConfigurationService.getPatterns().get(id);
|
coarNotifyConfigurationService.getPatterns().get(id);
|
||||||
|
|
||||||
@@ -36,15 +36,15 @@ public class SubmissionCOARNotifyServiceImpl implements SubmissionCOARNotifyServ
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new COARNotify(id, patterns);
|
return new COARNotifySubmissionConfiguration(id, patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<COARNotify> findAll() {
|
public List<COARNotifySubmissionConfiguration> findAll() {
|
||||||
List<COARNotify> coarNotifies = new ArrayList<>();
|
List<COARNotifySubmissionConfiguration> coarNotifies = new ArrayList<>();
|
||||||
|
|
||||||
coarNotifyConfigurationService.getPatterns().forEach((id, patterns) ->
|
coarNotifyConfigurationService.getPatterns().forEach((id, patterns) ->
|
||||||
coarNotifies.add(new COARNotify(id, patterns)
|
coarNotifies.add(new COARNotifySubmissionConfiguration(id, patterns)
|
||||||
));
|
));
|
||||||
|
|
||||||
return coarNotifies;
|
return coarNotifies;
|
||||||
|
@@ -9,7 +9,7 @@ package org.dspace.coarnotify.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.dspace.coarnotify.COARNotify;
|
import org.dspace.coarnotify.COARNotifySubmissionConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service interface class for the Creative Submission COAR Notify.
|
* Service interface class for the Creative Submission COAR Notify.
|
||||||
@@ -27,13 +27,13 @@ public interface SubmissionCOARNotifyService {
|
|||||||
* @param id - the ID of the COAR Notify to be found
|
* @param id - the ID of the COAR Notify to be found
|
||||||
* @return the corresponding COAR Notify if found or null when not found
|
* @return the corresponding COAR Notify if found or null when not found
|
||||||
*/
|
*/
|
||||||
public COARNotify findOne(String id);
|
public COARNotifySubmissionConfiguration findOne(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find all configured COAR Notifies
|
* Find all configured COAR Notifies
|
||||||
*
|
*
|
||||||
* @return all configured COAR Notifies
|
* @return all configured COAR Notifies
|
||||||
*/
|
*/
|
||||||
public List<COARNotify> findAll();
|
public List<COARNotifySubmissionConfiguration> findAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -9,17 +9,18 @@ package org.dspace.app.rest.converter;
|
|||||||
|
|
||||||
import org.dspace.app.rest.model.SubmissionCOARNotifyRest;
|
import org.dspace.app.rest.model.SubmissionCOARNotifyRest;
|
||||||
import org.dspace.app.rest.projection.Projection;
|
import org.dspace.app.rest.projection.Projection;
|
||||||
import org.dspace.coarnotify.COARNotify;
|
import org.dspace.coarnotify.COARNotifySubmissionConfiguration;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This converter is responsible for transforming the model representation of an COARNotify to the REST
|
* This converter is responsible for transforming the model representation of an COARNotify to the REST
|
||||||
* representation of an COARNotify and vice versa
|
* representation of an COARNotifySubmissionConfiguration and vice versa
|
||||||
*
|
*
|
||||||
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
|
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
|
||||||
**/
|
**/
|
||||||
@Component
|
@Component
|
||||||
public class SubmissionCOARNotifyConverter implements DSpaceConverter<COARNotify, SubmissionCOARNotifyRest> {
|
public class SubmissionCOARNotifyConverter
|
||||||
|
implements DSpaceConverter<COARNotifySubmissionConfiguration, SubmissionCOARNotifyRest> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a COARNotify to its REST representation
|
* Convert a COARNotify to its REST representation
|
||||||
@@ -28,9 +29,10 @@ public class SubmissionCOARNotifyConverter implements DSpaceConverter<COARNotify
|
|||||||
* @return the corresponding SubmissionCOARNotifyRest object
|
* @return the corresponding SubmissionCOARNotifyRest object
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SubmissionCOARNotifyRest convert(final COARNotify modelObject, final Projection projection) {
|
public SubmissionCOARNotifyRest convert(final COARNotifySubmissionConfiguration modelObject,
|
||||||
SubmissionCOARNotifyRest submissionCOARNotifyRest = new SubmissionCOARNotifyRest();
|
final Projection projection) {
|
||||||
|
|
||||||
|
SubmissionCOARNotifyRest submissionCOARNotifyRest = new SubmissionCOARNotifyRest();
|
||||||
submissionCOARNotifyRest.setProjection(projection);
|
submissionCOARNotifyRest.setProjection(projection);
|
||||||
submissionCOARNotifyRest.setId(modelObject.getId());
|
submissionCOARNotifyRest.setId(modelObject.getId());
|
||||||
submissionCOARNotifyRest.setPatterns(modelObject.getPatterns());
|
submissionCOARNotifyRest.setPatterns(modelObject.getPatterns());
|
||||||
@@ -38,8 +40,8 @@ public class SubmissionCOARNotifyConverter implements DSpaceConverter<COARNotify
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<COARNotify> getModelClass() {
|
public Class<COARNotifySubmissionConfiguration> getModelClass() {
|
||||||
return COARNotify.class;
|
return COARNotifySubmissionConfiguration.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -12,11 +12,13 @@ import java.util.List;
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.dspace.app.rest.RestResourceController;
|
import org.dspace.app.rest.RestResourceController;
|
||||||
|
import org.dspace.coarnotify.COARNotifySubmissionConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the REST representation of the COARNotify model object and acts as a data object
|
* This class is the REST representation of the COARNotifySubmissionConfiguration model object
|
||||||
* for the SubmissionCOARNotifyResource class.
|
* and acts as a data object for the SubmissionCOARNotifyResource class.
|
||||||
* Refer to {@link org.dspace.coarnotify.COARNotify} for explanation of the properties
|
*
|
||||||
|
* Refer to {@link COARNotifySubmissionConfiguration} for explanation of the properties
|
||||||
*/
|
*/
|
||||||
public class SubmissionCOARNotifyRest extends BaseObjectRest<String> {
|
public class SubmissionCOARNotifyRest extends BaseObjectRest<String> {
|
||||||
public static final String NAME = "submissioncoarnotifyconfig";
|
public static final String NAME = "submissioncoarnotifyconfig";
|
||||||
|
@@ -9,15 +9,24 @@ package org.dspace.app.rest.model.step;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.dspace.app.rest.model.NotifyServiceRest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Java Bean to expose the section creativecommons representing the CC License during in progress submission.
|
* Java Bean to expose the COAR Notify Section during in progress submission.
|
||||||
|
*
|
||||||
|
* @author Mohamed Eskander (mohamed.eskander at 4science.com)
|
||||||
*/
|
*/
|
||||||
public class DataCOARNotify implements SectionData {
|
public class DataCOARNotify implements SectionData {
|
||||||
|
|
||||||
private String pattern;
|
private String pattern;
|
||||||
private List<NotifyServiceRest> services;
|
private List<Integer> services;
|
||||||
|
|
||||||
|
public DataCOARNotify() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataCOARNotify(String pattern, List<Integer> services) {
|
||||||
|
this.pattern = pattern;
|
||||||
|
this.services = services;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPattern() {
|
public String getPattern() {
|
||||||
return pattern;
|
return pattern;
|
||||||
@@ -27,11 +36,11 @@ public class DataCOARNotify implements SectionData {
|
|||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<NotifyServiceRest> getServices() {
|
public List<Integer> getServices() {
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setServices(List<NotifyServiceRest> services) {
|
public void setServices(List<Integer> services) {
|
||||||
this.services = services;
|
this.services = services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
package org.dspace.app.rest.repository;
|
package org.dspace.app.rest.repository;
|
||||||
|
|
||||||
import org.dspace.app.rest.model.SubmissionCOARNotifyRest;
|
import org.dspace.app.rest.model.SubmissionCOARNotifyRest;
|
||||||
import org.dspace.coarnotify.COARNotify;
|
import org.dspace.coarnotify.COARNotifySubmissionConfiguration;
|
||||||
import org.dspace.coarnotify.service.SubmissionCOARNotifyService;
|
import org.dspace.coarnotify.service.SubmissionCOARNotifyService;
|
||||||
import org.dspace.core.Context;
|
import org.dspace.core.Context;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -32,11 +32,12 @@ public class SubmissionCoarNotifyRestRepository extends DSpaceRestRepository<Sub
|
|||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasAuthority('AUTHENTICATED')")
|
@PreAuthorize("hasAuthority('AUTHENTICATED')")
|
||||||
public SubmissionCOARNotifyRest findOne(final Context context, final String id) {
|
public SubmissionCOARNotifyRest findOne(final Context context, final String id) {
|
||||||
COARNotify coarNotify = submissionCOARNotifyService.findOne(id);
|
COARNotifySubmissionConfiguration coarNotifySubmissionConfiguration = submissionCOARNotifyService.findOne(id);
|
||||||
if (coarNotify == null) {
|
if (coarNotifySubmissionConfiguration == null) {
|
||||||
throw new ResourceNotFoundException("No COAR Notify could be found for ID: " + id );
|
throw new ResourceNotFoundException(
|
||||||
|
"No COAR Notify Submission Configuration could be found for ID: " + id );
|
||||||
}
|
}
|
||||||
return converter.toRest(coarNotify, utils.obtainProjection());
|
return converter.toRest(coarNotifySubmissionConfiguration, utils.obtainProjection());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -49,7 +49,10 @@ public final class NotifyServicePatchUtils {
|
|||||||
try {
|
try {
|
||||||
if (operation.getValue() != null) {
|
if (operation.getValue() != null) {
|
||||||
if (operation.getValue() instanceof JsonValueEvaluator) {
|
if (operation.getValue() instanceof JsonValueEvaluator) {
|
||||||
inboundPattern = objectMapper.readValue(((JsonValueEvaluator) operation.getValue()).getValueNode().toString(),
|
inboundPattern = objectMapper.readValue(((JsonValueEvaluator) operation.getValue())
|
||||||
|
.getValueNode().toString(), NotifyServiceInboundPattern.class);
|
||||||
|
} else if (operation.getValue() instanceof String) {
|
||||||
|
inboundPattern = objectMapper.readValue((String) operation.getValue(),
|
||||||
NotifyServiceInboundPattern.class);
|
NotifyServiceInboundPattern.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +78,10 @@ public final class NotifyServicePatchUtils {
|
|||||||
try {
|
try {
|
||||||
if (operation.getValue() != null) {
|
if (operation.getValue() != null) {
|
||||||
if (operation.getValue() instanceof JsonValueEvaluator) {
|
if (operation.getValue() instanceof JsonValueEvaluator) {
|
||||||
outboundPattern = objectMapper.readValue(((JsonValueEvaluator) operation.getValue()).getValueNode().toString(),
|
outboundPattern = objectMapper.readValue(((JsonValueEvaluator) operation.getValue())
|
||||||
|
.getValueNode().toString(), NotifyServiceOutboundPattern.class);
|
||||||
|
} else if (operation.getValue() instanceof String) {
|
||||||
|
outboundPattern = objectMapper.readValue((String) operation.getValue(),
|
||||||
NotifyServiceOutboundPattern.class);
|
NotifyServiceOutboundPattern.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,6 @@ public interface DataProcessingStep extends RestProcessingStep {
|
|||||||
public static final String UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY = "accessConditions";
|
public static final String UPLOAD_STEP_ACCESSCONDITIONS_OPERATION_ENTRY = "accessConditions";
|
||||||
public static final String LICENSE_STEP_OPERATION_ENTRY = "granted";
|
public static final String LICENSE_STEP_OPERATION_ENTRY = "granted";
|
||||||
public static final String CCLICENSE_STEP_OPERATION_ENTRY = "cclicense/uri";
|
public static final String CCLICENSE_STEP_OPERATION_ENTRY = "cclicense/uri";
|
||||||
public static final String COARNOTIFY_STEP_OPERATION_ENTRY = "coarnotify/service";
|
|
||||||
public static final String ACCESS_CONDITION_STEP_OPERATION_ENTRY = "discoverable";
|
public static final String ACCESS_CONDITION_STEP_OPERATION_ENTRY = "discoverable";
|
||||||
public static final String ACCESS_CONDITION_POLICY_STEP_OPERATION_ENTRY = "accessConditions";
|
public static final String ACCESS_CONDITION_POLICY_STEP_OPERATION_ENTRY = "accessConditions";
|
||||||
public static final String SHOW_IDENTIFIERS_ENTRY = "identifiers";
|
public static final String SHOW_IDENTIFIERS_ENTRY = "identifiers";
|
||||||
|
@@ -20,7 +20,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.atteo.evo.inflector.English;
|
import org.atteo.evo.inflector.English;
|
||||||
import org.dspace.app.ldn.NotifyPatternToTrigger;
|
import org.dspace.app.ldn.NotifyPatternToTrigger;
|
||||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
|
||||||
import org.dspace.app.ldn.service.NotifyPatternToTriggerService;
|
import org.dspace.app.ldn.service.NotifyPatternToTriggerService;
|
||||||
import org.dspace.app.rest.converter.ConverterService;
|
import org.dspace.app.rest.converter.ConverterService;
|
||||||
import org.dspace.app.rest.exception.DSpaceBadRequestException;
|
import org.dspace.app.rest.exception.DSpaceBadRequestException;
|
||||||
@@ -32,7 +31,6 @@ import org.dspace.app.rest.model.BitstreamRest;
|
|||||||
import org.dspace.app.rest.model.CheckSumRest;
|
import org.dspace.app.rest.model.CheckSumRest;
|
||||||
import org.dspace.app.rest.model.ErrorRest;
|
import org.dspace.app.rest.model.ErrorRest;
|
||||||
import org.dspace.app.rest.model.MetadataValueRest;
|
import org.dspace.app.rest.model.MetadataValueRest;
|
||||||
import org.dspace.app.rest.model.NotifyServiceRest;
|
|
||||||
import org.dspace.app.rest.model.WorkspaceItemRest;
|
import org.dspace.app.rest.model.WorkspaceItemRest;
|
||||||
import org.dspace.app.rest.model.patch.Operation;
|
import org.dspace.app.rest.model.patch.Operation;
|
||||||
import org.dspace.app.rest.model.step.DataCCLicense;
|
import org.dspace.app.rest.model.step.DataCCLicense;
|
||||||
@@ -488,29 +486,20 @@ public class SubmissionService {
|
|||||||
List<NotifyPatternToTrigger> patternsToTrigger =
|
List<NotifyPatternToTrigger> patternsToTrigger =
|
||||||
notifyPatternToTriggerService.findByItem(context, obj.getItem());
|
notifyPatternToTriggerService.findByItem(context, obj.getItem());
|
||||||
|
|
||||||
Map<String, List<NotifyServiceEntity>> data =
|
Map<String, List<Integer>> data =
|
||||||
patternsToTrigger.stream()
|
patternsToTrigger.stream()
|
||||||
.collect(Collectors.groupingBy(
|
.collect(Collectors.groupingBy(
|
||||||
NotifyPatternToTrigger::getPattern,
|
NotifyPatternToTrigger::getPattern,
|
||||||
Collectors.mapping(NotifyPatternToTrigger::getNotifyService, Collectors.toList())
|
Collectors.mapping(patternToTrigger ->
|
||||||
|
patternToTrigger.getNotifyService().getID(),
|
||||||
|
Collectors.toList())
|
||||||
));
|
));
|
||||||
|
|
||||||
data.forEach((pattern, notifyServiceEntities) -> {
|
data.forEach((pattern, ids) ->
|
||||||
DataCOARNotify dataCOARNotify = new DataCOARNotify();
|
dataCOARNotifyList.add(new DataCOARNotify(pattern, ids))
|
||||||
dataCOARNotify.setPattern(pattern);
|
);
|
||||||
dataCOARNotify.setServices(convertToNotifyServiceRests(notifyServiceEntities));
|
|
||||||
dataCOARNotifyList.add(dataCOARNotify);
|
|
||||||
});
|
|
||||||
|
|
||||||
return dataCOARNotifyList;
|
return dataCOARNotifyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<NotifyServiceRest> convertToNotifyServiceRests(List<NotifyServiceEntity> notifyServiceList) {
|
|
||||||
return notifyServiceList.stream()
|
|
||||||
.map(notifyServiceEntity ->
|
|
||||||
(NotifyServiceRest) converter.toRest(
|
|
||||||
notifyServiceEntity, Projection.DEFAULT))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -31,10 +31,10 @@ public class COARNotifyServiceUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String extractPattern(String path) {
|
public static String extractPattern(String path) {
|
||||||
Pattern pattern = Pattern.compile("/coarnotify/([a-zA-Z]+)/");
|
Pattern pattern = Pattern.compile("/([^/]+)/([^/]+)/([^/]+)");
|
||||||
Matcher matcher = pattern.matcher(path);
|
Matcher matcher = pattern.matcher(path);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
return matcher.group(1);
|
return matcher.group(3);
|
||||||
} else {
|
} else {
|
||||||
throw new DSpaceBadRequestException("Pattern not found in the path");
|
throw new DSpaceBadRequestException("Pattern not found in the path");
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ public class COARNotifyStep extends AbstractProcessingStep {
|
|||||||
Operation op, SubmissionStepConfig stepConf) throws Exception {
|
Operation op, SubmissionStepConfig stepConf) throws Exception {
|
||||||
|
|
||||||
PatchOperation<?> patchOperation = new PatchOperationFactory().instanceOf(
|
PatchOperation<?> patchOperation = new PatchOperationFactory().instanceOf(
|
||||||
COARNOTIFY_STEP_OPERATION_ENTRY, op.getOp());
|
"coarnotify", op.getOp());
|
||||||
patchOperation.perform(context, currentRequest, source, op);
|
patchOperation.perform(context, currentRequest, source, op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@
|
|||||||
<entry key="accessConditions">
|
<entry key="accessConditions">
|
||||||
<bean class="org.dspace.app.rest.submit.factory.impl.AccessConditionAddPatchOperation"/>
|
<bean class="org.dspace.app.rest.submit.factory.impl.AccessConditionAddPatchOperation"/>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="coarnotify/service">
|
<entry key="coarnotify">
|
||||||
<bean class="org.dspace.app.rest.submit.factory.impl.COARNotifyServiceAddPatchOperation"/>
|
<bean class="org.dspace.app.rest.submit.factory.impl.COARNotifyServiceAddPatchOperation"/>
|
||||||
</entry>
|
</entry>
|
||||||
</map>
|
</map>
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
<entry key="accessConditions">
|
<entry key="accessConditions">
|
||||||
<bean class="org.dspace.app.rest.submit.factory.impl.AccessConditionRemovePatchOperation"/>
|
<bean class="org.dspace.app.rest.submit.factory.impl.AccessConditionRemovePatchOperation"/>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="coarnotify/service">
|
<entry key="coarnotify">
|
||||||
<bean class="org.dspace.app.rest.submit.factory.impl.COARNotifyServiceRemovePatchOperation"/>
|
<bean class="org.dspace.app.rest.submit.factory.impl.COARNotifyServiceRemovePatchOperation"/>
|
||||||
</entry>
|
</entry>
|
||||||
</map>
|
</map>
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
<entry key="accessConditions">
|
<entry key="accessConditions">
|
||||||
<bean class="org.dspace.app.rest.submit.factory.impl.AccessConditionReplacePatchOperation"/>
|
<bean class="org.dspace.app.rest.submit.factory.impl.AccessConditionReplacePatchOperation"/>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="coarnotify/service">
|
<entry key="coarnotify">
|
||||||
<bean class="org.dspace.app.rest.submit.factory.impl.COARNotifyServiceReplacePatchOperation"/>
|
<bean class="org.dspace.app.rest.submit.factory.impl.COARNotifyServiceReplacePatchOperation"/>
|
||||||
</entry>
|
</entry>
|
||||||
</map>
|
</map>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -53,10 +53,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
import com.jayway.jsonpath.matchers.JsonPathMatchers;
|
import com.jayway.jsonpath.matchers.JsonPathMatchers;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.time.DateUtils;
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
import org.dspace.app.ldn.NotifyPatternToTrigger;
|
|
||||||
import org.dspace.app.ldn.NotifyServiceEntity;
|
import org.dspace.app.ldn.NotifyServiceEntity;
|
||||||
import org.dspace.app.ldn.service.NotifyPatternToTriggerService;
|
|
||||||
import org.dspace.app.ldn.service.NotifyService;
|
|
||||||
import org.dspace.app.rest.matcher.CollectionMatcher;
|
import org.dspace.app.rest.matcher.CollectionMatcher;
|
||||||
import org.dspace.app.rest.matcher.ItemMatcher;
|
import org.dspace.app.rest.matcher.ItemMatcher;
|
||||||
import org.dspace.app.rest.matcher.MetadataMatcher;
|
import org.dspace.app.rest.matcher.MetadataMatcher;
|
||||||
@@ -8627,17 +8624,17 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
NotifyServiceEntity notifyServiceOne =
|
NotifyServiceEntity notifyServiceOne =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
||||||
.withName("service name one")
|
.withName("service name one")
|
||||||
.withLdnUrl("service ldn url one")
|
.withLdnUrl("https://service.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
NotifyServiceEntity notifyServiceTwo =
|
NotifyServiceEntity notifyServiceTwo =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name two")
|
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name two")
|
||||||
.withLdnUrl("service ldn url two")
|
.withLdnUrl("https://service2.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
NotifyServiceEntity notifyServiceThree =
|
NotifyServiceEntity notifyServiceThree =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name three")
|
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name three")
|
||||||
.withLdnUrl("service ldn url three")
|
.withLdnUrl("https://service3.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// append the three services to the workspace item with different patterns
|
// append the three services to the workspace item with different patterns
|
||||||
@@ -8658,15 +8655,10 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0]", allOf(
|
.andExpect(jsonPath("$.sections.coarnotify[0]", allOf(
|
||||||
hasJsonPath("pattern", is("endorsement")),
|
hasJsonPath("pattern", is("endorsement")),
|
||||||
hasJsonPath("services", containsInAnyOrder(
|
hasJsonPath("services", contains(notifyServiceTwo.getID(), notifyServiceThree.getID())))))
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceTwo.getID(), "service name two",
|
|
||||||
null, null, "service ldn url two"),
|
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceThree.getID(), "service name three",
|
|
||||||
null, null, "service ldn url three"))))))
|
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[1]", allOf(
|
.andExpect(jsonPath("$.sections.coarnotify[1]", allOf(
|
||||||
hasJsonPath("pattern", is("review")),
|
hasJsonPath("pattern", is("review")),
|
||||||
hasJsonPath("services", contains(matchNotifyServiceWithoutLinks(notifyServiceOne.getID(),
|
hasJsonPath("services", contains(notifyServiceOne.getID())))));
|
||||||
"service name one", null, null, "service ldn url one"))))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -8687,17 +8679,17 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
NotifyServiceEntity notifyServiceOne =
|
NotifyServiceEntity notifyServiceOne =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
||||||
.withName("service name one")
|
.withName("service name one")
|
||||||
.withLdnUrl("service ldn url one")
|
.withLdnUrl("https://service.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
NotifyServiceEntity notifyServiceTwo =
|
NotifyServiceEntity notifyServiceTwo =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name two")
|
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name two")
|
||||||
.withLdnUrl("service ldn url two")
|
.withLdnUrl("https://service2.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
NotifyServiceEntity notifyServiceThree =
|
NotifyServiceEntity notifyServiceThree =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name three")
|
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name three")
|
||||||
.withLdnUrl("service ldn url three")
|
.withLdnUrl("https://service3.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1)
|
WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1)
|
||||||
@@ -8715,8 +8707,8 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(1)))
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(1)))
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceOne.getID(), "service name one",
|
notifyServiceOne.getID()
|
||||||
null, null, "service ldn url one"))));
|
)));
|
||||||
|
|
||||||
// try to add new service of review pattern to witem
|
// try to add new service of review pattern to witem
|
||||||
List<Operation> addOpts = new ArrayList<Operation>();
|
List<Operation> addOpts = new ArrayList<Operation>();
|
||||||
@@ -8730,13 +8722,10 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(3)))
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(3)))
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
.andExpect(jsonPath("$.sections.coarnotify[0].services",contains(
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceOne.getID(), "service name one",
|
notifyServiceOne.getID(),
|
||||||
null, null, "service ldn url one"),
|
notifyServiceTwo.getID(),
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceTwo.getID(), "service name two",
|
notifyServiceThree.getID()
|
||||||
null, null, "service ldn url two"),
|
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceThree.getID(), "service name three",
|
|
||||||
null, null, "service ldn url three")
|
|
||||||
)));
|
)));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8759,17 +8748,17 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
NotifyServiceEntity notifyServiceOne =
|
NotifyServiceEntity notifyServiceOne =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
||||||
.withName("service name one")
|
.withName("service name one")
|
||||||
.withLdnUrl("service ldn url one")
|
.withLdnUrl("https://service.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
NotifyServiceEntity notifyServiceTwo =
|
NotifyServiceEntity notifyServiceTwo =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name two")
|
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name two")
|
||||||
.withLdnUrl("service ldn url two")
|
.withLdnUrl("https://service2.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
NotifyServiceEntity notifyServiceThree =
|
NotifyServiceEntity notifyServiceThree =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name three")
|
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name three")
|
||||||
.withLdnUrl("service ldn url three")
|
.withLdnUrl("https://service3.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1)
|
WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1)
|
||||||
@@ -8788,10 +8777,8 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(2)))
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(2)))
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceOne.getID(), "service name one",
|
notifyServiceOne.getID(),
|
||||||
null, null, "service ldn url one"),
|
notifyServiceTwo.getID())));
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceTwo.getID(), "service name two",
|
|
||||||
null, null, "service ldn url two"))));
|
|
||||||
|
|
||||||
// try to replace the notifyServiceOne of witem with notifyServiceThree of review pattern
|
// try to replace the notifyServiceOne of witem with notifyServiceThree of review pattern
|
||||||
List<Operation> removeOpts = new ArrayList<Operation>();
|
List<Operation> removeOpts = new ArrayList<Operation>();
|
||||||
@@ -8805,10 +8792,7 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(2)))
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(2)))
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceThree.getID(), "service name three",
|
notifyServiceThree.getID(), notifyServiceTwo.getID()
|
||||||
null, null, "service ldn url three"),
|
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceTwo.getID(), "service name two",
|
|
||||||
null, null, "service ldn url two")
|
|
||||||
)));
|
)));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8831,12 +8815,12 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
NotifyServiceEntity notifyServiceOne =
|
NotifyServiceEntity notifyServiceOne =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
NotifyServiceBuilder.createNotifyServiceBuilder(context)
|
||||||
.withName("service name one")
|
.withName("service name one")
|
||||||
.withLdnUrl("service ldn url one")
|
.withLdnUrl("https://service.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
NotifyServiceEntity notifyServiceTwo =
|
NotifyServiceEntity notifyServiceTwo =
|
||||||
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name two")
|
NotifyServiceBuilder.createNotifyServiceBuilder(context).withName("service name two")
|
||||||
.withLdnUrl("service ldn url two")
|
.withLdnUrl("https://service2.ldn.org/inbox")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1)
|
WorkspaceItem witem = WorkspaceItemBuilder.createWorkspaceItem(context, col1)
|
||||||
@@ -8855,10 +8839,8 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(2)))
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(2)))
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceOne.getID(), "service name one",
|
notifyServiceOne.getID(), notifyServiceTwo.getID()
|
||||||
null, null, "service ldn url one"),
|
)));
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceTwo.getID(), "service name two",
|
|
||||||
null, null, "service ldn url two"))));
|
|
||||||
|
|
||||||
// try to remove the notifyServiceOne of witem
|
// try to remove the notifyServiceOne of witem
|
||||||
List<Operation> removeOpts = new ArrayList<Operation>();
|
List<Operation> removeOpts = new ArrayList<Operation>();
|
||||||
@@ -8871,10 +8853,8 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
|
|||||||
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(1)))
|
.andExpect(jsonPath("$.sections.coarnotify[0].services", hasSize(1)))
|
||||||
.andExpect(jsonPath("$.sections.coarnotify[0].services", contains(
|
.andExpect(jsonPath("$.sections.coarnotify[0].services",contains(
|
||||||
matchNotifyServiceWithoutLinks(notifyServiceTwo.getID(), "service name two",
|
notifyServiceTwo.getID())));
|
||||||
null, null, "service ldn url two"))
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user