Items count are now disabled by default. Naming changes.

This commit is contained in:
damian
2023-06-13 19:58:42 +02:00
parent ff504e35d1
commit ca7c75987e
10 changed files with 18 additions and 15 deletions

View File

@@ -75,7 +75,7 @@ public class ItemCounter {
this.dao = ItemCountDAOFactory.getInstance(this.context);
this.itemService = ContentServiceFactory.getInstance().getItemService();
this.configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
this.showStrengths = configurationService.getBooleanProperty("webui.strengths.show", true);
this.showStrengths = configurationService.getBooleanProperty("webui.strengths.show", false);
this.useCache = configurationService.getBooleanProperty("webui.strengths.cache", true);
}
@@ -96,7 +96,9 @@ public class ItemCounter {
/**
* Get the count of the items in the given container. If the configuration
* value webui.strengths.show is equal to 'true' this method will return all
* archived items. If the configuration value webui.strengths.cache
* archived items. If the configuration value webui.strengths.show is equal to
* 'false' this method will return -1.
* If the configuration value webui.strengths.cache
* is equal to 'true' this will return the cached value if it exists.
* If it is equal to 'false' it will count the number of items
* in the container in real time.
@@ -107,7 +109,7 @@ public class ItemCounter {
*/
public int getCount(DSpaceObject dso) throws ItemCountException {
if (!showStrengths) {
return 0;
return -1;
}
if (useCache) {

View File

@@ -342,9 +342,9 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
*
* @return int
*/
public int countArchivedItem() {
public int countArchivedItems() {
try {
return collectionService.countArchivedItem(this);
return collectionService.countArchivedItems(this);
} catch (ItemCountException e) {
throw new RuntimeException(e);
}

View File

@@ -1077,7 +1077,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
* @throws ItemCountException
*/
@Override
public int countArchivedItem(Collection collection) throws ItemCountException {
public int countArchivedItems(Collection collection) throws ItemCountException {
return ItemCounter.getInstance().getCount(collection);
}
}

View File

@@ -270,9 +270,9 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
*
* @return int
*/
public int countArchivedItem() {
public int countArchivedItems() {
try {
return communityService.getArchivedItems(this);
return communityService.countArchivedItems(this);
} catch (ItemCountException e) {
throw new RuntimeException(e);
}

View File

@@ -719,7 +719,7 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
* @throws ItemCountException
*/
@Override
public int getArchivedItems(Community community) throws ItemCountException {
public int countArchivedItems(Community community) throws ItemCountException {
return ItemCounter.getInstance().getCount(community);
}
}

View File

@@ -478,5 +478,5 @@ public interface CollectionService
* @return total collection archived items
* @throws ItemCountException
*/
int countArchivedItem(Collection collection) throws ItemCountException;
int countArchivedItems(Collection collection) throws ItemCountException;
}

View File

@@ -301,5 +301,5 @@ public interface CommunityService extends DSpaceObjectService<Community>, DSpace
* @return total community archived items
* @throws ItemCountException
*/
int getArchivedItems(Community community) throws ItemCountException;
int countArchivedItems(Community community) throws ItemCountException;
}

View File

@@ -26,7 +26,7 @@ public class CollectionConverter extends DSpaceObjectConverter<Collection, Colle
@Override
public CollectionRest convert(Collection collection, Projection projection) {
CollectionRest resource = super.convert(collection, projection);
resource.setArchivedItemsCount(collection.countArchivedItem());
resource.setArchivedItemsCount(collection.countArchivedItems());
return resource;
}

View File

@@ -26,7 +26,8 @@ public class CommunityConverter
public CommunityRest convert(Community community, Projection projection) {
CommunityRest resource = super.convert(community, projection);
resource.setArchivedItemsCount(community.countArchivedItem());
resource.setArchivedItemsCount(community.countArchivedItems());
return resource;
}

View File

@@ -1054,8 +1054,8 @@ webui.preview.brand.fontpoint = 12
##### Settings for item count (strength) information ####
# Whether to display collection and community strengths (i.e. item counts)
#The default behaviour is to show item counts.
#webui.strengths.show = true
# By default, this feature is disabled.
# webui.strengths.show = false
# Counts fetched in real time will perform an actual count of the
# index contents every time a page with this feature is requested,