This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.rest.api.model;
002/*
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *   http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 */
020
021import javax.xml.bind.annotation.XmlRootElement;
022import java.io.Serializable;
023import java.util.Date;
024import java.util.Map;
025
026/**
027 * @author Olivier Lamy
028 * @since 1.4-M3
029 */
030@XmlRootElement( name = "archivaRepositoryStatistics" )
031public class ArchivaRepositoryStatistics
032    implements Serializable
033{
034    private Date scanEndTime;
035
036    private Date scanStartTime;
037
038    private long totalArtifactCount;
039
040    private long totalArtifactFileSize;
041
042    private long totalFileCount;
043
044    private long totalGroupCount;
045
046    private long totalProjectCount;
047
048    private long newFileCount;
049
050    private long duration;
051
052    private String lastScanDate;
053
054    private Map<String, Long> totalCountForType;
055
056    private Map<String, Long> customValues;
057
058    public ArchivaRepositoryStatistics()
059    {
060        // no op
061    }
062
063    public Date getScanEndTime()
064    {
065        return scanEndTime;
066    }
067
068    public void setScanEndTime( Date scanEndTime )
069    {
070        this.scanEndTime = scanEndTime;
071    }
072
073    public Date getScanStartTime()
074    {
075        return scanStartTime;
076    }
077
078    public void setScanStartTime( Date scanStartTime )
079    {
080        this.scanStartTime = scanStartTime;
081    }
082
083    public long getTotalArtifactCount()
084    {
085        return totalArtifactCount;
086    }
087
088    public void setTotalArtifactCount( long totalArtifactCount )
089    {
090        this.totalArtifactCount = totalArtifactCount;
091    }
092
093    public long getTotalArtifactFileSize()
094    {
095        return totalArtifactFileSize;
096    }
097
098    public void setTotalArtifactFileSize( long totalArtifactFileSize )
099    {
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}