Skip to content

Commit

Permalink
Fix for StatisticsService
Browse files Browse the repository at this point in the history
  • Loading branch information
haarli committed Jun 18, 2024
1 parent 73a187d commit cbbcec7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
*
Expand All @@ -39,8 +43,9 @@ public long getUsedStorageSizeForInstitute(String instituteName) {
final Search s = new JenaSearch(SearchObjectTypes.ALL, null);
final List<String> 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;
Expand All @@ -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;
Expand Down

0 comments on commit cbbcec7

Please sign in to comment.