Refs #21354: Improve accounting manager portlet by new persistence
Updated portlet behavior
This commit is contained in:
parent
b829c6bf2f
commit
a36fef1aa9
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<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>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -45,5 +45,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?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="/target/m2e-wtp/web-resources"/>
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<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"
|
# 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
|
## [v1.14.0] - 2021-06-28
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<ReleaseNotes>
|
<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"
|
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-14-0"
|
||||||
date="2021-06-28">
|
date="2021-06-28">
|
||||||
<Change>Fixed display errors generated in Root scope [#21729]</Change>
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.portlets.admin</groupId>
|
<groupId>org.gcube.portlets.admin</groupId>
|
||||||
<artifactId>accounting-manager</artifactId>
|
<artifactId>accounting-manager</artifactId>
|
||||||
<version>1.14.0</version>
|
<version>1.15.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.accounting</groupId>
|
<groupId>org.gcube.accounting</groupId>
|
||||||
<artifactId>accounting-lib</artifactId>
|
<artifactId>accounting-lib</artifactId>
|
||||||
<version>[4.0.0,5.0.0-SNAPSHOT)</version>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -235,6 +235,13 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Document Store Lib -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.data.publishing</groupId>
|
||||||
|
<artifactId>document-store-lib</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Accounting Lib -->
|
<!-- Accounting Lib -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.accounting</groupId>
|
<groupId>org.gcube.accounting</groupId>
|
||||||
|
@ -246,14 +253,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.accounting</groupId>
|
<groupId>org.gcube.accounting</groupId>
|
||||||
<artifactId>accounting-analytics</artifactId>
|
<artifactId>accounting-analytics</artifactId>
|
||||||
<version>[3.0.0,4.0.0-SNAPSHOT)</version>
|
<version>[4.0.0-SNAPSHOT,5.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Document Store Lib -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.data.publishing</groupId>
|
|
||||||
<artifactId>document-store-lib</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.accounting</groupId>
|
<groupId>org.gcube.accounting</groupId>
|
||||||
<artifactId>accounting-analytics-persistence-postgresql</artifactId>
|
<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>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,8 @@ public class AccountingManagerController {
|
||||||
|
|
||||||
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
AccountingClientStateData accountingStateData = accountingState.getState(accountingType);
|
||||||
SeriesRequest seriesRequest = null;
|
SeriesRequest seriesRequest = null;
|
||||||
|
Context defaultContext=new Context();
|
||||||
|
|
||||||
switch (accountingType) {
|
switch (accountingType) {
|
||||||
case JOB:
|
case JOB:
|
||||||
case PORTLET:
|
case PORTLET:
|
||||||
|
@ -439,9 +440,8 @@ public class AccountingManagerController {
|
||||||
case TASK:
|
case TASK:
|
||||||
seriesRequest = new SeriesRequest(
|
seriesRequest = new SeriesRequest(
|
||||||
new AccountingPeriod(dtf.format(lastMonth), dtf.format(date), AccountingPeriodMode.DAILY),
|
new AccountingPeriod(dtf.format(lastMonth), dtf.format(date), AccountingPeriodMode.DAILY),
|
||||||
new AccountingFilterBasic());
|
new AccountingFilterBasic(defaultContext));
|
||||||
Log.debug("DefaultSeriesRequest: " + seriesRequest);
|
Log.debug("DefaultSeriesRequest: " + seriesRequest);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SPACE:
|
case SPACE:
|
||||||
accountingStateData.setAvailableSpaces(spaces);
|
accountingStateData.setAvailableSpaces(spaces);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,6 @@
|
||||||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
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.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.maindata.charts.job.JobChartTopPanel;
|
||||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
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
|
* Accounting Chart 4 Job
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -22,8 +21,7 @@ public class AccountingChart4Job extends AccountingChartBuilder {
|
||||||
private AccountingClientStateData accountingStateData;
|
private AccountingClientStateData accountingStateData;
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
|
||||||
public AccountingChart4Job(EventBus eventBus,
|
public AccountingChart4Job(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||||
AccountingClientStateData accountingStateData) {
|
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.accountingStateData = accountingStateData;
|
this.accountingStateData = accountingStateData;
|
||||||
}
|
}
|
||||||
|
@ -32,10 +30,8 @@ public class AccountingChart4Job extends AccountingChartBuilder {
|
||||||
public void buildChart() throws ChartDrawException {
|
public void buildChart() throws ChartDrawException {
|
||||||
AccountingChartPanel accountingChartPanel = null;
|
AccountingChartPanel accountingChartPanel = null;
|
||||||
|
|
||||||
if (accountingStateData == null
|
if (accountingStateData == null || accountingStateData.getAccountingType() == null
|
||||||
|| accountingStateData.getAccountingType() == null
|
|| accountingStateData.getSeriesRequest() == null || accountingStateData.getSeriesResponse() == null) {
|
||||||
|| accountingStateData.getSeriesRequest() == null
|
|
||||||
|| accountingStateData.getSeriesResponse() == null) {
|
|
||||||
accountingChartSpec.setChart(accountingChartPanel);
|
accountingChartSpec.setChart(accountingChartPanel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,25 +51,18 @@ public class AccountingChart4Job extends AccountingChartBuilder {
|
||||||
|
|
||||||
private SimpleContainer createJobChartPanel() throws ChartDrawException {
|
private SimpleContainer createJobChartPanel() throws ChartDrawException {
|
||||||
|
|
||||||
if (accountingStateData == null
|
if (accountingStateData == null || accountingStateData.getSeriesRequest() == null
|
||||||
|| accountingStateData.getSeriesRequest() == null
|
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition() == null
|
||||||
|| accountingStateData.getSeriesRequest()
|
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType() == null) {
|
||||||
.getAccountingFilterDefinition() == null
|
|
||||||
|| accountingStateData.getSeriesRequest()
|
|
||||||
.getAccountingFilterDefinition().getChartType() == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (accountingStateData.getSeriesRequest()
|
switch (accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType()) {
|
||||||
.getAccountingFilterDefinition().getChartType()) {
|
|
||||||
|
|
||||||
case Top:
|
case Top:
|
||||||
return new JobChartTopPanel(eventBus, accountingStateData);
|
return new JobChartTopPanel(eventBus, accountingStateData);
|
||||||
case Basic:
|
case Basic:
|
||||||
return new JobChartBasicPanel(eventBus, accountingStateData);
|
return new JobChartBasicPanel(eventBus, accountingStateData);
|
||||||
case Context:
|
|
||||||
return new JobChartContextPanel(eventBus, accountingStateData);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
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.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.maindata.charts.service.ServiceChartTopPanel;
|
||||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
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
|
* Accounting Chart 4 Service
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccountingChart4Service extends AccountingChartBuilder {
|
public class AccountingChart4Service extends AccountingChartBuilder {
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private AccountingClientStateData accountingStateData;
|
private AccountingClientStateData accountingStateData;
|
||||||
|
|
||||||
|
|
||||||
public AccountingChart4Service(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
public AccountingChart4Service(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||||
this.eventBus=eventBus;
|
this.eventBus = eventBus;
|
||||||
this.accountingStateData = accountingStateData;
|
this.accountingStateData = accountingStateData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,10 +29,8 @@ public class AccountingChart4Service extends AccountingChartBuilder {
|
||||||
public void buildChart() throws ChartDrawException {
|
public void buildChart() throws ChartDrawException {
|
||||||
AccountingChartPanel accountingChartPanel = null;
|
AccountingChartPanel accountingChartPanel = null;
|
||||||
|
|
||||||
if (accountingStateData == null
|
if (accountingStateData == null || accountingStateData.getAccountingType() == null
|
||||||
|| accountingStateData.getAccountingType() == null
|
|| accountingStateData.getSeriesRequest() == null || accountingStateData.getSeriesResponse() == null) {
|
||||||
|| accountingStateData.getSeriesRequest() == null
|
|
||||||
|| accountingStateData.getSeriesResponse() == null) {
|
|
||||||
accountingChartSpec.setChart(accountingChartPanel);
|
accountingChartSpec.setChart(accountingChartPanel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -52,28 +48,20 @@ public class AccountingChart4Service extends AccountingChartBuilder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SimpleContainer createServiceChartPanel()
|
private SimpleContainer createServiceChartPanel() throws ChartDrawException {
|
||||||
throws ChartDrawException {
|
|
||||||
|
|
||||||
if (accountingStateData == null
|
if (accountingStateData == null || accountingStateData.getSeriesRequest() == null
|
||||||
|| accountingStateData.getSeriesRequest() == null
|
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition() == null
|
||||||
|| accountingStateData.getSeriesRequest()
|
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType() == null) {
|
||||||
.getAccountingFilterDefinition() == null
|
|
||||||
|| accountingStateData.getSeriesRequest()
|
|
||||||
.getAccountingFilterDefinition().getChartType() == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (accountingStateData.getSeriesRequest()
|
switch (accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType()) {
|
||||||
.getAccountingFilterDefinition().getChartType()) {
|
|
||||||
|
|
||||||
case Top:
|
case Top:
|
||||||
return new ServiceChartTopPanel(eventBus,accountingStateData);
|
return new ServiceChartTopPanel(eventBus, accountingStateData);
|
||||||
case Basic:
|
case Basic:
|
||||||
return new ServiceChartBasicPanel(eventBus, accountingStateData);
|
return new ServiceChartBasicPanel(eventBus, accountingStateData);
|
||||||
case Context:
|
|
||||||
return new ServiceChartContextPanel(eventBus, accountingStateData);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
|
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.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.maindata.charts.storage.StorageChartTopPanel;
|
||||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
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
|
* Accounting Chart 4 Storage
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -21,8 +20,7 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private AccountingClientStateData accountingStateData;
|
private AccountingClientStateData accountingStateData;
|
||||||
|
|
||||||
public AccountingChart4Storage(EventBus eventBus,
|
public AccountingChart4Storage(EventBus eventBus, AccountingClientStateData accountingStateData) {
|
||||||
AccountingClientStateData accountingStateData) {
|
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.accountingStateData = accountingStateData;
|
this.accountingStateData = accountingStateData;
|
||||||
}
|
}
|
||||||
|
@ -31,10 +29,8 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
|
||||||
public void buildChart() throws ChartDrawException {
|
public void buildChart() throws ChartDrawException {
|
||||||
AccountingChartPanel accountingChartPanel = null;
|
AccountingChartPanel accountingChartPanel = null;
|
||||||
|
|
||||||
if (accountingStateData == null
|
if (accountingStateData == null || accountingStateData.getAccountingType() == null
|
||||||
|| accountingStateData.getAccountingType() == null
|
|| accountingStateData.getSeriesRequest() == null || accountingStateData.getSeriesResponse() == null) {
|
||||||
|| accountingStateData.getSeriesRequest() == null
|
|
||||||
|| accountingStateData.getSeriesResponse() == null) {
|
|
||||||
accountingChartSpec.setChart(accountingChartPanel);
|
accountingChartSpec.setChart(accountingChartPanel);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -54,25 +50,18 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
|
||||||
|
|
||||||
private SimpleContainer createStorageChartPanel() throws ChartDrawException {
|
private SimpleContainer createStorageChartPanel() throws ChartDrawException {
|
||||||
|
|
||||||
if (accountingStateData == null
|
if (accountingStateData == null || accountingStateData.getSeriesRequest() == null
|
||||||
|| accountingStateData.getSeriesRequest() == null
|
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition() == null
|
||||||
|| accountingStateData.getSeriesRequest()
|
|| accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType() == null) {
|
||||||
.getAccountingFilterDefinition() == null
|
|
||||||
|| accountingStateData.getSeriesRequest()
|
|
||||||
.getAccountingFilterDefinition().getChartType() == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (accountingStateData.getSeriesRequest()
|
switch (accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType()) {
|
||||||
.getAccountingFilterDefinition().getChartType()) {
|
|
||||||
|
|
||||||
case Top:
|
case Top:
|
||||||
return new StorageChartTopPanel(eventBus, accountingStateData);
|
return new StorageChartTopPanel(eventBus, accountingStateData);
|
||||||
case Basic:
|
case Basic:
|
||||||
return new StorageChartBasicPanel(eventBus, accountingStateData);
|
return new StorageChartBasicPanel(eventBus, accountingStateData);
|
||||||
case Context:
|
|
||||||
return new StorageChartContextPanel(eventBus, accountingStateData);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -9,8 +9,7 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author giancarlo
|
* @author Giancarlo Panichi
|
||||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface AccountingFilterProperties extends
|
public interface AccountingFilterProperties extends
|
||||||
|
|
|
@ -9,12 +9,10 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author giancarlo
|
* @author Giancarlo Panichi
|
||||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface AccountingPeriodModePropertiesCombo extends
|
public interface AccountingPeriodModePropertiesCombo extends PropertyAccess<AccountingPeriodMode> {
|
||||||
PropertyAccess<AccountingPeriodMode> {
|
|
||||||
|
|
||||||
@Path("id")
|
@Path("id")
|
||||||
ModelKeyProvider<AccountingPeriodMode> id();
|
ModelKeyProvider<AccountingPeriodMode> id();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.portlets.admin.accountingmanager.client.properties;
|
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.google.gwt.editor.client.Editor.Path;
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
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> {
|
public interface ContextDataProperties extends PropertyAccess<ContextData> {
|
||||||
@Path("genre")
|
|
||||||
ModelKeyProvider<GenresData> id();
|
|
||||||
|
|
||||||
ValueProvider<GenresData, String> label();
|
@Path("contextData")
|
||||||
|
ModelKeyProvider<ContextData> id();
|
||||||
|
|
||||||
|
ValueProvider<ContextData, String> label();
|
||||||
}
|
}
|
|
@ -3,11 +3,10 @@ package org.gcube.portlets.admin.accountingmanager.server.amservice;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandBasic;
|
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.AccountingCommandGetFilterKeys;
|
||||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.command.AccountingCommandGetFilterValues;
|
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.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.command.AccountingCommandTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery;
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery;
|
||||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuery4Job;
|
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.AccountingQuery4Task;
|
||||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQueryBasic;
|
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.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.AccountingQueryDirector;
|
||||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuerySpaces;
|
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.server.amservice.query.AccountingQueryTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
|
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.FilterKey;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesRequest;
|
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.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.query.SeriesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
|
@ -102,11 +100,6 @@ public class AccountingCaller implements AccountingCallerInterface {
|
||||||
AccountingCommandTop accountingCommandTop = new AccountingCommandTop(
|
AccountingCommandTop accountingCommandTop = new AccountingCommandTop(
|
||||||
accountingQueryTop, accountingType);
|
accountingQueryTop, accountingType);
|
||||||
return accountingCommandTop.execute();
|
return accountingCommandTop.execute();
|
||||||
case Context:
|
|
||||||
AccountingQueryContext accountingQueryContext = (AccountingQueryContext) query;
|
|
||||||
AccountingCommandContext accountingCommandContext = new AccountingCommandContext(
|
|
||||||
accountingQueryContext, accountingType);
|
|
||||||
return accountingCommandContext.execute();
|
|
||||||
case Spaces:
|
case Spaces:
|
||||||
AccountingQuerySpaces accountingQuerySpace = (AccountingQuerySpaces) query;
|
AccountingQuerySpaces accountingQuerySpace = (AccountingQuerySpaces) query;
|
||||||
AccountingCommandSpaces accountingCommandSpace = new AccountingCommandSpaces(
|
AccountingCommandSpaces accountingCommandSpace = new AccountingCommandSpaces(
|
||||||
|
|
|
@ -12,12 +12,11 @@ import java.util.List;
|
||||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
|
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.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.FilterKey;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
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.FilterValuesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesResponse;
|
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.query.SeriesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
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.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.SeriesSpace;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
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.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.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.SeriesJobDataTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDefinition;
|
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.job.SeriesJobTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceBasic;
|
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.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.SeriesServiceDataTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDefinition;
|
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.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.SeriesSpaceData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.space.SeriesSpaceDataSpaces;
|
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.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.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.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.SeriesStorageDataTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDefinition;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDefinition;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageTop;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageTop;
|
||||||
|
@ -229,26 +222,6 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
||||||
accountingFilterTop.getTopNumber(),
|
accountingFilterTop.getTopNumber(),
|
||||||
seriesJobDataTopList);
|
seriesJobDataTopList);
|
||||||
break;
|
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);
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -407,25 +380,6 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
||||||
accountingFilterTop.getTopNumber(),
|
accountingFilterTop.getTopNumber(),
|
||||||
seriesServiceDataTopList);
|
seriesServiceDataTopList);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -479,8 +433,6 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
||||||
.getChartType()) {
|
.getChartType()) {
|
||||||
case Basic:
|
case Basic:
|
||||||
case Top:
|
case Top:
|
||||||
case Context:
|
|
||||||
break;
|
|
||||||
case Spaces:
|
case Spaces:
|
||||||
// AccountingFilterContext accountingFilterContext =
|
// AccountingFilterContext accountingFilterContext =
|
||||||
// (AccountingFilterContext) seriesRequest
|
// (AccountingFilterContext) seriesRequest
|
||||||
|
@ -576,27 +528,6 @@ public class AccountingCallerTester implements AccountingCallerInterface {
|
||||||
accountingFilterTop.getTopNumber(),
|
accountingFilterTop.getTopNumber(),
|
||||||
seriesStorageDataTopList);
|
seriesStorageDataTopList);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
|
@ -43,27 +44,31 @@ public class AccountingCommandBasic implements AccountingCommand<SeriesResponse>
|
||||||
public SeriesResponse execute() throws ServiceException {
|
public SeriesResponse execute() throws ServiceException {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (accountingQueryBasic.getScope() != null && !accountingQueryBasic.getScope().isEmpty()) {
|
//if (accountingQueryBasic.getScope() != null) {
|
||||||
AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryBasic.getScope());
|
// AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryBasic.getScope());
|
||||||
}
|
//}
|
||||||
|
|
||||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||||
|
|
||||||
SortedMap<Calendar, Info> sm = null;
|
SortedMap<Calendar, Info> sm = null;
|
||||||
if (accountingQueryBasic.isNoContext()) {
|
logger.debug("Execute Basic()");
|
||||||
logger.debug("Execute NoContextTimeSeries()");
|
apq.setRequestedRecords(accountingQueryBasic.getType());
|
||||||
sm = apq.getNoContextTimeSeries(accountingQueryBasic.getType(),
|
HashSet<String> ctx=null;
|
||||||
accountingQueryBasic.getTemporalConstraint(), accountingQueryBasic.getFilters(), true);
|
if(accountingQueryBasic.getContext()!=null&&accountingQueryBasic.getContext().getContexts()!=null
|
||||||
} else {
|
&&!accountingQueryBasic.getContext().getContexts().isEmpty()){
|
||||||
logger.debug("Execute TimeSeries()");
|
ctx=new HashSet<String>(accountingQueryBasic.getContext().getContexts());
|
||||||
sm = apq.getTimeSeries(accountingQueryBasic.getType(), accountingQueryBasic.getTemporalConstraint(),
|
|
||||||
accountingQueryBasic.getFilters(), true);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
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()) {
|
//if (accountingQueryBasic.getScope() != null) {
|
||||||
AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
// AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (sm == null || sm.values() == null) {
|
if (sm == null || sm.values() == null) {
|
||||||
throw new ServiceException("Error retrieving info: sorted map is null!");
|
throw new ServiceException("Error retrieving info: sorted map is null!");
|
||||||
|
|
|
@ -27,19 +27,16 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccountingCommandGetFilterValues implements
|
public class AccountingCommandGetFilterValues implements AccountingCommand<FilterValuesResponse> {
|
||||||
AccountingCommand<FilterValuesResponse> {
|
private static final Logger logger = LoggerFactory.getLogger(AccountingCommandGetFilterValues.class);
|
||||||
private static final Logger logger = LoggerFactory
|
|
||||||
.getLogger(AccountingCommandGetFilterValues.class);
|
|
||||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMMMM dd");
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy MMMMM dd");
|
||||||
private FilterValuesRequest filterValuesRequest;
|
private FilterValuesRequest filterValuesRequest;
|
||||||
|
|
||||||
public AccountingCommandGetFilterValues(
|
public AccountingCommandGetFilterValues(FilterValuesRequest filterValuesRequest) {
|
||||||
FilterValuesRequest filterValuesRequest) {
|
|
||||||
this.filterValuesRequest = filterValuesRequest;
|
this.filterValuesRequest = filterValuesRequest;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,14 +44,11 @@ public class AccountingCommandGetFilterValues implements
|
||||||
@Override
|
@Override
|
||||||
public FilterValuesResponse execute() throws ServiceException {
|
public FilterValuesResponse execute() throws ServiceException {
|
||||||
try {
|
try {
|
||||||
logger.debug("getFilterValue(): [FilterValueRequest="
|
logger.debug("getFilterValue(): [FilterValueRequest=" + filterValuesRequest + "]");
|
||||||
+ filterValuesRequest + "]");
|
|
||||||
FilterValuesResponse filterValuesResponse = null;
|
FilterValuesResponse filterValuesResponse = null;
|
||||||
if (filterValuesRequest == null
|
if (filterValuesRequest == null || filterValuesRequest.getAccountingType() == null
|
||||||
|| filterValuesRequest.getAccountingType() == null
|
|
||||||
|| filterValuesRequest.getFilterKey() == null) {
|
|| filterValuesRequest.getFilterKey() == null) {
|
||||||
filterValuesResponse = new FilterValuesResponse(
|
filterValuesResponse = new FilterValuesResponse(new ArrayList<FilterValue>());
|
||||||
new ArrayList<FilterValue>());
|
|
||||||
return filterValuesResponse;
|
return filterValuesResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,24 +56,19 @@ public class AccountingCommandGetFilterValues implements
|
||||||
|
|
||||||
Set<NumberedFilter> values;
|
Set<NumberedFilter> values;
|
||||||
|
|
||||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||||
.getInstance();
|
|
||||||
|
|
||||||
Calendar startCalendar = GregorianCalendar
|
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
|
||||||
try {
|
try {
|
||||||
startCalendar.setTime(sdf.parse(filterValuesRequest
|
startCalendar.setTime(sdf.parse(filterValuesRequest.getAccountingPeriod().getStartDate()));
|
||||||
.getAccountingPeriod().getStartDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException("Start Date not valid!");
|
throw new ServiceException("Start Date not valid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Calendar endCalendar = GregorianCalendar
|
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
|
||||||
try {
|
try {
|
||||||
endCalendar.setTime(sdf.parse(filterValuesRequest
|
endCalendar.setTime(sdf.parse(filterValuesRequest.getAccountingPeriod().getEndDate()));
|
||||||
.getAccountingPeriod().getEndDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException("End Date not valid!");
|
throw new ServiceException("End Date not valid!");
|
||||||
|
@ -90,19 +79,18 @@ public class AccountingCommandGetFilterValues implements
|
||||||
endCalendar.set(GregorianCalendar.SECOND, 59);
|
endCalendar.set(GregorianCalendar.SECOND, 59);
|
||||||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||||
|
|
||||||
TemporalConstraint tc = new TemporalConstraint(
|
TemporalConstraint tc = new TemporalConstraint(startCalendar.getTimeInMillis(),
|
||||||
startCalendar.getTimeInMillis(),
|
|
||||||
endCalendar.getTimeInMillis(),
|
endCalendar.getTimeInMillis(),
|
||||||
PeriodModeMap.getMode(filterValuesRequest
|
PeriodModeMap.getMode(filterValuesRequest.getAccountingPeriod().getPeriod()));
|
||||||
.getAccountingPeriod().getPeriod()));
|
|
||||||
|
|
||||||
List<Filter> filters = new ArrayList<>();
|
List<Filter> filters = new ArrayList<>();
|
||||||
|
|
||||||
switch (filterValuesRequest.getAccountingType()) {
|
switch (filterValuesRequest.getAccountingType()) {
|
||||||
case JOB:
|
case JOB:
|
||||||
values = apq.getFilterValues(AggregatedJobUsageRecord.class,
|
apq.setRequestedRecords(AggregatedJobUsageRecord.class);
|
||||||
tc, filters, filterValuesRequest.getFilterKey()
|
apq.setTemporalConstraint(tc);
|
||||||
.getKey());
|
apq.setFilters(filters);
|
||||||
|
values = apq.getFilterValues(filterValuesRequest.getFilterKey().getKey());
|
||||||
break;
|
break;
|
||||||
case PORTLET:
|
case PORTLET:
|
||||||
// values = rrq.getPossibleValuesForKey(
|
// values = rrq.getPossibleValuesForKey(
|
||||||
|
@ -111,14 +99,16 @@ public class AccountingCommandGetFilterValues implements
|
||||||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||||
return filterValuesResponse;
|
return filterValuesResponse;
|
||||||
case SERVICE:
|
case SERVICE:
|
||||||
values = apq.getFilterValues(
|
apq.setRequestedRecords(AggregatedServiceUsageRecord.class);
|
||||||
AggregatedServiceUsageRecord.class, tc, filters,
|
apq.setTemporalConstraint(tc);
|
||||||
filterValuesRequest.getFilterKey().getKey());
|
apq.setFilters(filters);
|
||||||
|
values = apq.getFilterValues(filterValuesRequest.getFilterKey().getKey());
|
||||||
break;
|
break;
|
||||||
case STORAGE:
|
case STORAGE:
|
||||||
values = apq.getFilterValues(
|
apq.setRequestedRecords(AggregatedStorageUsageRecord.class);
|
||||||
AggregatedStorageUsageRecord.class, tc, filters,
|
apq.setTemporalConstraint(tc);
|
||||||
filterValuesRequest.getFilterKey().getKey());
|
apq.setFilters(filters);
|
||||||
|
values = apq.getFilterValues(filterValuesRequest.getFilterKey().getKey());
|
||||||
break;
|
break;
|
||||||
case TASK:
|
case TASK:
|
||||||
// values = rrq.getPossibleValuesForKey(
|
// values = rrq.getPossibleValuesForKey(
|
||||||
|
@ -127,9 +117,10 @@ public class AccountingCommandGetFilterValues implements
|
||||||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||||
return filterValuesResponse;
|
return filterValuesResponse;
|
||||||
case SPACE:
|
case SPACE:
|
||||||
values = apq.getFilterValues(
|
apq.setRequestedRecords(AggregatedStorageStatusRecord.class);
|
||||||
AggregatedStorageStatusRecord.class, tc, filters,
|
apq.setTemporalConstraint(tc);
|
||||||
filterValuesRequest.getFilterKey().getKey());
|
apq.setFilters(filters);
|
||||||
|
values = apq.getFilterValues(filterValuesRequest.getFilterKey().getKey());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||||
|
@ -145,8 +136,7 @@ public class AccountingCommandGetFilterValues implements
|
||||||
filterValuesResponse = new FilterValuesResponse(filterValues);
|
filterValuesResponse = new FilterValuesResponse(filterValues);
|
||||||
return filterValuesResponse;
|
return filterValuesResponse;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Error in AccountingCommandGetFilterValues(): "
|
logger.error("Error in AccountingCommandGetFilterValues(): " + e.getLocalizedMessage());
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException("No values available!");
|
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.ArrayList;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
|
import org.gcube.accounting.analytics.NumberedFilter;
|
||||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
||||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
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.data.Spaces;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -26,10 +28,14 @@ public class AccountingCommandGetSpaces implements AccountingCommand<Spaces> {
|
||||||
public Spaces execute() throws ServiceException {
|
public Spaces execute() throws ServiceException {
|
||||||
try {
|
try {
|
||||||
logger.debug("getSpaces()");
|
logger.debug("getSpaces()");
|
||||||
SortedSet<String> keys = null;
|
SortedSet<NumberedFilter> keys = null;
|
||||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
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);
|
logger.debug("AccountingPersistenceQuery.getSpaces: " + keys);
|
||||||
ArrayList<String> spaceList = new ArrayList<>();
|
ArrayList<String> spaceList = new ArrayList<>();
|
||||||
|
@ -37,9 +43,9 @@ public class AccountingCommandGetSpaces implements AccountingCommand<Spaces> {
|
||||||
if (keys == null || keys.isEmpty()) {
|
if (keys == null || keys.isEmpty()) {
|
||||||
logger.error("Spaces have not keys: {}", keys);
|
logger.error("Spaces have not keys: {}", keys);
|
||||||
} else {
|
} else {
|
||||||
for (String key : keys) {
|
for (NumberedFilter key : keys) {
|
||||||
if (key != null && !key.isEmpty()) {
|
if (key != null ) {
|
||||||
spaceList.add(key);
|
spaceList.add(key.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
import org.gcube.accounting.analytics.Filter;
|
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.AccountingPersistenceQuery;
|
||||||
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
import org.gcube.accounting.analytics.persistence.AccountingPersistenceQueryFactory;
|
||||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuerySpaces;
|
import org.gcube.portlets.admin.accountingmanager.server.amservice.query.AccountingQuerySpaces;
|
||||||
|
@ -46,7 +48,7 @@ public class AccountingCommandSpaces implements
|
||||||
|
|
||||||
logger.debug("Query Spaces: " + accountingQuerySpaces.getSpaces());
|
logger.debug("Query Spaces: " + accountingQuerySpaces.getSpaces());
|
||||||
|
|
||||||
SortedMap<Filter, SortedMap<Calendar, Long>> spaceSM;
|
SortedMap<Filter, SortedMap<Calendar, Info>> spaceSM;
|
||||||
|
|
||||||
Spaces spaces = accountingQuerySpaces.getSpaces();
|
Spaces spaces = accountingQuerySpaces.getSpaces();
|
||||||
|
|
||||||
|
@ -54,10 +56,16 @@ public class AccountingCommandSpaces implements
|
||||||
throw new ServiceException(
|
throw new ServiceException(
|
||||||
"Error retrieving Spaces param: null!");
|
"Error retrieving Spaces param: null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
spaceSM = apq.getSpaceTimeSeries(accountingQuerySpaces.getType(),
|
apq.setRequestedRecords(accountingQuerySpaces.getType());
|
||||||
accountingQuerySpaces.getTemporalConstraint(),
|
apq.setTemporalConstraint(accountingQuerySpaces.getTemporalConstraint());
|
||||||
accountingQuerySpaces.getFilters(), spaces.getSpacesList());
|
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) {
|
if (spaceSM == null) {
|
||||||
throw new ServiceException(
|
throw new ServiceException(
|
||||||
|
@ -93,7 +101,7 @@ public class AccountingCommandSpaces implements
|
||||||
|
|
||||||
private SeriesResponseBuilder getSeriesResponseBuilder(
|
private SeriesResponseBuilder getSeriesResponseBuilder(
|
||||||
AccountingType accountingType, Spaces spaces,
|
AccountingType accountingType, Spaces spaces,
|
||||||
SortedMap<Filter, SortedMap<Calendar, Long>> spaceSM)
|
SortedMap<Filter, SortedMap<Calendar, Info>> spaceSM)
|
||||||
throws ServiceException {
|
throws ServiceException {
|
||||||
if (accountingType == null) {
|
if (accountingType == null) {
|
||||||
throw new ServiceException("Error accounting type is null");
|
throw new ServiceException("Error accounting type is null");
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
package org.gcube.portlets.admin.accountingmanager.server.amservice.command;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
import org.gcube.accounting.analytics.Info;
|
import org.gcube.accounting.analytics.Info;
|
||||||
|
@ -42,28 +43,38 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
||||||
public SeriesResponse execute() throws ServiceException {
|
public SeriesResponse execute() throws ServiceException {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
|
//if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
|
||||||
AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryTop.getScope());
|
// AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryTop.getScope());
|
||||||
}
|
//}
|
||||||
|
|
||||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||||
|
|
||||||
logger.debug("Query TopValues: " + accountingQueryTop.getFilterKey().getKey());
|
logger.debug("Query TopValues: " + accountingQueryTop.getFilterKey().getKey());
|
||||||
|
|
||||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||||
|
|
||||||
|
logger.debug("Execute Top()");
|
||||||
|
apq.setRequestedRecords(accountingQueryTop.getType());
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
if (accountingQueryTop.getShowOthers()) {
|
if (accountingQueryTop.getShowOthers()) {
|
||||||
topSM = apq.getTopValues(accountingQueryTop.getType(), accountingQueryTop.getTemporalConstraint(),
|
topSM = apq.getTopValues(accountingQueryTop.getFilterKey().getKey(), null, true, 0);
|
||||||
accountingQueryTop.getFilters(), accountingQueryTop.getFilterKey().getKey(), null, true, 0);
|
|
||||||
} else {
|
} else {
|
||||||
topSM = apq.getTopValues(accountingQueryTop.getType(), accountingQueryTop.getTemporalConstraint(),
|
topSM = apq.getTopValues(accountingQueryTop.getFilterKey().getKey(), null, true,
|
||||||
accountingQueryTop.getFilters(), accountingQueryTop.getFilterKey().getKey(), null, true,
|
|
||||||
accountingQueryTop.getTopNumber());
|
accountingQueryTop.getTopNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
|
//if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
|
||||||
AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
// AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (topSM == null) {
|
if (topSM == null) {
|
||||||
throw new ServiceException("Error retrieving info for top: sorted map is null!");
|
throw new ServiceException("Error retrieving info for top: sorted map is null!");
|
||||||
|
|
|
@ -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.server.amservice.PeriodModeMap;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
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.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.AccountingFilterTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
|
@ -77,8 +76,8 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
||||||
filters.add(filter);
|
filters.add(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invocation = new AccountingQueryBasic(AggregatedJobUsageRecord.class, accountingFilterBasic.getScope(),
|
invocation = new AccountingQueryBasic(AggregatedJobUsageRecord.class,
|
||||||
accountingFilterBasic.isNoContext(), temporalConstraint, filters);
|
accountingFilterBasic.getContext(), temporalConstraint, filters);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||||
|
@ -93,28 +92,12 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
||||||
filters.add(filter);
|
filters.add(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invocation = new AccountingQueryTop(AggregatedJobUsageRecord.class, accountingFilterTop.getScope(),
|
invocation = new AccountingQueryTop(AggregatedJobUsageRecord.class, accountingFilterTop.getContext(),
|
||||||
accountingFilterTop.getFilterKey(), accountingFilterTop.getShowOthers(),
|
accountingFilterTop.getFilterKey(), accountingFilterTop.getShowOthers(),
|
||||||
accountingFilterTop.getTopNumber(), temporalConstraint, filters);
|
accountingFilterTop.getTopNumber(), temporalConstraint, filters);
|
||||||
} else {
|
} 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);
|
logger.error("Invalid Request: " + seriesRequest);
|
||||||
throw new ServiceException("Invalid Request!");
|
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.server.amservice.PeriodModeMap;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
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.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.AccountingFilterTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
|
@ -77,8 +76,7 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invocation = new AccountingQueryBasic(AggregatedPortletUsageRecord.class,
|
invocation = new AccountingQueryBasic(AggregatedPortletUsageRecord.class,
|
||||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
accountingFilterBasic.getContext(), temporalConstraint, filters);
|
||||||
filters);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||||
|
@ -94,28 +92,12 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invocation = new AccountingQueryTop(AggregatedPortletUsageRecord.class,
|
invocation = new AccountingQueryTop(AggregatedPortletUsageRecord.class,
|
||||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
accountingFilterTop.getContext(), accountingFilterTop.getFilterKey(),
|
||||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||||
filters);
|
filters);
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
logger.error("Invalid Request: " + seriesRequest);
|
||||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
throw new ServiceException("Invalid Request!");
|
||||||
.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!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.server.amservice.PeriodModeMap;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
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.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.AccountingFilterTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
|
@ -78,8 +77,7 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invocation = new AccountingQueryBasic(AggregatedServiceUsageRecord.class,
|
invocation = new AccountingQueryBasic(AggregatedServiceUsageRecord.class,
|
||||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
accountingFilterBasic.getContext(), temporalConstraint, filters);
|
||||||
filters);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||||
|
@ -95,28 +93,12 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invocation = new AccountingQueryTop(AggregatedServiceUsageRecord.class,
|
invocation = new AccountingQueryTop(AggregatedServiceUsageRecord.class,
|
||||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
accountingFilterTop.getContext(), accountingFilterTop.getFilterKey(),
|
||||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||||
filters);
|
filters);
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
logger.error("Invalid Request: " + seriesRequest);
|
||||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
throw new ServiceException("Invalid Request!");
|
||||||
.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!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.server.amservice.PeriodModeMap;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
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.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.AccountingFilterTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
|
@ -78,8 +77,7 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invocation = new AccountingQueryBasic(AggregatedStorageUsageRecord.class,
|
invocation = new AccountingQueryBasic(AggregatedStorageUsageRecord.class,
|
||||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
accountingFilterBasic.getContext(), temporalConstraint, filters);
|
||||||
filters);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||||
|
@ -95,28 +93,12 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
invocation = new AccountingQueryTop(AggregatedStorageUsageRecord.class,
|
invocation = new AccountingQueryTop(AggregatedStorageUsageRecord.class,
|
||||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
accountingFilterTop.getContext(), accountingFilterTop.getFilterKey(),
|
||||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||||
filters);
|
filters);
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
logger.error("Invalid Request: " + seriesRequest);
|
||||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
throw new ServiceException("Invalid Request!");
|
||||||
.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!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,9 @@ import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import org.gcube.accounting.analytics.Filter;
|
import org.gcube.accounting.analytics.Filter;
|
||||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
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.server.amservice.PeriodModeMap;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
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.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.AccountingFilterTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
|
@ -21,13 +19,12 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* Accounting Query 4 Task
|
* Accounting Query 4 Task
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccountingQuery4Task extends AccountingQueryBuilder {
|
public class AccountingQuery4Task extends AccountingQueryBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Task.class);
|
||||||
.getLogger(AccountingQuery4Task.class);
|
|
||||||
private SeriesRequest seriesRequest;
|
private SeriesRequest seriesRequest;
|
||||||
|
|
||||||
public AccountingQuery4Task(SeriesRequest seriesRequest) {
|
public AccountingQuery4Task(SeriesRequest seriesRequest) {
|
||||||
|
@ -36,21 +33,17 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildOpEx() throws ServiceException {
|
public void buildOpEx() throws ServiceException {
|
||||||
Calendar startCalendar = GregorianCalendar
|
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
|
||||||
try {
|
try {
|
||||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||||
.getStartDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException("Start Date not valid!");
|
throw new ServiceException("Start Date not valid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Calendar endCalendar = GregorianCalendar
|
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
|
||||||
try {
|
try {
|
||||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||||
.getEndDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException("End Date not valid!");
|
throw new ServiceException("End Date not valid!");
|
||||||
|
@ -62,17 +55,14 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
||||||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
TemporalConstraint temporalConstraint = new TemporalConstraint(startCalendar.getTimeInMillis(),
|
||||||
startCalendar.getTimeInMillis(), endCalendar.getTimeInMillis(),
|
endCalendar.getTimeInMillis(), PeriodModeMap.getMode(seriesRequest.getAccountingPeriod().getPeriod()));
|
||||||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
|
||||||
.getPeriod()));
|
|
||||||
|
|
||||||
ArrayList<Filter> filters = null;
|
ArrayList<Filter> filters = null;
|
||||||
ArrayList<AccountingFilter> accountingFilters = null;
|
ArrayList<AccountingFilter> accountingFilters = null;
|
||||||
AccountingQuery invocation = null;
|
AccountingQuery invocation = null;
|
||||||
|
|
||||||
if (seriesRequest != null
|
if (seriesRequest != null && seriesRequest.getAccountingFilterDefinition() != null) {
|
||||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterBasic) {
|
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterBasic) {
|
||||||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||||
.getAccountingFilterDefinition();
|
.getAccountingFilterDefinition();
|
||||||
|
@ -80,16 +70,16 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
||||||
filters = new ArrayList<Filter>();
|
filters = new ArrayList<Filter>();
|
||||||
if (accountingFilters != null) {
|
if (accountingFilters != null) {
|
||||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||||
Filter filter = new Filter(accountigFilters
|
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||||
.getFilterKey().getKey(),
|
|
||||||
accountigFilters.getFilterValue());
|
accountigFilters.getFilterValue());
|
||||||
filters.add(filter);
|
filters.add(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*invocation = new AccountingQueryBasic(
|
/*
|
||||||
AggregatedTaskUsageRecord.class, temporalConstraint,
|
* invocation = new AccountingQueryBasic(
|
||||||
filters, accountingFilterBasic.isNoContext());
|
* AggregatedTaskUsageRecord.class, temporalConstraint, filters,
|
||||||
*/
|
* accountingFilterBasic.isNoContext());
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) seriesRequest
|
||||||
|
@ -98,42 +88,22 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
||||||
filters = new ArrayList<Filter>();
|
filters = new ArrayList<Filter>();
|
||||||
if (accountingFilters != null) {
|
if (accountingFilters != null) {
|
||||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||||
Filter filter = new Filter(accountigFilters
|
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||||
.getFilterKey().getKey(),
|
|
||||||
accountigFilters.getFilterValue());
|
accountigFilters.getFilterValue());
|
||||||
filters.add(filter);
|
filters.add(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*invocation = new AccountingQueryTop(
|
/*
|
||||||
AggregatedTaskUsageRecord.class,
|
* invocation = new AccountingQueryTop(
|
||||||
accountingFilterTop.getFilterKey(),
|
* AggregatedTaskUsageRecord.class,
|
||||||
accountingFilterTop.getShowOthers(),
|
* accountingFilterTop.getFilterKey(),
|
||||||
accountingFilterTop.getTopNumber(),
|
* accountingFilterTop.getShowOthers(),
|
||||||
temporalConstraint, filters);*/
|
* accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||||
|
* filters);
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
logger.error("Invalid Request: " + seriesRequest);
|
||||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
throw new ServiceException("Invalid Request!");
|
||||||
.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!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.gcube.accounting.analytics.Filter;
|
||||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
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 {
|
public class AccountingQueryBasic extends AccountingQuery {
|
||||||
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
||||||
private String scope;
|
private Context context;
|
||||||
private boolean noContext;
|
|
||||||
private TemporalConstraint temporalConstraint;
|
private TemporalConstraint temporalConstraint;
|
||||||
private ArrayList<Filter> filters;
|
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) {
|
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||||
super();
|
super();
|
||||||
chartType = ChartType.Basic;
|
chartType = ChartType.Basic;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.temporalConstraint = temporalConstraint;
|
this.temporalConstraint = temporalConstraint;
|
||||||
this.scope = scope;
|
this.context = context;
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
this.noContext = noContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<? extends AggregatedUsageRecord<?, ?>> getType() {
|
public Class<? extends AggregatedUsageRecord<?, ?>> getType() {
|
||||||
|
@ -47,12 +46,13 @@ public class AccountingQueryBasic extends AccountingQuery {
|
||||||
this.temporalConstraint = temporalConstraint;
|
this.temporalConstraint = temporalConstraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScope() {
|
|
||||||
return scope;
|
public Context getContext() {
|
||||||
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScope(String scope) {
|
public void setContext(Context context) {
|
||||||
this.scope = scope;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Filter> getFilters() {
|
public ArrayList<Filter> getFilters() {
|
||||||
|
@ -63,18 +63,10 @@ public class AccountingQueryBasic extends AccountingQuery {
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNoContext() {
|
|
||||||
return noContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoContext(boolean noContext) {
|
|
||||||
this.noContext = noContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AccountingQueryBasic [type=" + type + ", temporalConstraint=" + temporalConstraint + ", scope=" + scope
|
return "AccountingQueryBasic [type=" + type + ", context=" + context + ", temporalConstraint="
|
||||||
+ ", filters=" + filters + ", noContext=" + noContext + "]";
|
+ temporalConstraint + ", filters=" + filters + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ import org.gcube.accounting.analytics.Filter;
|
||||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
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;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,19 +17,19 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||||
*/
|
*/
|
||||||
public class AccountingQueryTop extends AccountingQuery {
|
public class AccountingQueryTop extends AccountingQuery {
|
||||||
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
||||||
private String scope;
|
private Context context;
|
||||||
private FilterKey filterKey;
|
private FilterKey filterKey;
|
||||||
private Integer topNumber;
|
private Integer topNumber;
|
||||||
private Boolean showOthers;
|
private Boolean showOthers;
|
||||||
private TemporalConstraint temporalConstraint;
|
private TemporalConstraint temporalConstraint;
|
||||||
private ArrayList<Filter> filters;
|
private ArrayList<Filter> filters;
|
||||||
|
|
||||||
public AccountingQueryTop(Class<? extends AggregatedUsageRecord<?, ?>> type, String scope, FilterKey filterKey,
|
public AccountingQueryTop(Class<? extends AggregatedUsageRecord<?, ?>> type, Context context, FilterKey filterKey,
|
||||||
Boolean showOthers, Integer topNumber, TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
Boolean showOthers, Integer topNumber, TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||||
super();
|
super();
|
||||||
chartType = ChartType.Top;
|
chartType = ChartType.Top;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.scope = scope;
|
this.context = context;
|
||||||
this.temporalConstraint = temporalConstraint;
|
this.temporalConstraint = temporalConstraint;
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
this.filterKey = filterKey;
|
this.filterKey = filterKey;
|
||||||
|
@ -43,13 +44,13 @@ public class AccountingQueryTop extends AccountingQuery {
|
||||||
public void setType(Class<? extends AggregatedUsageRecord<?, ?>> type) {
|
public void setType(Class<? extends AggregatedUsageRecord<?, ?>> type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScope() {
|
public Context getContext() {
|
||||||
return scope;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScope(String scope) {
|
public void setContext(Context context) {
|
||||||
this.scope = scope;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TemporalConstraint getTemporalConstraint() {
|
public TemporalConstraint getTemporalConstraint() {
|
||||||
|
@ -94,9 +95,10 @@ public class AccountingQueryTop extends AccountingQuery {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AccountingQueryTop [type=" + type + ", scope=" + scope + ", filterKey=" + filterKey + ", topNumber="
|
return "AccountingQueryTop [type=" + type + ", context=" + context + ", filterKey=" + filterKey + ", topNumber="
|
||||||
+ topNumber + ", showOthers=" + showOthers + ", temporalConstraint=" + temporalConstraint + ", filters="
|
+ topNumber + ", showOthers=" + showOthers + ", temporalConstraint=" + temporalConstraint + ", filters="
|
||||||
+ filters + "]";
|
+ filters + ", chartType=" + chartType + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.accounting.analytics.Info;
|
import org.gcube.accounting.analytics.Info;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
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.SeriesJob;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobBasic;
|
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.data.response.job.SeriesJobData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -39,14 +39,15 @@ public class SeriesResponse4JobBasic extends SeriesResponseBuilder {
|
||||||
|
|
||||||
ArrayList<SeriesJobData> series = new ArrayList<SeriesJobData>();
|
ArrayList<SeriesJobData> series = new ArrayList<SeriesJobData>();
|
||||||
for (Info info : infos) {
|
for (Info info : infos) {
|
||||||
JSONObject jso = info.getValue();
|
JsonNode jso = info.getValue();
|
||||||
Long duration = jso.getLong(AggregatedJobUsageRecord.DURATION);
|
|
||||||
|
Long duration = jso.get(AggregatedJobUsageRecord.DURATION).asLong();
|
||||||
Long operationCount = jso
|
Long operationCount = jso
|
||||||
.getLong(AggregatedJobUsageRecord.OPERATION_COUNT);
|
.get(AggregatedJobUsageRecord.OPERATION_COUNT).asLong();
|
||||||
Long maxInvocationTime = jso
|
Long maxInvocationTime = jso
|
||||||
.getLong(AggregatedJobUsageRecord.MAX_INVOCATION_TIME);
|
.get(AggregatedJobUsageRecord.MAX_INVOCATION_TIME).asLong();
|
||||||
Long minInvocationTime = jso
|
Long minInvocationTime = jso
|
||||||
.getLong(AggregatedJobUsageRecord.MIN_INVOCATION_TIME);
|
.get(AggregatedJobUsageRecord.MIN_INVOCATION_TIME).asLong();
|
||||||
|
|
||||||
series.add(new SeriesJobData(info.getCalendar().getTime(),
|
series.add(new SeriesJobData(info.getCalendar().getTime(),
|
||||||
operationCount, duration, maxInvocationTime,
|
operationCount, duration, maxInvocationTime,
|
||||||
|
|
|
@ -7,13 +7,13 @@ import java.util.SortedMap;
|
||||||
import org.gcube.accounting.analytics.Info;
|
import org.gcube.accounting.analytics.Info;
|
||||||
import org.gcube.accounting.analytics.NumberedFilter;
|
import org.gcube.accounting.analytics.NumberedFilter;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
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.FilterValue;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
|
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.SeriesJobData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataTop;
|
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.data.response.job.SeriesJobTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -55,15 +55,15 @@ public class SeriesResponse4JobTop extends SeriesResponseBuilder {
|
||||||
ArrayList<SeriesJobData> series = new ArrayList<>();
|
ArrayList<SeriesJobData> series = new ArrayList<>();
|
||||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||||
for (Info info : infos.values()) {
|
for (Info info : infos.values()) {
|
||||||
JSONObject jso = info.getValue();
|
JsonNode jso = info.getValue();
|
||||||
Long duration = jso
|
Long duration = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
.get(AggregatedServiceUsageRecord.DURATION).asLong();
|
||||||
Long operationCount = jso
|
Long operationCount = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
.get(AggregatedServiceUsageRecord.OPERATION_COUNT).asLong();
|
||||||
Long maxInvocationTime = jso
|
Long maxInvocationTime = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
.get(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME).asLong();
|
||||||
Long minInvocationTime = jso
|
Long minInvocationTime = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
.get(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME).asLong();
|
||||||
|
|
||||||
series.add(new SeriesJobData(info.getCalendar()
|
series.add(new SeriesJobData(info.getCalendar()
|
||||||
.getTime(), operationCount, duration,
|
.getTime(), operationCount, duration,
|
||||||
|
|
|
@ -7,13 +7,13 @@ import java.util.SortedMap;
|
||||||
import org.gcube.accounting.analytics.Info;
|
import org.gcube.accounting.analytics.Info;
|
||||||
import org.gcube.accounting.analytics.NumberedFilter;
|
import org.gcube.accounting.analytics.NumberedFilter;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedPortletUsageRecord;
|
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.FilterValue;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesPortlet;
|
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.SeriesPortletData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.portlet.SeriesPortletDataTop;
|
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.data.response.portlet.SeriesPortletTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ public class SeriesResponse4PortletTop extends SeriesResponseBuilder {
|
||||||
ArrayList<SeriesPortletData> series = new ArrayList<>();
|
ArrayList<SeriesPortletData> series = new ArrayList<>();
|
||||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||||
for (Info info : infos.values()) {
|
for (Info info : infos.values()) {
|
||||||
JSONObject jso = info.getValue();
|
JsonNode jso = info.getValue();
|
||||||
// Long duration =
|
// Long duration =
|
||||||
// jso.getLong(AggregatedPortletUsageRecord.DURATION);
|
// jso.getLong(AggregatedPortletUsageRecord.DURATION);
|
||||||
Long operationCount = jso
|
Long operationCount = jso
|
||||||
.getLong(AggregatedPortletUsageRecord.OPERATION_COUNT);
|
.get(AggregatedPortletUsageRecord.OPERATION_COUNT).asLong();
|
||||||
// Long maxInvocationTime =
|
// Long maxInvocationTime =
|
||||||
// jso.getLong(AggregatedPortletUsageRecord.MAX_INVOCATION_TIME);
|
// jso.getLong(AggregatedPortletUsageRecord.MAX_INVOCATION_TIME);
|
||||||
// Long minInvocationTime =
|
// Long minInvocationTime =
|
||||||
|
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.accounting.analytics.Info;
|
import org.gcube.accounting.analytics.Info;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
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.SeriesService;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceBasic;
|
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.data.response.service.SeriesServiceData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -39,15 +39,15 @@ public class SeriesResponse4ServiceBasic extends SeriesResponseBuilder {
|
||||||
|
|
||||||
ArrayList<SeriesServiceData> series = new ArrayList<SeriesServiceData>();
|
ArrayList<SeriesServiceData> series = new ArrayList<SeriesServiceData>();
|
||||||
for (Info info : infos) {
|
for (Info info : infos) {
|
||||||
JSONObject jso = info.getValue();
|
JsonNode jso = info.getValue();
|
||||||
Long duration = jso
|
Long duration = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
.get(AggregatedServiceUsageRecord.DURATION).asLong();
|
||||||
Long operationCount = jso
|
Long operationCount = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
.get(AggregatedServiceUsageRecord.OPERATION_COUNT).asLong();
|
||||||
Long maxInvocationTime = jso
|
Long maxInvocationTime = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
.get(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME).asLong();
|
||||||
Long minInvocationTime = jso
|
Long minInvocationTime = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
.get(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME).asLong();
|
||||||
|
|
||||||
series.add(new SeriesServiceData(info.getCalendar().getTime(),
|
series.add(new SeriesServiceData(info.getCalendar().getTime(),
|
||||||
operationCount, duration, maxInvocationTime,
|
operationCount, duration, maxInvocationTime,
|
||||||
|
|
|
@ -7,13 +7,13 @@ import java.util.SortedMap;
|
||||||
import org.gcube.accounting.analytics.Info;
|
import org.gcube.accounting.analytics.Info;
|
||||||
import org.gcube.accounting.analytics.NumberedFilter;
|
import org.gcube.accounting.analytics.NumberedFilter;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
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.FilterValue;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
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.SeriesServiceData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataTop;
|
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.data.response.service.SeriesServiceTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -53,15 +53,15 @@ public class SeriesResponse4ServiceTop extends SeriesResponseBuilder {
|
||||||
ArrayList<SeriesServiceData> series = new ArrayList<>();
|
ArrayList<SeriesServiceData> series = new ArrayList<>();
|
||||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||||
for (Info info : infos.values()) {
|
for (Info info : infos.values()) {
|
||||||
JSONObject jso = info.getValue();
|
JsonNode jso = info.getValue();
|
||||||
Long duration = jso
|
Long duration = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.DURATION);
|
.get(AggregatedServiceUsageRecord.DURATION).asLong();
|
||||||
Long operationCount = jso
|
Long operationCount = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.OPERATION_COUNT);
|
.get(AggregatedServiceUsageRecord.OPERATION_COUNT).asLong();
|
||||||
Long maxInvocationTime = jso
|
Long maxInvocationTime = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME);
|
.get(AggregatedServiceUsageRecord.MAX_INVOCATION_TIME).asLong();
|
||||||
Long minInvocationTime = jso
|
Long minInvocationTime = jso
|
||||||
.getLong(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME);
|
.get(AggregatedServiceUsageRecord.MIN_INVOCATION_TIME).asLong();
|
||||||
|
|
||||||
series.add(new SeriesServiceData(info.getCalendar()
|
series.add(new SeriesServiceData(info.getCalendar()
|
||||||
.getTime(), operationCount, duration,
|
.getTime(), operationCount, duration,
|
||||||
|
|
|
@ -5,6 +5,10 @@ import java.util.Calendar;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
|
|
||||||
import org.gcube.accounting.analytics.Filter;
|
import org.gcube.accounting.analytics.Filter;
|
||||||
|
import org.gcube.accounting.analytics.Info;
|
||||||
|
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||||
|
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.Spaces;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesSpace;
|
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.SeriesSpaceSpaces;
|
||||||
|
@ -25,10 +29,10 @@ public class SeriesResponse4SpaceSpaces extends SeriesResponseBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
protected static Logger logger = LoggerFactory
|
||||||
.getLogger(SeriesResponse4SpaceSpaces.class);
|
.getLogger(SeriesResponse4SpaceSpaces.class);
|
||||||
private Spaces spaces;
|
private Spaces spaces;
|
||||||
private SortedMap<Filter, SortedMap<Calendar, Long>> spaceSM;
|
private SortedMap<Filter, SortedMap<Calendar, Info>> spaceSM;
|
||||||
|
|
||||||
public SeriesResponse4SpaceSpaces(Spaces spaces,
|
public SeriesResponse4SpaceSpaces(Spaces spaces,
|
||||||
SortedMap<Filter, SortedMap<Calendar, Long>> spaceSM) {
|
SortedMap<Filter, SortedMap<Calendar, Info>> spaceSM) {
|
||||||
this.spaces = spaces;
|
this.spaces = spaces;
|
||||||
this.spaceSM = spaceSM;
|
this.spaceSM = spaceSM;
|
||||||
}
|
}
|
||||||
|
@ -46,11 +50,13 @@ public class SeriesResponse4SpaceSpaces extends SeriesResponseBuilder {
|
||||||
for (Filter spaceValue : spaceSM.keySet()) {
|
for (Filter spaceValue : spaceSM.keySet()) {
|
||||||
|
|
||||||
ArrayList<SeriesSpaceData> series = new ArrayList<>();
|
ArrayList<SeriesSpaceData> series = new ArrayList<>();
|
||||||
SortedMap<Calendar, Long> infos = spaceSM.get(spaceValue);
|
SortedMap<Calendar, Info> infos = spaceSM.get(spaceValue);
|
||||||
for (Calendar calendar : infos.keySet()) {
|
for (Calendar calendar : infos.keySet()) {
|
||||||
Long value = infos.get(calendar);
|
Info info = infos.get(calendar);
|
||||||
if(value==null){
|
Long value=0L;
|
||||||
value=0L;
|
if(info!=null){
|
||||||
|
JsonNode jso=info.getValue();
|
||||||
|
value=jso.get(AggregatedStorageStatusRecord.DATA_VOLUME).asLong();
|
||||||
}
|
}
|
||||||
series.add(new SeriesSpaceData(calendar.getTime(), value));
|
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.analytics.Info;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
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.SeriesStorage;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageBasic;
|
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.data.response.storage.SeriesStorageData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -39,10 +39,10 @@ public class SeriesResponse4StorageBasic extends SeriesResponseBuilder {
|
||||||
|
|
||||||
ArrayList<SeriesStorageData> series=new ArrayList<SeriesStorageData>();
|
ArrayList<SeriesStorageData> series=new ArrayList<SeriesStorageData>();
|
||||||
for (Info info : infos) {
|
for (Info info : infos) {
|
||||||
JSONObject jso = info.getValue();
|
JsonNode jso = info.getValue();
|
||||||
Long dataVolume = jso.getLong(AggregatedStorageUsageRecord.DATA_VOLUME);
|
Long dataVolume = jso.get(AggregatedStorageUsageRecord.DATA_VOLUME).asLong();
|
||||||
Long operationCount = jso
|
Long operationCount = jso
|
||||||
.getLong(AggregatedStorageUsageRecord.OPERATION_COUNT);
|
.get(AggregatedStorageUsageRecord.OPERATION_COUNT).asLong();
|
||||||
series.add(new SeriesStorageData(info.getCalendar().getTime(), dataVolume, operationCount));
|
series.add(new SeriesStorageData(info.getCalendar().getTime(), dataVolume, operationCount));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,13 @@ import java.util.SortedMap;
|
||||||
import org.gcube.accounting.analytics.Info;
|
import org.gcube.accounting.analytics.Info;
|
||||||
import org.gcube.accounting.analytics.NumberedFilter;
|
import org.gcube.accounting.analytics.NumberedFilter;
|
||||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
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.FilterValue;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
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.SeriesStorageData;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataTop;
|
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.data.response.storage.SeriesStorageTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -54,11 +54,11 @@ public class SeriesResponse4StorageTop extends SeriesResponseBuilder {
|
||||||
ArrayList<SeriesStorageData> series = new ArrayList<>();
|
ArrayList<SeriesStorageData> series = new ArrayList<>();
|
||||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||||
for (Info info : infos.values()) {
|
for (Info info : infos.values()) {
|
||||||
JSONObject jso = info.getValue();
|
JsonNode jso = info.getValue();
|
||||||
Long dataVolume = jso
|
Long dataVolume = jso
|
||||||
.getLong(AggregatedStorageUsageRecord.DATA_VOLUME);
|
.get(AggregatedStorageUsageRecord.DATA_VOLUME).asLong();
|
||||||
Long operationCount = jso
|
Long operationCount = jso
|
||||||
.getLong(AggregatedStorageUsageRecord.OPERATION_COUNT);
|
.get(AggregatedStorageUsageRecord.OPERATION_COUNT).asLong();
|
||||||
series.add(new SeriesStorageData(info.getCalendar()
|
series.add(new SeriesStorageData(info.getCalendar()
|
||||||
.getTime(), dataVolume, operationCount));
|
.getTime(), dataVolume, operationCount));
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.SortedMap;
|
||||||
|
|
||||||
import org.gcube.accounting.analytics.Info;
|
import org.gcube.accounting.analytics.Info;
|
||||||
import org.gcube.accounting.analytics.NumberedFilter;
|
import org.gcube.accounting.analytics.NumberedFilter;
|
||||||
|
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||||
//import org.gcube.accounting.datamodel.aggregation.AggregatedTaskUsageRecord;
|
//import org.gcube.accounting.datamodel.aggregation.AggregatedTaskUsageRecord;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesTask;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesTask;
|
||||||
|
@ -13,7 +14,6 @@ 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.SeriesTaskDataTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskTop;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.task.SeriesTaskTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
import org.gcube.portlets.admin.accountingmanager.shared.exception.ServiceException;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class SeriesResponse4TaskTop extends SeriesResponseBuilder {
|
||||||
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
SortedMap<Calendar, Info> infos = topSM.get(topValue);
|
||||||
for (Info info : infos.values()) {
|
for (Info info : infos.values()) {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
JSONObject jso = info.getValue();
|
JsonNode jso = info.getValue();
|
||||||
// Long duration =
|
// Long duration =
|
||||||
// jso.getLong(AggregatedTaskUsageRecord.DURATION);
|
// jso.getLong(AggregatedTaskUsageRecord.DURATION);
|
||||||
//Long operationCount = jso
|
//Long operationCount = jso
|
||||||
|
|
|
@ -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.SeriesJob;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
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.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.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.SeriesJobDataTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDefinition;
|
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.job.SeriesJobTop;
|
||||||
|
@ -23,13 +21,12 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* Accounting Model 4 Job
|
* Accounting Model 4 Job
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccountingModel4Job extends AccountingModelBuilder {
|
public class AccountingModel4Job extends AccountingModelBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
protected static Logger logger = LoggerFactory.getLogger(AccountingModel4Job.class);
|
||||||
.getLogger(AccountingModel4Job.class);
|
|
||||||
private AccountingStateData accountingStateData;
|
private AccountingStateData accountingStateData;
|
||||||
|
|
||||||
public AccountingModel4Job(AccountingStateData accountingStateData) {
|
public AccountingModel4Job(AccountingStateData accountingStateData) {
|
||||||
|
@ -42,35 +39,30 @@ public class AccountingModel4Job extends AccountingModelBuilder {
|
||||||
|
|
||||||
if (seriesRequest == null) {
|
if (seriesRequest == null) {
|
||||||
logger.error("Error series request is null");
|
logger.error("Error series request is null");
|
||||||
throw new ServiceException(
|
throw new ServiceException("Error series request is null");
|
||||||
"Error series request is null");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String startDate="";
|
String startDate = "";
|
||||||
try {
|
try {
|
||||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||||
.getStartDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
String endDate="";
|
String endDate = "";
|
||||||
try {
|
try {
|
||||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||||
.getEndDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod()
|
String periodType = seriesRequest.getAccountingPeriod().getPeriod().getLabel();
|
||||||
.getLabel();
|
|
||||||
|
|
||||||
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
||||||
|
|
||||||
if (seriesResponse == null) {
|
if (seriesResponse == null) {
|
||||||
logger.error("Error series response is null");
|
logger.error("Error series response is null");
|
||||||
throw new ServiceException(
|
throw new ServiceException("Error series response is null");
|
||||||
"Error series response is null");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileName = "Untitled";
|
String fileName = "Untitled";
|
||||||
|
@ -78,17 +70,13 @@ public class AccountingModel4Job extends AccountingModelBuilder {
|
||||||
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
||||||
if (seriesResponse instanceof SeriesJob) {
|
if (seriesResponse instanceof SeriesJob) {
|
||||||
SeriesJob seriesService = (SeriesJob) seriesResponse;
|
SeriesJob seriesService = (SeriesJob) seriesResponse;
|
||||||
SeriesJobDefinition definition = seriesService
|
SeriesJobDefinition definition = seriesService.getSeriesJobDefinition();
|
||||||
.getSeriesJobDefinition();
|
|
||||||
if (definition instanceof SeriesJobBasic) {
|
if (definition instanceof SeriesJobBasic) {
|
||||||
SeriesJobBasic seriesJobBasic = (SeriesJobBasic) definition;
|
SeriesJobBasic seriesJobBasic = (SeriesJobBasic) definition;
|
||||||
fileName = "Job_" + periodType + "_" + startDate + "_"
|
fileName = "Job_" + periodType + "_" + startDate + "_" + endDate;
|
||||||
+ endDate;
|
header = new ArrayList<>(Arrays.asList(
|
||||||
header = new ArrayList<>(Arrays.asList(new String[] { "Date",
|
new String[] { "Date", "Operation Count", "Duration", "Max Invocation", "Min Invocation" }));
|
||||||
"Operation Count", "Duration", "Max Invocation",
|
ArrayList<SeriesJobData> listData = seriesJobBasic.getSeries();
|
||||||
"Min Invocation" }));
|
|
||||||
ArrayList<SeriesJobData> listData = seriesJobBasic
|
|
||||||
.getSeries();
|
|
||||||
for (SeriesJobData seriesData : listData) {
|
for (SeriesJobData seriesData : listData) {
|
||||||
ArrayList<String> data = new ArrayList<>();
|
ArrayList<String> data = new ArrayList<>();
|
||||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||||
|
@ -102,76 +90,35 @@ public class AccountingModel4Job extends AccountingModelBuilder {
|
||||||
} else {
|
} else {
|
||||||
if (definition instanceof SeriesJobTop) {
|
if (definition instanceof SeriesJobTop) {
|
||||||
SeriesJobTop seriesJobTop = (SeriesJobTop) definition;
|
SeriesJobTop seriesJobTop = (SeriesJobTop) definition;
|
||||||
fileName = "JobTop_" + periodType + "_" + startDate
|
fileName = "JobTop_" + periodType + "_" + startDate + "_" + endDate;
|
||||||
+ "_" + endDate;
|
header = new ArrayList<>(Arrays.asList(new String[] { "Value", "Date", "Operation Count",
|
||||||
header = new ArrayList<>(Arrays.asList(new String[] {
|
"Duration", "Max Invocation", "Min Invocation" }));
|
||||||
"Value", "Date", "Operation Count", "Duration",
|
ArrayList<SeriesJobDataTop> listDataTop = seriesJobTop.getSeriesJobDataTopList();
|
||||||
"Max Invocation", "Min Invocation" }));
|
|
||||||
ArrayList<SeriesJobDataTop> listDataTop = seriesJobTop
|
|
||||||
.getSeriesJobDataTopList();
|
|
||||||
for (SeriesJobDataTop seriesDataTop : listDataTop) {
|
for (SeriesJobDataTop seriesDataTop : listDataTop) {
|
||||||
FilterValue filterValue = seriesDataTop
|
FilterValue filterValue = seriesDataTop.getFilterValue();
|
||||||
.getFilterValue();
|
ArrayList<SeriesJobData> listData = seriesDataTop.getSeries();
|
||||||
ArrayList<SeriesJobData> listData = seriesDataTop
|
|
||||||
.getSeries();
|
|
||||||
for (SeriesJobData seriesData : listData) {
|
for (SeriesJobData seriesData : listData) {
|
||||||
ArrayList<String> data = new ArrayList<>();
|
ArrayList<String> data = new ArrayList<>();
|
||||||
data.add(filterValue.getValue());
|
data.add(filterValue.getValue());
|
||||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||||
data.add(String.valueOf(seriesData
|
data.add(String.valueOf(seriesData.getOperationCount()));
|
||||||
.getOperationCount()));
|
|
||||||
data.add(String.valueOf(seriesData.getDuration()));
|
data.add(String.valueOf(seriesData.getDuration()));
|
||||||
data.add(String.valueOf(seriesData
|
data.add(String.valueOf(seriesData.getMaxInvocationTime()));
|
||||||
.getMaxInvocationTime()));
|
data.add(String.valueOf(seriesData.getMinInvocationTime()));
|
||||||
data.add(String.valueOf(seriesData
|
|
||||||
.getMinInvocationTime()));
|
|
||||||
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
||||||
rows.add(csvDataRow);
|
rows.add(csvDataRow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (definition instanceof SeriesJobContext) {
|
|
||||||
SeriesJobContext seriesJobContext = (SeriesJobContext) definition;
|
logger.error("Unsupported Serie Definition for Job: " + definition);
|
||||||
fileName = "JobContext_" + periodType + "_" + startDate
|
throw new ServiceException("Unsupported Serie Definition for Job: " + definition);
|
||||||
+ "_" + 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error("Job not support this serie response: "
|
logger.error("Job not support this serie response: " + seriesResponse);
|
||||||
+ seriesResponse);
|
throw new ServiceException("Job not support this serie response: " + seriesResponse);
|
||||||
throw new ServiceException(
|
|
||||||
"Job not support this serie response: "
|
|
||||||
+ seriesResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountingDataModel invocation = new AccountingDataModel(fileName, header, rows);
|
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.SeriesResponse;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
|
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.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.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.SeriesServiceDataTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDefinition;
|
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.service.SeriesServiceTop;
|
||||||
|
@ -23,13 +21,12 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* Accounting Model 4 Service
|
* Accounting Model 4 Service
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccountingModel4Service extends AccountingModelBuilder {
|
public class AccountingModel4Service extends AccountingModelBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
protected static Logger logger = LoggerFactory.getLogger(AccountingModel4Service.class);
|
||||||
.getLogger(AccountingModel4Service.class);
|
|
||||||
private AccountingStateData accountingStateData;
|
private AccountingStateData accountingStateData;
|
||||||
|
|
||||||
public AccountingModel4Service(AccountingStateData accountingStateData) {
|
public AccountingModel4Service(AccountingStateData accountingStateData) {
|
||||||
|
@ -42,35 +39,30 @@ public class AccountingModel4Service extends AccountingModelBuilder {
|
||||||
|
|
||||||
if (seriesRequest == null) {
|
if (seriesRequest == null) {
|
||||||
logger.error("Error series request is null");
|
logger.error("Error series request is null");
|
||||||
throw new ServiceException(
|
throw new ServiceException("Error series request is null");
|
||||||
"Error series request is null");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String startDate="";
|
String startDate = "";
|
||||||
try {
|
try {
|
||||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||||
.getStartDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
String endDate="";
|
String endDate = "";
|
||||||
try {
|
try {
|
||||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||||
.getEndDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod()
|
String periodType = seriesRequest.getAccountingPeriod().getPeriod().getLabel();
|
||||||
.getLabel();
|
|
||||||
|
|
||||||
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
||||||
|
|
||||||
if (seriesResponse == null) {
|
if (seriesResponse == null) {
|
||||||
logger.error("Error series response is null");
|
logger.error("Error series response is null");
|
||||||
throw new ServiceException(
|
throw new ServiceException("Error series response is null");
|
||||||
"Error series response is null");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileName = "Untitled";
|
String fileName = "Untitled";
|
||||||
|
@ -78,17 +70,13 @@ public class AccountingModel4Service extends AccountingModelBuilder {
|
||||||
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
||||||
if (seriesResponse instanceof SeriesService) {
|
if (seriesResponse instanceof SeriesService) {
|
||||||
SeriesService seriesService = (SeriesService) seriesResponse;
|
SeriesService seriesService = (SeriesService) seriesResponse;
|
||||||
SeriesServiceDefinition definition = seriesService
|
SeriesServiceDefinition definition = seriesService.getSerieServiceDefinition();
|
||||||
.getSerieServiceDefinition();
|
|
||||||
if (definition instanceof SeriesServiceBasic) {
|
if (definition instanceof SeriesServiceBasic) {
|
||||||
SeriesServiceBasic seriesServiceBasic = (SeriesServiceBasic) definition;
|
SeriesServiceBasic seriesServiceBasic = (SeriesServiceBasic) definition;
|
||||||
fileName = "Service_" + periodType + "_" + startDate + "_"
|
fileName = "Service_" + periodType + "_" + startDate + "_" + endDate;
|
||||||
+ endDate;
|
header = new ArrayList<>(Arrays.asList(
|
||||||
header = new ArrayList<>(Arrays.asList(new String[] { "Date",
|
new String[] { "Date", "Operation Count", "Duration", "Max Invocation", "Min Invocation" }));
|
||||||
"Operation Count", "Duration", "Max Invocation",
|
ArrayList<SeriesServiceData> listData = seriesServiceBasic.getSeries();
|
||||||
"Min Invocation" }));
|
|
||||||
ArrayList<SeriesServiceData> listData = seriesServiceBasic
|
|
||||||
.getSeries();
|
|
||||||
for (SeriesServiceData seriesData : listData) {
|
for (SeriesServiceData seriesData : listData) {
|
||||||
ArrayList<String> data = new ArrayList<>();
|
ArrayList<String> data = new ArrayList<>();
|
||||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||||
|
@ -102,76 +90,33 @@ public class AccountingModel4Service extends AccountingModelBuilder {
|
||||||
} else {
|
} else {
|
||||||
if (definition instanceof SeriesServiceTop) {
|
if (definition instanceof SeriesServiceTop) {
|
||||||
SeriesServiceTop seriesServiceTop = (SeriesServiceTop) definition;
|
SeriesServiceTop seriesServiceTop = (SeriesServiceTop) definition;
|
||||||
fileName = "ServiceTop_" + periodType + "_" + startDate
|
fileName = "ServiceTop_" + periodType + "_" + startDate + "_" + endDate;
|
||||||
+ "_" + endDate;
|
header = new ArrayList<>(Arrays.asList(new String[] { "Value", "Date", "Operation Count",
|
||||||
header = new ArrayList<>(Arrays.asList(new String[] {
|
"Duration", "Max Invocation", "Min Invocation" }));
|
||||||
"Value", "Date", "Operation Count", "Duration",
|
ArrayList<SeriesServiceDataTop> listDataTop = seriesServiceTop.getSeriesServiceDataTopList();
|
||||||
"Max Invocation", "Min Invocation" }));
|
|
||||||
ArrayList<SeriesServiceDataTop> listDataTop = seriesServiceTop
|
|
||||||
.getSeriesServiceDataTopList();
|
|
||||||
for (SeriesServiceDataTop seriesDataTop : listDataTop) {
|
for (SeriesServiceDataTop seriesDataTop : listDataTop) {
|
||||||
FilterValue filterValue = seriesDataTop
|
FilterValue filterValue = seriesDataTop.getFilterValue();
|
||||||
.getFilterValue();
|
ArrayList<SeriesServiceData> listData = seriesDataTop.getSeries();
|
||||||
ArrayList<SeriesServiceData> listData = seriesDataTop
|
|
||||||
.getSeries();
|
|
||||||
for (SeriesServiceData seriesData : listData) {
|
for (SeriesServiceData seriesData : listData) {
|
||||||
ArrayList<String> data = new ArrayList<>();
|
ArrayList<String> data = new ArrayList<>();
|
||||||
data.add(filterValue.getValue());
|
data.add(filterValue.getValue());
|
||||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||||
data.add(String.valueOf(seriesData
|
data.add(String.valueOf(seriesData.getOperationCount()));
|
||||||
.getOperationCount()));
|
|
||||||
data.add(String.valueOf(seriesData.getDuration()));
|
data.add(String.valueOf(seriesData.getDuration()));
|
||||||
data.add(String.valueOf(seriesData
|
data.add(String.valueOf(seriesData.getMaxInvocationTime()));
|
||||||
.getMaxInvocationTime()));
|
data.add(String.valueOf(seriesData.getMinInvocationTime()));
|
||||||
data.add(String.valueOf(seriesData
|
|
||||||
.getMinInvocationTime()));
|
|
||||||
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
AccountingDataRow csvDataRow = new AccountingDataRow(data);
|
||||||
rows.add(csvDataRow);
|
rows.add(csvDataRow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (definition instanceof SeriesServiceContext) {
|
logger.error("Unsupported Serie Definition for Service: " + definition);
|
||||||
SeriesServiceContext seriesServiceContext = (SeriesServiceContext) definition;
|
throw new ServiceException("Unsupported Serie Definition for Service: " + 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error("Service not support this serie response: "
|
logger.error("Service not support this serie response: " + seriesResponse);
|
||||||
+ seriesResponse);
|
throw new ServiceException("Service not support this serie response: " + seriesResponse);
|
||||||
throw new ServiceException(
|
|
||||||
"Service not support this serie response: "
|
|
||||||
+ seriesResponse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountingDataModel invocation = new AccountingDataModel(fileName, header, rows);
|
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.SeriesResponse;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
|
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.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.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.SeriesStorageDataTop;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDefinition;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDefinition;
|
||||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageTop;
|
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageTop;
|
||||||
|
@ -23,13 +21,12 @@ import org.slf4j.LoggerFactory;
|
||||||
/**
|
/**
|
||||||
* Accounting Model 4 Storage
|
* Accounting Model 4 Storage
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccountingModel4Storage extends AccountingModelBuilder {
|
public class AccountingModel4Storage extends AccountingModelBuilder {
|
||||||
protected static Logger logger = LoggerFactory
|
protected static Logger logger = LoggerFactory.getLogger(AccountingModel4Storage.class);
|
||||||
.getLogger(AccountingModel4Storage.class);
|
|
||||||
private AccountingStateData accountingStateData;
|
private AccountingStateData accountingStateData;
|
||||||
|
|
||||||
public AccountingModel4Storage(AccountingStateData accountingStateData) {
|
public AccountingModel4Storage(AccountingStateData accountingStateData) {
|
||||||
|
@ -42,36 +39,31 @@ public class AccountingModel4Storage extends AccountingModelBuilder {
|
||||||
|
|
||||||
if (seriesRequest == null) {
|
if (seriesRequest == null) {
|
||||||
logger.error("Error series request is null");
|
logger.error("Error series request is null");
|
||||||
throw new ServiceException(
|
throw new ServiceException("Error series request is null");
|
||||||
"Error series request is null");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String startDate="";
|
String startDate = "";
|
||||||
try {
|
try {
|
||||||
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
startDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||||
.getStartDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
String endDate="";
|
String endDate = "";
|
||||||
try {
|
try {
|
||||||
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod()
|
endDate = sdfFile.format(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||||
.getEndDate()));
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
String periodType = seriesRequest.getAccountingPeriod().getPeriod()
|
String periodType = seriesRequest.getAccountingPeriod().getPeriod().getLabel();
|
||||||
.getLabel();
|
|
||||||
|
|
||||||
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
SeriesResponse seriesResponse = accountingStateData.getSeriesResponse();
|
||||||
|
|
||||||
if (seriesResponse == null) {
|
if (seriesResponse == null) {
|
||||||
logger.error("Error series response is null");
|
logger.error("Error series response is null");
|
||||||
throw new ServiceException(
|
throw new ServiceException("Error series response is null");
|
||||||
"Error series response is null");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileName = "Untitled";
|
String fileName = "Untitled";
|
||||||
|
@ -79,16 +71,12 @@ public class AccountingModel4Storage extends AccountingModelBuilder {
|
||||||
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
ArrayList<AccountingDataRow> rows = new ArrayList<>();
|
||||||
if (seriesResponse instanceof SeriesStorage) {
|
if (seriesResponse instanceof SeriesStorage) {
|
||||||
SeriesStorage seriesStorage = (SeriesStorage) seriesResponse;
|
SeriesStorage seriesStorage = (SeriesStorage) seriesResponse;
|
||||||
SeriesStorageDefinition definition = seriesStorage
|
SeriesStorageDefinition definition = seriesStorage.getSeriesStorageDefinition();
|
||||||
.getSeriesStorageDefinition();
|
|
||||||
if (definition instanceof SeriesStorageBasic) {
|
if (definition instanceof SeriesStorageBasic) {
|
||||||
SeriesStorageBasic seriesStorageBasic = (SeriesStorageBasic) definition;
|
SeriesStorageBasic seriesStorageBasic = (SeriesStorageBasic) definition;
|
||||||
fileName = "Storage_" + periodType + "_" + startDate + "_"
|
fileName = "Storage_" + periodType + "_" + startDate + "_" + endDate;
|
||||||
+ endDate;
|
header = new ArrayList<>(Arrays.asList(new String[] { "Date", "Operation Count", "Data Volume" }));
|
||||||
header = new ArrayList<>(Arrays.asList(new String[] { "Date",
|
ArrayList<SeriesStorageData> listData = seriesStorageBasic.getSeries();
|
||||||
"Operation Count", "Data Volume" }));
|
|
||||||
ArrayList<SeriesStorageData> listData = seriesStorageBasic
|
|
||||||
.getSeries();
|
|
||||||
for (SeriesStorageData seriesData : listData) {
|
for (SeriesStorageData seriesData : listData) {
|
||||||
ArrayList<String> data = new ArrayList<>();
|
ArrayList<String> data = new ArrayList<>();
|
||||||
data.add(sdfCSVDate.format(seriesData.getDate()));
|
data.add(sdfCSVDate.format(seriesData.getDate()));
|
||||||
|
@ -100,18 +88,13 @@ public class AccountingModel4Storage extends AccountingModelBuilder {
|
||||||
} else {
|
} else {
|
||||||
if (definition instanceof SeriesStorageTop) {
|
if (definition instanceof SeriesStorageTop) {
|
||||||
SeriesStorageTop seriesStorageTop = (SeriesStorageTop) definition;
|
SeriesStorageTop seriesStorageTop = (SeriesStorageTop) definition;
|
||||||
fileName = "StorageTop_" + periodType + "_" + startDate
|
fileName = "StorageTop_" + periodType + "_" + startDate + "_" + endDate;
|
||||||
+ "_" + endDate;
|
|
||||||
header = new ArrayList<>(
|
header = new ArrayList<>(
|
||||||
Arrays.asList(new String[] { "Value", "Date",
|
Arrays.asList(new String[] { "Value", "Date", "Operation Count", "Data Volume" }));
|
||||||
"Operation Count", "Data Volume" }));
|
ArrayList<SeriesStorageDataTop> listDataTop = seriesStorageTop.getSeriesStorageDataTopList();
|
||||||
ArrayList<SeriesStorageDataTop> listDataTop = seriesStorageTop
|
|
||||||
.getSeriesStorageDataTopList();
|
|
||||||
for (SeriesStorageDataTop seriesDataTop : listDataTop) {
|
for (SeriesStorageDataTop seriesDataTop : listDataTop) {
|
||||||
FilterValue filterValue = seriesDataTop
|
FilterValue filterValue = seriesDataTop.getFilterValue();
|
||||||
.getFilterValue();
|
ArrayList<SeriesStorageData> listData = seriesDataTop.getSeries();
|
||||||
ArrayList<SeriesStorageData> listData = seriesDataTop
|
|
||||||
.getSeries();
|
|
||||||
for (SeriesStorageData seriesData : listData) {
|
for (SeriesStorageData seriesData : listData) {
|
||||||
ArrayList<String> data = new ArrayList<>();
|
ArrayList<String> data = new ArrayList<>();
|
||||||
data.add(filterValue.getValue());
|
data.add(filterValue.getValue());
|
||||||
|
@ -123,46 +106,16 @@ public class AccountingModel4Storage extends AccountingModelBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (definition instanceof SeriesStorageContext) {
|
logger.error("Unsupported Serie Definition for Storage: " + definition);
|
||||||
SeriesStorageContext seriesStorageContext = (SeriesStorageContext) definition;
|
throw new ServiceException("Unsupported Serie Definition for Storage: " + 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.error("Storage not support this serie response: "
|
logger.error("Storage not support this serie response: " + seriesResponse);
|
||||||
+ seriesResponse);
|
throw new ServiceException("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);
|
accountingModelSpec.setOp(invocation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,55 +5,36 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccountingFilterBasic extends AccountingFilterDefinition implements
|
public class AccountingFilterBasic extends AccountingFilterDefinition implements Serializable {
|
||||||
Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -6805006183397381154L;
|
private static final long serialVersionUID = -6805006183397381154L;
|
||||||
private ArrayList<AccountingFilter> filters;
|
private ArrayList<AccountingFilter> filters;
|
||||||
private String scope;
|
private Context context;
|
||||||
private Boolean noContext;
|
|
||||||
|
|
||||||
public AccountingFilterBasic() {
|
public AccountingFilterBasic() {
|
||||||
super();
|
super();
|
||||||
this.chartType = ChartType.Basic;
|
this.chartType = ChartType.Basic;
|
||||||
noContext = false;
|
|
||||||
filters = null;
|
filters = null;
|
||||||
scope=null;
|
context = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountingFilterBasic(String scope, boolean noContenxt) {
|
public AccountingFilterBasic(Context context) {
|
||||||
super();
|
super();
|
||||||
chartType = ChartType.Basic;
|
chartType = ChartType.Basic;
|
||||||
this.filters = null;
|
this.filters = null;
|
||||||
this.scope=scope;
|
this.context = context;
|
||||||
this.noContext = noContenxt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public AccountingFilterBasic(String scope, ArrayList<AccountingFilter> filters,
|
|
||||||
boolean noContenxt) {
|
|
||||||
super();
|
|
||||||
chartType = ChartType.Basic;
|
|
||||||
this.scope=scope;
|
|
||||||
this.filters = filters;
|
|
||||||
this.noContext = noContenxt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getScope() {
|
public AccountingFilterBasic(Context context, ArrayList<AccountingFilter> filters) {
|
||||||
return scope;
|
super();
|
||||||
}
|
chartType = ChartType.Basic;
|
||||||
|
this.filters = filters;
|
||||||
public void setScope(String scope) {
|
this.context = context;
|
||||||
this.scope = scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getNoContext() {
|
|
||||||
return noContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<AccountingFilter> getFilters() {
|
public ArrayList<AccountingFilter> getFilters() {
|
||||||
|
@ -64,20 +45,18 @@ public class AccountingFilterBasic extends AccountingFilterDefinition implements
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNoContext() {
|
public Context getContext() {
|
||||||
return noContext;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNoContext(Boolean noContext) {
|
public void setContext(Context context) {
|
||||||
this.noContext = noContext;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AccountingFilterBasic [filters=" + filters + ", scope=" + scope + ", noContext=" + noContext
|
return "AccountingFilterBasic [filters=" + filters + ", context=" + context + ", chartType=" + chartType + "]";
|
||||||
+ ", chartType=" + chartType + "]";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,14 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Giancarlo Panichi
|
* @author Giancarlo Panichi
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AccountingFilterTop extends AccountingFilterDefinition implements
|
public class AccountingFilterTop extends AccountingFilterDefinition implements Serializable {
|
||||||
Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -6805006183397381154L;
|
private static final long serialVersionUID = -6805006183397381154L;
|
||||||
private String scope;
|
private Context context;
|
||||||
private FilterKey filterKey;
|
private FilterKey filterKey;
|
||||||
private Boolean showOthers;
|
private Boolean showOthers;
|
||||||
private Integer topNumber;
|
private Integer topNumber;
|
||||||
|
@ -22,32 +21,30 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
|
||||||
public AccountingFilterTop() {
|
public AccountingFilterTop() {
|
||||||
super();
|
super();
|
||||||
this.chartType = ChartType.Top;
|
this.chartType = ChartType.Top;
|
||||||
scope=null;
|
context = null;
|
||||||
showOthers = false;
|
showOthers = false;
|
||||||
topNumber = 5;
|
topNumber = 5;
|
||||||
filterKey = null;
|
filterKey = null;
|
||||||
filters = null;
|
filters = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountingFilterTop(String scope, Boolean showOthers,Integer topNumber) {
|
public AccountingFilterTop(Context context, Boolean showOthers, Integer topNumber) {
|
||||||
super();
|
super();
|
||||||
this.chartType = ChartType.Top;
|
this.chartType = ChartType.Top;
|
||||||
this.scope=scope;
|
this.context = context;
|
||||||
this.showOthers = showOthers;
|
this.showOthers = showOthers;
|
||||||
this.topNumber = topNumber;
|
this.topNumber = topNumber;
|
||||||
filterKey = null;
|
filterKey = null;
|
||||||
filters = null;
|
filters = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AccountingFilterTop(String scope, FilterKey filterKey,
|
public AccountingFilterTop(Context context, FilterKey filterKey, ArrayList<AccountingFilter> filters,
|
||||||
ArrayList<AccountingFilter> filters, Boolean showOthers,
|
Boolean showOthers, Integer topNumber) {
|
||||||
Integer topNumber) {
|
|
||||||
super();
|
super();
|
||||||
chartType = ChartType.Top;
|
chartType = ChartType.Top;
|
||||||
this.scope=scope;
|
this.context = context;
|
||||||
this.filterKey = filterKey;
|
this.filterKey = filterKey;
|
||||||
this.filters = filters;
|
this.filters = filters;
|
||||||
this.showOthers = showOthers;
|
this.showOthers = showOthers;
|
||||||
|
@ -55,12 +52,12 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScope() {
|
public Context getContext() {
|
||||||
return scope;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScope(String scope) {
|
public void setContext(Context context) {
|
||||||
this.scope = scope;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FilterKey getFilterKey() {
|
public FilterKey getFilterKey() {
|
||||||
|
@ -97,10 +94,10 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "AccountingFilterTop [scope=" + scope + ", filterKey=" + filterKey + ", showOthers=" + showOthers
|
return "AccountingFilterTop [context=" + context + ", filterKey=" + filterKey + ", showOthers=" + showOthers
|
||||||
+ ", topNumber=" + topNumber + ", filters=" + filters + ", chartType=" + chartType + "]";
|
+ ", topNumber=" + topNumber + ", filters=" + filters + ", chartType=" + chartType + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||||
|
|
||||||
public enum ChartType {
|
public enum ChartType {
|
||||||
|
|
||||||
Basic("Basic"), Top("Top"), Context("Context"), Spaces("Spaces");
|
Basic("Basic"), Top("Top"), Spaces("Spaces");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue