summaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/repository-statistics
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-07-05 20:43:37 +0000
committerOlivier Lamy <olamy@apache.org>2012-07-05 20:43:37 +0000
commit707cdb193ac7423404bf18b8bd86b814a1129724 (patch)
tree917d0fb9094a8158dd1b7f26a261193bf0730b98 /archiva-modules/plugins/repository-statistics
parent17d1f944e09872ee12b82c80fce34c6d34769745 (diff)
downloadarchiva-707cdb193ac7423404bf18b8bd86b814a1129724.tar.gz
archiva-707cdb193ac7423404bf18b8bd86b814a1129724.zip
[MRM-1583] ui rewrite: rewrite reports page
Submitted by Adrien Lecharpentier. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1357889 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/repository-statistics')
-rw-r--r--archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java1
-rw-r--r--archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java24
2 files changed, 23 insertions, 2 deletions
diff --git a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
index 4bad96e5f..d363543ad 100644
--- a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
+++ b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/DefaultRepositoryStatisticsManager.java
@@ -123,6 +123,7 @@ public class DefaultRepositoryStatisticsManager
throws MetadataRepositoryException
{
RepositoryStatistics repositoryStatistics = new RepositoryStatistics();
+ repositoryStatistics.setRepositoryId( repositoryId );
repositoryStatistics.setScanStartTime( startTime );
repositoryStatistics.setScanEndTime( endTime );
repositoryStatistics.setTotalFileCount( totalFiles );
diff --git a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java
index 8e0863478..f32c6992f 100644
--- a/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java
+++ b/archiva-modules/plugins/repository-statistics/src/main/java/org/apache/archiva/metadata/repository/stats/RepositoryStatistics.java
@@ -54,6 +54,8 @@ public class RepositoryStatistics
private static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "UTC" );
+ private String repositoryId;
+
public Date getScanEndTime()
{
return scanEndTime;
@@ -139,6 +141,16 @@ public class RepositoryStatistics
return scanEndTime.getTime() - scanStartTime.getTime();
}
+ public String getRepositoryId()
+ {
+ return repositoryId;
+ }
+
+ public void setRepositoryId( String repositoryId )
+ {
+ this.repositoryId = repositoryId;
+ }
+
public String getFacetId()
{
return FACET_ID;
@@ -167,6 +179,7 @@ public class RepositoryStatistics
properties.put( "totalGroupCount", String.valueOf( totalGroupCount ) );
properties.put( "totalProjectCount", String.valueOf( totalProjectCount ) );
properties.put( "newFileCount", String.valueOf( newFileCount ) );
+ properties.put( "repositoryId", repositoryId );
for ( Map.Entry<String, Long> entry : totalCountForType.entrySet() )
{
properties.put( "count-" + entry.getKey(), String.valueOf( entry.getValue() ) );
@@ -184,6 +197,7 @@ public class RepositoryStatistics
totalGroupCount = Long.parseLong( properties.get( "totalGroupCount" ) );
totalProjectCount = Long.parseLong( properties.get( "totalProjectCount" ) );
newFileCount = Long.parseLong( properties.get( "newFileCount" ) );
+ repositoryId = properties.get( "repositoryId" );
totalCountForType.clear();
for ( Map.Entry<String, String> entry : properties.entrySet() )
{
@@ -244,6 +258,10 @@ public class RepositoryStatistics
{
return false;
}
+ if ( !repositoryId.equals( that.repositoryId ) )
+ {
+ return false;
+ }
return true;
}
@@ -260,6 +278,7 @@ public class RepositoryStatistics
result = 31 * result + (int) ( totalProjectCount ^ ( totalProjectCount >>> 32 ) );
result = 31 * result + (int) ( newFileCount ^ ( newFileCount >>> 32 ) );
result = 31 * result + totalCountForType.hashCode();
+ result = 31 * result + repositoryId.hashCode();
return result;
}
@@ -269,7 +288,8 @@ public class RepositoryStatistics
return "RepositoryStatistics{" + "scanEndTime=" + scanEndTime + ", scanStartTime=" + scanStartTime +
", totalArtifactCount=" + totalArtifactCount + ", totalArtifactFileSize=" + totalArtifactFileSize +
", totalFileCount=" + totalFileCount + ", totalGroupCount=" + totalGroupCount + ", totalProjectCount=" +
- totalProjectCount + ", newFileCount=" + newFileCount + ", totalCountForType=" + totalCountForType + '}';
+ totalProjectCount + ", newFileCount=" + newFileCount + ", totalCountForType=" + totalCountForType + ", " +
+ "repositoryId=" + repositoryId + '}';
}
public Map<String, Long> getTotalCountForType()
@@ -284,7 +304,7 @@ public class RepositoryStatistics
public void setTotalCountForType( String type, long count )
{
- totalCountForType.put( type, count );
+ totalCountForType.put( type.replaceAll( "-", "_" ).replaceAll( "\\.", "_" ), count );
}
private static final class ZeroForNullHashMap<K, V extends Long> extends HashMap<K, V>