mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[CST-7756] code refactoring
This commit is contained in:
@@ -50,7 +50,7 @@ public class SubscriptionEmailNotification
|
|||||||
assignSpecialGroupsInContext();
|
assignSpecialGroupsInContext();
|
||||||
String frequencyOption = commandLine.getOptionValue("f");
|
String frequencyOption = commandLine.getOptionValue("f");
|
||||||
if (StringUtils.isBlank(frequencyOption)) {
|
if (StringUtils.isBlank(frequencyOption)) {
|
||||||
throw new IllegalArgumentException("Option frequency f must be set");
|
throw new IllegalArgumentException("Option --frequency (-f) must be set");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FrequencyType.isSupportedFrequencyType(frequencyOption)) {
|
if (!FrequencyType.isSupportedFrequencyType(frequencyOption)) {
|
||||||
|
@@ -42,7 +42,7 @@ public class SubscriptionEmailNotificationConfiguration<T
|
|||||||
public Options getOptions() {
|
public Options getOptions() {
|
||||||
if (Objects.isNull(options)) {
|
if (Objects.isNull(options)) {
|
||||||
Options options = new Options();
|
Options options = new Options();
|
||||||
options.addOption("f", "Frequency", true,
|
options.addOption("f", "frequency", true,
|
||||||
"Subscription frequency. Valid values include: D (Day), W (Week) and M (Month)");
|
"Subscription frequency. Valid values include: D (Day), W (Week) and M (Month)");
|
||||||
options.getOption("f").setRequired(true);
|
options.getOption("f").setRequired(true);
|
||||||
super.options = options;
|
super.options = options;
|
||||||
|
@@ -72,11 +72,15 @@ public class SubscriptionEmailNotificationServiceImpl implements SubscriptionEma
|
|||||||
DSpaceObject dSpaceObject = subscription.getDSpaceObject();
|
DSpaceObject dSpaceObject = subscription.getDSpaceObject();
|
||||||
|
|
||||||
if (dSpaceObject.getType() == COMMUNITY) {
|
if (dSpaceObject.getType() == COMMUNITY) {
|
||||||
communities.addAll(contentUpdates.get(Community.class.getSimpleName())
|
communities.addAll(contentUpdates.get(Community.class.getSimpleName().toLowerCase())
|
||||||
.findUpdates(context, dSpaceObject, frequency));
|
.findUpdates(context, dSpaceObject, frequency));
|
||||||
} else if (dSpaceObject.getType() == COLLECTION) {
|
} else if (dSpaceObject.getType() == COLLECTION) {
|
||||||
collections.addAll(contentUpdates.get(Collection.class.getSimpleName())
|
collections.addAll(contentUpdates.get(Collection.class.getSimpleName().toLowerCase())
|
||||||
.findUpdates(context, dSpaceObject, frequency));
|
.findUpdates(context, dSpaceObject, frequency));
|
||||||
|
} else {
|
||||||
|
log.warn("found an invalid DSpace Object type ({}) among subscriptions to send",
|
||||||
|
dSpaceObject.getType());
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ePerson = subscription.getEPerson();
|
var ePerson = subscription.getEPerson();
|
||||||
|
Reference in New Issue
Block a user