refs:4041: Accounting Manager portlet: give possibility to download raw data to users
https://support.d4science.org/issues/4041 Added Show Others for download all elements git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@129572 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0b03bda9a7
commit
52c9f154f9
|
@ -418,6 +418,8 @@ public class AccountingManagerController {
|
|||
|
||||
}
|
||||
|
||||
//TODO save on workspace
|
||||
@SuppressWarnings("unused")
|
||||
private void doSaveDataOnWorkspace(ExportRequestEvent event) {
|
||||
accountingMonitor = new AccountingMonitor();
|
||||
Log.debug("Call saveCSVOnWorkspace on server, params: "
|
||||
|
|
|
@ -30,15 +30,19 @@ import com.google.gwt.core.client.GWT;
|
|||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.event.shared.EventBus;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HasValue;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||
import com.sencha.gxt.core.client.XTemplates;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.core.client.util.ToggleGroup;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
|
@ -51,6 +55,9 @@ import com.sencha.gxt.dnd.core.client.GridDropTarget;
|
|||
import com.sencha.gxt.widget.core.client.button.ButtonBar;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
|
@ -67,6 +74,7 @@ import com.sencha.gxt.widget.core.client.form.ComboBox;
|
|||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
import com.sencha.gxt.widget.core.client.form.IntegerSpinnerField;
|
||||
import com.sencha.gxt.widget.core.client.form.Radio;
|
||||
import com.sencha.gxt.widget.core.client.form.StringComboBox;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
|
@ -105,12 +113,19 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
private ComboBox<FilterKey> comboTopFilterKey;
|
||||
private FieldLabel comboTopFilterKeyLabel;
|
||||
private ToolBar toolBar;
|
||||
//private CheckBox showOthers;
|
||||
private FieldLabel showOthersLabel;
|
||||
private IntegerSpinnerField topNumber;
|
||||
private FieldLabel topNumberLabel;
|
||||
|
||||
private FilterKey filterKey;
|
||||
private boolean cancelValue;
|
||||
private AccountingMonitor accountingMonitor;
|
||||
private Radio showOthersYes;
|
||||
private Radio showOthersNo;
|
||||
private ToggleGroup showOthersToggle;
|
||||
|
||||
|
||||
|
||||
public interface FilterKeyPropertiesCombo extends PropertyAccess<FilterKey> {
|
||||
|
||||
|
@ -427,7 +442,38 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
addHandlersForComboTopFilterKey(filterKeyPropertiesCombo.key());
|
||||
|
||||
comboTopFilterKeyLabel = new FieldLabel(comboTopFilterKey, "Key");
|
||||
|
||||
//ShowOthers
|
||||
showOthersYes=new Radio();
|
||||
showOthersYes.setBoxLabel("Yes");
|
||||
|
||||
showOthersNo=new Radio();
|
||||
showOthersNo.setBoxLabel("No");
|
||||
showOthersNo.setValue(true);
|
||||
|
||||
showOthersToggle=new ToggleGroup();
|
||||
showOthersToggle.add(showOthersYes);
|
||||
showOthersToggle.add(showOthersNo);
|
||||
|
||||
showOthersToggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
||||
ToggleGroup group=(ToggleGroup) event.getSource();
|
||||
Radio radio=(Radio) group.getValue();
|
||||
Log.debug("ShowOthers selected: "+radio.getBoxLabel());
|
||||
}
|
||||
});
|
||||
|
||||
HBoxLayoutContainer hp=new HBoxLayoutContainer();
|
||||
hp.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
hp.setPack(BoxLayoutPack.START);
|
||||
hp.add(showOthersYes, new BoxLayoutData(new Margins(0)));
|
||||
hp.add(showOthersNo, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
|
||||
showOthersLabel = new FieldLabel(hp, "Show Others");
|
||||
|
||||
//
|
||||
topNumber = new IntegerSpinnerField();
|
||||
topNumber.setMaxValue(TOP_NUMBER_MAX);
|
||||
|
@ -446,6 +492,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
0)));
|
||||
vlc.add(comboTopFilterKeyLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
vlc.add(showOthersLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(topNumberLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(grid, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
|
@ -457,6 +504,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
|
||||
add(fieldSet, new MarginData(0));
|
||||
comboTopFilterKeyLabel.setVisible(false);
|
||||
showOthersLabel.setVisible(false);
|
||||
topNumberLabel.setVisible(false);
|
||||
}
|
||||
|
||||
|
@ -579,6 +627,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
comboChartType.setValue(ChartType.Basic);
|
||||
comboTopFilterKey.reset();
|
||||
comboTopFilterKeyLabel.setVisible(false);
|
||||
showOthersToggle.reset();
|
||||
showOthersNo.setValue(true);
|
||||
showOthersLabel.setVisible(false);
|
||||
topNumber.reset();
|
||||
topNumberLabel.setVisible(false);
|
||||
forceLayout();
|
||||
|
@ -599,12 +650,16 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
|
||||
} else {
|
||||
comboTopFilterKey.reset();
|
||||
showOthersToggle.reset();
|
||||
showOthersNo.setValue(true);
|
||||
topNumber.reset();
|
||||
topNumber.setValue(TOP_NUMBER_DEFAULT);
|
||||
|
||||
}
|
||||
} else {
|
||||
comboTopFilterKey.reset();
|
||||
showOthersToggle.reset();
|
||||
showOthersNo.setValue(true);
|
||||
topNumber.reset();
|
||||
topNumber.setValue(TOP_NUMBER_DEFAULT);
|
||||
|
||||
|
@ -614,6 +669,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
seq = 0;
|
||||
comboChartType.setValue(ChartType.Top);
|
||||
comboTopFilterKeyLabel.setVisible(true);
|
||||
showOthersLabel.setVisible(true);
|
||||
topNumberLabel.setVisible(true);
|
||||
forceLayout();
|
||||
}
|
||||
|
@ -668,10 +724,11 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
if (filterKey == null) {
|
||||
return new AccountingFilterTop();
|
||||
} else {
|
||||
Boolean showOthersValue=showOthersYes.getValue();
|
||||
Integer topN = topNumber.getCurrentValue();
|
||||
|
||||
if (store == null || store.size() <= 0) {
|
||||
return new AccountingFilterTop(filterKey, null, topN);
|
||||
return new AccountingFilterTop(filterKey, null, showOthersValue, topN);
|
||||
} else {
|
||||
List<AccountingFilter> filtersActives = store.getAll();
|
||||
ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>();
|
||||
|
@ -683,9 +740,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
if (filtersReady.size() > 0) {
|
||||
return new AccountingFilterTop(filterKey, filtersReady,
|
||||
topN);
|
||||
showOthersValue,topN);
|
||||
} else {
|
||||
return new AccountingFilterTop(filterKey, null, topN);
|
||||
return new AccountingFilterTop(filterKey, null, showOthersValue, topN);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -898,6 +955,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
case Basic:
|
||||
comboTopFilterKey.reset();
|
||||
comboTopFilterKeyLabel.setVisible(false);
|
||||
showOthersToggle.reset();
|
||||
showOthersNo.setValue(true);
|
||||
showOthersLabel.setVisible(false);
|
||||
topNumber.reset();
|
||||
topNumberLabel.setVisible(false);
|
||||
store.clear();
|
||||
|
@ -914,6 +974,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
.getAvailableFilterKeys().get(0));
|
||||
}
|
||||
comboTopFilterKeyLabel.setVisible(true);
|
||||
showOthersToggle.reset();
|
||||
showOthersNo.setValue(true);
|
||||
showOthersLabel.setVisible(true);
|
||||
topNumber.reset();
|
||||
topNumber.setValue(TOP_NUMBER_DEFAULT);
|
||||
topNumberLabel.setVisible(true);
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.google.gwt.event.shared.EventBus;
|
|||
*
|
||||
*/
|
||||
public class AccountingChart4Portlet extends AccountingChartBuilder {
|
||||
@SuppressWarnings("unused")
|
||||
private EventBus eventBus;
|
||||
private AccountingClientStateData accountingStateData;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.google.gwt.event.shared.EventBus;
|
|||
*
|
||||
*/
|
||||
public class AccountingChart4Task extends AccountingChartBuilder {
|
||||
@SuppressWarnings("unused")
|
||||
private EventBus eventBus;
|
||||
private AccountingClientStateData accountingStateData;
|
||||
|
||||
|
|
|
@ -527,6 +527,170 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
+ " }" + " }");
|
||||
|
||||
ArrayList<SeriesColumn> seriesColumn = new ArrayList<>();
|
||||
if (seriesJobTop.getShowOthers()) {
|
||||
createSeriesColumnShowOthers(seriesJobTop, interval, dateStart,
|
||||
highchartsFactory, colors, seriesColumn);
|
||||
} else {
|
||||
createSeriesColumnSimple(seriesJobTop, interval, dateStart,
|
||||
highchartsFactory, colors, seriesColumn);
|
||||
}
|
||||
|
||||
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
}
|
||||
|
||||
options.chart().showAxes(true);
|
||||
|
||||
options.legend().enabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
private void createSeriesColumnShowOthers(SeriesJobTop seriesJobTop,
|
||||
double interval, Date dateStart,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series ShowOthers");
|
||||
int i = 0;
|
||||
for (; i < seriesJobTop.getSeriesJobDataTopList().size()
|
||||
&& i < seriesJobTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesJobTop
|
||||
.getSeriesJobDataTopList().get(i).getFilterValue()
|
||||
.getValue());
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
|
||||
|
||||
for (SeriesJobData seriesJobData : seriesJobTop
|
||||
.getSeriesJobDataTopList().get(i).getSeries()) {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
data.push(seriesJobData.getDuration() / unitMeasure);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
data.push(seriesJobData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
data.push(seriesJobData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
data.push(seriesJobData.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
data.push(seriesJobData.getDuration() / unitMeasure);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
||||
if (i < seriesJobTop.getSeriesJobDataTopList().size()) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name("Others");
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
ArrayList<Long> othersData = new ArrayList<>();
|
||||
for (int j = i; j < seriesJobTop.getSeriesJobDataTopList()
|
||||
.size(); j++) {
|
||||
Long value;
|
||||
for (int k = 0; k < seriesJobTop
|
||||
.getSeriesJobDataTopList().get(j).getSeries()
|
||||
.size(); k++) {
|
||||
SeriesJobData seriesJobData = seriesJobTop
|
||||
.getSeriesJobDataTopList().get(j).getSeries()
|
||||
.get(k);
|
||||
if (j == i) {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
othersData.add(seriesJobData.getDuration()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
othersData.add(seriesJobData
|
||||
.getMaxInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
othersData.add(seriesJobData
|
||||
.getMinInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
othersData.add(seriesJobData
|
||||
.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
othersData.add(seriesJobData.getDuration()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
value = (seriesJobData.getDuration() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
value = (seriesJobData.getMaxInvocationTime() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
value = (seriesJobData.getMinInvocationTime() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case OperationCount:
|
||||
value = seriesJobData.getOperationCount()
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
default:
|
||||
value = (seriesJobData.getDuration() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
|
||||
|
||||
for (Long value : othersData) {
|
||||
data.push(value);
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void createSeriesColumnSimple(SeriesJobTop seriesJobTop,
|
||||
double interval, Date dateStart,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series Simple");
|
||||
for (int i = 0; i < seriesJobTop.getSeriesJobDataTopList().size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
@ -568,15 +732,6 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
}
|
||||
|
||||
options.chart().showAxes(true);
|
||||
|
||||
options.legend().enabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
private String retrieveYAxis(ArrayString colors) {
|
||||
|
|
|
@ -4,10 +4,10 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.event.ExportRequestEvent;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.TimeUnitMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ChartTimeMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.DownloadConstants;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ServiceChartMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.TimeUnitMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||
|
@ -188,7 +188,7 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
downloadXMLItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
|
@ -198,7 +198,7 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
downloadJSONItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
|
@ -208,7 +208,6 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
downloadPNGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
|
@ -401,24 +400,23 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
private void onDownloadCSV() {
|
||||
ExportRequestEvent event = new ExportRequestEvent(
|
||||
ExportType.CSV, accountingStateData.getAccountingType());
|
||||
ExportRequestEvent event = new ExportRequestEvent(ExportType.CSV,
|
||||
accountingStateData.getAccountingType());
|
||||
eventBus.fireEvent(event);
|
||||
}
|
||||
|
||||
|
||||
private void onDownloadXML() {
|
||||
ExportRequestEvent event = new ExportRequestEvent(
|
||||
ExportType.XML, accountingStateData.getAccountingType());
|
||||
ExportRequestEvent event = new ExportRequestEvent(ExportType.XML,
|
||||
accountingStateData.getAccountingType());
|
||||
eventBus.fireEvent(event);
|
||||
}
|
||||
|
||||
private void onDownloadJSON() {
|
||||
ExportRequestEvent event = new ExportRequestEvent(
|
||||
ExportType.JSON, accountingStateData.getAccountingType());
|
||||
ExportRequestEvent event = new ExportRequestEvent(ExportType.JSON,
|
||||
accountingStateData.getAccountingType());
|
||||
eventBus.fireEvent(event);
|
||||
}
|
||||
|
||||
|
||||
// chart.options.exporting.buttons.contextButton.menuItems[0].onclick();
|
||||
|
||||
public static native void onDownloadPNG(String id) /*-{
|
||||
|
@ -531,6 +529,168 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
+ " }" + " }");
|
||||
|
||||
ArrayList<SeriesColumn> seriesColumn = new ArrayList<>();
|
||||
if (seriesServiceTop.getShowOthers()) {
|
||||
createSeriesColumnShowOthers(seriesServiceTop, interval, dateStart,
|
||||
highchartsFactory, colors, seriesColumn);
|
||||
} else {
|
||||
createSeriesColumnSimple(seriesServiceTop, interval, dateStart,
|
||||
highchartsFactory, colors, seriesColumn);
|
||||
}
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
}
|
||||
|
||||
options.chart().showAxes(true);
|
||||
|
||||
options.legend().enabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
private void createSeriesColumnShowOthers(
|
||||
SeriesServiceTop seriesServiceTop, double interval, Date dateStart,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series ShowOthers");
|
||||
int i = 0;
|
||||
for (; i < seriesServiceTop.getSeriesServiceDataTopList().size()
|
||||
&& i < seriesServiceTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(i).getFilterValue()
|
||||
.getValue());
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
|
||||
|
||||
for (SeriesServiceData seriesServiceData : seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(i).getSeries()) {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
data.push(seriesServiceData.getDuration() / unitMeasure);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
data.push(seriesServiceData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
data.push(seriesServiceData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
data.push(seriesServiceData.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
data.push(seriesServiceData.getDuration() / unitMeasure);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
||||
if (i < seriesServiceTop.getSeriesServiceDataTopList().size()) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name("Others");
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
ArrayList<Long> othersData = new ArrayList<>();
|
||||
for (int j = i; j < seriesServiceTop.getSeriesServiceDataTopList()
|
||||
.size(); j++) {
|
||||
Long value;
|
||||
for (int k = 0; k < seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(j).getSeries()
|
||||
.size(); k++) {
|
||||
SeriesServiceData seriesServiceData = seriesServiceTop
|
||||
.getSeriesServiceDataTopList().get(j).getSeries()
|
||||
.get(k);
|
||||
if (j == i) {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
othersData.add(seriesServiceData.getDuration()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
othersData.add(seriesServiceData
|
||||
.getMaxInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
othersData.add(seriesServiceData
|
||||
.getMinInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
othersData.add(seriesServiceData
|
||||
.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
othersData.add(seriesServiceData.getDuration()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
value = (seriesServiceData.getDuration() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
value = (seriesServiceData.getMaxInvocationTime() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
value = (seriesServiceData.getMinInvocationTime() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case OperationCount:
|
||||
value = seriesServiceData.getOperationCount()
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
default:
|
||||
value = (seriesServiceData.getDuration() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
|
||||
|
||||
for (Long value : othersData) {
|
||||
data.push(value);
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createSeriesColumnSimple(SeriesServiceTop seriesServiceTop,
|
||||
double interval, Date dateStart,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series Simple");
|
||||
for (int i = 0; i < seriesServiceTop.getSeriesServiceDataTopList()
|
||||
.size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
|
@ -574,15 +734,6 @@ public class ServiceChartTopPanel extends SimpleContainer {
|
|||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
}
|
||||
|
||||
options.chart().showAxes(true);
|
||||
|
||||
options.legend().enabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
private String retrieveYAxis(ArrayString colors) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
private DateTimeFormat dtf = DateTimeFormat
|
||||
.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
|
||||
|
||||
private EventBus eventBus;
|
||||
private AccountingClientStateData accountingStateData;
|
||||
private HighchartsLayoutPanel highchartsLayoutPanel;
|
||||
|
@ -90,9 +90,9 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
private VerticalLayoutContainer vert;
|
||||
|
||||
|
||||
public StorageChartTopPanel(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||
this.eventBus=eventBus;
|
||||
public StorageChartTopPanel(EventBus eventBus,
|
||||
AccountingClientStateData accountingStateData) {
|
||||
this.eventBus = eventBus;
|
||||
this.accountingStateData = accountingStateData;
|
||||
forceLayoutOnResize = true;
|
||||
create();
|
||||
|
@ -151,18 +151,16 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
highchartsLayoutPanel.renderChart(options);
|
||||
forceLayout();
|
||||
/*
|
||||
vert.remove(highchartsLayoutPanel);
|
||||
//
|
||||
createChart();
|
||||
|
||||
highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||
highchartsLayoutPanel.renderChart(options);
|
||||
|
||||
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1,
|
||||
new Margins(0)));
|
||||
|
||||
forceLayout();
|
||||
*/
|
||||
* vert.remove(highchartsLayoutPanel); // createChart();
|
||||
*
|
||||
* highchartsLayoutPanel = new HighchartsLayoutPanel();
|
||||
* highchartsLayoutPanel.renderChart(options);
|
||||
*
|
||||
* vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1, new
|
||||
* Margins(0)));
|
||||
*
|
||||
* forceLayout();
|
||||
*/
|
||||
}
|
||||
|
||||
private Menu createDownloadMenu() {
|
||||
|
@ -188,7 +186,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
downloadSVGItem = new MenuItem(DownloadConstants.DOWNLOAD_SVG,
|
||||
AccountingManagerResources.INSTANCE.accountingFileSVG24());
|
||||
downloadSVGItem.setHeight(30);
|
||||
|
||||
|
||||
downloadCSVItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
|
@ -198,7 +196,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
downloadXMLItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
|
@ -208,7 +206,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
downloadJSONItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
|
@ -218,7 +216,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
downloadPNGItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
|
@ -255,7 +253,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
onDownloadSVG(id);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
menuDownload.add(downloadCSVItem);
|
||||
menuDownload.add(downloadXMLItem);
|
||||
menuDownload.add(downloadJSONItem);
|
||||
|
@ -271,7 +269,8 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
Menu menuMeasure = new Menu();
|
||||
dataVolumeItem = new MenuItem(StorageChartMeasure.DataVolume.getLabel());
|
||||
dataVolumeItem.setHeight(30);
|
||||
operationCountItem = new MenuItem(StorageChartMeasure.OperationCount.getLabel());
|
||||
operationCountItem = new MenuItem(
|
||||
StorageChartMeasure.OperationCount.getLabel());
|
||||
operationCountItem.setHeight(30);
|
||||
|
||||
dataVolumeItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
@ -279,7 +278,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(StorageChartMeasure.DataVolume.getLabel());
|
||||
measure=StorageChartMeasure.DataVolume;
|
||||
measure = StorageChartMeasure.DataVolume;
|
||||
unitButton.setVisible(true);
|
||||
updateChart();
|
||||
}
|
||||
|
@ -291,7 +290,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(StorageChartMeasure.OperationCount
|
||||
.getLabel());
|
||||
measure=StorageChartMeasure.OperationCount;
|
||||
measure = StorageChartMeasure.OperationCount;
|
||||
unitButton.setVisible(false);
|
||||
updateChart();
|
||||
}
|
||||
|
@ -325,7 +324,8 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = ByteUnitMeasure.getKiloByteDimForStorage();
|
||||
unitMeasureLabel = ByteUnitMeasure.kB;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitkB24());
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitkB24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -336,7 +336,8 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = ByteUnitMeasure.getMegaByteDimForStorage();
|
||||
unitMeasureLabel = ByteUnitMeasure.MB;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitMB24());
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitMB24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -347,7 +348,8 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = ByteUnitMeasure.getGigaByteDimForStorage();
|
||||
unitMeasureLabel = ByteUnitMeasure.GB;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitGB24());
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitGB24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -358,7 +360,8 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = ByteUnitMeasure.getTeraByteDimForStorage();
|
||||
unitMeasureLabel = ByteUnitMeasure.TB;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitTB24());
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitTB24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -370,26 +373,25 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
return menuUnit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void onDownloadCSV() {
|
||||
ExportRequestEvent event = new ExportRequestEvent(
|
||||
ExportType.CSV, accountingStateData.getAccountingType());
|
||||
ExportRequestEvent event = new ExportRequestEvent(ExportType.CSV,
|
||||
accountingStateData.getAccountingType());
|
||||
eventBus.fireEvent(event);
|
||||
}
|
||||
|
||||
private void onDownloadXML() {
|
||||
ExportRequestEvent event = new ExportRequestEvent(
|
||||
ExportType.XML, accountingStateData.getAccountingType());
|
||||
ExportRequestEvent event = new ExportRequestEvent(ExportType.XML,
|
||||
accountingStateData.getAccountingType());
|
||||
eventBus.fireEvent(event);
|
||||
}
|
||||
|
||||
private void onDownloadJSON() {
|
||||
ExportRequestEvent event = new ExportRequestEvent(
|
||||
ExportType.JSON, accountingStateData.getAccountingType());
|
||||
ExportRequestEvent event = new ExportRequestEvent(ExportType.JSON,
|
||||
accountingStateData.getAccountingType());
|
||||
eventBus.fireEvent(event);
|
||||
}
|
||||
|
||||
|
||||
// chart.options.exporting.buttons.contextButton.menuItems[0].onclick();
|
||||
|
||||
public static native void onDownloadPNG(String id) /*-{
|
||||
|
@ -502,8 +504,33 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
+ " }" + " }");
|
||||
|
||||
ArrayList<SeriesColumn> seriesColumn = new ArrayList<>();
|
||||
for (int i = 0; i < seriesStorageTop.getSeriesStorageDataTopList()
|
||||
.size(); i++) {
|
||||
if (seriesStorageTop.getShowOthers()) {
|
||||
createSeriesColumnShowOthers(seriesStorageTop, interval, dateStart,
|
||||
highchartsFactory, colors, seriesColumn);
|
||||
} else {
|
||||
createSeriesColumnSimple(seriesStorageTop, interval, dateStart,
|
||||
highchartsFactory, colors, seriesColumn);
|
||||
}
|
||||
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
}
|
||||
|
||||
options.chart().showAxes(true);
|
||||
|
||||
options.legend().enabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
private void createSeriesColumnShowOthers(
|
||||
SeriesStorageTop seriesStorageTop, double interval, Date dateStart,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series ShowOthers");
|
||||
|
||||
int i = 0;
|
||||
for (; i < seriesStorageTop.getSeriesStorageDataTopList().size()
|
||||
&& i < seriesStorageTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
|
@ -519,7 +546,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
.getSeriesStorageDataTopList().get(i).getSeries()) {
|
||||
switch (measure) {
|
||||
case DataVolume:
|
||||
data.push(seriesStorageData.getDataVolume()/unitMeasure);
|
||||
data.push(seriesStorageData.getDataVolume() / unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
data.push(seriesStorageData.getOperationCount());
|
||||
|
@ -538,14 +565,117 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
if (i < seriesStorageTop.getSeriesStorageDataTopList().size()) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name("Others");
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
ArrayList<Long> othersData = new ArrayList<>();
|
||||
for (int j = i; j < seriesStorageTop.getSeriesStorageDataTopList()
|
||||
.size(); j++) {
|
||||
Long value;
|
||||
for (int k = 0; k < seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(j).getSeries()
|
||||
.size(); k++) {
|
||||
SeriesStorageData seriesStorageData = seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(j).getSeries()
|
||||
.get(k);
|
||||
if (j == i) {
|
||||
switch (measure) {
|
||||
case DataVolume:
|
||||
othersData.add(seriesStorageData.getDataVolume()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
othersData.add(seriesStorageData.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
othersData.add(seriesStorageData.getDataVolume()
|
||||
/ unitMeasure);
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
switch (measure) {
|
||||
case DataVolume:
|
||||
|
||||
value = seriesStorageData.getDataVolume()
|
||||
/ unitMeasure + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case OperationCount:
|
||||
value = seriesStorageData.getOperationCount()
|
||||
+ othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
default:
|
||||
value = seriesStorageData.getDataVolume()
|
||||
/ unitMeasure + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
|
||||
|
||||
for (Long value : othersData) {
|
||||
data.push(value);
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
}
|
||||
|
||||
options.chart().showAxes(true);
|
||||
}
|
||||
|
||||
options.legend().enabled(true);
|
||||
return;
|
||||
private void createSeriesColumnSimple(SeriesStorageTop seriesStorageTop,
|
||||
double interval, Date dateStart,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series Simple");
|
||||
for (int i = 0; i < seriesStorageTop.getSeriesStorageDataTopList()
|
||||
.size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(i).getFilterValue()
|
||||
.getValue());
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
ArrayNumber data = seriesColumnData.dataAsArrayNumber();
|
||||
|
||||
for (SeriesStorageData seriesStorageData : seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(i).getSeries()) {
|
||||
switch (measure) {
|
||||
case DataVolume:
|
||||
data.push(seriesStorageData.getDataVolume() / unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
data.push(seriesStorageData.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
data.push(seriesStorageData.getDataVolume());
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private String retrieveYAxis(ArrayString colors) {
|
||||
|
|
|
@ -74,8 +74,7 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
}
|
||||
|
||||
public ArrayList<FilterValue> getFilterValues(
|
||||
FilterValuesRequest filterValuesRequest)
|
||||
throws ServiceException {
|
||||
FilterValuesRequest filterValuesRequest) throws ServiceException {
|
||||
try {
|
||||
logger.debug("getFilterValue(): [FilterValueRequest="
|
||||
+ filterValuesRequest + "]");
|
||||
|
@ -121,8 +120,7 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
}
|
||||
|
||||
public SeriesResponse getSeries(AccountingType accountingType,
|
||||
SeriesRequest seriesRequest)
|
||||
throws ServiceException {
|
||||
SeriesRequest seriesRequest) throws ServiceException {
|
||||
try {
|
||||
logger.debug("getSeries(): [AccountingType=" + accountingType
|
||||
+ " , seriesRequest=" + seriesRequest + "]");
|
||||
|
@ -152,13 +150,28 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
.getAccountingFilterDefinition();
|
||||
|
||||
ArrayList<SeriesJobDataTop> seriesJobDataTopList = new ArrayList<>();
|
||||
for (int i = 0; i < accountingFilterTop.getTopNumber(); i++) {
|
||||
if (accountingFilterTop.getShowOthers()) {
|
||||
for (int i = 0; i < 40; i++) {
|
||||
|
||||
SeriesJobDataTop seriesJobDataTop = new SeriesJobDataTop(
|
||||
new FilterValue("User" + i), seriesJobData);
|
||||
seriesJobDataTopList.add(seriesJobDataTop);
|
||||
SeriesJobDataTop seriesJobDataTop = new SeriesJobDataTop(
|
||||
new FilterValue("User" + i),
|
||||
seriesJobData);
|
||||
seriesJobDataTopList.add(seriesJobDataTop);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < accountingFilterTop
|
||||
.getTopNumber(); i++) {
|
||||
|
||||
SeriesJobDataTop seriesJobDataTop = new SeriesJobDataTop(
|
||||
new FilterValue("User" + i),
|
||||
seriesJobData);
|
||||
seriesJobDataTopList.add(seriesJobDataTop);
|
||||
}
|
||||
}
|
||||
|
||||
serieJobDefinition = new SeriesJobTop(
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
seriesJobDataTopList);
|
||||
break;
|
||||
default:
|
||||
|
@ -199,15 +212,31 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
.getAccountingFilterDefinition();
|
||||
ArrayList<SeriesServiceDataTop> seriesServiceDataTopList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < accountingFilterTop.getTopNumber(); i++) {
|
||||
if (accountingFilterTop.getShowOthers()) {
|
||||
for (int i = 0; i < 40; i++) {
|
||||
|
||||
SeriesServiceDataTop seriesServiceDataTop1 = new SeriesServiceDataTop(
|
||||
new FilterValue("User" + i),
|
||||
seriesServiceData);
|
||||
seriesServiceDataTopList.add(seriesServiceDataTop1);
|
||||
SeriesServiceDataTop seriesServiceDataTop1 = new SeriesServiceDataTop(
|
||||
new FilterValue("User" + i),
|
||||
seriesServiceData);
|
||||
seriesServiceDataTopList
|
||||
.add(seriesServiceDataTop1);
|
||||
}
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < accountingFilterTop
|
||||
.getTopNumber(); i++) {
|
||||
|
||||
SeriesServiceDataTop seriesServiceDataTop1 = new SeriesServiceDataTop(
|
||||
new FilterValue("User" + i),
|
||||
seriesServiceData);
|
||||
seriesServiceDataTopList
|
||||
.add(seriesServiceDataTop1);
|
||||
}
|
||||
}
|
||||
|
||||
serieServiceDefinition = new SeriesServiceTop(
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
seriesServiceDataTopList);
|
||||
break;
|
||||
default:
|
||||
|
@ -227,8 +256,9 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
for (int i = 0; i < 30; i++) {
|
||||
SeriesStorageData data = new SeriesStorageData(
|
||||
new Date(),
|
||||
new Double(1024*1024 * Math.random()).longValue(),
|
||||
new Double(100 * Math.random()).longValue());
|
||||
new Double(1024 * 1024 * Math.random())
|
||||
.longValue(), new Double(
|
||||
100 * Math.random()).longValue());
|
||||
seriesStorageData.add(data);
|
||||
|
||||
}
|
||||
|
@ -242,13 +272,28 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
ArrayList<SeriesStorageDataTop> seriesStorageDataTopList = new ArrayList<>();
|
||||
for (int i = 0; i < accountingFilterTop.getTopNumber(); i++) {
|
||||
SeriesStorageDataTop seriesStorageDataTop = new SeriesStorageDataTop(
|
||||
new FilterValue("User"+i),
|
||||
seriesStorageData);
|
||||
seriesStorageDataTopList.add(seriesStorageDataTop);
|
||||
if (accountingFilterTop.getShowOthers()) {
|
||||
for (int i = 0; i < 40; i++) {
|
||||
SeriesStorageDataTop seriesStorageDataTop = new SeriesStorageDataTop(
|
||||
new FilterValue("User" + i),
|
||||
seriesStorageData);
|
||||
seriesStorageDataTopList
|
||||
.add(seriesStorageDataTop);
|
||||
}
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < accountingFilterTop
|
||||
.getTopNumber(); i++) {
|
||||
SeriesStorageDataTop seriesStorageDataTop = new SeriesStorageDataTop(
|
||||
new FilterValue("User" + i),
|
||||
seriesStorageData);
|
||||
seriesStorageDataTopList
|
||||
.add(seriesStorageDataTop);
|
||||
}
|
||||
}
|
||||
serieStorageDefinition = new SeriesStorageTop(
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
seriesStorageDataTopList);
|
||||
break;
|
||||
default:
|
||||
|
@ -268,8 +313,7 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
}
|
||||
|
||||
if (seriesResponse == null) {
|
||||
throw new ServiceException(
|
||||
"Error creating series response!");
|
||||
throw new ServiceException("Error creating series response!");
|
||||
}
|
||||
logger.debug("SeriesResponse Created: " + seriesResponse);
|
||||
return seriesResponse;
|
||||
|
|
|
@ -33,7 +33,6 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
|
||||
private AccountingQueryTop accountingQueryTop;
|
||||
private AccountingType accountingType;
|
||||
|
||||
|
||||
public AccountingCommandTop(AccountingQueryTop accountingQueryTop,
|
||||
AccountingType accountingType) {
|
||||
|
@ -47,23 +46,33 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||
.getInstance();
|
||||
|
||||
logger.debug("Qyery TopValues: "+accountingQueryTop.getFilterKey()
|
||||
.getKey());
|
||||
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM = apq
|
||||
.getTopValues(accountingQueryTop.getType(),
|
||||
accountingQueryTop.getTemporalConstraint(),
|
||||
accountingQueryTop.getFilters(), accountingQueryTop.getFilterKey()
|
||||
.getKey(),null, true,
|
||||
accountingQueryTop.getTopNumber());
|
||||
logger.debug("Qyery TopValues: "
|
||||
+ accountingQueryTop.getFilterKey().getKey());
|
||||
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
if (accountingQueryTop.getShowOthers()) {
|
||||
topSM= apq
|
||||
.getTopValues(accountingQueryTop.getType(),
|
||||
accountingQueryTop.getTemporalConstraint(),
|
||||
accountingQueryTop.getFilters(),
|
||||
accountingQueryTop.getFilterKey().getKey(),
|
||||
null, true, 0);
|
||||
} else {
|
||||
topSM= apq
|
||||
.getTopValues(accountingQueryTop.getType(),
|
||||
accountingQueryTop.getTemporalConstraint(),
|
||||
accountingQueryTop.getFilters(),
|
||||
accountingQueryTop.getFilterKey().getKey(),
|
||||
null, true, accountingQueryTop.getTopNumber());
|
||||
}
|
||||
|
||||
if (topSM == null) {
|
||||
throw new ServiceException(
|
||||
"Error retrieving info for top: sorted map is null!");
|
||||
}
|
||||
|
||||
logger.debug("TopSM: "+topSM);
|
||||
|
||||
logger.debug("TopSM: " + topSM);
|
||||
|
||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
||||
accountingType, topSM);
|
||||
|
@ -76,8 +85,7 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
.getSeriesResponse();
|
||||
|
||||
if (seriesResponse == null) {
|
||||
throw new ServiceException(
|
||||
"Error creating series response!");
|
||||
throw new ServiceException("Error creating series response!");
|
||||
}
|
||||
logger.debug("SeriesResponse Created: " + seriesResponse);
|
||||
return seriesResponse;
|
||||
|
@ -92,27 +100,26 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
}
|
||||
|
||||
private SeriesResponseBuilder getSeriesResponseBuilder(
|
||||
AccountingType accountingType, SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM)
|
||||
AccountingType accountingType,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM)
|
||||
throws ServiceException {
|
||||
if (accountingType == null) {
|
||||
throw new ServiceException(
|
||||
"Error accounting type is null");
|
||||
throw new ServiceException("Error accounting type is null");
|
||||
}
|
||||
|
||||
switch (accountingType) {
|
||||
case JOB:
|
||||
return new SeriesResponse4JobTop(topSM);
|
||||
return new SeriesResponse4JobTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(), topSM);
|
||||
case PORTLET:
|
||||
return new SeriesResponse4PortletTop(topSM);
|
||||
return new SeriesResponse4PortletTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM);
|
||||
case SERVICE:
|
||||
return new SeriesResponse4ServiceTop(topSM);
|
||||
return new SeriesResponse4ServiceTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM);
|
||||
case STORAGE:
|
||||
return new SeriesResponse4StorageTop(topSM);
|
||||
return new SeriesResponse4StorageTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM);
|
||||
case TASK:
|
||||
return new SeriesResponse4TaskTop(topSM);
|
||||
return new SeriesResponse4TaskTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM);
|
||||
default:
|
||||
throw new ServiceException(
|
||||
"Error request type is unknow!");
|
||||
throw new ServiceException("Error request type is unknow!");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
invocation = new AccountingQueryTop(
|
||||
AggregatedJobUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
|
|
|
@ -105,6 +105,7 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
invocation = new AccountingQueryTop(
|
||||
AggregatedPortletUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
|
|
|
@ -106,6 +106,7 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
invocation = new AccountingQueryTop(
|
||||
AggregatedServiceUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
|
|
|
@ -106,6 +106,7 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
invocation = new AccountingQueryTop(
|
||||
AggregatedStorageUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
|
|
|
@ -105,6 +105,7 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
|||
invocation = new AccountingQueryTop(
|
||||
AggregatedTaskUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
} else {
|
||||
|
|
|
@ -18,11 +18,12 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
private Class<? extends AggregatedUsageRecord<?,?>> type;
|
||||
private FilterKey filterKey;
|
||||
private Integer topNumber;
|
||||
private Boolean showOthers;
|
||||
private TemporalConstraint temporalConstraint;
|
||||
private ArrayList<Filter> filters;
|
||||
|
||||
public AccountingQueryTop(Class<? extends AggregatedUsageRecord<?,?>> type,
|
||||
FilterKey filterKey, Integer topNumber,
|
||||
FilterKey filterKey, Boolean showOthers, Integer topNumber,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Top;
|
||||
|
@ -30,6 +31,7 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
this.temporalConstraint = temporalConstraint;
|
||||
this.filters = filters;
|
||||
this.filterKey = filterKey;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
}
|
||||
|
||||
|
@ -64,6 +66,15 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
public void setFilterKey(FilterKey filterKey) {
|
||||
this.filterKey = filterKey;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
|
@ -76,8 +87,11 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQueryTop [type=" + type + ", filterKey=" + filterKey
|
||||
+ ", topNumber=" + topNumber + ", temporalConstraint="
|
||||
+ temporalConstraint + ", filters=" + filters + "]";
|
||||
+ ", topNumber=" + topNumber + ", showOthers=" + showOthers
|
||||
+ ", temporalConstraint=" + temporalConstraint + ", filters="
|
||||
+ filters + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -27,10 +27,14 @@ import org.slf4j.LoggerFactory;
|
|||
public class SeriesResponse4JobTop extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4JobTop.class);
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
public SeriesResponse4JobTop(
|
||||
public SeriesResponse4JobTop(Boolean showOthers, Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
}
|
||||
|
||||
|
@ -39,10 +43,8 @@ public class SeriesResponse4JobTop extends SeriesResponseBuilder {
|
|||
try {
|
||||
if (topSM == null || topSM.isEmpty()) {
|
||||
logger.error("Error creating series for job accounting: No data available!");
|
||||
throw new ServiceException(
|
||||
"No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
|
||||
ArrayList<SeriesJobDataTop> seriesJobDataTopList = new ArrayList<>();
|
||||
|
||||
|
@ -71,7 +73,8 @@ public class SeriesResponse4JobTop extends SeriesResponseBuilder {
|
|||
|
||||
}
|
||||
|
||||
SeriesJobTop seriesJobTop = new SeriesJobTop(seriesJobDataTopList);
|
||||
SeriesJobTop seriesJobTop = new SeriesJobTop(showOthers, topNumber,
|
||||
seriesJobDataTopList);
|
||||
SeriesJob seriesJob = new SeriesJob(seriesJobTop);
|
||||
|
||||
seriesResponseSpec.setSr(seriesJob);
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Top Series Response 4 Portlet
|
||||
* Top Series Response 4 Portlet
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
|
@ -27,11 +27,15 @@ import org.slf4j.LoggerFactory;
|
|||
public class SeriesResponse4PortletTop extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4PortletTop.class);
|
||||
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
public SeriesResponse4PortletTop(SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.topSM=topSM;
|
||||
public SeriesResponse4PortletTop(Boolean showOthers, Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,10 +43,8 @@ public class SeriesResponse4PortletTop extends SeriesResponseBuilder {
|
|||
try {
|
||||
if (topSM == null || topSM.isEmpty()) {
|
||||
logger.error("Error creating series for portlet accounting: No data available!");
|
||||
throw new ServiceException(
|
||||
"No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
|
||||
ArrayList<SeriesPortletDataTop> seriesPortletDataTopList = new ArrayList<>();
|
||||
|
||||
|
@ -61,8 +63,8 @@ public class SeriesResponse4PortletTop extends SeriesResponseBuilder {
|
|||
// Long minInvocationTime =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
series.add(new SeriesPortletData(info.getCalendar().getTime(),
|
||||
operationCount));
|
||||
series.add(new SeriesPortletData(info.getCalendar()
|
||||
.getTime(), operationCount));
|
||||
}
|
||||
SeriesPortletDataTop seriesPortletDataTop = new SeriesPortletDataTop(
|
||||
new FilterValue(topValue.getValue()), series);
|
||||
|
@ -70,7 +72,8 @@ public class SeriesResponse4PortletTop extends SeriesResponseBuilder {
|
|||
|
||||
}
|
||||
|
||||
SeriesPortletTop seriesPortletTop = new SeriesPortletTop(seriesPortletDataTopList);
|
||||
SeriesPortletTop seriesPortletTop = new SeriesPortletTop(
|
||||
showOthers, topNumber, seriesPortletDataTopList);
|
||||
SeriesPortlet seriesPortlet = new SeriesPortlet(seriesPortletTop);
|
||||
|
||||
seriesResponseSpec.setSr(seriesPortlet);
|
||||
|
|
|
@ -27,10 +27,14 @@ import org.slf4j.LoggerFactory;
|
|||
public class SeriesResponse4ServiceTop extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4ServiceTop.class);
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
public SeriesResponse4ServiceTop(
|
||||
public SeriesResponse4ServiceTop(Boolean showOthers, Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers=showOthers;
|
||||
this.topNumber=topNumber;
|
||||
this.topSM = topSM;
|
||||
}
|
||||
|
||||
|
@ -72,7 +76,7 @@ public class SeriesResponse4ServiceTop extends SeriesResponseBuilder {
|
|||
|
||||
}
|
||||
|
||||
SeriesServiceTop seriesServiceTop = new SeriesServiceTop(
|
||||
SeriesServiceTop seriesServiceTop = new SeriesServiceTop(showOthers,topNumber,
|
||||
seriesServiceDataTopList);
|
||||
SeriesService seriesService = new SeriesService(seriesServiceTop);
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Top Series Response 4 Storage
|
||||
*
|
||||
* Top Series Response 4 Storage
|
||||
*
|
||||
* @author "Giancarlo Panichi" email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
|
@ -27,49 +27,60 @@ import org.slf4j.LoggerFactory;
|
|||
public class SeriesResponse4StorageTop extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4StorageTop.class);
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
public SeriesResponse4StorageTop(SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.topSM=topSM;
|
||||
public SeriesResponse4StorageTop(Boolean showOthers, Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if(topSM==null||topSM.isEmpty()){
|
||||
if (topSM == null || topSM.isEmpty()) {
|
||||
logger.error("Error creating series for storage accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
|
||||
ArrayList<SeriesStorageDataTop> seriesStorageDataTopList=new ArrayList<>();
|
||||
|
||||
for(NumberedFilter topValue:topSM.keySet()){
|
||||
|
||||
ArrayList<SeriesStorageData> series=new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos=topSM.get(topValue);
|
||||
|
||||
ArrayList<SeriesStorageDataTop> seriesStorageDataTopList = new ArrayList<>();
|
||||
|
||||
for (NumberedFilter topValue : topSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesStorageData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long dataVolume = jso.getLong(AggregatedStorageUsageRecord.DATA_VOLUME);
|
||||
Long dataVolume = jso
|
||||
.getLong(AggregatedStorageUsageRecord.DATA_VOLUME);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedStorageUsageRecord.OPERATION_COUNT);
|
||||
series.add(new SeriesStorageData(info.getCalendar().getTime(), dataVolume, operationCount));
|
||||
|
||||
series.add(new SeriesStorageData(info.getCalendar()
|
||||
.getTime(), dataVolume, operationCount));
|
||||
|
||||
}
|
||||
SeriesStorageDataTop seriesStorageDataTop=new SeriesStorageDataTop(
|
||||
SeriesStorageDataTop seriesStorageDataTop = new SeriesStorageDataTop(
|
||||
new FilterValue(topValue.getValue()), series);
|
||||
seriesStorageDataTopList.add(seriesStorageDataTop);
|
||||
|
||||
|
||||
}
|
||||
|
||||
SeriesStorageTop seriesStorageTop=new SeriesStorageTop(seriesStorageDataTopList);
|
||||
|
||||
SeriesStorageTop seriesStorageTop = new SeriesStorageTop(
|
||||
showOthers, topNumber, seriesStorageDataTopList);
|
||||
SeriesStorage seriesStorage = new SeriesStorage(seriesStorageTop);
|
||||
|
||||
|
||||
seriesResponseSpec.setSr(seriesStorage);
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for storage accounting top chart: "+e.getLocalizedMessage());
|
||||
logger.error("Error creating series for storage accounting top chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Error creating series for storage accounting basic chart: "+e.getLocalizedMessage());
|
||||
throw new ServiceException(
|
||||
"Error creating series for storage accounting basic chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,10 +27,15 @@ import org.slf4j.LoggerFactory;
|
|||
public class SeriesResponse4TaskTop extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4TaskTop.class);
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
public SeriesResponse4TaskTop(SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.topSM=topSM;
|
||||
public SeriesResponse4TaskTop(Boolean showOthers, Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,11 +43,9 @@ public class SeriesResponse4TaskTop extends SeriesResponseBuilder {
|
|||
try {
|
||||
if (topSM == null || topSM.isEmpty()) {
|
||||
logger.error("Error creating series for task accounting: No data available!");
|
||||
throw new ServiceException(
|
||||
"No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
ArrayList<SeriesTaskDataTop> seriesTaskDataTopList = new ArrayList<>();
|
||||
|
||||
for (NumberedFilter topValue : topSM.keySet()) {
|
||||
|
@ -69,7 +72,8 @@ public class SeriesResponse4TaskTop extends SeriesResponseBuilder {
|
|||
|
||||
}
|
||||
|
||||
SeriesTaskTop seriesTaskTop = new SeriesTaskTop(seriesTaskDataTopList);
|
||||
SeriesTaskTop seriesTaskTop = new SeriesTaskTop(showOthers,
|
||||
topNumber, seriesTaskDataTopList);
|
||||
SeriesTask seriesTask = new SeriesTask(seriesTaskTop);
|
||||
|
||||
seriesResponseSpec.setSr(seriesTask);
|
||||
|
|
|
@ -9,28 +9,35 @@ import java.util.ArrayList;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class AccountingFilterTop extends AccountingFilterDefinition implements Serializable {
|
||||
public class AccountingFilterTop extends AccountingFilterDefinition implements
|
||||
Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6805006183397381154L;
|
||||
private FilterKey filterKey;
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private ArrayList<AccountingFilter> filters;
|
||||
private ArrayList<AccountingFilter> filters;
|
||||
|
||||
public AccountingFilterTop() {
|
||||
super();
|
||||
this.chartType=ChartType.Top;
|
||||
topNumber=5;
|
||||
filterKey=null;
|
||||
filters=null;
|
||||
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
showOthers = false;
|
||||
topNumber = 5;
|
||||
filterKey = null;
|
||||
filters = null;
|
||||
|
||||
}
|
||||
|
||||
public AccountingFilterTop(FilterKey filterKey, ArrayList<AccountingFilter> filters, Integer topNumber) {
|
||||
public AccountingFilterTop(FilterKey filterKey,
|
||||
ArrayList<AccountingFilter> filters, Boolean showOthers,
|
||||
Integer topNumber) {
|
||||
super();
|
||||
chartType = ChartType.Top;
|
||||
this.filterKey = filterKey;
|
||||
this.filters = filters;
|
||||
this.topNumber=topNumber;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
|
||||
}
|
||||
|
||||
public FilterKey getFilterKey() {
|
||||
|
@ -41,6 +48,14 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements S
|
|||
this.filterKey = filterKey;
|
||||
}
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
}
|
||||
|
@ -59,11 +74,9 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements S
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilterTop [filterKey=" + filterKey + ", topNumber="
|
||||
+ topNumber + ", filters=" + filters + "]";
|
||||
return "AccountingFilterTop [filterKey=" + filterKey + ", showOthers="
|
||||
+ showOthers + ", topNumber=" + topNumber + ", filters="
|
||||
+ filters + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,29 +14,55 @@ public class SeriesJobTop extends SeriesJobDefinition {
|
|||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private ArrayList<SeriesJobDataTop> seriesJobDataTopList;
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
|
||||
public SeriesJobTop() {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = false;
|
||||
this.topNumber = 5;
|
||||
}
|
||||
|
||||
public SeriesJobTop(ArrayList<SeriesJobDataTop> seriesJobDataTopList) {
|
||||
public SeriesJobTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesJobDataTop> seriesJobDataTopList) {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.seriesJobDataTopList = seriesJobDataTopList;
|
||||
}
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
}
|
||||
|
||||
public void setTopNumber(Integer topNumber) {
|
||||
this.topNumber = topNumber;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesJobDataTop> getSeriesJobDataTopList() {
|
||||
return seriesJobDataTopList;
|
||||
}
|
||||
|
||||
public void setSeriesJobDataTopList(ArrayList<SeriesJobDataTop> seriesJobDataTopList) {
|
||||
public void setSeriesJobDataTopList(
|
||||
ArrayList<SeriesJobDataTop> seriesJobDataTopList) {
|
||||
this.seriesJobDataTopList = seriesJobDataTopList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesJobTop [seriesJobDataTopList=" + seriesJobDataTopList + "]";
|
||||
return "SeriesJobTop [seriesJobDataTopList=" + seriesJobDataTopList
|
||||
+ ", showOthers=" + showOthers + ", topNumber=" + topNumber
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,20 +13,42 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
|||
public class SeriesPortletTop extends SeriesPortletDefinition {
|
||||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private ArrayList<SeriesPortletDataTop> seriesPortletDataTopList;
|
||||
|
||||
public SeriesPortletTop() {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = false;
|
||||
this.topNumber = 5;
|
||||
}
|
||||
|
||||
public SeriesPortletTop(
|
||||
public SeriesPortletTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesPortletDataTop> seriesPortletDataTopList) {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.seriesPortletDataTopList = seriesPortletDataTopList;
|
||||
}
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
}
|
||||
|
||||
public void setTopNumber(Integer topNumber) {
|
||||
this.topNumber = topNumber;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesPortletDataTop> getSeriesPortletDataTopList() {
|
||||
return seriesPortletDataTopList;
|
||||
}
|
||||
|
@ -38,7 +60,8 @@ public class SeriesPortletTop extends SeriesPortletDefinition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesPortletTop [seriesPortletDataTopList="
|
||||
return "SeriesPortletTop [showOthers=" + showOthers + ", topNumber="
|
||||
+ topNumber + ", seriesPortletDataTopList="
|
||||
+ seriesPortletDataTopList + "]";
|
||||
}
|
||||
|
||||
|
|
|
@ -13,19 +13,43 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
|||
public class SeriesServiceTop extends SeriesServiceDefinition {
|
||||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private ArrayList<SeriesServiceDataTop> seriesServiceDataTopList;
|
||||
|
||||
public SeriesServiceTop() {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = false;
|
||||
this.topNumber = 5;
|
||||
|
||||
}
|
||||
|
||||
public SeriesServiceTop(ArrayList<SeriesServiceDataTop> seriesServiceDataTopList) {
|
||||
public SeriesServiceTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesServiceDataTop> seriesServiceDataTopList) {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.seriesServiceDataTopList = seriesServiceDataTopList;
|
||||
}
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
}
|
||||
|
||||
public void setTopNumber(Integer topNumber) {
|
||||
this.topNumber = topNumber;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesServiceDataTop> getSeriesServiceDataTopList() {
|
||||
return seriesServiceDataTopList;
|
||||
}
|
||||
|
@ -37,8 +61,9 @@ public class SeriesServiceTop extends SeriesServiceDefinition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesServiceTop [seriesServiceDataTopList=" + seriesServiceDataTopList
|
||||
+ "]";
|
||||
return "SeriesServiceTop [showOthers=" + showOthers + ", topNumber="
|
||||
+ topNumber + ", seriesServiceDataTopList="
|
||||
+ seriesServiceDataTopList + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,20 +13,43 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
|||
public class SeriesStorageTop extends SeriesStorageDefinition {
|
||||
|
||||
private static final long serialVersionUID = -5477545972037227361L;
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private ArrayList<SeriesStorageDataTop> seriesStorageDataTopList;
|
||||
|
||||
public SeriesStorageTop() {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = false;
|
||||
this.topNumber = 5;
|
||||
|
||||
}
|
||||
|
||||
public SeriesStorageTop(
|
||||
public SeriesStorageTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesStorageDataTop> seriesStorageDataTopList) {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.seriesStorageDataTopList = seriesStorageDataTopList;
|
||||
}
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
}
|
||||
|
||||
public void setTopNumber(Integer topNumber) {
|
||||
this.topNumber = topNumber;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesStorageDataTop> getSeriesStorageDataTopList() {
|
||||
return seriesStorageDataTopList;
|
||||
}
|
||||
|
@ -38,10 +61,9 @@ public class SeriesStorageTop extends SeriesStorageDefinition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesStorageTop [seriesStorageDataTopList="
|
||||
return "SeriesStorageTop [showOthers=" + showOthers + ", topNumber="
|
||||
+ topNumber + ", seriesStorageDataTopList="
|
||||
+ seriesStorageDataTopList + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,19 +13,43 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
|||
public class SeriesTaskTop extends SeriesTaskDefinition {
|
||||
|
||||
private static final long serialVersionUID = 6805210072384752359L;
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private ArrayList<SeriesTaskDataTop> seriesTaskDataTopList;
|
||||
|
||||
public SeriesTaskTop() {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = false;
|
||||
this.topNumber = 5;
|
||||
|
||||
}
|
||||
|
||||
public SeriesTaskTop(ArrayList<SeriesTaskDataTop> seriesTaskDataTopList) {
|
||||
public SeriesTaskTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesTaskDataTop> seriesTaskDataTopList) {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.seriesTaskDataTopList = seriesTaskDataTopList;
|
||||
}
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
}
|
||||
|
||||
public void setTopNumber(Integer topNumber) {
|
||||
this.topNumber = topNumber;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesTaskDataTop> getSeriesTaskDataTopList() {
|
||||
return seriesTaskDataTopList;
|
||||
}
|
||||
|
@ -37,8 +61,9 @@ public class SeriesTaskTop extends SeriesTaskDefinition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesTaskTop [seriesTaskDataTopList=" + seriesTaskDataTopList
|
||||
+ "]";
|
||||
return "SeriesTaskTop [showOthers=" + showOthers + ", topNumber="
|
||||
+ topNumber + ", seriesTaskDataTopList="
|
||||
+ seriesTaskDataTopList + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,18 +48,19 @@
|
|||
name="locale" values="es" /> <set-property name="locale" value="en, it, es"
|
||||
/> <set-property-fallback name="locale" value="en" /> -->
|
||||
|
||||
<!-- <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
|
||||
<!--
|
||||
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
|
||||
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
|
||||
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
|
||||
/> -->
|
||||
/> -->
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED"
|
||||
/> -->
|
||||
|
||||
|
||||
|
||||
<set-property name="log_ConsoleLogger" value="DISABLED" />
|
||||
<set-property name="log_DivLogger" value="DISABLED" />
|
||||
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="DISABLED"
|
||||
/> -->
|
||||
|
||||
|
|
Loading…
Reference in New Issue