sort tiles on the dashboard
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
package org.lucares.pdbui.domain;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PlotResponse {
|
||||
private String imageUrl = "";
|
||||
private Map<String, Integer> dataSeries;
|
||||
private final String thumbnailUrl;
|
||||
private PlotResponseStats stats;
|
||||
private String thumbnailUrl;
|
||||
|
||||
public PlotResponse(final Map<String, Integer> dataSeries, final String imageUrl, final String thumbnailUrl) {
|
||||
this.dataSeries = dataSeries;
|
||||
public PlotResponse(final PlotResponseStats stats, final String imageUrl, final String thumbnailUrl) {
|
||||
this.stats = stats;
|
||||
this.imageUrl = imageUrl;
|
||||
this.thumbnailUrl = thumbnailUrl;
|
||||
}
|
||||
@@ -25,16 +23,21 @@ public class PlotResponse {
|
||||
return thumbnailUrl;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getDataSeries() {
|
||||
return dataSeries;
|
||||
public PlotResponseStats getStats() {
|
||||
return stats;
|
||||
}
|
||||
|
||||
public void setDataSeries(final Map<String, Integer> dataSeries) {
|
||||
this.dataSeries = dataSeries;
|
||||
public void setStats(final PlotResponseStats stats) {
|
||||
this.stats = stats;
|
||||
}
|
||||
|
||||
public void setThumbnailUrl(final String thumbnailUrl) {
|
||||
this.thumbnailUrl = thumbnailUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return imageUrl + " " + dataSeries + " " + thumbnailUrl;
|
||||
return "PlotResponse [imageUrl=" + imageUrl + ", stats=" + stats + ", thumbnailUrl=" + thumbnailUrl + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.lucares.pdbui.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lucares.recommind.logs.DataSeries;
|
||||
|
||||
public class PlotResponseStats {
|
||||
private long maxValue;
|
||||
|
||||
private int values;
|
||||
|
||||
public PlotResponseStats() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PlotResponseStats(final long maxValue, final int values) {
|
||||
|
||||
this.maxValue = maxValue;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public long getMaxValue() {
|
||||
return maxValue;
|
||||
}
|
||||
|
||||
public void setMaxValue(final long maxValue) {
|
||||
this.maxValue = maxValue;
|
||||
}
|
||||
|
||||
public int getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(final int values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlotResponseStats [maxValue=" + maxValue + ", values=" + values + "]";
|
||||
}
|
||||
|
||||
public static PlotResponseStats fromDataSeries(final List<DataSeries> dataSeries) {
|
||||
|
||||
int values = 0;
|
||||
long maxValue = 0;
|
||||
|
||||
for (final DataSeries dataSerie : dataSeries) {
|
||||
values += dataSerie.getValues();
|
||||
maxValue = Math.max(maxValue, dataSerie.getMaxValue());
|
||||
}
|
||||
|
||||
return new PlotResponseStats(maxValue, values);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user