From cbbcec768e9cb486cc10d943b0b71ecb87ee3ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Haarl=C3=A4nder?= Date: Tue, 18 Jun 2024 15:53:35 +0200 Subject: [PATCH] Fix for StatisticsService --- .../de/mpg/imeji/logic/statistic/StatisticsService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/mpg/imeji/logic/statistic/StatisticsService.java b/src/main/java/de/mpg/imeji/logic/statistic/StatisticsService.java index 810d5b0f2..d96e62086 100644 --- a/src/main/java/de/mpg/imeji/logic/statistic/StatisticsService.java +++ b/src/main/java/de/mpg/imeji/logic/statistic/StatisticsService.java @@ -2,12 +2,15 @@ import java.util.List; +import de.mpg.imeji.logic.export.ZIPExport; import de.mpg.imeji.logic.model.User; import de.mpg.imeji.logic.search.Search; import de.mpg.imeji.logic.search.Search.SearchObjectTypes; import de.mpg.imeji.logic.search.jenasearch.JenaCustomQueries; import de.mpg.imeji.logic.search.jenasearch.JenaSearch; import de.mpg.imeji.logic.security.user.util.QuotaUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; /** * Controller for all actions which are related to statistics @@ -17,6 +20,7 @@ */ public class StatisticsService { + private static final Logger LOGGER = LogManager.getLogger(StatisticsService.class); /** * Return the all institute names (define by the suffix of emails users) * @@ -39,8 +43,9 @@ public long getUsedStorageSizeForInstitute(String instituteName) { final Search s = new JenaSearch(SearchObjectTypes.ALL, null); final List result = s.searchString(JenaCustomQueries.selectInstituteFileSize(instituteName), null, null, Search.SEARCH_FROM_START_INDEX, Search.GET_ALL_RESULTS).getResults(); + LOGGER.info(result); if (result.size() == 1 && result.get(0) != null) { - final String size = result.get(0).replace("^^http://www.w3.org/2001/XMLSchema#integer", ""); + final String size = result.get(0).replace("^^xsd:integer", "").replace("\"",""); return Long.parseLong(size); } return 0; @@ -52,7 +57,7 @@ public long getAllFileSize() { s.searchString(JenaCustomQueries.selectFileSizeForAll(), null, null, Search.SEARCH_FROM_START_INDEX, Search.GET_ALL_RESULTS) .getResults(); if (result.size() == 1 && result.get(0) != null) { - final String size = result.get(0).replace("^^http://www.w3.org/2001/XMLSchema#integer", ""); + final String size = result.get(0).replace("^^xsd:integer", "").replace("\"","");; return Long.parseLong(size); } return 0;