src: re-organize switch statements in scripts

It makes more sense to me to start from the top level of the hier-
archy.
This commit is contained in:
Alan Orth 2022-10-07 13:11:03 +03:00
parent 8e01595cc1
commit 5ebf4930cf
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
2 changed files with 12 additions and 12 deletions

View File

@ -59,10 +59,8 @@ public class FixJpgJpgThumbnails {
DSpaceObject parent = handleService.resolveToObject(context, parentHandle); DSpaceObject parent = handleService.resolveToObject(context, parentHandle);
if (parent != null) { if (parent != null) {
switch (parent.getType()) { switch (parent.getType()) {
case Constants.COLLECTION: case Constants.SITE:
process( process(context, itemService.findAll(context));
context,
itemService.findByCollection(context, (Collection) parent));
break; break;
case Constants.COMMUNITY: case Constants.COMMUNITY:
List<Collection> collections = ((Community) parent).getCollections(); List<Collection> collections = ((Community) parent).getCollections();
@ -72,8 +70,10 @@ public class FixJpgJpgThumbnails {
itemService.findAllByCollection(context, collection)); itemService.findAllByCollection(context, collection));
} }
break; break;
case Constants.SITE: case Constants.COLLECTION:
process(context, itemService.findAll(context)); process(
context,
itemService.findByCollection(context, (Collection) parent));
break; break;
case Constants.ITEM: case Constants.ITEM:
processItem(context, (Item) parent); processItem(context, (Item) parent);

View File

@ -76,10 +76,8 @@ public class FixLowQualityThumbnails {
DSpaceObject parent = handleService.resolveToObject(context, parentHandle); DSpaceObject parent = handleService.resolveToObject(context, parentHandle);
if (parent != null) { if (parent != null) {
switch (parent.getType()) { switch (parent.getType()) {
case Constants.COLLECTION: case Constants.SITE:
process( process(context, itemService.findAll(context));
context,
itemService.findByCollection(context, (Collection) parent));
break; break;
case Constants.COMMUNITY: case Constants.COMMUNITY:
List<Collection> collections = ((Community) parent).getCollections(); List<Collection> collections = ((Community) parent).getCollections();
@ -89,8 +87,10 @@ public class FixLowQualityThumbnails {
itemService.findAllByCollection(context, collection)); itemService.findAllByCollection(context, collection));
} }
break; break;
case Constants.SITE: case Constants.COLLECTION:
process(context, itemService.findAll(context)); process(
context,
itemService.findByCollection(context, (Collection) parent));
break; break;
case Constants.ITEM: case Constants.ITEM:
processItem(context, (Item) parent); processItem(context, (Item) parent);