mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-11 03:53:07 +00:00
Items count are now disabled by default. Naming changes.
This commit is contained in:
@@ -75,7 +75,7 @@ public class ItemCounter {
|
|||||||
this.dao = ItemCountDAOFactory.getInstance(this.context);
|
this.dao = ItemCountDAOFactory.getInstance(this.context);
|
||||||
this.itemService = ContentServiceFactory.getInstance().getItemService();
|
this.itemService = ContentServiceFactory.getInstance().getItemService();
|
||||||
this.configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
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);
|
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
|
* 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
|
* 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.
|
* 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
|
* If it is equal to 'false' it will count the number of items
|
||||||
* in the container in real time.
|
* in the container in real time.
|
||||||
@@ -107,7 +109,7 @@ public class ItemCounter {
|
|||||||
*/
|
*/
|
||||||
public int getCount(DSpaceObject dso) throws ItemCountException {
|
public int getCount(DSpaceObject dso) throws ItemCountException {
|
||||||
if (!showStrengths) {
|
if (!showStrengths) {
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useCache) {
|
if (useCache) {
|
||||||
|
@@ -342,9 +342,9 @@ public class Collection extends DSpaceObject implements DSpaceObjectLegacySuppor
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public int countArchivedItem() {
|
public int countArchivedItems() {
|
||||||
try {
|
try {
|
||||||
return collectionService.countArchivedItem(this);
|
return collectionService.countArchivedItems(this);
|
||||||
} catch (ItemCountException e) {
|
} catch (ItemCountException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@@ -1077,7 +1077,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
|
|||||||
* @throws ItemCountException
|
* @throws ItemCountException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int countArchivedItem(Collection collection) throws ItemCountException {
|
public int countArchivedItems(Collection collection) throws ItemCountException {
|
||||||
return ItemCounter.getInstance().getCount(collection);
|
return ItemCounter.getInstance().getCount(collection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -270,9 +270,9 @@ public class Community extends DSpaceObject implements DSpaceObjectLegacySupport
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public int countArchivedItem() {
|
public int countArchivedItems() {
|
||||||
try {
|
try {
|
||||||
return communityService.getArchivedItems(this);
|
return communityService.countArchivedItems(this);
|
||||||
} catch (ItemCountException e) {
|
} catch (ItemCountException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@@ -719,7 +719,7 @@ public class CommunityServiceImpl extends DSpaceObjectServiceImpl<Community> imp
|
|||||||
* @throws ItemCountException
|
* @throws ItemCountException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getArchivedItems(Community community) throws ItemCountException {
|
public int countArchivedItems(Community community) throws ItemCountException {
|
||||||
return ItemCounter.getInstance().getCount(community);
|
return ItemCounter.getInstance().getCount(community);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -478,5 +478,5 @@ public interface CollectionService
|
|||||||
* @return total collection archived items
|
* @return total collection archived items
|
||||||
* @throws ItemCountException
|
* @throws ItemCountException
|
||||||
*/
|
*/
|
||||||
int countArchivedItem(Collection collection) throws ItemCountException;
|
int countArchivedItems(Collection collection) throws ItemCountException;
|
||||||
}
|
}
|
||||||
|
@@ -301,5 +301,5 @@ public interface CommunityService extends DSpaceObjectService<Community>, DSpace
|
|||||||
* @return total community archived items
|
* @return total community archived items
|
||||||
* @throws ItemCountException
|
* @throws ItemCountException
|
||||||
*/
|
*/
|
||||||
int getArchivedItems(Community community) throws ItemCountException;
|
int countArchivedItems(Community community) throws ItemCountException;
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ public class CollectionConverter extends DSpaceObjectConverter<Collection, Colle
|
|||||||
@Override
|
@Override
|
||||||
public CollectionRest convert(Collection collection, Projection projection) {
|
public CollectionRest convert(Collection collection, Projection projection) {
|
||||||
CollectionRest resource = super.convert(collection, projection);
|
CollectionRest resource = super.convert(collection, projection);
|
||||||
resource.setArchivedItemsCount(collection.countArchivedItem());
|
resource.setArchivedItemsCount(collection.countArchivedItems());
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,7 +26,8 @@ public class CommunityConverter
|
|||||||
|
|
||||||
public CommunityRest convert(Community community, Projection projection) {
|
public CommunityRest convert(Community community, Projection projection) {
|
||||||
CommunityRest resource = super.convert(community, projection);
|
CommunityRest resource = super.convert(community, projection);
|
||||||
resource.setArchivedItemsCount(community.countArchivedItem());
|
resource.setArchivedItemsCount(community.countArchivedItems());
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1054,8 +1054,8 @@ webui.preview.brand.fontpoint = 12
|
|||||||
##### Settings for item count (strength) information ####
|
##### Settings for item count (strength) information ####
|
||||||
|
|
||||||
# Whether to display collection and community strengths (i.e. item counts)
|
# Whether to display collection and community strengths (i.e. item counts)
|
||||||
#The default behaviour is to show item counts.
|
# By default, this feature is disabled.
|
||||||
#webui.strengths.show = true
|
# webui.strengths.show = false
|
||||||
|
|
||||||
# Counts fetched in real time will perform an actual count of the
|
# Counts fetched in real time will perform an actual count of the
|
||||||
# index contents every time a page with this feature is requested,
|
# index contents every time a page with this feature is requested,
|
||||||
|
Reference in New Issue
Block a user