You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ArchivaRepositoryStatistics.java 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. package org.apache.archiva.rest.api.model;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import javax.xml.bind.annotation.XmlRootElement;
  21. import java.io.Serializable;
  22. import java.util.Date;
  23. import java.util.Map;
  24. /**
  25. * @author Olivier Lamy
  26. * @since 1.4-M3
  27. */
  28. @XmlRootElement( name = "archivaRepositoryStatistics" )
  29. public class ArchivaRepositoryStatistics
  30. implements Serializable
  31. {
  32. private Date scanEndTime;
  33. private Date scanStartTime;
  34. private long totalArtifactCount;
  35. private long totalArtifactFileSize;
  36. private long totalFileCount;
  37. private long totalGroupCount;
  38. private long totalProjectCount;
  39. private long newFileCount;
  40. private long duration;
  41. private String lastScanDate;
  42. private Map<String, Long> totalCountForType;
  43. private Map<String, Long> customValues;
  44. public ArchivaRepositoryStatistics()
  45. {
  46. // no op
  47. }
  48. public Date getScanEndTime()
  49. {
  50. return scanEndTime;
  51. }
  52. public void setScanEndTime( Date scanEndTime )
  53. {
  54. this.scanEndTime = scanEndTime;
  55. }
  56. public Date getScanStartTime()
  57. {
  58. return scanStartTime;
  59. }
  60. public void setScanStartTime( Date scanStartTime )
  61. {
  62. this.scanStartTime = scanStartTime;
  63. }
  64. public long getTotalArtifactCount()
  65. {
  66. return totalArtifactCount;
  67. }
  68. public void setTotalArtifactCount( long totalArtifactCount )
  69. {
  70. this.totalArtifactCount = totalArtifactCount;
  71. }
  72. public long getTotalArtifactFileSize()
  73. {
  74. return totalArtifactFileSize;
  75. }
  76. public void setTotalArtifactFileSize( long totalArtifactFileSize )
  77. {
  78. this.totalArtifactFileSize = totalArtifactFileSize;
  79. }
  80. public long getTotalFileCount()
  81. {
  82. return totalFileCount;
  83. }
  84. public void setTotalFileCount( long totalFileCount )
  85. {
  86. this.totalFileCount = totalFileCount;
  87. }
  88. public long getTotalGroupCount()
  89. {
  90. return totalGroupCount;
  91. }
  92. public void setTotalGroupCount( long totalGroupCount )
  93. {
  94. this.totalGroupCount = totalGroupCount;
  95. }
  96. public long getTotalProjectCount()
  97. {
  98. return totalProjectCount;
  99. }
  100. public void setTotalProjectCount( long totalProjectCount )
  101. {
  102. this.totalProjectCount = totalProjectCount;
  103. }
  104. public long getNewFileCount()
  105. {
  106. return newFileCount;
  107. }
  108. public void setNewFileCount( long newFileCount )
  109. {
  110. this.newFileCount = newFileCount;
  111. }
  112. public void setDuration( long duration )
  113. {
  114. this.duration = duration;
  115. }
  116. public long getDuration()
  117. {
  118. return duration;
  119. }
  120. public String getLastScanDate()
  121. {
  122. return lastScanDate;
  123. }
  124. public void setLastScanDate( String lastScanDate )
  125. {
  126. this.lastScanDate = lastScanDate;
  127. }
  128. public void setTotalCountForType(Map<String, Long> totalCountForType) {
  129. this.totalCountForType = totalCountForType;
  130. }
  131. public Map<String, Long> getTotalCountForType() {
  132. return this.totalCountForType;
  133. }
  134. public void setCustomValues(Map<String,Long> customValues) {
  135. this.customValues = customValues;
  136. }
  137. public Map<String,Long> getCustomValues() {
  138. return this.customValues;
  139. }
  140. @Override
  141. public String toString()
  142. {
  143. final StringBuilder sb = new StringBuilder();
  144. sb.append( "ArchivaRepositoryStatistics" );
  145. sb.append( "{scanEndTime=" ).append( scanEndTime );
  146. sb.append( ", scanStartTime=" ).append( scanStartTime );
  147. sb.append( ", totalArtifactCount=" ).append( totalArtifactCount );
  148. sb.append( ", totalArtifactFileSize=" ).append( totalArtifactFileSize );
  149. sb.append( ", totalFileCount=" ).append( totalFileCount );
  150. sb.append( ", totalGroupCount=" ).append( totalGroupCount );
  151. sb.append( ", totalProjectCount=" ).append( totalProjectCount );
  152. sb.append( ", newFileCount=" ).append( newFileCount );
  153. sb.append( ", duration=" ).append( duration );
  154. sb.append( ", lastScanDate='" ).append( lastScanDate ).append( '\'' );
  155. addMapString( sb, totalCountForType );
  156. addMapString( sb, customValues );
  157. sb.append( '}' );
  158. return sb.toString();
  159. }
  160. private void addMapString(StringBuilder builder, Map<String, Long> map) {
  161. if (map!=null)
  162. {
  163. map.entrySet( ).stream( ).forEach( entry -> builder.append( ", " ).append( entry.getKey( ) ).append( '=' ).append( entry.getValue( ) ) );
  164. }
  165. }
  166. }