This project has retired. For details please refer to its Attic page.
ArchivaRepositoryStatistics xref
View Javadoc
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  
21  import javax.xml.bind.annotation.XmlRootElement;
22  import java.io.Serializable;
23  import java.util.Date;
24  import java.util.Map;
25  
26  /**
27   * @author Olivier Lamy
28   * @since 1.4-M3
29   */
30  @XmlRootElement( name = "archivaRepositoryStatistics" )
31  public class ArchivaRepositoryStatistics
32      implements Serializable
33  {
34      private Date scanEndTime;
35  
36      private Date scanStartTime;
37  
38      private long totalArtifactCount;
39  
40      private long totalArtifactFileSize;
41  
42      private long totalFileCount;
43  
44      private long totalGroupCount;
45  
46      private long totalProjectCount;
47  
48      private long newFileCount;
49  
50      private long duration;
51  
52      private String lastScanDate;
53  
54      private Map<String, Long> totalCountForType;
55  
56      private Map<String, Long> customValues;
57  
58      public ArchivaRepositoryStatistics()
59      {
60          // no op
61      }
62  
63      public Date getScanEndTime()
64      {
65          return scanEndTime;
66      }
67  
68      public void setScanEndTime( Date scanEndTime )
69      {
70          this.scanEndTime = scanEndTime;
71      }
72  
73      public Date getScanStartTime()
74      {
75          return scanStartTime;
76      }
77  
78      public void setScanStartTime( Date scanStartTime )
79      {
80          this.scanStartTime = scanStartTime;
81      }
82  
83      public long getTotalArtifactCount()
84      {
85          return totalArtifactCount;
86      }
87  
88      public void setTotalArtifactCount( long totalArtifactCount )
89      {
90          this.totalArtifactCount = totalArtifactCount;
91      }
92  
93      public long getTotalArtifactFileSize()
94      {
95          return totalArtifactFileSize;
96      }
97  
98      public void setTotalArtifactFileSize( long totalArtifactFileSize )
99      {
100         this.totalArtifactFileSize = totalArtifactFileSize;
101     }
102 
103     public long getTotalFileCount()
104     {
105         return totalFileCount;
106     }
107 
108     public void setTotalFileCount( long totalFileCount )
109     {
110         this.totalFileCount = totalFileCount;
111     }
112 
113     public long getTotalGroupCount()
114     {
115         return totalGroupCount;
116     }
117 
118     public void setTotalGroupCount( long totalGroupCount )
119     {
120         this.totalGroupCount = totalGroupCount;
121     }
122 
123     public long getTotalProjectCount()
124     {
125         return totalProjectCount;
126     }
127 
128     public void setTotalProjectCount( long totalProjectCount )
129     {
130         this.totalProjectCount = totalProjectCount;
131     }
132 
133     public long getNewFileCount()
134     {
135         return newFileCount;
136     }
137 
138     public void setNewFileCount( long newFileCount )
139     {
140         this.newFileCount = newFileCount;
141     }
142 
143     public void setDuration( long duration )
144     {
145         this.duration = duration;
146     }
147 
148     public long getDuration()
149     {
150         return duration;
151     }
152 
153     public String getLastScanDate()
154     {
155         return lastScanDate;
156     }
157 
158     public void setLastScanDate( String lastScanDate )
159     {
160         this.lastScanDate = lastScanDate;
161     }
162 
163     public void setTotalCountForType(Map<String, Long> totalCountForType) {
164         this.totalCountForType = totalCountForType;
165     }
166 
167     public Map<String, Long> getTotalCountForType() {
168         return this.totalCountForType;
169     }
170 
171     public void setCustomValues(Map<String,Long> customValues) {
172         this.customValues = customValues;
173     }
174 
175     public Map<String,Long> getCustomValues() {
176         return this.customValues;
177     }
178 
179 
180 
181     @Override
182     public String toString()
183     {
184         final StringBuilder sb = new StringBuilder();
185         sb.append( "ArchivaRepositoryStatistics" );
186         sb.append( "{scanEndTime=" ).append( scanEndTime );
187         sb.append( ", scanStartTime=" ).append( scanStartTime );
188         sb.append( ", totalArtifactCount=" ).append( totalArtifactCount );
189         sb.append( ", totalArtifactFileSize=" ).append( totalArtifactFileSize );
190         sb.append( ", totalFileCount=" ).append( totalFileCount );
191         sb.append( ", totalGroupCount=" ).append( totalGroupCount );
192         sb.append( ", totalProjectCount=" ).append( totalProjectCount );
193         sb.append( ", newFileCount=" ).append( newFileCount );
194         sb.append( ", duration=" ).append( duration );
195         sb.append( ", lastScanDate='" ).append( lastScanDate ).append( '\'' );
196         addMapString( sb, totalCountForType );
197         addMapString( sb, customValues );
198         sb.append( '}' );
199         return sb.toString();
200     }
201 
202     private void addMapString(StringBuilder builder, Map<String, Long> map) {
203         if (map!=null)
204         {
205             map.entrySet( ).stream( ).forEach( entry -> builder.append( ", " ).append( entry.getKey( ) ).append( '=' ).append( entry.getValue( ) ) );
206         }
207     }
208 }