Merge pull request 'feature/21354' (!3) from feature/21354 into master
Reviewed-on: #3
This commit is contained in:
commit
109e04f8e8
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/accounting-manager-1.13.0/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/accounting-manager-1.15.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/accounting-manager-1.13.0/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/accounting-manager-1.15.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -45,5 +45,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/accounting-manager-1.13.0/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/accounting-manager-1.15.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="accounting-manager-1.13.0">
|
||||
<wb-module deploy-name="accounting-manager-1.15.0-SNAPSHOT">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
|
|
@ -3,6 +3,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
# Changelog for "accounting-manager"
|
||||
|
||||
|
||||
## [v1.15.0-SNAPSHOT] - 2021-11-30
|
||||
|
||||
### Features
|
||||
|
||||
- Improve query support of the new persistence [#21354]
|
||||
|
||||
|
||||
## [v1.14.0] - 2021-06-28
|
||||
|
||||
### Fixes
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-15-0"
|
||||
date="2021-11-30">
|
||||
<Change>Improve query support of the new persistence [#21354]</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-14-0"
|
||||
date="2021-06-28">
|
||||
<Change>Fixed display errors generated in Root scope [#21729]</Change>
|
||||
|
|
22
pom.xml
22
pom.xml
|
@ -15,7 +15,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>accounting-manager</artifactId>
|
||||
<version>1.14.0</version>
|
||||
<version>1.15.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-lib</artifactId>
|
||||
<version>[4.0.0,5.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@ -235,6 +235,13 @@
|
|||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Document Store Lib -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.data.publishing</groupId>
|
||||
<artifactId>document-store-lib</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Accounting Lib -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
|
@ -246,14 +253,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-analytics</artifactId>
|
||||
<version>[3.0.0,4.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Document Store Lib -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.data.publishing</groupId>
|
||||
<artifactId>document-store-lib</artifactId>
|
||||
<scope>provided</scope>
|
||||
<version>[4.0.0-SNAPSHOT,5.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
@ -261,7 +261,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-analytics-persistence-postgresql</artifactId>
|
||||
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
||||
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
|
||||
<!-- <set-configuration-property name="CssResource.style" value="pretty"/> -->
|
||||
|
||||
<!-- <set-property name="log_DivLogger" value="ENABLED" /> <set-property
|
||||
<!--
|
||||
<set-property name="log_DivLogger" value="ENABLED" /> <set-property
|
||||
name="log_ConsoleLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
|
||||
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
|
||||
/> -->
|
||||
|
@ -56,8 +57,7 @@
|
|||
<set-property name="log_ConsoleLogger" value="DISABLED" />
|
||||
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
|
|
|
@ -430,7 +430,8 @@ public class AccountingManagerController {
|
|||
|
||||
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
||||
SeriesRequest seriesRequest = null;
|
||||
|
||||
Context defaultContext=availableContext;
|
||||
|
||||
switch (accountingType) {
|
||||
case JOB:
|
||||
case PORTLET:
|
||||
|
@ -439,9 +440,8 @@ public class AccountingManagerController {
|
|||
case TASK:
|
||||
seriesRequest = new SeriesRequest(
|
||||
new AccountingPeriod(dtf.format(lastMonth), dtf.format(date), AccountingPeriodMode.DAILY),
|
||||
new AccountingFilterBasic());
|
||||
new AccountingFilterBasic(defaultContext));
|
||||
Log.debug("DefaultSeriesRequest: " + seriesRequest);
|
||||
|
||||
break;
|
||||
case SPACE:
|
||||
accountingStateData.setAvailableSpaces(spaces);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -92,7 +92,7 @@ public class FiltersPanel extends FramedPanel {
|
|||
AccountingFilterDefinition accountingFilterDefinition = activeFiltersPanel
|
||||
.getActiveFilters();
|
||||
|
||||
if (accountingPeriod != null) {
|
||||
if (accountingPeriod != null && accountingFilterDefinition!=null) {
|
||||
SeriesRequest seriesRequest = new SeriesRequest(accountingPeriod,
|
||||
accountingFilterDefinition);
|
||||
Log.debug("UpdateChart: " + seriesRequest);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartBasicPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartContextPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartTopPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
|
@ -13,7 +12,7 @@ import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
|||
/**
|
||||
* Accounting Chart 4 Job
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
@ -22,8 +21,7 @@ public class AccountingChart4Job extends AccountingChartBuilder {
|
|||
private AccountingClientStateData accountingStateData;
|
||||
private EventBus eventBus;
|
||||
|
||||
public AccountingChart4Job(EventBus eventBus,
|
||||
AccountingClientStateData accountingStateData) {
|
||||
public AccountingChart4Job(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||
this.eventBus = eventBus;
|
||||
this.accountingStateData = accountingStateData;
|
||||
}
|
||||
|
@ -32,10 +30,8 @@ public class AccountingChart4Job extends AccountingChartBuilder {
|
|||
public void buildChart() throws ChartDrawException {
|
||||
AccountingChartPanel accountingChartPanel = null;
|
||||
|
||||
if (accountingStateData == null
|
||||
|| accountingStateData.getAccountingType() == null
|
||||
|| accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesResponse() == null) {
|
||||
if (accountingStateData == null || accountingStateData.getAccountingType() == null
|
||||
|| accountingStateData.getSeriesRequest() == null || accountingStateData.getSeriesResponse() == null) {
|
||||
accountingChartSpec.setChart(accountingChartPanel);
|
||||
return;
|
||||
}
|
||||
|
@ -55,25 +51,18 @@ public class AccountingChart4Job extends AccountingChartBuilder {
|
|||
|
||||
private SimpleContainer createJobChartPanel() throws ChartDrawException {
|
||||
|
||||
if (accountingStateData == null
|
||||
|| accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition() == null
|
||||
|| accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition().getChartType() == null) {
|
||||
if (accountingStateData == null || accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition() == null
|
||||
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition().getChartType()) {
|
||||
switch (accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType()) {
|
||||
|
||||
case Top:
|
||||
return new JobChartTopPanel(eventBus, accountingStateData);
|
||||
case Basic:
|
||||
return new JobChartBasicPanel(eventBus, accountingStateData);
|
||||
case Context:
|
||||
return new JobChartContextPanel(eventBus, accountingStateData);
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service.ServiceChartBasicPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service.ServiceChartContextPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service.ServiceChartTopPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||
|
@ -13,17 +12,16 @@ import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
|||
/**
|
||||
* Accounting Chart 4 Service
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingChart4Service extends AccountingChartBuilder {
|
||||
private EventBus eventBus;
|
||||
private AccountingClientStateData accountingStateData;
|
||||
|
||||
|
||||
public AccountingChart4Service(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||
this.eventBus=eventBus;
|
||||
this.eventBus = eventBus;
|
||||
this.accountingStateData = accountingStateData;
|
||||
}
|
||||
|
||||
|
@ -31,10 +29,8 @@ public class AccountingChart4Service extends AccountingChartBuilder {
|
|||
public void buildChart() throws ChartDrawException {
|
||||
AccountingChartPanel accountingChartPanel = null;
|
||||
|
||||
if (accountingStateData == null
|
||||
|| accountingStateData.getAccountingType() == null
|
||||
|| accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesResponse() == null) {
|
||||
if (accountingStateData == null || accountingStateData.getAccountingType() == null
|
||||
|| accountingStateData.getSeriesRequest() == null || accountingStateData.getSeriesResponse() == null) {
|
||||
accountingChartSpec.setChart(accountingChartPanel);
|
||||
return;
|
||||
}
|
||||
|
@ -52,28 +48,20 @@ public class AccountingChart4Service extends AccountingChartBuilder {
|
|||
|
||||
}
|
||||
|
||||
private SimpleContainer createServiceChartPanel()
|
||||
throws ChartDrawException {
|
||||
private SimpleContainer createServiceChartPanel() throws ChartDrawException {
|
||||
|
||||
if (accountingStateData == null
|
||||
|| accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition() == null
|
||||
|| accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition().getChartType() == null) {
|
||||
if (accountingStateData == null || accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition() == null
|
||||
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition().getChartType()) {
|
||||
switch (accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType()) {
|
||||
|
||||
case Top:
|
||||
return new ServiceChartTopPanel(eventBus,accountingStateData);
|
||||
return new ServiceChartTopPanel(eventBus, accountingStateData);
|
||||
case Basic:
|
||||
return new ServiceChartBasicPanel(eventBus, accountingStateData);
|
||||
case Context:
|
||||
return new ServiceChartContextPanel(eventBus, accountingStateData);
|
||||
|
||||
default:
|
||||
|
||||
return null;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.storage.StorageChartBasicPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.storage.StorageChartContextPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.storage.StorageChartTopPanel;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||
|
@ -13,7 +12,7 @@ import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
|||
/**
|
||||
* Accounting Chart 4 Storage
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
@ -21,8 +20,7 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
|
|||
private EventBus eventBus;
|
||||
private AccountingClientStateData accountingStateData;
|
||||
|
||||
public AccountingChart4Storage(EventBus eventBus,
|
||||
AccountingClientStateData accountingStateData) {
|
||||
public AccountingChart4Storage(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||
this.eventBus = eventBus;
|
||||
this.accountingStateData = accountingStateData;
|
||||
}
|
||||
|
@ -31,10 +29,8 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
|
|||
public void buildChart() throws ChartDrawException {
|
||||
AccountingChartPanel accountingChartPanel = null;
|
||||
|
||||
if (accountingStateData == null
|
||||
|| accountingStateData.getAccountingType() == null
|
||||
|| accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesResponse() == null) {
|
||||
if (accountingStateData == null || accountingStateData.getAccountingType() == null
|
||||
|| accountingStateData.getSeriesRequest() == null || accountingStateData.getSeriesResponse() == null) {
|
||||
accountingChartSpec.setChart(accountingChartPanel);
|
||||
return;
|
||||
}
|
||||
|
@ -54,25 +50,18 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
|
|||
|
||||
private SimpleContainer createStorageChartPanel() throws ChartDrawException {
|
||||
|
||||
if (accountingStateData == null
|
||||
|| accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition() == null
|
||||
|| accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition().getChartType() == null) {
|
||||
if (accountingStateData == null || accountingStateData.getSeriesRequest() == null
|
||||
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition() == null
|
||||
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (accountingStateData.getSeriesRequest()
|
||||
.getAccountingFilterDefinition().getChartType()) {
|
||||
switch (accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType()) {
|
||||
|
||||
case Top:
|
||||
return new StorageChartTopPanel(eventBus, accountingStateData);
|
||||
case Basic:
|
||||
return new StorageChartBasicPanel(eventBus, accountingStateData);
|
||||
case Context:
|
||||
return new StorageChartContextPanel(eventBus, accountingStateData);
|
||||
|
||||
default:
|
||||
|
||||
return null;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,7 @@ import java.util.Date;
|
|||
import org.gcube.portlets.admin.accountingmanager.client.event.ExportRequestEvent;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ChartDateTimeData;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ChartTimeMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ColorsPalette;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.DownloadConstants;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.JobChartMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.TimeUnitMeasure;
|
||||
|
@ -57,8 +58,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
private static final String TIME_UNIT = "Time Unit";
|
||||
// private static final String MEASURE_TYPE = "Measure";
|
||||
|
||||
private DateTimeFormat dtf = DateTimeFormat
|
||||
.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
private DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
|
||||
private EventBus eventBus;
|
||||
private AccountingClientStateData accountingStateData;
|
||||
|
@ -96,8 +96,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
|
||||
private VerticalLayoutContainer vert;
|
||||
|
||||
public JobChartTopPanel(EventBus eventBus,
|
||||
AccountingClientStateData accountingStateData) {
|
||||
public JobChartTopPanel(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||
this.eventBus = eventBus;
|
||||
this.accountingStateData = accountingStateData;
|
||||
forceLayoutOnResize = true;
|
||||
|
@ -109,8 +108,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.setSpacing(2);
|
||||
// Download
|
||||
final TextButton downloadButton = new TextButton(
|
||||
DownloadConstants.DOWNLOAD,
|
||||
final TextButton downloadButton = new TextButton(DownloadConstants.DOWNLOAD,
|
||||
AccountingManagerResources.INSTANCE.accountingDownload24());
|
||||
// downloadButton.setScale(ButtonScale.MEDIUM);
|
||||
downloadButton.setIconAlign(IconAlign.RIGHT);
|
||||
|
@ -125,8 +123,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
measureButton.setMenu(createMeasureMenu());
|
||||
|
||||
// Unit
|
||||
unitButton = new TextButton(TIME_UNIT,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
unitButton = new TextButton(TIME_UNIT, AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
unitButton.setIconAlign(IconAlign.RIGHT);
|
||||
unitButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
unitButton.setMenu(createUnitMenu());
|
||||
|
@ -145,8 +142,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
//
|
||||
vert = new VerticalLayoutContainer();
|
||||
vert.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1,
|
||||
new Margins(0)));
|
||||
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
|
||||
add(vert, new MarginData(0));
|
||||
|
||||
|
@ -265,14 +261,11 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
// TODO
|
||||
durationItem = new MenuItem(JobChartMeasure.Duration.getLabel());
|
||||
durationItem.setHeight(30);
|
||||
operationCountItem = new MenuItem(
|
||||
JobChartMeasure.OperationCount.getLabel());
|
||||
operationCountItem = new MenuItem(JobChartMeasure.OperationCount.getLabel());
|
||||
operationCountItem.setHeight(30);
|
||||
maxInvocationTimeItem = new MenuItem(
|
||||
JobChartMeasure.MaxInvocationTime.getLabel());
|
||||
maxInvocationTimeItem = new MenuItem(JobChartMeasure.MaxInvocationTime.getLabel());
|
||||
maxInvocationTimeItem.setHeight(30);
|
||||
minInvocationTimeItem = new MenuItem(
|
||||
JobChartMeasure.MinInvocationTime.getLabel());
|
||||
minInvocationTimeItem = new MenuItem(JobChartMeasure.MinInvocationTime.getLabel());
|
||||
minInvocationTimeItem.setHeight(30);
|
||||
|
||||
durationItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
@ -301,8 +294,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(JobChartMeasure.MaxInvocationTime
|
||||
.getLabel());
|
||||
measureButton.setText(JobChartMeasure.MaxInvocationTime.getLabel());
|
||||
measure = JobChartMeasure.MaxInvocationTime;
|
||||
unitButton.setVisible(true);
|
||||
updateChart();
|
||||
|
@ -313,8 +305,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(JobChartMeasure.MinInvocationTime
|
||||
.getLabel());
|
||||
measureButton.setText(JobChartMeasure.MinInvocationTime.getLabel());
|
||||
measure = JobChartMeasure.MinInvocationTime;
|
||||
unitButton.setVisible(true);
|
||||
updateChart();
|
||||
|
@ -332,17 +323,13 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
|
||||
private Menu createUnitMenu() {
|
||||
Menu menuUnit = new Menu();
|
||||
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
msItem = new MenuItem(TimeUnitMeasure.MILLISECONDS, AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
msItem.setHeight(30);
|
||||
sItem = new MenuItem(TimeUnitMeasure.SECONDS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnits24());
|
||||
sItem = new MenuItem(TimeUnitMeasure.SECONDS, AccountingManagerResources.INSTANCE.accountingUnits24());
|
||||
sItem.setHeight(30);
|
||||
mItem = new MenuItem(TimeUnitMeasure.MINUTES,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitm24());
|
||||
mItem = new MenuItem(TimeUnitMeasure.MINUTES, AccountingManagerResources.INSTANCE.accountingUnitm24());
|
||||
mItem.setHeight(30);
|
||||
hItem = new MenuItem(TimeUnitMeasure.HOURS,
|
||||
AccountingManagerResources.INSTANCE.accountingUnith24());
|
||||
hItem = new MenuItem(TimeUnitMeasure.HOURS, AccountingManagerResources.INSTANCE.accountingUnith24());
|
||||
hItem.setHeight(30);
|
||||
|
||||
msItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
@ -351,8 +338,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getMilliseconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.MS;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitms24());
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitms24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -363,8 +349,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getSeconds();
|
||||
unitMeasureLabel = TimeUnitMeasure.S;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnits24());
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnits24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -375,8 +360,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getMinutes();
|
||||
unitMeasureLabel = TimeUnitMeasure.M;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnitm24());
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnitm24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -387,8 +371,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
unitMeasure = TimeUnitMeasure.getHours();
|
||||
unitMeasureLabel = TimeUnitMeasure.H;
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE
|
||||
.accountingUnith24());
|
||||
unitButton.setIcon(AccountingManagerResources.INSTANCE.accountingUnith24());
|
||||
updateChart();
|
||||
}
|
||||
});
|
||||
|
@ -402,20 +385,17 @@ public class JobChartTopPanel 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);
|
||||
}
|
||||
|
||||
|
@ -472,15 +452,13 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
}-*/;
|
||||
|
||||
private void createChart() {
|
||||
SeriesJob seriesJob = (SeriesJob) accountingStateData
|
||||
.getSeriesResponse();
|
||||
SeriesJob seriesJob = (SeriesJob) accountingStateData.getSeriesResponse();
|
||||
|
||||
if (!(seriesJob.getSeriesJobDefinition() instanceof SeriesJobTop)) {
|
||||
Log.debug("Invalid SeriesJobTop!");
|
||||
return;
|
||||
}
|
||||
SeriesJobTop seriesJobTop = (SeriesJobTop) seriesJob
|
||||
.getSeriesJobDefinition();
|
||||
SeriesJobTop seriesJobTop = (SeriesJobTop) seriesJob.getSeriesJobDefinition();
|
||||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
|
||||
|
@ -491,32 +469,28 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
options.title().text("Accounting Job Top");
|
||||
|
||||
/*
|
||||
* options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||
* options.subtitle().text("Click and drag in the plot area to zoom in"
|
||||
* );
|
||||
*/
|
||||
|
||||
ColorsPalette colorsPalette=new ColorsPalette();
|
||||
ArrayString colors = options.colors();
|
||||
colors=colorsPalette.getColorsPalette(colors);
|
||||
options.colors(colors);
|
||||
|
||||
// colors.setValue(0, "#cc0038");
|
||||
// colors.setValue(1, "#32cd32");
|
||||
|
||||
// yAxis
|
||||
options.setFieldAsJsonObject("yAxis", retrieveYAxis(colors));
|
||||
|
||||
options.plotOptions().setFieldAsJsonObject(
|
||||
"column",
|
||||
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { "
|
||||
+ " \"enabled\": \"true\","
|
||||
options.plotOptions().setFieldAsJsonObject("column",
|
||||
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { " + " \"enabled\": \"true\","
|
||||
+ " \"color\": \"white\", " + " \"style\": {"
|
||||
+ " \"textShadow\": \"0 0 3px black\"" + " }"
|
||||
+ " }" + " }");
|
||||
+ " \"textShadow\": \"0 0 3px black\"" + " }" + " }" + " }");
|
||||
|
||||
ArrayList<SeriesColumn> seriesColumn = new ArrayList<>();
|
||||
if (seriesJobTop.getShowOthers()) {
|
||||
createSeriesColumnShowOthers(seriesJobTop, highchartsFactory,
|
||||
colors, seriesColumn);
|
||||
} else {
|
||||
createSeriesColumnSimple(seriesJobTop, highchartsFactory, colors,
|
||||
seriesColumn);
|
||||
}
|
||||
createSeriesColumnSimple(seriesJobTop, highchartsFactory, colors, seriesColumn);
|
||||
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
|
@ -528,35 +502,28 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
return;
|
||||
}
|
||||
|
||||
private void createSeriesColumnShowOthers(SeriesJobTop seriesJobTop,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
private void createSeriesColumnShowOthers(SeriesJobTop seriesJobTop, HighchartsOptionFactory highchartsFactory,
|
||||
ArrayString colors, ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series ShowOthers");
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.DAILY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.HOURLY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.MINUTELY) == 0) {
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.DAILY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.HOURLY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.MINUTELY) == 0) {
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest().getAccountingPeriod());
|
||||
|
||||
double interval = ChartTimeMeasure
|
||||
.calculateInterval(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
.calculateInterval(accountingStateData.getSeriesRequest().getAccountingPeriod());
|
||||
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getStartDate());
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate());
|
||||
|
||||
dateStart.setTime(dateStart.getTime()
|
||||
+ ChartTimeMeasure.timeZoneOffset()
|
||||
* ChartTimeMeasure.MINUTE);
|
||||
dateStart.setTime(dateStart.getTime() + ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
|
||||
|
||||
Log.debug("BuildChart DateStart: "
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
|
||||
.format(dateStart));
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL).format(dateStart));
|
||||
|
||||
// xAxis
|
||||
options.xAxis().type("datetime");
|
||||
|
@ -564,31 +531,25 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
int i = 0;
|
||||
for (; i < seriesJobTop.getSeriesJobDataTopList().size()
|
||||
&& i < seriesJobTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
for (; i < seriesJobTop.getSeriesJobDataTopList().size() && i < seriesJobTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesJobTop.getSeriesJobDataTopList()
|
||||
.get(i).getFilterValue().getValue());
|
||||
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()) {
|
||||
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);
|
||||
data.push(seriesJobData.getMaxInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
data.push(seriesJobData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
data.push(seriesJobData.getMinInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
data.push(seriesJobData.getOperationCount());
|
||||
|
@ -601,77 +562,61 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
||||
if (i < seriesJobTop.getSeriesJobDataTopList().size()) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
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++) {
|
||||
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);
|
||||
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);
|
||||
othersData.add(seriesJobData.getDuration() / unitMeasure);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
othersData.add(seriesJobData
|
||||
.getMaxInvocationTime() / unitMeasure);
|
||||
othersData.add(seriesJobData.getMaxInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
othersData.add(seriesJobData
|
||||
.getMinInvocationTime() / unitMeasure);
|
||||
othersData.add(seriesJobData.getMinInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
othersData.add(seriesJobData
|
||||
.getOperationCount());
|
||||
othersData.add(seriesJobData.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
othersData.add(seriesJobData.getDuration()
|
||||
/ unitMeasure);
|
||||
othersData.add(seriesJobData.getDuration() / unitMeasure);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
value = (seriesJobData.getDuration() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
value = (seriesJobData.getDuration() / unitMeasure) + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
value = (seriesJobData.getMaxInvocationTime() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
value = (seriesJobData.getMaxInvocationTime() / unitMeasure) + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
value = (seriesJobData.getMinInvocationTime() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
value = (seriesJobData.getMinInvocationTime() / unitMeasure) + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case OperationCount:
|
||||
value = seriesJobData.getOperationCount()
|
||||
+ othersData.get(k);
|
||||
value = seriesJobData.getOperationCount() + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
default:
|
||||
value = (seriesJobData.getDuration() / unitMeasure)
|
||||
+ othersData.get(k);
|
||||
value = (seriesJobData.getDuration() / unitMeasure) + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
|
||||
|
@ -688,8 +633,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
data.push(value);
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
@ -697,16 +641,15 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
// xAxis
|
||||
options.xAxis().type("datetime");
|
||||
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.MONTHLY) == 0) {
|
||||
//options.tooltip().xDateFormat("%b, %Y");
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.MONTHLY) == 0) {
|
||||
// options.tooltip().xDateFormat("%b, %Y");
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
} else {
|
||||
if (accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getPeriod()
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.YEARLY) == 0) {
|
||||
//options.tooltip().xDateFormat("%Y");
|
||||
// options.tooltip().xDateFormat("%Y");
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
} else {
|
||||
|
@ -716,20 +659,16 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
int i = 0;
|
||||
for (; i < seriesJobTop.getSeriesJobDataTopList().size()
|
||||
&& i < seriesJobTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
for (; i < seriesJobTop.getSeriesJobDataTopList().size() && i < seriesJobTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesJobTop.getSeriesJobDataTopList()
|
||||
.get(i).getFilterValue().getValue());
|
||||
seriesColumnData.name(seriesJobTop.getSeriesJobDataTopList().get(i).getFilterValue().getValue());
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
Array<Data> arrayData = seriesColumnData.dataAsArrayObject();
|
||||
|
||||
for (SeriesJobData seriesJobData : seriesJobTop
|
||||
.getSeriesJobDataTopList().get(i).getSeries()) {
|
||||
for (SeriesJobData seriesJobData : seriesJobTop.getSeriesJobDataTopList().get(i).getSeries()) {
|
||||
long dateFrom1970 = seriesJobData.getDate().getTime();
|
||||
|
||||
Log.debug("SeriersJobData: " + seriesJobData.getDate());
|
||||
|
@ -745,14 +684,12 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
break;
|
||||
case MaxInvocationTime:
|
||||
data.x(dateFrom1970);
|
||||
data.y(seriesJobData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
data.y(seriesJobData.getMaxInvocationTime() / unitMeasure);
|
||||
arrayData.addToEnd(data);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
data.x(dateFrom1970);
|
||||
data.y(seriesJobData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
data.y(seriesJobData.getMinInvocationTime() / unitMeasure);
|
||||
arrayData.addToEnd(data);
|
||||
break;
|
||||
case OperationCount:
|
||||
|
@ -775,94 +712,72 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
if (i < seriesJobTop.getSeriesJobDataTopList().size()) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name("Others");
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
ArrayList<ChartDateTimeData> othersData = new ArrayList<>();
|
||||
for (int j = i; j < seriesJobTop.getSeriesJobDataTopList()
|
||||
.size(); j++) {
|
||||
for (int j = i; j < seriesJobTop.getSeriesJobDataTopList().size(); j++) {
|
||||
ChartDateTimeData chartDateTimeData;
|
||||
for (int k = 0; k < seriesJobTop.getSeriesJobDataTopList()
|
||||
.get(j).getSeries().size(); k++) {
|
||||
SeriesJobData seriesJobData = seriesJobTop
|
||||
.getSeriesJobDataTopList().get(j).getSeries()
|
||||
.get(k);
|
||||
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:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
seriesJobData.getDuration()
|
||||
/ unitMeasure);
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
seriesJobData.getDuration() / unitMeasure);
|
||||
othersData.add(chartDateTimeData);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
seriesJobData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
seriesJobData.getMaxInvocationTime() / unitMeasure);
|
||||
othersData.add(chartDateTimeData);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
seriesJobData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
seriesJobData.getMinInvocationTime() / unitMeasure);
|
||||
othersData.add(chartDateTimeData);
|
||||
break;
|
||||
case OperationCount:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
seriesJobData.getOperationCount());
|
||||
othersData.add(chartDateTimeData);
|
||||
break;
|
||||
default:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
seriesJobData.getDuration()
|
||||
/ unitMeasure);
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
seriesJobData.getDuration() / unitMeasure);
|
||||
othersData.add(chartDateTimeData);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
(seriesJobData.getDuration() / unitMeasure)
|
||||
+ othersData.get(k).getValue());
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
(seriesJobData.getDuration() / unitMeasure) + othersData.get(k).getValue());
|
||||
othersData.set(k, chartDateTimeData);
|
||||
break;
|
||||
case MaxInvocationTime:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
(seriesJobData.getMaxInvocationTime() / unitMeasure)
|
||||
+ othersData.get(k).getValue());
|
||||
othersData.set(k, chartDateTimeData);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
(seriesJobData.getMinInvocationTime() / unitMeasure)
|
||||
+ othersData.get(k).getValue());
|
||||
othersData.set(k, chartDateTimeData);
|
||||
break;
|
||||
case OperationCount:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
seriesJobData.getOperationCount()
|
||||
+ othersData.get(k).getValue());
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
seriesJobData.getOperationCount() + othersData.get(k).getValue());
|
||||
othersData.set(k, chartDateTimeData);
|
||||
break;
|
||||
default:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesJobData.getDate(),
|
||||
(seriesJobData.getDuration() / unitMeasure)
|
||||
+ othersData.get(k).getValue());
|
||||
chartDateTimeData = new ChartDateTimeData(seriesJobData.getDate(),
|
||||
(seriesJobData.getDuration() / unitMeasure) + othersData.get(k).getValue());
|
||||
othersData.set(k, chartDateTimeData);
|
||||
break;
|
||||
|
||||
|
@ -878,8 +793,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
for (ChartDateTimeData chartDateTimeData : othersData) {
|
||||
long dateFrom1970 = chartDateTimeData.getDate().getTime();
|
||||
|
||||
Log.debug("SeriersOthersData: "
|
||||
+ chartDateTimeData.getDate());
|
||||
Log.debug("SeriersOthersData: " + chartDateTimeData.getDate());
|
||||
Log.debug("SeriersOthersData: " + dateFrom1970);
|
||||
|
||||
Data data = highchartsFactory.createSeriesColumnData();
|
||||
|
@ -896,65 +810,53 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
}
|
||||
|
||||
private void createSeriesColumnSimple(SeriesJobTop seriesJobTop,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
private void createSeriesColumnSimple(SeriesJobTop seriesJobTop, HighchartsOptionFactory highchartsFactory,
|
||||
ArrayString colors, ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series Simple");
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.DAILY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.HOURLY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.MINUTELY) == 0) {
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.DAILY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.HOURLY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.MINUTELY) == 0) {
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest().getAccountingPeriod());
|
||||
|
||||
double interval = ChartTimeMeasure
|
||||
.calculateInterval(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
.calculateInterval(accountingStateData.getSeriesRequest().getAccountingPeriod());
|
||||
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getStartDate());
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate());
|
||||
|
||||
dateStart.setTime(dateStart.getTime()
|
||||
+ ChartTimeMeasure.timeZoneOffset()
|
||||
* ChartTimeMeasure.MINUTE);
|
||||
dateStart.setTime(dateStart.getTime() + ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
|
||||
|
||||
Log.debug("BuildChart DateStart: "
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
|
||||
.format(dateStart));
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL).format(dateStart));
|
||||
|
||||
// xAxis
|
||||
options.xAxis().type("datetime");
|
||||
options.xAxis().minRange(minRange);
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
for (int i = 0; i < seriesJobTop.getSeriesJobDataTopList().size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesJobTop.getSeriesJobDataTopList()
|
||||
.get(i).getFilterValue().getValue());
|
||||
for (int i = 0; i < seriesJobTop.getSeriesJobDataTopList().size(); 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()) {
|
||||
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);
|
||||
data.push(seriesJobData.getMaxInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
data.push(seriesJobData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
data.push(seriesJobData.getMinInvocationTime() / unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
data.push(seriesJobData.getOperationCount());
|
||||
|
@ -967,8 +869,7 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
@ -976,16 +877,15 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
// xAxis
|
||||
options.xAxis().type("datetime");
|
||||
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.MONTHLY) == 0) {
|
||||
//options.tooltip().xDateFormat("%b, %Y");
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.MONTHLY) == 0) {
|
||||
// options.tooltip().xDateFormat("%b, %Y");
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
} else {
|
||||
if (accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getPeriod()
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.YEARLY) == 0) {
|
||||
//options.tooltip().xDateFormat("%Y");
|
||||
// options.tooltip().xDateFormat("%Y");
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
} else {
|
||||
|
@ -995,18 +895,15 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
for (int i = 0; i < seriesJobTop.getSeriesJobDataTopList().size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesJobTop.getSeriesJobDataTopList()
|
||||
.get(i).getFilterValue().getValue());
|
||||
seriesColumnData.name(seriesJobTop.getSeriesJobDataTopList().get(i).getFilterValue().getValue());
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
Array<Data> arrayData = seriesColumnData.dataAsArrayObject();
|
||||
|
||||
for (SeriesJobData seriesJobData : seriesJobTop
|
||||
.getSeriesJobDataTopList().get(i).getSeries()) {
|
||||
for (SeriesJobData seriesJobData : seriesJobTop.getSeriesJobDataTopList().get(i).getSeries()) {
|
||||
long dateFrom1970 = seriesJobData.getDate().getTime();
|
||||
|
||||
Log.debug("SeriersJobData: " + seriesJobData.getDate());
|
||||
|
@ -1022,14 +919,12 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
break;
|
||||
case MaxInvocationTime:
|
||||
data.x(dateFrom1970);
|
||||
data.y(seriesJobData.getMaxInvocationTime()
|
||||
/ unitMeasure);
|
||||
data.y(seriesJobData.getMaxInvocationTime() / unitMeasure);
|
||||
arrayData.addToEnd(data);
|
||||
break;
|
||||
case MinInvocationTime:
|
||||
data.x(dateFrom1970);
|
||||
data.y(seriesJobData.getMinInvocationTime()
|
||||
/ unitMeasure);
|
||||
data.y(seriesJobData.getMinInvocationTime() / unitMeasure);
|
||||
arrayData.addToEnd(data);
|
||||
break;
|
||||
case OperationCount:
|
||||
|
@ -1057,68 +952,45 @@ public class JobChartTopPanel extends SimpleContainer {
|
|||
private String retrieveYAxis(ArrayString colors) {
|
||||
switch (measure) {
|
||||
case Duration:
|
||||
return "[{" + " \"id\": \"" + JobChartMeasure.Duration.name()
|
||||
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.Duration.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
return "[{" + " \"id\": \"" + JobChartMeasure.Duration.name() + "\"," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"#434348\"" + " }" + " }," + " \"stackLabels\": {"
|
||||
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.Duration.getLabel() + "\"," + " \"style\": {" + " \"color\": \"#434348\""
|
||||
+ " }" + " }" + "}]";
|
||||
case MaxInvocationTime:
|
||||
return "[{" + " \"id\": \""
|
||||
+ JobChartMeasure.MaxInvocationTime.name() + "\","
|
||||
+ " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.MaxInvocationTime.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
return "[{" + " \"id\": \"" + JobChartMeasure.MaxInvocationTime.name() + "\"," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"#434348\"" + " }" + " }," + " \"stackLabels\": {"
|
||||
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.MaxInvocationTime.getLabel() + "\"," + " \"style\": {" + " \"color\": \"#434348\""
|
||||
+ " }" + " }" + "}]";
|
||||
case MinInvocationTime:
|
||||
return "[{" + " \"id\": \""
|
||||
+ JobChartMeasure.MinInvocationTime.name() + "\","
|
||||
+ " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.MinInvocationTime.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
return "[{" + " \"id\": \"" + JobChartMeasure.MinInvocationTime.name() + "\"," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"#434348\"" + " }" + " }," + " \"stackLabels\": {"
|
||||
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.MinInvocationTime.getLabel() + "\"," + " \"style\": {" + " \"color\": \"#434348\""
|
||||
+ " }" + " }" + "}]";
|
||||
case OperationCount:
|
||||
return "[{" + " \"id\": \"" + JobChartMeasure.OperationCount.name()
|
||||
+ "\"," + " \"labels\": { "
|
||||
+ " \"format\": \"{value}\"," + " \"style\": { "
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
return "[{" + " \"id\": \"" + JobChartMeasure.OperationCount.name() + "\"," + " \"labels\": { "
|
||||
+ " \"format\": \"{value}\"," + " \"style\": { " + " \"color\": \"#434348\""
|
||||
+ " }" + " }," + " \"stackLabels\": {" + " \"enabled\": \"true\"," + " \"style\": {"
|
||||
+ " \"fontWeight\": \"bold\"," + " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \"" + JobChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"#434348\"" + " }" + " }" + "}]";
|
||||
|
||||
default:
|
||||
return "[{" + " \"id\": \"" + JobChartMeasure.Duration.name()
|
||||
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.Duration.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
return "[{" + " \"id\": \"" + JobChartMeasure.Duration.name() + "\"," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"#434348\"" + " }" + " }," + " \"stackLabels\": {"
|
||||
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
|
||||
+ JobChartMeasure.Duration.getLabel() + "\"," + " \"style\": {" + " \"color\": \"#434348\""
|
||||
+ " }" + " }" + "}]";
|
||||
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -7,6 +7,7 @@ import org.gcube.portlets.admin.accountingmanager.client.event.ExportRequestEven
|
|||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ByteUnitMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ChartDateTimeData;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ChartTimeMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.ColorsPalette;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.DownloadConstants;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils.StorageChartMeasure;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||
|
@ -57,8 +58,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
private static final String DATA_VOLUME_UNIT = "Data Volume Unit";
|
||||
// private static final String MEASURE_TYPE = "Measure";
|
||||
|
||||
private DateTimeFormat dtf = DateTimeFormat
|
||||
.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
private DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.YEAR_MONTH_DAY);
|
||||
|
||||
private EventBus eventBus;
|
||||
private AccountingClientStateData accountingStateData;
|
||||
|
@ -94,8 +94,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
private VerticalLayoutContainer vert;
|
||||
|
||||
public StorageChartTopPanel(EventBus eventBus,
|
||||
AccountingClientStateData accountingStateData) {
|
||||
public StorageChartTopPanel(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||
this.eventBus = eventBus;
|
||||
this.accountingStateData = accountingStateData;
|
||||
forceLayoutOnResize = true;
|
||||
|
@ -107,8 +106,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.setSpacing(2);
|
||||
// Download
|
||||
final TextButton downloadButton = new TextButton(
|
||||
DownloadConstants.DOWNLOAD,
|
||||
final TextButton downloadButton = new TextButton(DownloadConstants.DOWNLOAD,
|
||||
AccountingManagerResources.INSTANCE.accountingDownload24());
|
||||
// downloadButton.setScale(ButtonScale.MEDIUM);
|
||||
downloadButton.setIconAlign(IconAlign.RIGHT);
|
||||
|
@ -116,16 +114,14 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
downloadButton.setMenu(createDownloadMenu());
|
||||
|
||||
// Measure
|
||||
measureButton = new TextButton(
|
||||
StorageChartMeasure.DataVolume.getLabel(),
|
||||
measureButton = new TextButton(StorageChartMeasure.DataVolume.getLabel(),
|
||||
AccountingManagerResources.INSTANCE.accountingByte24());
|
||||
measureButton.setIconAlign(IconAlign.RIGHT);
|
||||
measureButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
measureButton.setMenu(createMeasureMenu());
|
||||
|
||||
// Unit
|
||||
unitButton = new TextButton(DATA_VOLUME_UNIT,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitMB24());
|
||||
unitButton = new TextButton(DATA_VOLUME_UNIT, AccountingManagerResources.INSTANCE.accountingUnitMB24());
|
||||
unitButton.setIconAlign(IconAlign.RIGHT);
|
||||
unitButton.setArrowAlign(ButtonArrowAlign.RIGHT);
|
||||
unitButton.setMenu(createUnitMenu());
|
||||
|
@ -143,8 +139,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
//
|
||||
vert = new VerticalLayoutContainer();
|
||||
vert.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1,
|
||||
new Margins(0)));
|
||||
vert.add(highchartsLayoutPanel, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
|
||||
add(vert, new MarginData(0));
|
||||
|
||||
|
@ -273,8 +268,7 @@ 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>() {
|
||||
|
@ -292,8 +286,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
measureButton.setText(StorageChartMeasure.OperationCount
|
||||
.getLabel());
|
||||
measureButton.setText(StorageChartMeasure.OperationCount.getLabel());
|
||||
measure = StorageChartMeasure.OperationCount;
|
||||
unitButton.setVisible(false);
|
||||
updateChart();
|
||||
|
@ -309,17 +302,13 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
private Menu createUnitMenu() {
|
||||
Menu menuUnit = new Menu();
|
||||
kBItem = new MenuItem(ByteUnitMeasure.KILOBYTE,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitkB24());
|
||||
kBItem = new MenuItem(ByteUnitMeasure.KILOBYTE, AccountingManagerResources.INSTANCE.accountingUnitkB24());
|
||||
kBItem.setHeight(30);
|
||||
MBItem = new MenuItem(ByteUnitMeasure.MEGABYTE,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitMB24());
|
||||
MBItem = new MenuItem(ByteUnitMeasure.MEGABYTE, AccountingManagerResources.INSTANCE.accountingUnitMB24());
|
||||
MBItem.setHeight(30);
|
||||
GBItem = new MenuItem(ByteUnitMeasure.GIGABYTE,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitGB24());
|
||||
GBItem = new MenuItem(ByteUnitMeasure.GIGABYTE, AccountingManagerResources.INSTANCE.accountingUnitGB24());
|
||||
GBItem.setHeight(30);
|
||||
TBItem = new MenuItem(ByteUnitMeasure.TERABYTE,
|
||||
AccountingManagerResources.INSTANCE.accountingUnitTB24());
|
||||
TBItem = new MenuItem(ByteUnitMeasure.TERABYTE, AccountingManagerResources.INSTANCE.accountingUnitTB24());
|
||||
TBItem.setHeight(30);
|
||||
|
||||
kBItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
@ -328,8 +317,7 @@ 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();
|
||||
}
|
||||
});
|
||||
|
@ -340,8 +328,7 @@ 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();
|
||||
}
|
||||
});
|
||||
|
@ -352,8 +339,7 @@ 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();
|
||||
}
|
||||
});
|
||||
|
@ -364,8 +350,7 @@ 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();
|
||||
}
|
||||
});
|
||||
|
@ -379,20 +364,17 @@ public class StorageChartTopPanel 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);
|
||||
}
|
||||
|
||||
|
@ -449,15 +431,13 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
}-*/;
|
||||
|
||||
private void createChart() {
|
||||
SeriesStorage seriesStorage = (SeriesStorage) accountingStateData
|
||||
.getSeriesResponse();
|
||||
SeriesStorage seriesStorage = (SeriesStorage) accountingStateData.getSeriesResponse();
|
||||
|
||||
if (!(seriesStorage.getSeriesStorageDefinition() instanceof SeriesStorageTop)) {
|
||||
Log.debug("Invalid SeriesStorageTop!");
|
||||
return;
|
||||
}
|
||||
SeriesStorageTop seriesStorageTop = (SeriesStorageTop) seriesStorage
|
||||
.getSeriesStorageDefinition();
|
||||
SeriesStorageTop seriesStorageTop = (SeriesStorageTop) seriesStorage.getSeriesStorageDefinition();
|
||||
|
||||
HighchartsOptionFactory highchartsFactory = new JsoHighchartsOptionFactory();
|
||||
|
||||
|
@ -468,32 +448,29 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
options.title().text("Accounting Storage Top");
|
||||
|
||||
/*
|
||||
* options.subtitle().text("Click and drag in the plot area to zoom in");
|
||||
* options.subtitle().text("Click and drag in the plot area to zoom in"
|
||||
* );
|
||||
*/
|
||||
|
||||
ColorsPalette colorsPalette = new ColorsPalette();
|
||||
ArrayString colors = options.colors();
|
||||
colors = colorsPalette.getColorsPalette(colors);
|
||||
options.colors(colors);
|
||||
|
||||
// colors.setValue(0, "#cc0038");
|
||||
// colors.setValue(1, "#32cd32");
|
||||
|
||||
// yAxis
|
||||
options.setFieldAsJsonObject("yAxis", retrieveYAxis(colors));
|
||||
|
||||
options.plotOptions().setFieldAsJsonObject(
|
||||
"column",
|
||||
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { "
|
||||
+ " \"enabled\": \"true\","
|
||||
options.plotOptions().setFieldAsJsonObject("column",
|
||||
"{ " + "\"stacking\": \"normal\"," + "\"dataLabels\": { " + " \"enabled\": \"true\","
|
||||
+ " \"color\": \"white\", " + " \"style\": {"
|
||||
+ " \"textShadow\": \"0 0 3px black\"" + " }"
|
||||
+ " }" + " }");
|
||||
+ " \"textShadow\": \"0 0 3px black\"" + " }" + " }" + " }");
|
||||
|
||||
ArrayList<SeriesColumn> seriesColumn = new ArrayList<>();
|
||||
if (seriesStorageTop.getShowOthers()) {
|
||||
createSeriesColumnShowOthers(seriesStorageTop, highchartsFactory,
|
||||
colors, seriesColumn);
|
||||
} else {
|
||||
createSeriesColumnSimple(seriesStorageTop, highchartsFactory,
|
||||
colors, seriesColumn);
|
||||
}
|
||||
|
||||
createSeriesColumnSimple(seriesStorageTop, highchartsFactory, colors, seriesColumn);
|
||||
|
||||
for (SeriesColumn serie : seriesColumn) {
|
||||
options.series().addToEnd(serie);
|
||||
|
@ -505,62 +482,51 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
return;
|
||||
}
|
||||
|
||||
private void createSeriesColumnShowOthers(
|
||||
SeriesStorageTop seriesStorageTop,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
private void createSeriesColumnShowOthers(SeriesStorageTop seriesStorageTop,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors, ArrayList<SeriesColumn> seriesColumn) {
|
||||
Log.debug("Series ShowOthers");
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.DAILY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.HOURLY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.MINUTELY) == 0) {
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.DAILY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.HOURLY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.MINUTELY) == 0) {
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest().getAccountingPeriod());
|
||||
|
||||
double interval = ChartTimeMeasure
|
||||
.calculateInterval(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
.calculateInterval(accountingStateData.getSeriesRequest().getAccountingPeriod());
|
||||
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getStartDate());
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate());
|
||||
|
||||
dateStart.setTime(dateStart.getTime()
|
||||
+ ChartTimeMeasure.timeZoneOffset()
|
||||
* ChartTimeMeasure.MINUTE);
|
||||
dateStart.setTime(dateStart.getTime() + ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
|
||||
|
||||
Log.debug("BuildChart DateStart: "
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
|
||||
.format(dateStart));
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL).format(dateStart));
|
||||
|
||||
// xAxis
|
||||
options.xAxis().type("datetime");
|
||||
options.xAxis().minRange(minRange);
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
|
||||
int i = 0;
|
||||
for (; i < seriesStorageTop.getSeriesStorageDataTopList().size()
|
||||
&& i < seriesStorageTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(i).getFilterValue()
|
||||
.getValue());
|
||||
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()) {
|
||||
for (SeriesStorageData seriesStorageData : seriesStorageTop.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());
|
||||
|
@ -573,43 +539,34 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
||||
if (i < seriesStorageTop.getSeriesStorageDataTopList().size()) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
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++) {
|
||||
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)
|
||||
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);
|
||||
othersData.add(seriesStorageData.getDataVolume() / unitMeasure);
|
||||
break;
|
||||
case OperationCount:
|
||||
othersData.add(seriesStorageData
|
||||
.getOperationCount());
|
||||
othersData.add(seriesStorageData.getOperationCount());
|
||||
break;
|
||||
default:
|
||||
othersData.add(seriesStorageData
|
||||
.getDataVolume() / unitMeasure);
|
||||
othersData.add(seriesStorageData.getDataVolume() / unitMeasure);
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -617,18 +574,15 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
switch (measure) {
|
||||
case DataVolume:
|
||||
|
||||
value = seriesStorageData.getDataVolume()
|
||||
/ unitMeasure + othersData.get(k);
|
||||
value = seriesStorageData.getDataVolume() / unitMeasure + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
case OperationCount:
|
||||
value = seriesStorageData.getOperationCount()
|
||||
+ othersData.get(k);
|
||||
value = seriesStorageData.getOperationCount() + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
default:
|
||||
value = seriesStorageData.getDataVolume()
|
||||
/ unitMeasure + othersData.get(k);
|
||||
value = seriesStorageData.getDataVolume() / unitMeasure + othersData.get(k);
|
||||
othersData.set(k, value);
|
||||
break;
|
||||
|
||||
|
@ -644,8 +598,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
data.push(value);
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
}
|
||||
|
||||
|
@ -653,16 +606,15 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
// xAxis
|
||||
options.xAxis().type("datetime");
|
||||
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.MONTHLY) == 0) {
|
||||
//options.tooltip().xDateFormat("%b, %Y");
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.MONTHLY) == 0) {
|
||||
// options.tooltip().xDateFormat("%b, %Y");
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
} else {
|
||||
if (accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getPeriod()
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.YEARLY) == 0) {
|
||||
//options.tooltip().xDateFormat("%Y");
|
||||
// options.tooltip().xDateFormat("%Y");
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
} else {
|
||||
|
@ -674,23 +626,20 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
int i = 0;
|
||||
for (; i < seriesStorageTop.getSeriesStorageDataTopList().size()
|
||||
&& i < seriesStorageTop.getTopNumber(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(i).getFilterValue()
|
||||
.getValue());
|
||||
seriesColumnData
|
||||
.name(seriesStorageTop.getSeriesStorageDataTopList().get(i).getFilterValue().getValue());
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
Array<Data> arrayData = seriesColumnData.dataAsArrayObject();
|
||||
|
||||
for (SeriesStorageData seriesStorageData : seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(i).getSeries()) {
|
||||
for (SeriesStorageData seriesStorageData : seriesStorageTop.getSeriesStorageDataTopList().get(i)
|
||||
.getSeries()) {
|
||||
long dateFrom1970 = seriesStorageData.getDate().getTime();
|
||||
|
||||
Log.debug("SeriersStorageData: "
|
||||
+ seriesStorageData.getDate());
|
||||
Log.debug("SeriersStorageData: " + seriesStorageData.getDate());
|
||||
Log.debug("SeriersStorageData: " + dateFrom1970);
|
||||
|
||||
Data data = highchartsFactory.createSeriesColumnData();
|
||||
|
@ -721,65 +670,51 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
if (i < seriesStorageTop.getSeriesStorageDataTopList().size()) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name("Others");
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
ArrayList<ChartDateTimeData> othersData = new ArrayList<>();
|
||||
for (int j = i; j < seriesStorageTop
|
||||
.getSeriesStorageDataTopList().size(); j++) {
|
||||
for (int j = i; j < seriesStorageTop.getSeriesStorageDataTopList().size(); j++) {
|
||||
ChartDateTimeData chartDateTimeData;
|
||||
for (int k = 0; k < seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(j).getSeries()
|
||||
.size(); k++) {
|
||||
SeriesStorageData seriesStorageData = seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(j)
|
||||
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:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesStorageData.getDate(),
|
||||
seriesStorageData.getDataVolume()
|
||||
/ unitMeasure);
|
||||
chartDateTimeData = new ChartDateTimeData(seriesStorageData.getDate(),
|
||||
seriesStorageData.getDataVolume() / unitMeasure);
|
||||
othersData.add(chartDateTimeData);
|
||||
break;
|
||||
case OperationCount:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesStorageData.getDate(),
|
||||
chartDateTimeData = new ChartDateTimeData(seriesStorageData.getDate(),
|
||||
seriesStorageData.getOperationCount());
|
||||
othersData.add(chartDateTimeData);
|
||||
break;
|
||||
default:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesStorageData.getDate(),
|
||||
seriesStorageData.getDataVolume()
|
||||
/ unitMeasure);
|
||||
chartDateTimeData = new ChartDateTimeData(seriesStorageData.getDate(),
|
||||
seriesStorageData.getDataVolume() / unitMeasure);
|
||||
othersData.add(chartDateTimeData);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (measure) {
|
||||
case DataVolume:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesStorageData.getDate(),
|
||||
chartDateTimeData = new ChartDateTimeData(seriesStorageData.getDate(),
|
||||
(seriesStorageData.getDataVolume() / unitMeasure)
|
||||
+ othersData.get(k).getValue());
|
||||
othersData.set(k, chartDateTimeData);
|
||||
break;
|
||||
case OperationCount:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesStorageData.getDate(),
|
||||
seriesStorageData.getOperationCount()
|
||||
+ othersData.get(k).getValue());
|
||||
chartDateTimeData = new ChartDateTimeData(seriesStorageData.getDate(),
|
||||
seriesStorageData.getOperationCount() + othersData.get(k).getValue());
|
||||
othersData.set(k, chartDateTimeData);
|
||||
break;
|
||||
default:
|
||||
chartDateTimeData = new ChartDateTimeData(
|
||||
seriesStorageData.getDate(),
|
||||
chartDateTimeData = new ChartDateTimeData(seriesStorageData.getDate(),
|
||||
(seriesStorageData.getDataVolume() / unitMeasure)
|
||||
+ othersData.get(k).getValue());
|
||||
othersData.set(k, chartDateTimeData);
|
||||
|
@ -796,8 +731,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
for (ChartDateTimeData chartDateTimeData : othersData) {
|
||||
long dateFrom1970 = chartDateTimeData.getDate().getTime();
|
||||
|
||||
Log.debug("SeriersOthersData: "
|
||||
+ chartDateTimeData.getDate());
|
||||
Log.debug("SeriersOthersData: " + chartDateTimeData.getDate());
|
||||
Log.debug("SeriersOthersData: " + dateFrom1970);
|
||||
|
||||
Data data = highchartsFactory.createSeriesColumnData();
|
||||
|
@ -815,61 +749,50 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
private void createSeriesColumnSimple(SeriesStorageTop seriesStorageTop,
|
||||
HighchartsOptionFactory highchartsFactory, ArrayString colors,
|
||||
ArrayList<SeriesColumn> seriesColumn) {
|
||||
private void createSeriesColumnSimple(SeriesStorageTop seriesStorageTop, HighchartsOptionFactory highchartsFactory,
|
||||
ArrayString colors, ArrayList<SeriesColumn> seriesColumn) {
|
||||
|
||||
Log.debug("Series Simple");
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.DAILY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.HOURLY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.MINUTELY) == 0) {
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.DAILY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.HOURLY) == 0
|
||||
|| accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.MINUTELY) == 0) {
|
||||
|
||||
double minRange = ChartTimeMeasure
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
.calculateMinRange(accountingStateData.getSeriesRequest().getAccountingPeriod());
|
||||
|
||||
double interval = ChartTimeMeasure
|
||||
.calculateInterval(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod());
|
||||
.calculateInterval(accountingStateData.getSeriesRequest().getAccountingPeriod());
|
||||
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getStartDate());
|
||||
Date dateStart = dtf.parse(accountingStateData.getSeriesRequest().getAccountingPeriod().getStartDate());
|
||||
|
||||
dateStart.setTime(dateStart.getTime()
|
||||
+ ChartTimeMeasure.timeZoneOffset()
|
||||
* ChartTimeMeasure.MINUTE);
|
||||
dateStart.setTime(dateStart.getTime() + ChartTimeMeasure.timeZoneOffset() * ChartTimeMeasure.MINUTE);
|
||||
|
||||
Log.debug("BuildChart DateStart: "
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL)
|
||||
.format(dateStart));
|
||||
+ DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_FULL).format(dateStart));
|
||||
|
||||
// xAxis
|
||||
options.xAxis().type("datetime");
|
||||
options.xAxis().minRange(minRange);
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
for (int i = 0; i < seriesStorageTop.getSeriesStorageDataTopList()
|
||||
.size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(i).getFilterValue()
|
||||
.getValue());
|
||||
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()) {
|
||||
for (SeriesStorageData seriesStorageData : seriesStorageTop.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());
|
||||
|
@ -882,8 +805,7 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
seriesColumnData.pointInterval(interval).pointStart(
|
||||
dateStart.getTime());
|
||||
seriesColumnData.pointInterval(interval).pointStart(dateStart.getTime());
|
||||
seriesColumn.add(seriesColumnData);
|
||||
|
||||
}
|
||||
|
@ -892,16 +814,15 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
// xAxis
|
||||
options.xAxis().type("datetime");
|
||||
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod()
|
||||
.getPeriod().compareTo(AccountingPeriodMode.MONTHLY) == 0) {
|
||||
//options.tooltip().xDateFormat("%b, %Y");
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.MONTHLY) == 0) {
|
||||
// options.tooltip().xDateFormat("%b, %Y");
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
} else {
|
||||
if (accountingStateData.getSeriesRequest()
|
||||
.getAccountingPeriod().getPeriod()
|
||||
if (accountingStateData.getSeriesRequest().getAccountingPeriod().getPeriod()
|
||||
.compareTo(AccountingPeriodMode.YEARLY) == 0) {
|
||||
//options.tooltip().xDateFormat("%Y");
|
||||
// options.tooltip().xDateFormat("%Y");
|
||||
options.tooltip().xDateFormat("Selected Data");
|
||||
|
||||
} else {
|
||||
|
@ -910,25 +831,21 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
|
||||
for (int i = 0; i < seriesStorageTop.getSeriesStorageDataTopList()
|
||||
.size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory
|
||||
.createSeriesColumn();
|
||||
for (int i = 0; i < seriesStorageTop.getSeriesStorageDataTopList().size(); i++) {
|
||||
SeriesColumn seriesColumnData = highchartsFactory.createSeriesColumn();
|
||||
|
||||
seriesColumnData.name(seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(i).getFilterValue()
|
||||
.getValue());
|
||||
seriesColumnData
|
||||
.name(seriesStorageTop.getSeriesStorageDataTopList().get(i).getFilterValue().getValue());
|
||||
seriesColumnData.color(colors.get(i));
|
||||
seriesColumnData.type("column");
|
||||
|
||||
Array<Data> arrayData = seriesColumnData.dataAsArrayObject();
|
||||
|
||||
for (SeriesStorageData seriesStorageData : seriesStorageTop
|
||||
.getSeriesStorageDataTopList().get(i).getSeries()) {
|
||||
for (SeriesStorageData seriesStorageData : seriesStorageTop.getSeriesStorageDataTopList().get(i)
|
||||
.getSeries()) {
|
||||
long dateFrom1970 = seriesStorageData.getDate().getTime();
|
||||
|
||||
Log.debug("SeriersStorageData: "
|
||||
+ seriesStorageData.getDate());
|
||||
Log.debug("SeriersStorageData: " + seriesStorageData.getDate());
|
||||
Log.debug("SeriersStorageData: " + dateFrom1970);
|
||||
|
||||
Data data = highchartsFactory.createSeriesColumnData();
|
||||
|
@ -964,44 +881,30 @@ public class StorageChartTopPanel extends SimpleContainer {
|
|||
private String retrieveYAxis(ArrayString colors) {
|
||||
switch (measure) {
|
||||
case DataVolume:
|
||||
return "[{" + " \"id\": \"" + StorageChartMeasure.DataVolume.name()
|
||||
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ StorageChartMeasure.DataVolume.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
return "[{" + " \"id\": \"" + StorageChartMeasure.DataVolume.name() + "\"," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"#434348\"" + " }" + " }," + " \"stackLabels\": {"
|
||||
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
|
||||
+ StorageChartMeasure.DataVolume.getLabel() + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"#434348\"" + " }" + " }" + "}]";
|
||||
|
||||
case OperationCount:
|
||||
return "[{" + " \"id\": \""
|
||||
+ StorageChartMeasure.OperationCount.name() + "\","
|
||||
+ " \"labels\": { " + " \"format\": \"{value}\","
|
||||
+ " \"style\": { " + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " },"
|
||||
+ " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ StorageChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
return "[{" + " \"id\": \"" + StorageChartMeasure.OperationCount.name() + "\"," + " \"labels\": { "
|
||||
+ " \"format\": \"{value}\"," + " \"style\": { " + " \"color\": \"#434348\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\"," + " \"style\": {"
|
||||
+ " \"fontWeight\": \"bold\"," + " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \"" + StorageChartMeasure.OperationCount.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \"#434348\"" + " }" + " }" + "}]";
|
||||
|
||||
default:
|
||||
return "[{" + " \"id\": \"" + StorageChartMeasure.DataVolume.name()
|
||||
+ "\"," + " \"labels\": {" + " \"format\": \"{value} "
|
||||
+ unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"" + colors.get(1) + "\"" + " }"
|
||||
+ " }," + " \"stackLabels\": {" + " \"enabled\": \"true\","
|
||||
+ " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " },"
|
||||
+ " \"title\": { " + " \"text\": \""
|
||||
+ StorageChartMeasure.DataVolume.getLabel() + "\","
|
||||
+ " \"style\": {" + " \"color\": \""
|
||||
+ colors.get(1) + "\"" + " }" + " }" + "}]";
|
||||
return "[{" + " \"id\": \"" + StorageChartMeasure.DataVolume.name() + "\"," + " \"labels\": {"
|
||||
+ " \"format\": \"{value} " + unitMeasureLabel + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"#434348\"" + " }" + " }," + " \"stackLabels\": {"
|
||||
+ " \"enabled\": \"true\"," + " \"style\": {" + " \"fontWeight\": \"bold\","
|
||||
+ " \"color\": \"gray\"" + " } " + " }," + " \"title\": { " + " \"text\": \""
|
||||
+ StorageChartMeasure.DataVolume.getLabel() + "\"," + " \"style\": {"
|
||||
+ " \"color\": \"#434348\"" + " }" + " }" + "}]";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts.utils;
|
||||
|
||||
import com.github.highcharts4gwt.model.array.api.ArrayString;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*/
|
||||
public class ColorsPalette {
|
||||
|
||||
private String[] palette = { "#87CEEB", "#DAA520", "#3CB371", "#FF4500", "#8FBC8F", "#FF00FF", "#BDB76B", "#5F9EA0",
|
||||
"#A0522D", "#6B8E23", "#FFA07A", "#696969", "#DDA0DD", "#C71585", "#1E90FF", "#D2B48C", "#90EE90",
|
||||
"#B22222", "#00CED1", "#9400D3", "#FFDAB9", "#663399", "#FFE4C4", "#ADFF2F", "#FF0000", "#00FFFF",
|
||||
"#483D8B", "#FFFF00", "#00008B", "#FFDEAD", "#7CFC00", "#FF6347", "#AFEEEE", "#6A5ACD", "#FFFACD",
|
||||
"#0000CD", "#F5DEB3", "#00FF00", "#FF7F50", "#7FFFD4", "#7B68EE", "#FFEFD5", "#0000FF", "#DEB887",
|
||||
"#32CD32", "#FFA500", "#40E0D0", "#9370DB", "#FFE4B5", "#4169E1", "#BC8F8F", "#98FB98", "#8B0000",
|
||||
"#48D1CC", "#800080", "#EEE8AA", "#00BFFF", "#F4A460", "#00FA9A", "#800000", "#556B2F", "#8A2BE2",
|
||||
"#F0E68C", "#6495ED", "#B8860B", "#2E8B57", "#FFD700", "#66CDAA", "#9932CC", "#FFC0CB", "#87CEFA",
|
||||
"#CD853F", "#228B22", "#DC143C", "#20B2AA", "#BA55D3", "#FFB6C1", "#B0E0E6", "#D2691E", "#008000",
|
||||
"#CD5C5C", "#008B8B", "#FF00FF", "#FF69B4", "#B0C4DE", "#808000", "#006400", "#F08080", "#008080",
|
||||
"#EE82EE", "#FF1493", "#4682B4", "#8B4513", "#9ACD32", "#FA8072", "#778899", "#DA70D6", "#DB7093" };
|
||||
|
||||
public ColorsPalette() {
|
||||
|
||||
}
|
||||
|
||||
public ArrayString getColorsPalette(ArrayString colors) {
|
||||
for (int i = 0; i < palette.length; i++) {
|
||||
colors.setValue(i, palette[i]);
|
||||
}
|
||||
colors.setLength(palette.length);
|
||||
return colors;
|
||||
}
|
||||
}
|
|
@ -9,8 +9,7 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*/
|
||||
public interface AccountingFilterProperties extends
|
||||
|
|
|
@ -9,12 +9,10 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*/
|
||||
public interface AccountingPeriodModePropertiesCombo extends
|
||||
PropertyAccess<AccountingPeriodMode> {
|
||||
public interface AccountingPeriodModePropertiesCombo extends PropertyAccess<AccountingPeriodMode> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<AccountingPeriodMode> id();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.properties;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.GenresData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ContextData;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.sencha.gxt.core.client.ValueProvider;
|
||||
|
@ -9,13 +9,14 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface GenresDataProperties extends PropertyAccess<GenresData> {
|
||||
@Path("genre")
|
||||
ModelKeyProvider<GenresData> id();
|
||||
public interface ContextDataProperties extends PropertyAccess<ContextData> {
|
||||
|
||||
ValueProvider<GenresData, String> label();
|
||||
@Path("contextData")
|
||||
ModelKeyProvider<ContextData> id();
|
||||
|
||||
ValueProvider<ContextData, String> label();
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.properties;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.GenresData;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface GenresDataPropertiesCombo extends
|
||||
PropertyAccess<GenresData> {
|
||||
|
||||
@Path("genre")
|
||||
ModelKeyProvider<GenresData> id();
|
||||
|
||||
LabelProvider<GenresData> label();
|
||||
|
||||
}
|
|
@ -68,7 +68,7 @@ public class AccountingClientStateData implements Serializable {
|
|||
*/
|
||||
public AccountingClientStateData(AccountingType accountingType, SeriesRequest seriesRequest,
|
||||
SeriesResponse seriesResponse, ArrayList<FilterKey> availableFilterKeys, Context availableContext,
|
||||
Spaces availableSpaces, Boolean rootScope) {
|
||||
String scopeFilterActive, Spaces availableSpaces, Boolean rootScope) {
|
||||
super();
|
||||
this.accountingType = accountingType;
|
||||
this.seriesRequest = seriesRequest;
|
||||
|
|
|
@ -3,11 +3,10 @@ package org.gcube.portlets.admin.accountingmanager.server.amservice;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandGetFilterKeys;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandGetFilterValues;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandGetSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Job;
|
||||
|
@ -18,15 +17,14 @@ import org.gcube.portlets.admin.accountingmanager.server.amservice.query.Account
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Task;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryBuilder;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryDirector;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuerySpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Spaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Spaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -102,11 +100,6 @@ public class AccountingCaller implements AccountingCallerInterface {
|
|||
AccountingCommandTop accountingCommandTop = new AccountingCommandTop(
|
||||
accountingQueryTop, accountingType);
|
||||
return accountingCommandTop.execute();
|
||||
case Context:
|
||||
AccountingQueryContext accountingQueryContext = (AccountingQueryContext) query;
|
||||
AccountingCommandContext accountingCommandContext = new AccountingCommandContext(
|
||||
accountingQueryContext, accountingType);
|
||||
return accountingCommandContext.execute();
|
||||
case Spaces:
|
||||
AccountingQuerySpaces accountingQuerySpace = (AccountingQuerySpaces) query;
|
||||
AccountingCommandSpaces accountingCommandSpace = new AccountingCommandSpaces(
|
||||
|
|
|
@ -12,12 +12,11 @@ import java.util.List;
|
|||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Spaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Spaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
|
@ -25,27 +24,21 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesSer
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesSpace;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDefinition;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDefinition;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceDataSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceDefinition;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDefinition;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageTop;
|
||||
|
@ -60,8 +53,7 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class AccountingCallerTester implements AccountingCallerInterface {
|
||||
private static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingCallerTester.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(AccountingCallerTester.class);
|
||||
|
||||
protected SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMMMM dd");
|
||||
|
||||
|
@ -69,11 +61,9 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
super();
|
||||
}
|
||||
|
||||
public ArrayList<FilterKey> getFilterKeys(AccountingType accountingType)
|
||||
throws ServiceException {
|
||||
public ArrayList<FilterKey> getFilterKeys(AccountingType accountingType) throws ServiceException {
|
||||
try {
|
||||
logger.debug("getFilterKeys(): [AccountingType=" + accountingType
|
||||
+ "]");
|
||||
logger.debug("getFilterKeys(): [AccountingType=" + accountingType + "]");
|
||||
if (accountingType == null) {
|
||||
return new ArrayList<FilterKey>();
|
||||
}
|
||||
|
@ -100,17 +90,13 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
}
|
||||
}
|
||||
|
||||
public FilterValuesResponse getFilterValues(
|
||||
FilterValuesRequest filterValuesRequest) throws ServiceException {
|
||||
public FilterValuesResponse getFilterValues(FilterValuesRequest filterValuesRequest) throws ServiceException {
|
||||
try {
|
||||
logger.debug("getFilterValue(): [FilterValueRequest="
|
||||
+ filterValuesRequest + "]");
|
||||
logger.debug("getFilterValue(): [FilterValueRequest=" + filterValuesRequest + "]");
|
||||
FilterValuesResponse filterValuesResponse = null;
|
||||
if (filterValuesRequest == null
|
||||
|| filterValuesRequest.getAccountingType() == null
|
||||
if (filterValuesRequest == null || filterValuesRequest.getAccountingType() == null
|
||||
|| filterValuesRequest.getFilterKey() == null) {
|
||||
filterValuesResponse = new FilterValuesResponse(
|
||||
new ArrayList<FilterValue>());
|
||||
filterValuesResponse = new FilterValuesResponse(new ArrayList<FilterValue>());
|
||||
return filterValuesResponse;
|
||||
|
||||
}
|
||||
|
@ -139,42 +125,36 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||
return filterValuesResponse;
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error in getFilterValues(): "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error in getFilterValues(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("No values available!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public SeriesResponse getSeries(AccountingType accountingType,
|
||||
SeriesRequest seriesRequest) throws ServiceException {
|
||||
public SeriesResponse getSeries(AccountingType accountingType, SeriesRequest seriesRequest)
|
||||
throws ServiceException {
|
||||
try {
|
||||
logger.debug("getSeries(): [AccountingType=" + accountingType
|
||||
+ " , seriesRequest=" + seriesRequest + "]");
|
||||
logger.debug("getSeries(): [AccountingType=" + accountingType + " , seriesRequest=" + seriesRequest + "]");
|
||||
SeriesResponse seriesResponse = null;
|
||||
|
||||
Calendar startCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(seriesRequest
|
||||
.getAccountingPeriod().getStartDate()));
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Start Date not valid!");
|
||||
}
|
||||
|
||||
Calendar endCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
|
||||
// GregorianCalendar endCalendar = new GregorianCalendar();
|
||||
// .getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
|
||||
// GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(seriesRequest
|
||||
.getAccountingPeriod().getEndDate()));
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("End Date not valid!");
|
||||
|
@ -183,20 +163,16 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
switch (accountingType) {
|
||||
case JOB:
|
||||
SeriesJobDefinition serieJobDefinition = null;
|
||||
if (seriesRequest.getAccountingFilterDefinition()
|
||||
.getChartType() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition().getChartType() != null) {
|
||||
ArrayList<SeriesJobData> seriesJobData = new ArrayList<>();
|
||||
for (int i = 0; i < 30; i++) {
|
||||
SeriesJobData data = new SeriesJobData(new Date(),
|
||||
new Double(10 * Math.random()).longValue(),
|
||||
new Double(10 * Math.random()).longValue(),
|
||||
new Double(10 * Math.random()).longValue(),
|
||||
SeriesJobData data = new SeriesJobData(new Date(), new Double(10 * Math.random()).longValue(),
|
||||
new Double(10 * Math.random()).longValue(), new Double(10 * Math.random()).longValue(),
|
||||
new Double(100 * Math.random()).longValue());
|
||||
seriesJobData.add(data);
|
||||
|
||||
}
|
||||
switch (seriesRequest.getAccountingFilterDefinition()
|
||||
.getChartType()) {
|
||||
switch (seriesRequest.getAccountingFilterDefinition().getChartType()) {
|
||||
case Basic:
|
||||
serieJobDefinition = new SeriesJobBasic(seriesJobData);
|
||||
break;
|
||||
|
@ -205,49 +181,13 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
.getAccountingFilterDefinition();
|
||||
|
||||
ArrayList<SeriesJobDataTop> seriesJobDataTopList = new ArrayList<>();
|
||||
if (accountingFilterTop.getShowOthers()) {
|
||||
for (int i = 0; i < 40; i++) {
|
||||
for (int i = 0; i < accountingFilterTop.getTopNumber(); i++) {
|
||||
|
||||
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);
|
||||
}
|
||||
SeriesJobDataTop seriesJobDataTop = new SeriesJobDataTop(new FilterValue("User" + i),
|
||||
seriesJobData);
|
||||
seriesJobDataTopList.add(seriesJobDataTop);
|
||||
}
|
||||
|
||||
serieJobDefinition = new SeriesJobTop(
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
seriesJobDataTopList);
|
||||
break;
|
||||
case Context:
|
||||
// AccountingFilterContext accountingFilterContext =
|
||||
// (AccountingFilterContext) seriesRequest
|
||||
// .getAccountingFilterDefinition();
|
||||
ArrayList<SeriesJobDataContext> seriesJobDataContextList = new ArrayList<>();
|
||||
ArrayList<String> contexts = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
String scope = new String("VRE " + i);
|
||||
contexts.add(scope);
|
||||
SeriesJobDataContext seriesJobDataContext = new SeriesJobDataContext(
|
||||
scope, seriesJobData);
|
||||
seriesJobDataContextList.add(seriesJobDataContext);
|
||||
}
|
||||
|
||||
Context context = new Context(contexts);
|
||||
serieJobDefinition = new SeriesJobContext(context,
|
||||
seriesJobDataContextList);
|
||||
|
||||
serieJobDefinition = new SeriesJobTop(accountingFilterTop.getTopNumber(), seriesJobDataTopList);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -263,49 +203,39 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
break;
|
||||
case SERVICE:
|
||||
SeriesServiceDefinition serieServiceDefinition = null;
|
||||
if (seriesRequest.getAccountingFilterDefinition()
|
||||
.getChartType() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition().getChartType() != null) {
|
||||
ArrayList<SeriesServiceData> seriesServiceData = new ArrayList<>();
|
||||
switch (seriesRequest.getAccountingPeriod().getPeriod()) {
|
||||
case DAILY:
|
||||
case HOURLY:
|
||||
case MINUTELY:
|
||||
for (int i = 0; i < 30; i++) {
|
||||
SeriesServiceData data = new SeriesServiceData(
|
||||
new Date(),
|
||||
SeriesServiceData data = new SeriesServiceData(new Date(),
|
||||
new Double(50 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random())
|
||||
.longValue(), new Double(
|
||||
10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random())
|
||||
.longValue());
|
||||
new Double(10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue());
|
||||
seriesServiceData.add(data);
|
||||
}
|
||||
break;
|
||||
case MONTHLY:
|
||||
while (startCalendar.compareTo(endCalendar) <= 0) {
|
||||
SeriesServiceData data = new SeriesServiceData(
|
||||
startCalendar.getTime(), new Double(
|
||||
50 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random())
|
||||
.longValue(), new Double(
|
||||
10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random())
|
||||
.longValue());
|
||||
SeriesServiceData data = new SeriesServiceData(startCalendar.getTime(),
|
||||
new Double(50 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue());
|
||||
seriesServiceData.add(data);
|
||||
startCalendar.add(Calendar.MONTH, 1);
|
||||
}
|
||||
break;
|
||||
case YEARLY:
|
||||
while (startCalendar.compareTo(endCalendar) <= 0) {
|
||||
SeriesServiceData data = new SeriesServiceData(
|
||||
startCalendar.getTime(), new Double(
|
||||
50 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random())
|
||||
.longValue(), new Double(
|
||||
10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random())
|
||||
.longValue());
|
||||
SeriesServiceData data = new SeriesServiceData(startCalendar.getTime(),
|
||||
new Double(50 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue(),
|
||||
new Double(10000 * Math.random()).longValue());
|
||||
seriesServiceData.add(data);
|
||||
startCalendar.add(Calendar.YEAR, 1);
|
||||
}
|
||||
|
@ -315,117 +245,25 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
|
||||
}
|
||||
|
||||
switch (seriesRequest.getAccountingFilterDefinition()
|
||||
.getChartType()) {
|
||||
switch (seriesRequest.getAccountingFilterDefinition().getChartType()) {
|
||||
case Basic:
|
||||
serieServiceDefinition = new SeriesServiceBasic(
|
||||
seriesServiceData);
|
||||
serieServiceDefinition = new SeriesServiceBasic(seriesServiceData);
|
||||
break;
|
||||
case Top:
|
||||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
ArrayList<SeriesServiceDataTop> seriesServiceDataTopList = new ArrayList<>();
|
||||
|
||||
if (accountingFilterTop.getShowOthers()) {
|
||||
for (int i = 0; i < accountingFilterTop.getTopNumber(); i++) {
|
||||
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(seriesRequest
|
||||
.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Start Date not valid!");
|
||||
}
|
||||
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(seriesRequest
|
||||
.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"End Date not valid!");
|
||||
}
|
||||
|
||||
int k = 0;
|
||||
|
||||
switch (seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()) {
|
||||
case DAILY:
|
||||
case HOURLY:
|
||||
case MINUTELY:
|
||||
for (int i = 0; i < 40; i++) {
|
||||
|
||||
SeriesServiceDataTop seriesServiceDataTop1 = new SeriesServiceDataTop(
|
||||
new FilterValue("User" + i),
|
||||
seriesServiceData);
|
||||
seriesServiceDataTopList
|
||||
.add(seriesServiceDataTop1);
|
||||
}
|
||||
break;
|
||||
case MONTHLY:
|
||||
k = 0;
|
||||
while (startCalendar.compareTo(endCalendar) <= 0) {
|
||||
SeriesServiceDataTop seriesServiceDataTop1 = new SeriesServiceDataTop(
|
||||
new FilterValue("User" + k),
|
||||
seriesServiceData);
|
||||
seriesServiceDataTopList
|
||||
.add(seriesServiceDataTop1);
|
||||
startCalendar.add(Calendar.MONTH, 1);
|
||||
k++;
|
||||
}
|
||||
break;
|
||||
case YEARLY:
|
||||
k = 0;
|
||||
while (startCalendar.compareTo(endCalendar) <= 0) {
|
||||
SeriesServiceDataTop seriesServiceDataTop1 = new SeriesServiceDataTop(
|
||||
new FilterValue("User" + k),
|
||||
seriesServiceData);
|
||||
seriesServiceDataTopList
|
||||
.add(seriesServiceDataTop1);
|
||||
startCalendar.add(Calendar.YEAR, 1);
|
||||
k++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < accountingFilterTop
|
||||
.getTopNumber(); 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);
|
||||
}
|
||||
|
||||
serieServiceDefinition = new SeriesServiceTop(
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
serieServiceDefinition = new SeriesServiceTop(accountingFilterTop.getTopNumber(),
|
||||
seriesServiceDataTopList);
|
||||
break;
|
||||
case Context:
|
||||
// AccountingFilterContext accountingFilterContext =
|
||||
// (AccountingFilterContext) seriesRequest
|
||||
// .getAccountingFilterDefinition();
|
||||
ArrayList<SeriesServiceDataContext> seriesServiceDataContextList = new ArrayList<>();
|
||||
ArrayList<String> contexts = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
String scope = new String("VRE " + i);
|
||||
contexts.add(scope);
|
||||
SeriesServiceDataContext seriesServiceDataContext = new SeriesServiceDataContext(
|
||||
scope, seriesServiceData);
|
||||
seriesServiceDataContextList
|
||||
.add(seriesServiceDataContext);
|
||||
}
|
||||
|
||||
Context context = new Context(contexts);
|
||||
serieServiceDefinition = new SeriesServiceContext(
|
||||
context, seriesServiceDataContextList);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -438,34 +276,30 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
break;
|
||||
case SPACE:
|
||||
SeriesSpaceDefinition serieSpaceDefinition = null;
|
||||
if (seriesRequest.getAccountingFilterDefinition()
|
||||
.getChartType() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition().getChartType() != null) {
|
||||
ArrayList<SeriesSpaceData> seriesSpaceData = new ArrayList<>();
|
||||
switch (seriesRequest.getAccountingPeriod().getPeriod()) {
|
||||
case DAILY:
|
||||
case HOURLY:
|
||||
case MINUTELY:
|
||||
for (int i = 0; i < 30; i++) {
|
||||
SeriesSpaceData data = new SeriesSpaceData(
|
||||
new Date(), new Double(
|
||||
10000 * Math.random()).longValue());
|
||||
SeriesSpaceData data = new SeriesSpaceData(new Date(),
|
||||
new Double(10000 * Math.random()).longValue());
|
||||
seriesSpaceData.add(data);
|
||||
}
|
||||
break;
|
||||
case MONTHLY:
|
||||
while (startCalendar.compareTo(endCalendar) <= 0) {
|
||||
SeriesSpaceData data = new SeriesSpaceData(
|
||||
startCalendar.getTime(), new Double(
|
||||
10000 * Math.random()).longValue());
|
||||
SeriesSpaceData data = new SeriesSpaceData(startCalendar.getTime(),
|
||||
new Double(10000 * Math.random()).longValue());
|
||||
seriesSpaceData.add(data);
|
||||
startCalendar.add(Calendar.MONTH, 1);
|
||||
}
|
||||
break;
|
||||
case YEARLY:
|
||||
while (startCalendar.compareTo(endCalendar) <= 0) {
|
||||
SeriesSpaceData data = new SeriesSpaceData(
|
||||
startCalendar.getTime(), new Double(
|
||||
10000 * Math.random()).longValue());
|
||||
SeriesSpaceData data = new SeriesSpaceData(startCalendar.getTime(),
|
||||
new Double(10000 * Math.random()).longValue());
|
||||
seriesSpaceData.add(data);
|
||||
startCalendar.add(Calendar.YEAR, 1);
|
||||
}
|
||||
|
@ -475,12 +309,9 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
|
||||
}
|
||||
|
||||
switch (seriesRequest.getAccountingFilterDefinition()
|
||||
.getChartType()) {
|
||||
switch (seriesRequest.getAccountingFilterDefinition().getChartType()) {
|
||||
case Basic:
|
||||
case Top:
|
||||
case Context:
|
||||
break;
|
||||
case Spaces:
|
||||
// AccountingFilterContext accountingFilterContext =
|
||||
// (AccountingFilterContext) seriesRequest
|
||||
|
@ -491,15 +322,13 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
for (int i = 1; i < 3; i++) {
|
||||
String space = new String("Space" + i);
|
||||
spacesList.add(space);
|
||||
SeriesSpaceDataSpaces seriesSpaceDataSpaces = new SeriesSpaceDataSpaces(
|
||||
space, seriesSpaceData);
|
||||
seriesSpaceDataSpacesList
|
||||
.add(seriesSpaceDataSpaces);
|
||||
SeriesSpaceDataSpaces seriesSpaceDataSpaces = new SeriesSpaceDataSpaces(space,
|
||||
seriesSpaceData);
|
||||
seriesSpaceDataSpacesList.add(seriesSpaceDataSpaces);
|
||||
}
|
||||
|
||||
Spaces spaces=new Spaces(spacesList);
|
||||
serieSpaceDefinition = new SeriesSpaceSpaces(
|
||||
spaces, seriesSpaceDataSpacesList);
|
||||
Spaces spaces = new Spaces(spacesList);
|
||||
serieSpaceDefinition = new SeriesSpaceSpaces(spaces, seriesSpaceDataSpacesList);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -513,17 +342,14 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
|
||||
case STORAGE:
|
||||
SeriesStorageDefinition serieStorageDefinition = null;
|
||||
if (seriesRequest.getAccountingFilterDefinition()
|
||||
.getChartType() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition().getChartType() != null) {
|
||||
ArrayList<SeriesStorageData> seriesStorageData = new ArrayList<>();
|
||||
for (int i = 0; i < 30; i++) {
|
||||
|
||||
// Valori variabili
|
||||
SeriesStorageData data = new SeriesStorageData(
|
||||
new Date(),
|
||||
new Double(1024 * 1024 * Math.random())
|
||||
.longValue(), new Double(
|
||||
100 * Math.random()).longValue());
|
||||
SeriesStorageData data = new SeriesStorageData(new Date(),
|
||||
new Double(1024 * 1024 * Math.random()).longValue(),
|
||||
new Double(100 * Math.random()).longValue());
|
||||
|
||||
// Valori Fissi
|
||||
/*
|
||||
|
@ -535,68 +361,29 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
|||
seriesStorageData.add(data);
|
||||
|
||||
}
|
||||
switch (seriesRequest.getAccountingFilterDefinition()
|
||||
.getChartType()) {
|
||||
switch (seriesRequest.getAccountingFilterDefinition().getChartType()) {
|
||||
case Basic:
|
||||
for (SeriesStorageData serieStorageData : seriesStorageData) {
|
||||
serieStorageData.setDataVolume(serieStorageData
|
||||
.getDataVolume() * 1000);
|
||||
serieStorageData.setOperationCount(serieStorageData
|
||||
.getOperationCount() * 1000);
|
||||
serieStorageData.setDataVolume(serieStorageData.getDataVolume() * 1000);
|
||||
serieStorageData.setOperationCount(serieStorageData.getOperationCount() * 1000);
|
||||
}
|
||||
|
||||
serieStorageDefinition = new SeriesStorageBasic(
|
||||
seriesStorageData);
|
||||
serieStorageDefinition = new SeriesStorageBasic(seriesStorageData);
|
||||
break;
|
||||
case Top:
|
||||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
ArrayList<SeriesStorageDataTop> seriesStorageDataTopList = new ArrayList<>();
|
||||
if (accountingFilterTop.getShowOthers()) {
|
||||
for (int i = 0; i < 1000; 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);
|
||||
}
|
||||
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(),
|
||||
|
||||
serieStorageDefinition = new SeriesStorageTop(accountingFilterTop.getTopNumber(),
|
||||
seriesStorageDataTopList);
|
||||
break;
|
||||
case Context:
|
||||
// AccountingFilterContext accountingFilterContext =
|
||||
// (AccountingFilterContext) seriesRequest
|
||||
// .getAccountingFilterDefinition();
|
||||
ArrayList<SeriesStorageDataContext> seriesStorageDataContextList = new ArrayList<>();
|
||||
ArrayList<String> contexts = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
String scope = new String("VRE " + i);
|
||||
contexts.add(scope);
|
||||
SeriesStorageDataContext seriesStorageDataContext = new SeriesStorageDataContext(
|
||||
scope, seriesStorageData);
|
||||
seriesStorageDataContextList
|
||||
.add(seriesStorageDataContext);
|
||||
}
|
||||
|
||||
Context context = new Context(contexts);
|
||||
serieStorageDefinition = new SeriesStorageContext(
|
||||
context, seriesStorageDataContextList);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
|
||||
|
@ -43,27 +44,31 @@ public class AccountingCommandBasic implements AccountingCommand<SeriesResponse>
|
|||
public SeriesResponse execute() throws ServiceException {
|
||||
try {
|
||||
|
||||
if (accountingQueryBasic.getScope() != null && !accountingQueryBasic.getScope().isEmpty()) {
|
||||
AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryBasic.getScope());
|
||||
}
|
||||
//if (accountingQueryBasic.getScope() != null) {
|
||||
// AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryBasic.getScope());
|
||||
//}
|
||||
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||
|
||||
SortedMap<Calendar, Info> sm = null;
|
||||
if (accountingQueryBasic.isNoContext()) {
|
||||
logger.debug("Execute NoContextTimeSeries()");
|
||||
sm = apq.getNoContextTimeSeries(accountingQueryBasic.getType(),
|
||||
accountingQueryBasic.getTemporalConstraint(), accountingQueryBasic.getFilters(), true);
|
||||
} else {
|
||||
logger.debug("Execute TimeSeries()");
|
||||
sm = apq.getTimeSeries(accountingQueryBasic.getType(), accountingQueryBasic.getTemporalConstraint(),
|
||||
accountingQueryBasic.getFilters(), true);
|
||||
|
||||
logger.debug("Execute Basic()");
|
||||
apq.setRequestedRecords(accountingQueryBasic.getType());
|
||||
HashSet<String> ctx=null;
|
||||
if(accountingQueryBasic.getContext()!=null&&accountingQueryBasic.getContext().getContexts()!=null
|
||||
&&!accountingQueryBasic.getContext().getContexts().isEmpty()){
|
||||
ctx=new HashSet<String>(accountingQueryBasic.getContext().getContexts());
|
||||
}
|
||||
apq.setContexts(ctx);
|
||||
apq.setTemporalConstraint(accountingQueryBasic.getTemporalConstraint());
|
||||
apq.setFilters(accountingQueryBasic.getFilters());
|
||||
sm=apq.getTimeSeries(true);
|
||||
|
||||
//sm = apq.getTimeSeries(accountingQueryBasic.getType(), accountingQueryBasic.getTemporalConstraint(),
|
||||
// accountingQueryBasic.getFilters(), true);
|
||||
|
||||
if (accountingQueryBasic.getScope() != null && !accountingQueryBasic.getScope().isEmpty()) {
|
||||
AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
||||
}
|
||||
//if (accountingQueryBasic.getScope() != null) {
|
||||
// AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
||||
//}
|
||||
|
||||
if (sm == null || sm.values() == null) {
|
||||
throw new ServiceException("Error retrieving info: sorted map is null!");
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4JobContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4PortletContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4ServiceContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4StorageContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponse4TaskContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponseBuilder;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.response.SeriesResponseDirector;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingCommandContext implements AccountingCommand<SeriesResponse> {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(AccountingCommandContext.class);
|
||||
|
||||
private AccountingQueryContext accountingQueryContext;
|
||||
private AccountingType accountingType;
|
||||
|
||||
public AccountingCommandContext(AccountingQueryContext accountingQueryContext,
|
||||
AccountingType accountingType) {
|
||||
this.accountingQueryContext = accountingQueryContext;
|
||||
this.accountingType = accountingType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SeriesResponse execute() throws ServiceException {
|
||||
try {
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||
.getInstance();
|
||||
|
||||
logger.debug("Query Context: "
|
||||
+ accountingQueryContext.getContext());
|
||||
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
Context context=accountingQueryContext.getContext();
|
||||
|
||||
if(context==null){
|
||||
throw new ServiceException(
|
||||
"Error retrieving context param: null!");
|
||||
}
|
||||
|
||||
contextSM= apq.getContextTimeSeries(accountingQueryContext.getType(),
|
||||
accountingQueryContext.getTemporalConstraint(),
|
||||
accountingQueryContext.getFilters(),
|
||||
context.getContexts(),
|
||||
true);
|
||||
|
||||
|
||||
if (contextSM == null) {
|
||||
throw new ServiceException(
|
||||
"Error retrieving info for context: sorted map is null!");
|
||||
}
|
||||
|
||||
logger.debug("ContextSM: " + contextSM);
|
||||
|
||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
||||
accountingType, context, contextSM);
|
||||
|
||||
SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector();
|
||||
seriesResponseDirector
|
||||
.setSeriesResponseBuilder(seriesResponseBuilder);
|
||||
seriesResponseDirector.constructSeriesResponse();
|
||||
SeriesResponse seriesResponse = seriesResponseDirector
|
||||
.getSeriesResponse();
|
||||
|
||||
if (seriesResponse == null) {
|
||||
throw new ServiceException("Error creating series response!");
|
||||
}
|
||||
logger.debug("SeriesResponse Created: " + seriesResponse);
|
||||
return seriesResponse;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error in AccountingCommandTop(): "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("No data available!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private SeriesResponseBuilder getSeriesResponseBuilder(
|
||||
AccountingType accountingType, Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM)
|
||||
throws ServiceException {
|
||||
if (accountingType == null) {
|
||||
throw new ServiceException("Error accounting type is null");
|
||||
}
|
||||
|
||||
switch (accountingType) {
|
||||
case JOB:
|
||||
return new SeriesResponse4JobContext(context,contextSM);
|
||||
case PORTLET:
|
||||
return new SeriesResponse4PortletContext(context, contextSM);
|
||||
case SERVICE:
|
||||
return new SeriesResponse4ServiceContext(context, contextSM);
|
||||
case STORAGE:
|
||||
return new SeriesResponse4StorageContext(context, contextSM);
|
||||
case TASK:
|
||||
return new SeriesResponse4TaskContext(context, contextSM);
|
||||
default:
|
||||
throw new ServiceException("Error request type is unknow!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -27,19 +27,16 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingCommandGetFilterValues implements
|
||||
AccountingCommand<FilterValuesResponse> {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(AccountingCommandGetFilterValues.class);
|
||||
public class AccountingCommandGetFilterValues implements AccountingCommand<FilterValuesResponse> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AccountingCommandGetFilterValues.class);
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMMMM dd");
|
||||
private FilterValuesRequest filterValuesRequest;
|
||||
|
||||
public AccountingCommandGetFilterValues(
|
||||
FilterValuesRequest filterValuesRequest) {
|
||||
public AccountingCommandGetFilterValues(FilterValuesRequest filterValuesRequest) {
|
||||
this.filterValuesRequest = filterValuesRequest;
|
||||
|
||||
}
|
||||
|
@ -47,14 +44,11 @@ public class AccountingCommandGetFilterValues implements
|
|||
@Override
|
||||
public FilterValuesResponse execute() throws ServiceException {
|
||||
try {
|
||||
logger.debug("getFilterValue(): [FilterValueRequest="
|
||||
+ filterValuesRequest + "]");
|
||||
logger.debug("getFilterValue(): [FilterValueRequest=" + filterValuesRequest + "]");
|
||||
FilterValuesResponse filterValuesResponse = null;
|
||||
if (filterValuesRequest == null
|
||||
|| filterValuesRequest.getAccountingType() == null
|
||||
if (filterValuesRequest == null || filterValuesRequest.getAccountingType() == null
|
||||
|| filterValuesRequest.getFilterKey() == null) {
|
||||
filterValuesResponse = new FilterValuesResponse(
|
||||
new ArrayList<FilterValue>());
|
||||
filterValuesResponse = new FilterValuesResponse(new ArrayList<FilterValue>());
|
||||
return filterValuesResponse;
|
||||
}
|
||||
|
||||
|
@ -62,24 +56,19 @@ public class AccountingCommandGetFilterValues implements
|
|||
|
||||
Set<NumberedFilter> values;
|
||||
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||
.getInstance();
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||
|
||||
Calendar startCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(filterValuesRequest
|
||||
.getAccountingPeriod().getStartDate()));
|
||||
startCalendar.setTime(sdf.parse(filterValuesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Start Date not valid!");
|
||||
}
|
||||
|
||||
Calendar endCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(filterValuesRequest
|
||||
.getAccountingPeriod().getEndDate()));
|
||||
endCalendar.setTime(sdf.parse(filterValuesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("End Date not valid!");
|
||||
|
@ -90,19 +79,18 @@ public class AccountingCommandGetFilterValues implements
|
|||
endCalendar.set(GregorianCalendar.SECOND, 59);
|
||||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||
|
||||
TemporalConstraint tc = new TemporalConstraint(
|
||||
startCalendar.getTimeInMillis(),
|
||||
TemporalConstraint tc = new TemporalConstraint(startCalendar.getTimeInMillis(),
|
||||
endCalendar.getTimeInMillis(),
|
||||
PeriodModeMap.getMode(filterValuesRequest
|
||||
.getAccountingPeriod().getPeriod()));
|
||||
PeriodModeMap.getMode(filterValuesRequest.getAccountingPeriod().getPeriod()));
|
||||
|
||||
List<Filter> filters = new ArrayList<>();
|
||||
|
||||
switch (filterValuesRequest.getAccountingType()) {
|
||||
case JOB:
|
||||
values = apq.getFilterValues(AggregatedJobUsageRecord.class,
|
||||
tc, filters, filterValuesRequest.getFilterKey()
|
||||
.getKey());
|
||||
apq.setRequestedRecords(AggregatedJobUsageRecord.class);
|
||||
apq.setTemporalConstraint(tc);
|
||||
apq.setFilters(filters);
|
||||
values = apq.getFilterValues(filterValuesRequest.getFilterKey().getKey());
|
||||
break;
|
||||
case PORTLET:
|
||||
// values = rrq.getPossibleValuesForKey(
|
||||
|
@ -111,14 +99,16 @@ public class AccountingCommandGetFilterValues implements
|
|||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||
return filterValuesResponse;
|
||||
case SERVICE:
|
||||
values = apq.getFilterValues(
|
||||
AggregatedServiceUsageRecord.class, tc, filters,
|
||||
filterValuesRequest.getFilterKey().getKey());
|
||||
apq.setRequestedRecords(AggregatedServiceUsageRecord.class);
|
||||
apq.setTemporalConstraint(tc);
|
||||
apq.setFilters(filters);
|
||||
values = apq.getFilterValues(filterValuesRequest.getFilterKey().getKey());
|
||||
break;
|
||||
case STORAGE:
|
||||
values = apq.getFilterValues(
|
||||
AggregatedStorageUsageRecord.class, tc, filters,
|
||||
filterValuesRequest.getFilterKey().getKey());
|
||||
apq.setRequestedRecords(AggregatedStorageUsageRecord.class);
|
||||
apq.setTemporalConstraint(tc);
|
||||
apq.setFilters(filters);
|
||||
values = apq.getFilterValues(filterValuesRequest.getFilterKey().getKey());
|
||||
break;
|
||||
case TASK:
|
||||
// values = rrq.getPossibleValuesForKey(
|
||||
|
@ -127,9 +117,10 @@ public class AccountingCommandGetFilterValues implements
|
|||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||
return filterValuesResponse;
|
||||
case SPACE:
|
||||
values = apq.getFilterValues(
|
||||
AggregatedStorageStatusRecord.class, tc, filters,
|
||||
filterValuesRequest.getFilterKey().getKey());
|
||||
apq.setRequestedRecords(AggregatedStorageStatusRecord.class);
|
||||
apq.setTemporalConstraint(tc);
|
||||
apq.setFilters(filters);
|
||||
values = apq.getFilterValues(filterValuesRequest.getFilterKey().getKey());
|
||||
break;
|
||||
default:
|
||||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||
|
@ -145,8 +136,7 @@ public class AccountingCommandGetFilterValues implements
|
|||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||
return filterValuesResponse;
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error in AccountingCommandGetFilterValues(): "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error in AccountingCommandGetFilterValues(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("No values available!");
|
||||
|
||||
|
|
|
@ -3,8 +3,10 @@ package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
|||
import java.util.ArrayList;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageStatusRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Spaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -26,10 +28,14 @@ public class AccountingCommandGetSpaces implements AccountingCommand<Spaces> {
|
|||
public Spaces execute() throws ServiceException {
|
||||
try {
|
||||
logger.debug("getSpaces()");
|
||||
SortedSet<String> keys = null;
|
||||
SortedSet<NumberedFilter> keys = null;
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||
|
||||
keys = apq.getSpaceProvidersIds();
|
||||
|
||||
//TODO the library must implement this interface
|
||||
keys = apq.getFilterValues(AggregatedStorageStatusRecord.DATA_TYPE);
|
||||
|
||||
|
||||
//keys = apq.getSpaceProvidersIds();
|
||||
|
||||
logger.debug("AccountingPersistenceQuery.getSpaces: " + keys);
|
||||
ArrayList<String> spaceList = new ArrayList<>();
|
||||
|
@ -37,9 +43,9 @@ public class AccountingCommandGetSpaces implements AccountingCommand<Spaces> {
|
|||
if (keys == null || keys.isEmpty()) {
|
||||
logger.error("Spaces have not keys: {}", keys);
|
||||
} else {
|
||||
for (String key : keys) {
|
||||
if (key != null && !key.isEmpty()) {
|
||||
spaceList.add(key);
|
||||
for (NumberedFilter key : keys) {
|
||||
if (key != null ) {
|
||||
spaceList.add(key.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuerySpaces;
|
||||
|
@ -46,7 +48,7 @@ public class AccountingCommandSpaces implements
|
|||
|
||||
logger.debug("Query Spaces: " + accountingQuerySpaces.getSpaces());
|
||||
|
||||
SortedMap<Filter, SortedMap<Calendar, Long>> spaceSM;
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> spaceSM;
|
||||
|
||||
Spaces spaces = accountingQuerySpaces.getSpaces();
|
||||
|
||||
|
@ -54,10 +56,16 @@ public class AccountingCommandSpaces implements
|
|||
throw new ServiceException(
|
||||
"Error retrieving Spaces param: null!");
|
||||
}
|
||||
|
||||
spaceSM = apq.getSpaceTimeSeries(accountingQuerySpaces.getType(),
|
||||
accountingQuerySpaces.getTemporalConstraint(),
|
||||
accountingQuerySpaces.getFilters(), spaces.getSpacesList());
|
||||
|
||||
apq.setRequestedRecords(accountingQuerySpaces.getType());
|
||||
apq.setTemporalConstraint(accountingQuerySpaces.getTemporalConstraint());
|
||||
apq.setFilters(accountingQuerySpaces.getFilters());
|
||||
spaceSM = apq.getSpaceTimeSeries(new HashSet<String>(spaces.getSpacesList()));
|
||||
|
||||
|
||||
//spaceSM = apq.getSpaceTimeSeries(accountingQuerySpaces.getType(),
|
||||
// accountingQuerySpaces.getTemporalConstraint(),
|
||||
// accountingQuerySpaces.getFilters(), spaces.getSpacesList());
|
||||
|
||||
if (spaceSM == null) {
|
||||
throw new ServiceException(
|
||||
|
@ -93,7 +101,7 @@ public class AccountingCommandSpaces implements
|
|||
|
||||
private SeriesResponseBuilder getSeriesResponseBuilder(
|
||||
AccountingType accountingType, Spaces spaces,
|
||||
SortedMap<Filter, SortedMap<Calendar, Long>> spaceSM)
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> spaceSM)
|
||||
throws ServiceException {
|
||||
if (accountingType == null) {
|
||||
throw new ServiceException("Error accounting type is null");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
|
@ -42,9 +43,10 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
public SeriesResponse execute() throws ServiceException {
|
||||
try {
|
||||
|
||||
if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
|
||||
AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryTop.getScope());
|
||||
}
|
||||
// if (accountingQueryTop.getScope() != null &&
|
||||
// !accountingQueryTop.getScope().isEmpty()) {
|
||||
// AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryTop.getScope());
|
||||
// }
|
||||
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||
|
||||
|
@ -52,18 +54,25 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
|
||||
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());
|
||||
}
|
||||
logger.debug("Execute Top()");
|
||||
apq.setRequestedRecords(accountingQueryTop.getType());
|
||||
|
||||
if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
|
||||
AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
||||
HashSet<String> ctx = null;
|
||||
if (accountingQueryTop.getContext() != null && accountingQueryTop.getContext().getContexts() != null
|
||||
&& !accountingQueryTop.getContext().getContexts().isEmpty()) {
|
||||
ctx = new HashSet<String>(accountingQueryTop.getContext().getContexts());
|
||||
}
|
||||
apq.setContexts(ctx);
|
||||
apq.setTemporalConstraint(accountingQueryTop.getTemporalConstraint());
|
||||
apq.setFilters(accountingQueryTop.getFilters());
|
||||
|
||||
topSM = apq.getTopValues(accountingQueryTop.getFilterKey().getKey(), null, true,
|
||||
accountingQueryTop.getTopNumber());
|
||||
|
||||
// if (accountingQueryTop.getScope() != null &&
|
||||
// !accountingQueryTop.getScope().isEmpty()) {
|
||||
// AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
||||
// }
|
||||
|
||||
if (topSM == null) {
|
||||
throw new ServiceException("Error retrieving info for top: sorted map is null!");
|
||||
|
@ -100,20 +109,15 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
|
||||
switch (accountingType) {
|
||||
case JOB:
|
||||
return new SeriesResponse4JobTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
return new SeriesResponse4JobTop(accountingQueryTop.getTopNumber(), topSM);
|
||||
case PORTLET:
|
||||
return new SeriesResponse4PortletTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
return new SeriesResponse4PortletTop(accountingQueryTop.getTopNumber(), topSM);
|
||||
case SERVICE:
|
||||
return new SeriesResponse4ServiceTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
return new SeriesResponse4ServiceTop(accountingQueryTop.getTopNumber(), topSM);
|
||||
case STORAGE:
|
||||
return new SeriesResponse4StorageTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
return new SeriesResponse4StorageTop(accountingQueryTop.getTopNumber(), topSM);
|
||||
case TASK:
|
||||
return new SeriesResponse4TaskTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
return new SeriesResponse4TaskTop(accountingQueryTop.getTopNumber(), topSM);
|
||||
default:
|
||||
throw new ServiceException("Error request type is unknow!");
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -77,8 +76,8 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryBasic(AggregatedJobUsageRecord.class, accountingFilterBasic.getScope(),
|
||||
accountingFilterBasic.isNoContext(), temporalConstraint, filters);
|
||||
invocation = new AccountingQueryBasic(AggregatedJobUsageRecord.class,
|
||||
accountingFilterBasic.getContext(), temporalConstraint, filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
|
@ -93,28 +92,12 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryTop(AggregatedJobUsageRecord.class, accountingFilterTop.getScope(),
|
||||
accountingFilterTop.getFilterKey(), accountingFilterTop.getShowOthers(),
|
||||
invocation = new AccountingQueryTop(AggregatedJobUsageRecord.class, accountingFilterTop.getContext(),
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getTopNumber(), temporalConstraint, filters);
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(AggregatedJobUsageRecord.class,
|
||||
accountingFilterContext.getContext(), temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedPortletUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -77,8 +76,7 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
}
|
||||
}
|
||||
invocation = new AccountingQueryBasic(AggregatedPortletUsageRecord.class,
|
||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
||||
filters);
|
||||
accountingFilterBasic.getContext(), temporalConstraint, filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
|
@ -94,28 +92,11 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
}
|
||||
}
|
||||
invocation = new AccountingQueryTop(AggregatedPortletUsageRecord.class,
|
||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||
filters);
|
||||
accountingFilterTop.getContext(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getTopNumber(), temporalConstraint, filters);
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(AggregatedPortletUsageRecord.class,
|
||||
accountingFilterContext.getContext(), temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -78,8 +77,7 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
}
|
||||
}
|
||||
invocation = new AccountingQueryBasic(AggregatedServiceUsageRecord.class,
|
||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
||||
filters);
|
||||
accountingFilterBasic.getContext(), temporalConstraint, filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
|
@ -95,28 +93,11 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
}
|
||||
}
|
||||
invocation = new AccountingQueryTop(AggregatedServiceUsageRecord.class,
|
||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||
filters);
|
||||
accountingFilterTop.getContext(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getTopNumber(), temporalConstraint, filters);
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(AggregatedServiceUsageRecord.class,
|
||||
accountingFilterContext.getContext(), temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException("Invalid Request!");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -78,8 +77,7 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
}
|
||||
}
|
||||
invocation = new AccountingQueryBasic(AggregatedStorageUsageRecord.class,
|
||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
||||
filters);
|
||||
accountingFilterBasic.getContext(), temporalConstraint, filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
|
@ -95,28 +93,11 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
}
|
||||
}
|
||||
invocation = new AccountingQueryTop(AggregatedStorageUsageRecord.class,
|
||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||
filters);
|
||||
accountingFilterTop.getContext(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getTopNumber(), temporalConstraint, filters);
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(AggregatedStorageUsageRecord.class,
|
||||
accountingFilterContext.getContext(), temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,11 +7,9 @@ import java.util.GregorianCalendar;
|
|||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
//import org.gcube.accounting.datamodel.aggregation.AggregatedTaskUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
|
@ -21,13 +19,12 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Accounting Query 4 Task
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingQuery4Task extends AccountingQueryBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingQuery4Task.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Task.class);
|
||||
private SeriesRequest seriesRequest;
|
||||
|
||||
public AccountingQuery4Task(SeriesRequest seriesRequest) {
|
||||
|
@ -36,21 +33,17 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
|||
|
||||
@Override
|
||||
public void buildOpEx() throws ServiceException {
|
||||
Calendar startCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Start Date not valid!");
|
||||
}
|
||||
|
||||
Calendar endCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("End Date not valid!");
|
||||
|
@ -62,17 +55,14 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
|||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||
startCalendar.getTimeInMillis(), endCalendar.getTimeInMillis(),
|
||||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()));
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(startCalendar.getTimeInMillis(),
|
||||
endCalendar.getTimeInMillis(), PeriodModeMap.getMode(seriesRequest.getAccountingPeriod().getPeriod()));
|
||||
|
||||
ArrayList<Filter> filters = null;
|
||||
ArrayList<AccountingFilter> accountingFilters = null;
|
||||
AccountingQuery invocation = null;
|
||||
|
||||
if (seriesRequest != null
|
||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest != null && seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterBasic) {
|
||||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
|
@ -80,16 +70,16 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
/*invocation = new AccountingQueryBasic(
|
||||
AggregatedTaskUsageRecord.class, temporalConstraint,
|
||||
filters, accountingFilterBasic.isNoContext());
|
||||
*/
|
||||
/*
|
||||
* invocation = new AccountingQueryBasic(
|
||||
* AggregatedTaskUsageRecord.class, temporalConstraint, filters,
|
||||
* accountingFilterBasic.isNoContext());
|
||||
*/
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
||||
|
@ -98,42 +88,22 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
/*invocation = new AccountingQueryTop(
|
||||
AggregatedTaskUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);*/
|
||||
/*
|
||||
* invocation = new AccountingQueryTop(
|
||||
* AggregatedTaskUsageRecord.class,
|
||||
* accountingFilterTop.getFilterKey(),
|
||||
* accountingFilterTop.getShowOthers(),
|
||||
* accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||
* filters);
|
||||
*/
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
accountingFilters = accountingFilterContext.getFilters();
|
||||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
/*invocation = new AccountingQueryContext(
|
||||
AggregatedTaskUsageRecord.class,
|
||||
accountingFilterContext.getContext(),
|
||||
temporalConstraint,
|
||||
filters);*/
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
}
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.gcube.accounting.analytics.Filter;
|
|||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -15,20 +16,18 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
|||
*/
|
||||
public class AccountingQueryBasic extends AccountingQuery {
|
||||
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
||||
private String scope;
|
||||
private boolean noContext;
|
||||
private Context context;
|
||||
private TemporalConstraint temporalConstraint;
|
||||
private ArrayList<Filter> filters;
|
||||
|
||||
public AccountingQueryBasic(Class<? extends AggregatedUsageRecord<?, ?>> type, String scope, boolean noContext,
|
||||
public AccountingQueryBasic(Class<? extends AggregatedUsageRecord<?, ?>> type, Context context,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Basic;
|
||||
this.type = type;
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
this.scope = scope;
|
||||
this.context = context;
|
||||
this.filters = filters;
|
||||
this.noContext = noContext;
|
||||
}
|
||||
|
||||
public Class<? extends AggregatedUsageRecord<?, ?>> getType() {
|
||||
|
@ -47,12 +46,13 @@ public class AccountingQueryBasic extends AccountingQuery {
|
|||
this.temporalConstraint = temporalConstraint;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<Filter> getFilters() {
|
||||
|
@ -63,18 +63,10 @@ public class AccountingQueryBasic extends AccountingQuery {
|
|||
this.filters = filters;
|
||||
}
|
||||
|
||||
public boolean isNoContext() {
|
||||
return noContext;
|
||||
}
|
||||
|
||||
public void setNoContext(boolean noContext) {
|
||||
this.noContext = noContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQueryBasic [type=" + type + ", temporalConstraint=" + temporalConstraint + ", scope=" + scope
|
||||
+ ", filters=" + filters + ", noContext=" + noContext + "]";
|
||||
return "AccountingQueryBasic [type=" + type + ", context=" + context + ", temporalConstraint="
|
||||
+ temporalConstraint + ", filters=" + filters + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingQueryContext extends AccountingQuery {
|
||||
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
||||
private Context context;
|
||||
private TemporalConstraint temporalConstraint;
|
||||
private ArrayList<Filter> filters;
|
||||
|
||||
public AccountingQueryContext(Class<? extends AggregatedUsageRecord<?, ?>> type, Context context,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Context;
|
||||
this.type = type;
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
this.filters = filters;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public Class<? extends AggregatedUsageRecord<?, ?>> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Class<? extends AggregatedUsageRecord<?, ?>> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public TemporalConstraint getTemporalConstraint() {
|
||||
return temporalConstraint;
|
||||
}
|
||||
|
||||
public void setTemporalConstraint(TemporalConstraint temporalConstraint) {
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
}
|
||||
|
||||
public ArrayList<Filter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(ArrayList<Filter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQueryContext [type=" + type + ", context=" + context + ", temporalConstraint="
|
||||
+ temporalConstraint + ", filters=" + filters + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,7 @@ import org.gcube.accounting.analytics.Filter;
|
|||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||
|
||||
/**
|
||||
|
@ -16,23 +17,21 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
|||
*/
|
||||
public class AccountingQueryTop extends AccountingQuery {
|
||||
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
||||
private String scope;
|
||||
private Context context;
|
||||
private FilterKey filterKey;
|
||||
private Integer topNumber;
|
||||
private Boolean showOthers;
|
||||
private TemporalConstraint temporalConstraint;
|
||||
private ArrayList<Filter> filters;
|
||||
|
||||
public AccountingQueryTop(Class<? extends AggregatedUsageRecord<?, ?>> type, String scope, FilterKey filterKey,
|
||||
Boolean showOthers, Integer topNumber, TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
public AccountingQueryTop(Class<? extends AggregatedUsageRecord<?, ?>> type, Context context, FilterKey filterKey,
|
||||
Integer topNumber, TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Top;
|
||||
this.type = type;
|
||||
this.scope = scope;
|
||||
this.context = context;
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
this.filters = filters;
|
||||
this.filterKey = filterKey;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
}
|
||||
|
||||
|
@ -44,12 +43,12 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public TemporalConstraint getTemporalConstraint() {
|
||||
|
@ -76,14 +75,6 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
this.filterKey = filterKey;
|
||||
}
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
}
|
||||
|
@ -94,9 +85,9 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQueryTop [type=" + type + ", scope=" + scope + ", filterKey=" + filterKey + ", topNumber="
|
||||
+ topNumber + ", showOthers=" + showOthers + ", temporalConstraint=" + temporalConstraint + ", filters="
|
||||
+ filters + "]";
|
||||
return "AccountingQueryTop [type=" + type + ", context=" + context + ", filterKey=" + filterKey + ", topNumber="
|
||||
+ topNumber + ", temporalConstraint=" + temporalConstraint + ", filters=" + filters + ", chartType="
|
||||
+ chartType + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
|||
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -39,14 +39,15 @@ public class SeriesResponse4JobBasic extends SeriesResponseBuilder {
|
|||
|
||||
ArrayList<SeriesJobData> series = new ArrayList<SeriesJobData>();
|
||||
for (Info info : infos) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long duration = jso.getLong(AggregatedJobUsageRecord.DURATION);
|
||||
JsonNode jso = info.getValue();
|
||||
|
||||
Long duration = jso.get(AggregatedJobUsageRecord.DURATION).asLong();
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedJobUsageRecord.OPERATION_COUNT);
|
||||
.get(AggregatedJobUsageRecord.OPERATION_COUNT).asLong();
|
||||
Long maxInvocationTime = jso
|
||||
.getLong(AggregatedJobUsageRecord.MAX_INVOCATION_TIME);
|
||||
.get(AggregatedJobUsageRecord.MAX_INVOCATION_TIME).asLong();
|
||||
Long minInvocationTime = jso
|
||||
.getLong(AggregatedJobUsageRecord.MIN_INVOCATION_TIME);
|
||||
.get(AggregatedJobUsageRecord.MIN_INVOCATION_TIME).asLong();
|
||||
|
||||
series.add(new SeriesJobData(info.getCalendar().getTime(),
|
||||
operationCount, duration, maxInvocationTime,
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Job
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4JobContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4JobContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4JobContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context=context;
|
||||
this.contextSM = contextSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for job accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesJobDataContext> seriesJobDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesJobData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long duration = jso
|
||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
||||
Long maxInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||
Long minInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
series.add(new SeriesJobData(info.getCalendar().getTime(),
|
||||
operationCount, duration, maxInvocationTime,
|
||||
minInvocationTime));
|
||||
|
||||
}
|
||||
SeriesJobDataContext seriesJobDataContext = new SeriesJobDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesJobDataContextList.add(seriesJobDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesJobContext seriesJobContext = new SeriesJobContext(context,
|
||||
seriesJobDataContextList);
|
||||
SeriesJob seriesService = new SeriesJob(seriesJobContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesService);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for job accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for job accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -7,13 +7,13 @@ import java.util.SortedMap;
|
|||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -27,13 +27,11 @@ 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(Boolean showOthers, Integer topNumber,
|
||||
public SeriesResponse4JobTop(Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
}
|
||||
|
@ -55,15 +53,15 @@ public class SeriesResponse4JobTop extends SeriesResponseBuilder {
|
|||
ArrayList<SeriesJobData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
JsonNode jso = info.getValue();
|
||||
Long duration = jso
|
||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
||||
.get(AggregatedServiceUsageRecord.DURATION).asLong();
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
||||
.get(AggregatedServiceUsageRecord.OPERATION_COUNT).asLong();
|
||||
Long maxInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||
.get(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME).asLong();
|
||||
Long minInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||
.get(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME).asLong();
|
||||
|
||||
series.add(new SeriesJobData(info.getCalendar()
|
||||
.getTime(), operationCount, duration,
|
||||
|
@ -76,7 +74,7 @@ public class SeriesResponse4JobTop extends SeriesResponseBuilder {
|
|||
|
||||
}
|
||||
|
||||
SeriesJobTop seriesJobTop = new SeriesJobTop(showOthers,topNumber,
|
||||
SeriesJobTop seriesJobTop = new SeriesJobTop(topNumber,
|
||||
seriesJobDataTopList);
|
||||
SeriesJob seriesService = new SeriesJob(seriesJobTop);
|
||||
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedPortletUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesPortlet;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Portlet
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4PortletContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4PortletContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4PortletContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context = context;
|
||||
this.contextSM = contextSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for portlet accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesPortletDataContext> seriesPortletDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesPortletData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
// Long duration =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedPortletUsageRecord.OPERATION_COUNT);
|
||||
// Long maxInvocationTime =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.MAX_INVOCATION_TIME);
|
||||
// Long minInvocationTime =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
series.add(new SeriesPortletData(info.getCalendar()
|
||||
.getTime(), operationCount));
|
||||
}
|
||||
SeriesPortletDataContext seriesPortletDataContext = new SeriesPortletDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesPortletDataContextList.add(seriesPortletDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesPortletContext seriesPortletContext = new SeriesPortletContext(
|
||||
context, seriesPortletDataContextList);
|
||||
SeriesPortlet seriesPortlet = new SeriesPortlet(
|
||||
seriesPortletContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesPortlet);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for portlet accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for portlet accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,13 +7,13 @@ import java.util.SortedMap;
|
|||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedPortletUsageRecord;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesPortlet;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -27,13 +27,11 @@ 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(Boolean showOthers, Integer topNumber,
|
||||
public SeriesResponse4PortletTop(Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
}
|
||||
|
@ -53,11 +51,11 @@ public class SeriesResponse4PortletTop extends SeriesResponseBuilder {
|
|||
ArrayList<SeriesPortletData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
JsonNode jso = info.getValue();
|
||||
// Long duration =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedPortletUsageRecord.OPERATION_COUNT);
|
||||
.get(AggregatedPortletUsageRecord.OPERATION_COUNT).asLong();
|
||||
// Long maxInvocationTime =
|
||||
// jso.getLong(AggregatedPortletUsageRecord.MAX_INVOCATION_TIME);
|
||||
// Long minInvocationTime =
|
||||
|
@ -72,8 +70,7 @@ public class SeriesResponse4PortletTop extends SeriesResponseBuilder {
|
|||
|
||||
}
|
||||
|
||||
SeriesPortletTop seriesPortletTop = new SeriesPortletTop(
|
||||
showOthers, topNumber, seriesPortletDataTopList);
|
||||
SeriesPortletTop seriesPortletTop = new SeriesPortletTop(topNumber, seriesPortletDataTopList);
|
||||
SeriesPortlet seriesPortlet = new SeriesPortlet(seriesPortletTop);
|
||||
|
||||
seriesResponseSpec.setSr(seriesPortlet);
|
||||
|
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
|||
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -39,15 +39,15 @@ public class SeriesResponse4ServiceBasic extends SeriesResponseBuilder {
|
|||
|
||||
ArrayList<SeriesServiceData> series = new ArrayList<SeriesServiceData>();
|
||||
for (Info info : infos) {
|
||||
JSONObject jso = info.getValue();
|
||||
JsonNode jso = info.getValue();
|
||||
Long duration = jso
|
||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
||||
.get(AggregatedServiceUsageRecord.DURATION).asLong();
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
||||
.get(AggregatedServiceUsageRecord.OPERATION_COUNT).asLong();
|
||||
Long maxInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||
.get(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME).asLong();
|
||||
Long minInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||
.get(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME).asLong();
|
||||
|
||||
series.add(new SeriesServiceData(info.getCalendar().getTime(),
|
||||
operationCount, duration, maxInvocationTime,
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Service
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4ServiceContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4ServiceContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4ServiceContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context = context;
|
||||
this.contextSM = contextSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for service accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesServiceDataContext> seriesServiceDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesServiceData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long duration = jso
|
||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
||||
Long maxInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||
Long minInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
series.add(new SeriesServiceData(info.getCalendar()
|
||||
.getTime(), operationCount, duration,
|
||||
maxInvocationTime, minInvocationTime));
|
||||
|
||||
}
|
||||
SeriesServiceDataContext seriesServiceDataContext = new SeriesServiceDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesServiceDataContextList.add(seriesServiceDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesServiceContext seriesServiceContext = new SeriesServiceContext(context,
|
||||
seriesServiceDataContextList);
|
||||
SeriesService seriesService = new SeriesService(
|
||||
seriesServiceContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesService);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for service accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for service accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -7,33 +7,29 @@ import java.util.SortedMap;
|
|||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Top Series Response 4 Service
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4ServiceTop extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4ServiceTop.class);
|
||||
private Boolean showOthers;
|
||||
protected static Logger logger = LoggerFactory.getLogger(SeriesResponse4ServiceTop.class);
|
||||
private Integer topNumber;
|
||||
private SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
public SeriesResponse4ServiceTop(Boolean showOthers, Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
public SeriesResponse4ServiceTop(Integer topNumber, SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
}
|
||||
|
@ -53,18 +49,13 @@ public class SeriesResponse4ServiceTop extends SeriesResponseBuilder {
|
|||
ArrayList<SeriesServiceData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long duration = jso
|
||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
||||
Long maxInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
||||
Long minInvocationTime = jso
|
||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
||||
JsonNode jso = info.getValue();
|
||||
Long duration = jso.get(AggregatedServiceUsageRecord.DURATION).asLong();
|
||||
Long operationCount = jso.get(AggregatedServiceUsageRecord.OPERATION_COUNT).asLong();
|
||||
Long maxInvocationTime = jso.get(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME).asLong();
|
||||
Long minInvocationTime = jso.get(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME).asLong();
|
||||
|
||||
series.add(new SeriesServiceData(info.getCalendar()
|
||||
.getTime(), operationCount, duration,
|
||||
series.add(new SeriesServiceData(info.getCalendar().getTime(), operationCount, duration,
|
||||
maxInvocationTime, minInvocationTime));
|
||||
|
||||
}
|
||||
|
@ -74,19 +65,16 @@ public class SeriesResponse4ServiceTop extends SeriesResponseBuilder {
|
|||
|
||||
}
|
||||
|
||||
SeriesServiceTop seriesServiceTop = new SeriesServiceTop(
|
||||
showOthers, topNumber, seriesServiceDataTopList);
|
||||
SeriesServiceTop seriesServiceTop = new SeriesServiceTop(topNumber, seriesServiceDataTopList);
|
||||
SeriesService seriesService = new SeriesService(seriesServiceTop);
|
||||
|
||||
seriesResponseSpec.setSr(seriesService);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for service accounting top chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error creating series for service accounting top chart: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for service accounting top chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
"Error creating series for service accounting top chart: " + e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,11 +5,14 @@ import java.util.Calendar;
|
|||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageStatusRecord;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Spaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesSpace;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceDataSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceSpaces;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -25,10 +28,10 @@ public class SeriesResponse4SpaceSpaces extends SeriesResponseBuilder {
|
|||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4SpaceSpaces.class);
|
||||
private Spaces spaces;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Long>> spaceSM;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> spaceSM;
|
||||
|
||||
public SeriesResponse4SpaceSpaces(Spaces spaces,
|
||||
SortedMap<Filter, SortedMap<Calendar, Long>> spaceSM) {
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> spaceSM) {
|
||||
this.spaces = spaces;
|
||||
this.spaceSM = spaceSM;
|
||||
}
|
||||
|
@ -46,11 +49,13 @@ public class SeriesResponse4SpaceSpaces extends SeriesResponseBuilder {
|
|||
for (Filter spaceValue : spaceSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesSpaceData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Long> infos = spaceSM.get(spaceValue);
|
||||
SortedMap<Calendar, Info> infos = spaceSM.get(spaceValue);
|
||||
for (Calendar calendar : infos.keySet()) {
|
||||
Long value = infos.get(calendar);
|
||||
if(value==null){
|
||||
value=0L;
|
||||
Info info = infos.get(calendar);
|
||||
Long value=0L;
|
||||
if(info!=null){
|
||||
JsonNode jso=info.getValue();
|
||||
value=jso.get(AggregatedStorageStatusRecord.DATA_VOLUME).asLong();
|
||||
}
|
||||
series.add(new SeriesSpaceData(calendar.getTime(), value));
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
|||
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -39,10 +39,10 @@ public class SeriesResponse4StorageBasic extends SeriesResponseBuilder {
|
|||
|
||||
ArrayList<SeriesStorageData> series=new ArrayList<SeriesStorageData>();
|
||||
for (Info info : infos) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long dataVolume = jso.getLong(AggregatedStorageUsageRecord.DATA_VOLUME);
|
||||
JsonNode jso = info.getValue();
|
||||
Long dataVolume = jso.get(AggregatedStorageUsageRecord.DATA_VOLUME).asLong();
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedStorageUsageRecord.OPERATION_COUNT);
|
||||
.get(AggregatedStorageUsageRecord.OPERATION_COUNT).asLong();
|
||||
series.add(new SeriesStorageData(info.getCalendar().getTime(), dataVolume, operationCount));
|
||||
|
||||
}
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Storage
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4StorageContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4StorageContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4StorageContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context = context;
|
||||
this.contextSM = contextSM;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for storage accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesStorageDataContext> seriesStorageDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesStorageData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
JSONObject jso = info.getValue();
|
||||
Long dataVolume = jso
|
||||
.getLong(AggregatedStorageUsageRecord.DATA_VOLUME);
|
||||
Long operationCount = jso
|
||||
.getLong(AggregatedStorageUsageRecord.OPERATION_COUNT);
|
||||
series.add(new SeriesStorageData(info.getCalendar()
|
||||
.getTime(), dataVolume, operationCount));
|
||||
|
||||
}
|
||||
SeriesStorageDataContext seriesStorageDataContext = new SeriesStorageDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesStorageDataContextList.add(seriesStorageDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesStorageContext seriesStorageContext = new SeriesStorageContext(
|
||||
context, seriesStorageDataContextList);
|
||||
SeriesStorage seriesStorage = new SeriesStorage(
|
||||
seriesStorageContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesStorage);
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for storage accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for storage accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,33 +7,29 @@ import java.util.SortedMap;
|
|||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Top Series Response 4 Storage
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4StorageTop extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4StorageTop.class);
|
||||
private Boolean showOthers;
|
||||
protected static Logger logger = LoggerFactory.getLogger(SeriesResponse4StorageTop.class);
|
||||
private Integer topNumber;
|
||||
private SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
public SeriesResponse4StorageTop(Boolean showOthers, Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
public SeriesResponse4StorageTop(Integer topNumber, SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
|
||||
|
@ -54,13 +50,10 @@ public class SeriesResponse4StorageTop extends SeriesResponseBuilder {
|
|||
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 operationCount = jso
|
||||
.getLong(AggregatedStorageUsageRecord.OPERATION_COUNT);
|
||||
series.add(new SeriesStorageData(info.getCalendar()
|
||||
.getTime(), dataVolume, operationCount));
|
||||
JsonNode jso = info.getValue();
|
||||
Long dataVolume = jso.get(AggregatedStorageUsageRecord.DATA_VOLUME).asLong();
|
||||
Long operationCount = jso.get(AggregatedStorageUsageRecord.OPERATION_COUNT).asLong();
|
||||
series.add(new SeriesStorageData(info.getCalendar().getTime(), dataVolume, operationCount));
|
||||
|
||||
}
|
||||
SeriesStorageDataTop seriesStorageDataTop = new SeriesStorageDataTop(
|
||||
|
@ -69,18 +62,15 @@ public class SeriesResponse4StorageTop extends SeriesResponseBuilder {
|
|||
|
||||
}
|
||||
|
||||
SeriesStorageTop seriesStorageTop = new SeriesStorageTop(
|
||||
showOthers, topNumber, seriesStorageDataTopList);
|
||||
SeriesStorageTop seriesStorageTop = new SeriesStorageTop(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());
|
||||
"Error creating series for storage accounting basic chart: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
//import org.gcube.accounting.datamodel.aggregation.AggregatedTaskUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesTask;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Context Series Response 4 Task
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4TaskContext extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4TaskContext.class);
|
||||
private Context context;
|
||||
private SortedMap<Filter, SortedMap<Calendar, Info>> contextSM;
|
||||
|
||||
public SeriesResponse4TaskContext(Context context,
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> contextSM) {
|
||||
this.context = context;
|
||||
this.contextSM = contextSM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildSeriesResponse() throws ServiceException {
|
||||
try {
|
||||
if (contextSM == null || contextSM.isEmpty()) {
|
||||
logger.error("Error creating series for task accounting: No data available!");
|
||||
throw new ServiceException("No data available!");
|
||||
}
|
||||
|
||||
ArrayList<SeriesTaskDataContext> seriesTaskDataContextList = new ArrayList<>();
|
||||
|
||||
for (Filter contextValue : contextSM.keySet()) {
|
||||
|
||||
ArrayList<SeriesTaskData> series = new ArrayList<>();
|
||||
SortedMap<Calendar, Info> infos = contextSM.get(contextValue);
|
||||
for (Info info : infos.values()) {
|
||||
@SuppressWarnings("unused")
|
||||
JSONObject jso = info.getValue();
|
||||
// Long duration =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.DURATION);
|
||||
//Long operationCount = jso
|
||||
// .getLong(AggregatedTaskUsageRecord.OPERATION_COUNT);
|
||||
// Long maxInvocationTime =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.MAX_INVOCATION_TIME);
|
||||
// Long minInvocationTime =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
//series.add(new SeriesTaskData(info.getCalendar().getTime(),
|
||||
// operationCount));
|
||||
}
|
||||
SeriesTaskDataContext seriesTaskDataContext = new SeriesTaskDataContext(
|
||||
contextValue.getValue(), series);
|
||||
seriesTaskDataContextList.add(seriesTaskDataContext);
|
||||
|
||||
}
|
||||
|
||||
SeriesTaskContext seriesTaskContext = new SeriesTaskContext(
|
||||
context, seriesTaskDataContextList);
|
||||
SeriesTask seriesTask = new SeriesTask(seriesTaskContext);
|
||||
|
||||
seriesResponseSpec.setSr(seriesTask);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for portlet accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for portlet accounting context chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import java.util.SortedMap;
|
|||
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
//import org.gcube.accounting.datamodel.aggregation.AggregatedTaskUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesTask;
|
||||
|
@ -13,27 +14,22 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.Seri
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Top Series Response 4 Task
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesResponse4TaskTop extends SeriesResponseBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(SeriesResponse4TaskTop.class);
|
||||
private Boolean showOthers;
|
||||
protected static Logger logger = LoggerFactory.getLogger(SeriesResponse4TaskTop.class);
|
||||
private Integer topNumber;
|
||||
private SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
public SeriesResponse4TaskTop(Boolean showOthers, Integer topNumber,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.showOthers = showOthers;
|
||||
public SeriesResponse4TaskTop(Integer topNumber, SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) {
|
||||
this.topNumber = topNumber;
|
||||
this.topSM = topSM;
|
||||
}
|
||||
|
@ -54,38 +50,36 @@ public class SeriesResponse4TaskTop extends SeriesResponseBuilder {
|
|||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||
for (Info info : infos.values()) {
|
||||
@SuppressWarnings("unused")
|
||||
JSONObject jso = info.getValue();
|
||||
JsonNode jso = info.getValue();
|
||||
// Long duration =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.DURATION);
|
||||
//Long operationCount = jso
|
||||
// .getLong(AggregatedTaskUsageRecord.OPERATION_COUNT);
|
||||
// Long operationCount = jso
|
||||
// .getLong(AggregatedTaskUsageRecord.OPERATION_COUNT);
|
||||
// Long maxInvocationTime =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.MAX_INVOCATION_TIME);
|
||||
// Long minInvocationTime =
|
||||
// jso.getLong(AggregatedTaskUsageRecord.MIN_INVOCATION_TIME);
|
||||
|
||||
//series.add(new SeriesTaskData(info.getCalendar().getTime(),
|
||||
// operationCount));
|
||||
// series.add(new
|
||||
// SeriesTaskData(info.getCalendar().getTime(),
|
||||
// operationCount));
|
||||
}
|
||||
SeriesTaskDataTop seriesTaskDataTop = new SeriesTaskDataTop(
|
||||
new FilterValue(topValue.getValue()), series);
|
||||
SeriesTaskDataTop seriesTaskDataTop = new SeriesTaskDataTop(new FilterValue(topValue.getValue()),
|
||||
series);
|
||||
seriesTaskDataTopList.add(seriesTaskDataTop);
|
||||
|
||||
}
|
||||
|
||||
SeriesTaskTop seriesTaskTop = new SeriesTaskTop(showOthers,
|
||||
topNumber, seriesTaskDataTopList);
|
||||
SeriesTaskTop seriesTaskTop = new SeriesTaskTop(topNumber, seriesTaskDataTopList);
|
||||
SeriesTask seriesTask = new SeriesTask(seriesTaskTop);
|
||||
|
||||
seriesResponseSpec.setSr(seriesTask);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error creating series for portlet accounting top chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error creating series for portlet accounting top chart: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException(
|
||||
"Error creating series for portlet accounting top chart: "
|
||||
+ e.getLocalizedMessage());
|
||||
"Error creating series for portlet accounting top chart: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesReques
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDefinition;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobTop;
|
||||
|
@ -23,13 +21,12 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Accounting Model 4 Job
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingModel4Job extends AccountingModelBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingModel4Job.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(AccountingModel4Job.class);
|
||||
private AccountingStateData accountingStateData;
|
||||
|
||||
public AccountingModel4Job(AccountingStateData accountingStateData) {
|
||||
|
@ -42,35 +39,30 @@ public class AccountingModel4Job extends AccountingModelBuilder {
|
|||
|
||||
if (seriesRequest == null) {
|
||||
logger.error("Error series request is null");
|
||||
throw new ServiceException(
|
||||
"Error series request is null");
|
||||
throw new ServiceException("Error series request is null");
|
||||
|
||||
}
|
||||
|
||||
String startDate="";
|
||||
String startDate = "";
|
||||
try {
|
||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String endDate="";
|
||||
|
||||
String endDate = "";
|
||||
try {
|
||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod()
|
||||
.getLabel();
|
||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod().getLabel();
|
||||
|
||||
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
||||
|
||||
if (seriesResponse == null) {
|
||||
logger.error("Error series response is null");
|
||||
throw new ServiceException(
|
||||
"Error series response is null");
|
||||
throw new ServiceException("Error series response is null");
|
||||
}
|
||||
|
||||
String fileName = "Untitled";
|
||||
|
@ -78,17 +70,13 @@ public class AccountingModel4Job extends AccountingModelBuilder {
|
|||
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
||||
if (seriesResponse instanceof SeriesJob) {
|
||||
SeriesJob seriesService = (SeriesJob) seriesResponse;
|
||||
SeriesJobDefinition definition = seriesService
|
||||
.getSeriesJobDefinition();
|
||||
SeriesJobDefinition definition = seriesService.getSeriesJobDefinition();
|
||||
if (definition instanceof SeriesJobBasic) {
|
||||
SeriesJobBasic seriesJobBasic = (SeriesJobBasic) definition;
|
||||
fileName = "Job_" + periodType + "_" + startDate + "_"
|
||||
+ endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] { "Date",
|
||||
"Operation Count", "Duration", "Max Invocation",
|
||||
"Min Invocation" }));
|
||||
ArrayList<SeriesJobData> listData = seriesJobBasic
|
||||
.getSeries();
|
||||
fileName = "Job_" + periodType + "_" + startDate + "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(
|
||||
new String[] { "Date", "Operation Count", "Duration", "Max Invocation", "Min Invocation" }));
|
||||
ArrayList<SeriesJobData> listData = seriesJobBasic.getSeries();
|
||||
for (SeriesJobData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||
|
@ -102,76 +90,35 @@ public class AccountingModel4Job extends AccountingModelBuilder {
|
|||
} else {
|
||||
if (definition instanceof SeriesJobTop) {
|
||||
SeriesJobTop seriesJobTop = (SeriesJobTop) definition;
|
||||
fileName = "JobTop_" + periodType + "_" + startDate
|
||||
+ "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] {
|
||||
"Value", "Date", "Operation Count", "Duration",
|
||||
"Max Invocation", "Min Invocation" }));
|
||||
ArrayList<SeriesJobDataTop> listDataTop = seriesJobTop
|
||||
.getSeriesJobDataTopList();
|
||||
fileName = "JobTop_" + periodType + "_" + startDate + "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] { "Value", "Date", "Operation Count",
|
||||
"Duration", "Max Invocation", "Min Invocation" }));
|
||||
ArrayList<SeriesJobDataTop> listDataTop = seriesJobTop.getSeriesJobDataTopList();
|
||||
for (SeriesJobDataTop seriesDataTop : listDataTop) {
|
||||
FilterValue filterValue = seriesDataTop
|
||||
.getFilterValue();
|
||||
ArrayList<SeriesJobData> listData = seriesDataTop
|
||||
.getSeries();
|
||||
FilterValue filterValue = seriesDataTop.getFilterValue();
|
||||
ArrayList<SeriesJobData> listData = seriesDataTop.getSeries();
|
||||
for (SeriesJobData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(filterValue.getValue());
|
||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getOperationCount()));
|
||||
data.add(String.valueOf(seriesData.getOperationCount()));
|
||||
data.add(String.valueOf(seriesData.getDuration()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getMaxInvocationTime()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getMinInvocationTime()));
|
||||
data.add(String.valueOf(seriesData.getMaxInvocationTime()));
|
||||
data.add(String.valueOf(seriesData.getMinInvocationTime()));
|
||||
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
||||
rows.add(csvDataRow);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (definition instanceof SeriesJobContext) {
|
||||
SeriesJobContext seriesJobContext = (SeriesJobContext) definition;
|
||||
fileName = "JobContext_" + periodType + "_" + startDate
|
||||
+ "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] {
|
||||
"Value", "Date", "Operation Count", "Duration",
|
||||
"Max Invocation", "Min Invocation" }));
|
||||
ArrayList<SeriesJobDataContext> listDataContext = seriesJobContext
|
||||
.getSeriesJobDataContextList();
|
||||
for (SeriesJobDataContext seriesDataContext : listDataContext) {
|
||||
ArrayList<SeriesJobData> listData = seriesDataContext
|
||||
.getSeries();
|
||||
for (SeriesJobData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(seriesDataContext.getContext());
|
||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getOperationCount()));
|
||||
data.add(String.valueOf(seriesData.getDuration()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getMaxInvocationTime()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getMinInvocationTime()));
|
||||
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
||||
rows.add(csvDataRow);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Unsupported Serie Definition for Job: "
|
||||
+ definition);
|
||||
throw new ServiceException(
|
||||
"Unsupported Serie Definition for Job: "
|
||||
+ definition);
|
||||
}
|
||||
|
||||
logger.error("Unsupported Serie Definition for Job: " + definition);
|
||||
throw new ServiceException("Unsupported Serie Definition for Job: " + definition);
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Job not support this serie response: "
|
||||
+ seriesResponse);
|
||||
throw new ServiceException(
|
||||
"Job not support this serie response: "
|
||||
+ seriesResponse);
|
||||
logger.error("Job not support this serie response: " + seriesResponse);
|
||||
throw new ServiceException("Job not support this serie response: " + seriesResponse);
|
||||
}
|
||||
|
||||
AccountingDataModel invocation = new AccountingDataModel(fileName, header, rows);
|
||||
|
|
|
@ -10,9 +10,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesReques
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDefinition;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceTop;
|
||||
|
@ -23,13 +21,12 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Accounting Model 4 Service
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingModel4Service extends AccountingModelBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingModel4Service.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(AccountingModel4Service.class);
|
||||
private AccountingStateData accountingStateData;
|
||||
|
||||
public AccountingModel4Service(AccountingStateData accountingStateData) {
|
||||
|
@ -42,35 +39,30 @@ public class AccountingModel4Service extends AccountingModelBuilder {
|
|||
|
||||
if (seriesRequest == null) {
|
||||
logger.error("Error series request is null");
|
||||
throw new ServiceException(
|
||||
"Error series request is null");
|
||||
throw new ServiceException("Error series request is null");
|
||||
|
||||
}
|
||||
|
||||
String startDate="";
|
||||
String startDate = "";
|
||||
try {
|
||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String endDate="";
|
||||
|
||||
String endDate = "";
|
||||
try {
|
||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod()
|
||||
.getLabel();
|
||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod().getLabel();
|
||||
|
||||
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
||||
|
||||
if (seriesResponse == null) {
|
||||
logger.error("Error series response is null");
|
||||
throw new ServiceException(
|
||||
"Error series response is null");
|
||||
throw new ServiceException("Error series response is null");
|
||||
}
|
||||
|
||||
String fileName = "Untitled";
|
||||
|
@ -78,17 +70,13 @@ public class AccountingModel4Service extends AccountingModelBuilder {
|
|||
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
||||
if (seriesResponse instanceof SeriesService) {
|
||||
SeriesService seriesService = (SeriesService) seriesResponse;
|
||||
SeriesServiceDefinition definition = seriesService
|
||||
.getSerieServiceDefinition();
|
||||
SeriesServiceDefinition definition = seriesService.getSerieServiceDefinition();
|
||||
if (definition instanceof SeriesServiceBasic) {
|
||||
SeriesServiceBasic seriesServiceBasic = (SeriesServiceBasic) definition;
|
||||
fileName = "Service_" + periodType + "_" + startDate + "_"
|
||||
+ endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] { "Date",
|
||||
"Operation Count", "Duration", "Max Invocation",
|
||||
"Min Invocation" }));
|
||||
ArrayList<SeriesServiceData> listData = seriesServiceBasic
|
||||
.getSeries();
|
||||
fileName = "Service_" + periodType + "_" + startDate + "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(
|
||||
new String[] { "Date", "Operation Count", "Duration", "Max Invocation", "Min Invocation" }));
|
||||
ArrayList<SeriesServiceData> listData = seriesServiceBasic.getSeries();
|
||||
for (SeriesServiceData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||
|
@ -102,76 +90,33 @@ public class AccountingModel4Service extends AccountingModelBuilder {
|
|||
} else {
|
||||
if (definition instanceof SeriesServiceTop) {
|
||||
SeriesServiceTop seriesServiceTop = (SeriesServiceTop) definition;
|
||||
fileName = "ServiceTop_" + periodType + "_" + startDate
|
||||
+ "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] {
|
||||
"Value", "Date", "Operation Count", "Duration",
|
||||
"Max Invocation", "Min Invocation" }));
|
||||
ArrayList<SeriesServiceDataTop> listDataTop = seriesServiceTop
|
||||
.getSeriesServiceDataTopList();
|
||||
fileName = "ServiceTop_" + periodType + "_" + startDate + "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] { "Value", "Date", "Operation Count",
|
||||
"Duration", "Max Invocation", "Min Invocation" }));
|
||||
ArrayList<SeriesServiceDataTop> listDataTop = seriesServiceTop.getSeriesServiceDataTopList();
|
||||
for (SeriesServiceDataTop seriesDataTop : listDataTop) {
|
||||
FilterValue filterValue = seriesDataTop
|
||||
.getFilterValue();
|
||||
ArrayList<SeriesServiceData> listData = seriesDataTop
|
||||
.getSeries();
|
||||
FilterValue filterValue = seriesDataTop.getFilterValue();
|
||||
ArrayList<SeriesServiceData> listData = seriesDataTop.getSeries();
|
||||
for (SeriesServiceData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(filterValue.getValue());
|
||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getOperationCount()));
|
||||
data.add(String.valueOf(seriesData.getOperationCount()));
|
||||
data.add(String.valueOf(seriesData.getDuration()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getMaxInvocationTime()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getMinInvocationTime()));
|
||||
data.add(String.valueOf(seriesData.getMaxInvocationTime()));
|
||||
data.add(String.valueOf(seriesData.getMinInvocationTime()));
|
||||
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
||||
rows.add(csvDataRow);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (definition instanceof SeriesServiceContext) {
|
||||
SeriesServiceContext seriesServiceContext = (SeriesServiceContext) definition;
|
||||
fileName = "ServiceContext_" + periodType + "_" + startDate
|
||||
+ "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] {
|
||||
"Value", "Date", "Operation Count", "Duration",
|
||||
"Max Invocation", "Min Invocation" }));
|
||||
ArrayList<SeriesServiceDataContext> listDataContext = seriesServiceContext
|
||||
.getSeriesServiceDataContextList();
|
||||
for (SeriesServiceDataContext seriesDataContext : listDataContext) {
|
||||
ArrayList<SeriesServiceData> listData = seriesDataContext
|
||||
.getSeries();
|
||||
for (SeriesServiceData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(seriesDataContext.getContext());
|
||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getOperationCount()));
|
||||
data.add(String.valueOf(seriesData.getDuration()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getMaxInvocationTime()));
|
||||
data.add(String.valueOf(seriesData
|
||||
.getMinInvocationTime()));
|
||||
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
||||
rows.add(csvDataRow);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Unsupported Serie Definition for Service: "
|
||||
+ definition);
|
||||
throw new ServiceException(
|
||||
"Unsupported Serie Definition for Service: "
|
||||
+ definition);
|
||||
}
|
||||
logger.error("Unsupported Serie Definition for Service: " + definition);
|
||||
throw new ServiceException("Unsupported Serie Definition for Service: " + definition);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Service not support this serie response: "
|
||||
+ seriesResponse);
|
||||
throw new ServiceException(
|
||||
"Service not support this serie response: "
|
||||
+ seriesResponse);
|
||||
logger.error("Service not support this serie response: " + seriesResponse);
|
||||
throw new ServiceException("Service not support this serie response: " + seriesResponse);
|
||||
}
|
||||
|
||||
AccountingDataModel invocation = new AccountingDataModel(fileName, header, rows);
|
||||
|
|
|
@ -10,9 +10,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesReques
|
|||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageBasic;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageData;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataContext;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataTop;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDefinition;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageTop;
|
||||
|
@ -23,13 +21,12 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* Accounting Model 4 Storage
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingModel4Storage extends AccountingModelBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingModel4Storage.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(AccountingModel4Storage.class);
|
||||
private AccountingStateData accountingStateData;
|
||||
|
||||
public AccountingModel4Storage(AccountingStateData accountingStateData) {
|
||||
|
@ -42,36 +39,31 @@ public class AccountingModel4Storage extends AccountingModelBuilder {
|
|||
|
||||
if (seriesRequest == null) {
|
||||
logger.error("Error series request is null");
|
||||
throw new ServiceException(
|
||||
"Error series request is null");
|
||||
throw new ServiceException("Error series request is null");
|
||||
|
||||
}
|
||||
|
||||
String startDate="";
|
||||
String startDate = "";
|
||||
try {
|
||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String endDate="";
|
||||
|
||||
String endDate = "";
|
||||
try {
|
||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod()
|
||||
.getLabel();
|
||||
|
||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod().getLabel();
|
||||
|
||||
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
||||
|
||||
if (seriesResponse == null) {
|
||||
logger.error("Error series response is null");
|
||||
throw new ServiceException(
|
||||
"Error series response is null");
|
||||
throw new ServiceException("Error series response is null");
|
||||
}
|
||||
|
||||
String fileName = "Untitled";
|
||||
|
@ -79,16 +71,12 @@ public class AccountingModel4Storage extends AccountingModelBuilder {
|
|||
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
||||
if (seriesResponse instanceof SeriesStorage) {
|
||||
SeriesStorage seriesStorage = (SeriesStorage) seriesResponse;
|
||||
SeriesStorageDefinition definition = seriesStorage
|
||||
.getSeriesStorageDefinition();
|
||||
SeriesStorageDefinition definition = seriesStorage.getSeriesStorageDefinition();
|
||||
if (definition instanceof SeriesStorageBasic) {
|
||||
SeriesStorageBasic seriesStorageBasic = (SeriesStorageBasic) definition;
|
||||
fileName = "Storage_" + periodType + "_" + startDate + "_"
|
||||
+ endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] { "Date",
|
||||
"Operation Count", "Data Volume" }));
|
||||
ArrayList<SeriesStorageData> listData = seriesStorageBasic
|
||||
.getSeries();
|
||||
fileName = "Storage_" + periodType + "_" + startDate + "_" + endDate;
|
||||
header = new ArrayList<>(Arrays.asList(new String[] { "Date", "Operation Count", "Data Volume" }));
|
||||
ArrayList<SeriesStorageData> listData = seriesStorageBasic.getSeries();
|
||||
for (SeriesStorageData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||
|
@ -100,18 +88,13 @@ public class AccountingModel4Storage extends AccountingModelBuilder {
|
|||
} else {
|
||||
if (definition instanceof SeriesStorageTop) {
|
||||
SeriesStorageTop seriesStorageTop = (SeriesStorageTop) definition;
|
||||
fileName = "StorageTop_" + periodType + "_" + startDate
|
||||
+ "_" + endDate;
|
||||
fileName = "StorageTop_" + periodType + "_" + startDate + "_" + endDate;
|
||||
header = new ArrayList<>(
|
||||
Arrays.asList(new String[] { "Value", "Date",
|
||||
"Operation Count", "Data Volume" }));
|
||||
ArrayList<SeriesStorageDataTop> listDataTop = seriesStorageTop
|
||||
.getSeriesStorageDataTopList();
|
||||
Arrays.asList(new String[] { "Value", "Date", "Operation Count", "Data Volume" }));
|
||||
ArrayList<SeriesStorageDataTop> listDataTop = seriesStorageTop.getSeriesStorageDataTopList();
|
||||
for (SeriesStorageDataTop seriesDataTop : listDataTop) {
|
||||
FilterValue filterValue = seriesDataTop
|
||||
.getFilterValue();
|
||||
ArrayList<SeriesStorageData> listData = seriesDataTop
|
||||
.getSeries();
|
||||
FilterValue filterValue = seriesDataTop.getFilterValue();
|
||||
ArrayList<SeriesStorageData> listData = seriesDataTop.getSeries();
|
||||
for (SeriesStorageData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(filterValue.getValue());
|
||||
|
@ -123,46 +106,16 @@ public class AccountingModel4Storage extends AccountingModelBuilder {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (definition instanceof SeriesStorageContext) {
|
||||
SeriesStorageContext seriesStorageContext = (SeriesStorageContext) definition;
|
||||
fileName = "StorageContext_" + periodType + "_" + startDate
|
||||
+ "_" + endDate;
|
||||
header = new ArrayList<>(
|
||||
Arrays.asList(new String[] { "Value", "Date",
|
||||
"Operation Count", "Data Volume" }));
|
||||
ArrayList<SeriesStorageDataContext> listDataContext = seriesStorageContext
|
||||
.getSeriesStorageDataContextList();
|
||||
for (SeriesStorageDataContext seriesDataContext : listDataContext) {
|
||||
ArrayList<SeriesStorageData> listData = seriesDataContext
|
||||
.getSeries();
|
||||
for (SeriesStorageData seriesData : listData) {
|
||||
ArrayList<String> data = new ArrayList<>();
|
||||
data.add(seriesDataContext.getContext());
|
||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||
data.add(String.valueOf(seriesData.getOperationCount()));
|
||||
data.add(String.valueOf(seriesData.getDataVolume()));
|
||||
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
||||
rows.add(csvDataRow);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Unsupported Serie Definition for Storage: "
|
||||
+ definition);
|
||||
throw new ServiceException(
|
||||
"Unsupported Serie Definition for Storage: "
|
||||
+ definition);
|
||||
}
|
||||
logger.error("Unsupported Serie Definition for Storage: " + definition);
|
||||
throw new ServiceException("Unsupported Serie Definition for Storage: " + definition);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Storage not support this serie response: "
|
||||
+ seriesResponse);
|
||||
throw new ServiceException(
|
||||
"Storage not support this serie response: "
|
||||
+ seriesResponse);
|
||||
logger.error("Storage not support this serie response: " + seriesResponse);
|
||||
throw new ServiceException("Storage not support this serie response: " + seriesResponse);
|
||||
}
|
||||
|
||||
AccountingDataModel invocation = new AccountingDataModel(fileName,header, rows);
|
||||
AccountingDataModel invocation = new AccountingDataModel(fileName, header, rows);
|
||||
accountingModelSpec.setOp(invocation);
|
||||
|
||||
}
|
||||
|
|
|
@ -48,5 +48,10 @@ public class Constants {
|
|||
public static final int CLIENT_MONITOR_TIME_OUT_PERIODMILLIS = 1800000;
|
||||
public static final int DAEMON_SLEEP_MILLIS = 1000;
|
||||
|
||||
//Top Number
|
||||
public static final int TOP_NUMBER_DEFAULT = 10;
|
||||
public static final int TOP_NUMBER_MAX = 100;
|
||||
public static final int TOP_NUMBER_MIN = 1;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,55 +5,64 @@ import java.util.ArrayList;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingFilterBasic extends AccountingFilterDefinition implements
|
||||
Serializable {
|
||||
public class AccountingFilterBasic extends AccountingFilterDefinition implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6805006183397381154L;
|
||||
private ArrayList<AccountingFilter> filters;
|
||||
private String scope;
|
||||
private Boolean noContext;
|
||||
private Context context;
|
||||
private String scopeFilterActive;
|
||||
|
||||
public AccountingFilterBasic() {
|
||||
super();
|
||||
this.chartType = ChartType.Basic;
|
||||
noContext = false;
|
||||
filters = null;
|
||||
scope=null;
|
||||
context = null;
|
||||
scopeFilterActive = null;
|
||||
}
|
||||
|
||||
public AccountingFilterBasic(String scope, boolean noContenxt) {
|
||||
|
||||
public AccountingFilterBasic(Context context) {
|
||||
super();
|
||||
chartType = ChartType.Basic;
|
||||
this.filters = null;
|
||||
this.scope=scope;
|
||||
this.noContext = noContenxt;
|
||||
this.context = context;
|
||||
this.scopeFilterActive = null;
|
||||
}
|
||||
|
||||
|
||||
public AccountingFilterBasic(String scope, ArrayList<AccountingFilter> filters,
|
||||
boolean noContenxt) {
|
||||
public AccountingFilterBasic(Context context,String scopeFilterActive) {
|
||||
super();
|
||||
chartType = ChartType.Basic;
|
||||
this.filters = null;
|
||||
this.context = context;
|
||||
this.scopeFilterActive = scopeFilterActive;
|
||||
}
|
||||
|
||||
|
||||
public AccountingFilterBasic(Context context, ArrayList<AccountingFilter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Basic;
|
||||
this.scope=scope;
|
||||
this.filters = filters;
|
||||
this.noContext = noContenxt;
|
||||
this.context = context;
|
||||
this.scopeFilterActive = null;
|
||||
}
|
||||
|
||||
public AccountingFilterBasic(Context context, String scopeFilterActive, ArrayList<AccountingFilter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Basic;
|
||||
this.filters = filters;
|
||||
this.context = context;
|
||||
this.scopeFilterActive = scopeFilterActive;
|
||||
}
|
||||
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
public String getScopeFilterActive() {
|
||||
return scopeFilterActive;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public Boolean getNoContext() {
|
||||
return noContext;
|
||||
public void setScopeFilterActive(String scopeFilterActive) {
|
||||
this.scopeFilterActive = scopeFilterActive;
|
||||
}
|
||||
|
||||
public ArrayList<AccountingFilter> getFilters() {
|
||||
|
@ -64,20 +73,19 @@ public class AccountingFilterBasic extends AccountingFilterDefinition implements
|
|||
this.filters = filters;
|
||||
}
|
||||
|
||||
public boolean isNoContext() {
|
||||
return noContext;
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setNoContext(Boolean noContext) {
|
||||
this.noContext = noContext;
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilterBasic [filters=" + filters + ", scope=" + scope + ", noContext=" + noContext
|
||||
+ ", chartType=" + chartType + "]";
|
||||
return "AccountingFilterBasic [filters=" + filters + ", context=" + context + ", scopeFilterActive="
|
||||
+ scopeFilterActive + ", chartType=" + chartType + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingFilterContext extends AccountingFilterDefinition
|
||||
implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6805006183397381154L;
|
||||
private Context context;
|
||||
private ArrayList<AccountingFilter> filters;
|
||||
|
||||
public AccountingFilterContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
context = null;
|
||||
filters = null;
|
||||
|
||||
}
|
||||
|
||||
public AccountingFilterContext(Context context,
|
||||
ArrayList<AccountingFilter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.filters = filters;
|
||||
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<AccountingFilter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(ArrayList<AccountingFilter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilterContext [context=" + context + ", filters="
|
||||
+ filters + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -3,64 +3,84 @@ package org.gcube.portlets.admin.accountingmanager.shared.data;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingFilterTop extends AccountingFilterDefinition implements
|
||||
Serializable {
|
||||
public class AccountingFilterTop extends AccountingFilterDefinition implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6805006183397381154L;
|
||||
private String scope;
|
||||
private Context context;
|
||||
private String scopeFilterActive;
|
||||
private FilterKey filterKey;
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
private ArrayList<AccountingFilter> filters;
|
||||
|
||||
public AccountingFilterTop() {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
scope=null;
|
||||
showOthers = false;
|
||||
topNumber = 5;
|
||||
context = null;
|
||||
scopeFilterActive = null;
|
||||
topNumber = Constants.TOP_NUMBER_DEFAULT;
|
||||
filterKey = null;
|
||||
filters = null;
|
||||
|
||||
}
|
||||
|
||||
public AccountingFilterTop(String scope, Boolean showOthers,Integer topNumber) {
|
||||
|
||||
public AccountingFilterTop(Context context, Integer topNumber) {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.scope=scope;
|
||||
this.showOthers = showOthers;
|
||||
this.context = context;
|
||||
this.scopeFilterActive = null;
|
||||
this.topNumber = topNumber;
|
||||
filterKey = null;
|
||||
filters = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public AccountingFilterTop(String scope, FilterKey filterKey,
|
||||
ArrayList<AccountingFilter> filters, Boolean showOthers,
|
||||
public AccountingFilterTop(Context context, String scopeFilterActive, Integer topNumber) {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
this.context = context;
|
||||
this.scopeFilterActive = scopeFilterActive;
|
||||
this.topNumber = topNumber;
|
||||
filterKey = null;
|
||||
filters = null;
|
||||
|
||||
}
|
||||
|
||||
public AccountingFilterTop(Context context, FilterKey filterKey, ArrayList<AccountingFilter> filters,
|
||||
Integer topNumber) {
|
||||
super();
|
||||
chartType = ChartType.Top;
|
||||
this.scope=scope;
|
||||
this.context = context;
|
||||
this.scopeFilterActive = null;
|
||||
this.filterKey = filterKey;
|
||||
this.filters = filters;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
public AccountingFilterTop(Context context, String scopeFilterActive, FilterKey filterKey,
|
||||
ArrayList<AccountingFilter> filters, Integer topNumber) {
|
||||
super();
|
||||
chartType = ChartType.Top;
|
||||
this.context = context;
|
||||
this.scopeFilterActive = scopeFilterActive;
|
||||
this.filterKey = filterKey;
|
||||
this.filters = filters;
|
||||
this.topNumber = topNumber;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public FilterKey getFilterKey() {
|
||||
|
@ -71,14 +91,6 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
|
|||
this.filterKey = filterKey;
|
||||
}
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
||||
public void setShowOthers(Boolean showOthers) {
|
||||
this.showOthers = showOthers;
|
||||
}
|
||||
|
||||
public Integer getTopNumber() {
|
||||
return topNumber;
|
||||
}
|
||||
|
@ -95,12 +107,18 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
|
|||
this.filters = filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilterTop [scope=" + scope + ", filterKey=" + filterKey + ", showOthers=" + showOthers
|
||||
+ ", topNumber=" + topNumber + ", filters=" + filters + ", chartType=" + chartType + "]";
|
||||
public String getScopeFilterActive() {
|
||||
return scopeFilterActive;
|
||||
}
|
||||
|
||||
public void setScopeFilterActive(String scopeFilterActive) {
|
||||
this.scopeFilterActive = scopeFilterActive;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilterTop [context=" + context + ", scopeFilterActive=" + scopeFilterActive + ", filterKey="
|
||||
+ filterKey + ", topNumber=" + topNumber + ", filters=" + filters + ", chartType=" + chartType + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
|
||||
public enum ChartType {
|
||||
|
||||
Basic("Basic"), Top("Top"), Context("Context"), Spaces("Spaces");
|
||||
Basic("Basic"), Top("Top"), Spaces("Spaces");
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class Genres implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1704075020370137961L;
|
||||
private ArrayList<String> genresList;
|
||||
|
||||
public Genres() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Genres(ArrayList<String> genresList) {
|
||||
super();
|
||||
this.genresList = genresList;
|
||||
}
|
||||
|
||||
public ArrayList<String> getGenresList() {
|
||||
return genresList;
|
||||
}
|
||||
|
||||
public void setGenresList(ArrayList<String> genresList) {
|
||||
this.genresList = genresList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Genres [genresList=" + genresList + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class GenresData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 719740085818609829L;
|
||||
private String genre;
|
||||
|
||||
public GenresData() {
|
||||
super();
|
||||
}
|
||||
|
||||
public GenresData(String genre) {
|
||||
super();
|
||||
this.genre = genre;
|
||||
}
|
||||
|
||||
public String getGenre() {
|
||||
return genre;
|
||||
}
|
||||
|
||||
public void setGenre(String genre) {
|
||||
this.genre = genre;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return genre;
|
||||
}
|
||||
|
||||
public void setLabel(String genre) {
|
||||
this.genre = genre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GenresData [genre=" + genre + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -21,8 +21,7 @@ public class SeriesRequest implements Serializable {
|
|||
super();
|
||||
}
|
||||
|
||||
public SeriesRequest(AccountingPeriod accountingPeriod,
|
||||
AccountingFilterDefinition accountingFilterDefinition) {
|
||||
public SeriesRequest(AccountingPeriod accountingPeriod, AccountingFilterDefinition accountingFilterDefinition) {
|
||||
super();
|
||||
this.accountingPeriod = accountingPeriod;
|
||||
this.accountingFilterDefinition = accountingFilterDefinition;
|
||||
|
@ -40,18 +39,14 @@ public class SeriesRequest implements Serializable {
|
|||
return accountingFilterDefinition;
|
||||
}
|
||||
|
||||
public void setAccountingFilterDefinition(
|
||||
AccountingFilterDefinition accountingFilterDefinition) {
|
||||
public void setAccountingFilterDefinition(AccountingFilterDefinition accountingFilterDefinition) {
|
||||
this.accountingFilterDefinition = accountingFilterDefinition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesRequest [accountingPeriod=" + accountingPeriod
|
||||
+ ", accountingFilterDefinition=" + accountingFilterDefinition
|
||||
+ "]";
|
||||
return "SeriesRequest [accountingPeriod=" + accountingPeriod + ", accountingFilterDefinition="
|
||||
+ accountingFilterDefinition + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.job;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesJobContext extends SeriesJobDefinition {
|
||||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesJobDataContext> seriesJobDataContextList;
|
||||
|
||||
public SeriesJobContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
}
|
||||
|
||||
public SeriesJobContext(Context context,
|
||||
ArrayList<SeriesJobDataContext> seriesJobDataContextList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.seriesJobDataContextList = seriesJobDataContextList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesJobDataContext> getSeriesJobDataContextList() {
|
||||
return seriesJobDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesJobDataContextList(
|
||||
ArrayList<SeriesJobDataContext> seriesJobDataContextList) {
|
||||
this.seriesJobDataContextList = seriesJobDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesJobContext [context=" + context
|
||||
+ ", seriesJobDataContextList=" + seriesJobDataContextList
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.job;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesJobDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6043106605633429465L;
|
||||
private String context;
|
||||
private ArrayList<SeriesJobData> series;
|
||||
|
||||
public SeriesJobDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesJobDataContext(String context, ArrayList<SeriesJobData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesJobData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesJobData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesJobDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,11 +2,12 @@ package org.gcube.portlets.admin.accountingmanager.shared.data.response.job;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
@ -14,33 +15,21 @@ 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;
|
||||
this.topNumber = Constants.TOP_NUMBER_DEFAULT;
|
||||
}
|
||||
|
||||
public SeriesJobTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesJobDataTop> seriesJobDataTopList) {
|
||||
public SeriesJobTop(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;
|
||||
}
|
||||
|
@ -53,16 +42,14 @@ public class SeriesJobTop extends SeriesJobDefinition {
|
|||
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
|
||||
+ ", showOthers=" + showOthers + ", topNumber=" + topNumber
|
||||
+ "]";
|
||||
return "SeriesJobTop [seriesJobDataTopList=" + seriesJobDataTopList + ", topNumber=" + topNumber
|
||||
+ ", chartType=" + chartType + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesPortletContext extends SeriesPortletDefinition {
|
||||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesPortletDataContext> seriesPortletDataContextList;
|
||||
|
||||
public SeriesPortletContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
}
|
||||
|
||||
public SeriesPortletContext(Context context,
|
||||
ArrayList<SeriesPortletDataContext> seriesPortletDataContextList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.seriesPortletDataContextList = seriesPortletDataContextList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesPortletDataContext> getSeriesPortletDataContextList() {
|
||||
return seriesPortletDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesPortletDataContextList(
|
||||
ArrayList<SeriesPortletDataContext> seriesPortletDataContextList) {
|
||||
this.seriesPortletDataContextList = seriesPortletDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesPortletContext [context=" + context
|
||||
+ ", seriesPortletDataContextList="
|
||||
+ seriesPortletDataContextList + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesPortletDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6043106605633429465L;
|
||||
private String context;
|
||||
private ArrayList<SeriesPortletData> series;
|
||||
|
||||
public SeriesPortletDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesPortletDataContext(String context,
|
||||
ArrayList<SeriesPortletData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesPortletData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesPortletData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesPortletDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,45 +2,34 @@ package org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
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;
|
||||
this.topNumber = Constants.TOP_NUMBER_DEFAULT;
|
||||
}
|
||||
|
||||
public SeriesPortletTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesPortletDataTop> seriesPortletDataTopList) {
|
||||
public SeriesPortletTop(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;
|
||||
}
|
||||
|
@ -53,16 +42,14 @@ public class SeriesPortletTop extends SeriesPortletDefinition {
|
|||
return seriesPortletDataTopList;
|
||||
}
|
||||
|
||||
public void setSeriesPortletDataTopList(
|
||||
ArrayList<SeriesPortletDataTop> seriesPortletDataTopList) {
|
||||
public void setSeriesPortletDataTopList(ArrayList<SeriesPortletDataTop> seriesPortletDataTopList) {
|
||||
this.seriesPortletDataTopList = seriesPortletDataTopList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesPortletTop [showOthers=" + showOthers + ", topNumber="
|
||||
+ topNumber + ", seriesPortletDataTopList="
|
||||
+ seriesPortletDataTopList + "]";
|
||||
return "SeriesPortletTop [topNumber=" + topNumber + ", seriesPortletDataTopList=" + seriesPortletDataTopList
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesServiceContext extends SeriesServiceDefinition {
|
||||
|
||||
private static final long serialVersionUID = -2350334263342186590L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesServiceDataContext> seriesServiceDataContextList;
|
||||
|
||||
public SeriesServiceContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
|
||||
}
|
||||
|
||||
public SeriesServiceContext(Context context,
|
||||
ArrayList<SeriesServiceDataContext> seriesServiceDataContextList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.seriesServiceDataContextList = seriesServiceDataContextList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesServiceDataContext> getSeriesServiceDataContextList() {
|
||||
return seriesServiceDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesServiceDataContextList(
|
||||
ArrayList<SeriesServiceDataContext> seriesServiceDataContextList) {
|
||||
this.seriesServiceDataContextList = seriesServiceDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesServiceContext [context=" + context
|
||||
+ ", seriesServiceDataContextList="
|
||||
+ seriesServiceDataContextList + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesServiceDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6043106605633429465L;
|
||||
private String context;
|
||||
private ArrayList<SeriesServiceData> series;
|
||||
|
||||
public SeriesServiceDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesServiceDataContext(String context,
|
||||
ArrayList<SeriesServiceData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesServiceData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesServiceData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesServiceDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,46 +2,35 @@ package org.gcube.portlets.admin.accountingmanager.shared.data.response.service;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
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;
|
||||
|
||||
this.topNumber = Constants.TOP_NUMBER_DEFAULT;
|
||||
|
||||
}
|
||||
|
||||
public SeriesServiceTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesServiceDataTop> seriesServiceDataTopList) {
|
||||
public SeriesServiceTop(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;
|
||||
}
|
||||
|
@ -54,16 +43,14 @@ public class SeriesServiceTop extends SeriesServiceDefinition {
|
|||
return seriesServiceDataTopList;
|
||||
}
|
||||
|
||||
public void setSeriesServiceDataTopList(
|
||||
ArrayList<SeriesServiceDataTop> seriesServiceDataTopList) {
|
||||
public void setSeriesServiceDataTopList(ArrayList<SeriesServiceDataTop> seriesServiceDataTopList) {
|
||||
this.seriesServiceDataTopList = seriesServiceDataTopList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesServiceTop [showOthers=" + showOthers + ", topNumber="
|
||||
+ topNumber + ", seriesServiceDataTopList="
|
||||
+ seriesServiceDataTopList + "]";
|
||||
return "SeriesServiceTop [topNumber=" + topNumber + ", seriesServiceDataTopList=" + seriesServiceDataTopList
|
||||
+ ", chartType=" + chartType + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesStorageContext extends SeriesStorageDefinition {
|
||||
|
||||
private static final long serialVersionUID = -5477545972037227361L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesStorageDataContext> seriesStorageDataContextList;
|
||||
|
||||
public SeriesStorageContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
|
||||
}
|
||||
|
||||
public SeriesStorageContext(Context context,
|
||||
ArrayList<SeriesStorageDataContext> seriesStorageDataContextList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context=context;
|
||||
this.seriesStorageDataContextList = seriesStorageDataContextList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesStorageDataContext> getSeriesStorageDataContextList() {
|
||||
return seriesStorageDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesStorageDataContextList(
|
||||
ArrayList<SeriesStorageDataContext> seriesStorageDataContextList) {
|
||||
this.seriesStorageDataContextList = seriesStorageDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesStorageContext [context=" + context
|
||||
+ ", seriesStorageDataContextList="
|
||||
+ seriesStorageDataContextList + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.storage;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesStorageDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -627227653308818605L;
|
||||
private String context;
|
||||
private ArrayList<SeriesStorageData> series;
|
||||
|
||||
public SeriesStorageDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesStorageDataContext(String context,
|
||||
ArrayList<SeriesStorageData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesStorageData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesStorageData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesStorageDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,46 +2,35 @@ package org.gcube.portlets.admin.accountingmanager.shared.data.response.storage;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
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;
|
||||
|
||||
this.topNumber = Constants.TOP_NUMBER_DEFAULT;
|
||||
|
||||
}
|
||||
|
||||
public SeriesStorageTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesStorageDataTop> seriesStorageDataTopList) {
|
||||
public SeriesStorageTop(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;
|
||||
}
|
||||
|
@ -54,16 +43,14 @@ public class SeriesStorageTop extends SeriesStorageDefinition {
|
|||
return seriesStorageDataTopList;
|
||||
}
|
||||
|
||||
public void setSeriesStorageDataTopList(
|
||||
ArrayList<SeriesStorageDataTop> seriesStorageDataTopList) {
|
||||
public void setSeriesStorageDataTopList(ArrayList<SeriesStorageDataTop> seriesStorageDataTopList) {
|
||||
this.seriesStorageDataTopList = seriesStorageDataTopList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesStorageTop [showOthers=" + showOthers + ", topNumber="
|
||||
+ topNumber + ", seriesStorageDataTopList="
|
||||
+ seriesStorageDataTopList + "]";
|
||||
return "SeriesStorageTop [topNumber=" + topNumber + ", seriesStorageDataTopList=" + seriesStorageDataTopList
|
||||
+ ", chartType=" + chartType + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.task;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesTaskContext extends SeriesTaskDefinition {
|
||||
|
||||
private static final long serialVersionUID = 6805210072384752359L;
|
||||
private Context context;
|
||||
private ArrayList<SeriesTaskDataContext> seriesTaskDataContextList;
|
||||
|
||||
public SeriesTaskContext() {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
|
||||
}
|
||||
|
||||
public SeriesTaskContext(Context context,
|
||||
ArrayList<SeriesTaskDataContext> seriesTaskDataTopList) {
|
||||
super();
|
||||
this.chartType = ChartType.Context;
|
||||
this.context = context;
|
||||
this.seriesTaskDataContextList = seriesTaskDataTopList;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesTaskDataContext> getSeriesTaskDataContextList() {
|
||||
return seriesTaskDataContextList;
|
||||
}
|
||||
|
||||
public void setSeriesTaskDataContextList(
|
||||
ArrayList<SeriesTaskDataContext> seriesTaskDataContextList) {
|
||||
this.seriesTaskDataContextList = seriesTaskDataContextList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesTaskContext [context=" + context
|
||||
+ ", seriesTaskDataContextList=" + seriesTaskDataContextList
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.response.task;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SeriesTaskDataContext implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6799983693606904130L;
|
||||
private String context;
|
||||
private ArrayList<SeriesTaskData> series;
|
||||
|
||||
public SeriesTaskDataContext() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesTaskDataContext(String context,
|
||||
ArrayList<SeriesTaskData> series) {
|
||||
super();
|
||||
this.context = context;
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public ArrayList<SeriesTaskData> getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
public void setSeries(ArrayList<SeriesTaskData> series) {
|
||||
this.series = series;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesTaskDataContext [context=" + context + ", series="
|
||||
+ series + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,46 +2,35 @@ package org.gcube.portlets.admin.accountingmanager.shared.data.response.task;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
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;
|
||||
this.topNumber = Constants.TOP_NUMBER_DEFAULT;
|
||||
|
||||
}
|
||||
|
||||
public SeriesTaskTop(Boolean showOthers, Integer topNumber,
|
||||
ArrayList<SeriesTaskDataTop> seriesTaskDataTopList) {
|
||||
public SeriesTaskTop(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;
|
||||
}
|
||||
|
@ -54,16 +43,14 @@ public class SeriesTaskTop extends SeriesTaskDefinition {
|
|||
return seriesTaskDataTopList;
|
||||
}
|
||||
|
||||
public void setSeriesTaskDataTopList(
|
||||
ArrayList<SeriesTaskDataTop> seriesTaskDataTopList) {
|
||||
public void setSeriesTaskDataTopList(ArrayList<SeriesTaskDataTop> seriesTaskDataTopList) {
|
||||
this.seriesTaskDataTopList = seriesTaskDataTopList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeriesTaskTop [showOthers=" + showOthers + ", topNumber="
|
||||
+ topNumber + ", seriesTaskDataTopList="
|
||||
+ seriesTaskDataTopList + "]";
|
||||
return "SeriesTaskTop [topNumber=" + topNumber + ", seriesTaskDataTopList=" + seriesTaskDataTopList
|
||||
+ ", chartType=" + chartType + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.admin.accountingmanager.shared.exception;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class NoScopeSelectedException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -8737011216478988776L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public NoScopeSelectedException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* message
|
||||
*/
|
||||
public NoScopeSelectedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public NoScopeSelectedException(String message, Throwable t) {
|
||||
super(message, t);
|
||||
}
|
||||
|
||||
}
|
|
@ -55,11 +55,11 @@
|
|||
<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" />
|
||||
|
|
Loading…
Reference in New Issue