[CST-7756] code refactoring

This commit is contained in:
corrado lombardi
2023-02-03 15:10:27 +01:00
parent ad6d514e0e
commit 2c2c037ce0
3 changed files with 8 additions and 4 deletions

View File

@@ -50,7 +50,7 @@ public class SubscriptionEmailNotification
assignSpecialGroupsInContext();
String frequencyOption = commandLine.getOptionValue("f");
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)) {

View File

@@ -42,7 +42,7 @@ public class SubscriptionEmailNotificationConfiguration<T
public Options getOptions() {
if (Objects.isNull(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)");
options.getOption("f").setRequired(true);
super.options = options;

View File

@@ -72,11 +72,15 @@ public class SubscriptionEmailNotificationServiceImpl implements SubscriptionEma
DSpaceObject dSpaceObject = subscription.getDSpaceObject();
if (dSpaceObject.getType() == COMMUNITY) {
communities.addAll(contentUpdates.get(Community.class.getSimpleName())
communities.addAll(contentUpdates.get(Community.class.getSimpleName().toLowerCase())
.findUpdates(context, dSpaceObject, frequency));
} else if (dSpaceObject.getType() == COLLECTION) {
collections.addAll(contentUpdates.get(Collection.class.getSimpleName())
collections.addAll(contentUpdates.get(Collection.class.getSimpleName().toLowerCase())
.findUpdates(context, dSpaceObject, frequency));
} else {
log.warn("found an invalid DSpace Object type ({}) among subscriptions to send",
dSpaceObject.getType());
continue;
}
var ePerson = subscription.getEPerson();