ref 10188:AccountingManager - Add a way to esplicitly set the scope in accounting-analytics

https://support.d4science.org/issues/10188

Updated to support scope selection for Basic and Top charts

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@176271 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-12-28 17:01:45 +00:00
parent bf8394056a
commit a7cbb9d9d6
17 changed files with 432 additions and 287 deletions

View File

@ -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.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/accounting-manager-1.11.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.10.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/accounting-manager-1.11.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.10.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/accounting-manager-1.11.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -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.10.0-SNAPSHOT"> <wb-module deploy-name="accounting-manager-1.11.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"/>

View File

@ -1,4 +1,8 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-11-0"
date="2018-12-28">
<Change>Added scope selection [Ticket #10188]</Change>
</Changeset>
<Changeset component="org.gcube.portlets.admin.accounting-manager.1-10-0" <Changeset component="org.gcube.portlets.admin.accounting-manager.1-10-0"
date="2018-10-01"> date="2018-10-01">
<Change>Updated to StorageHub [Ticket #12474]</Change> <Change>Updated to StorageHub [Ticket #12474]</Change>

View File

@ -13,7 +13,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.10.0-SNAPSHOT</version> <version>1.11.0-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>

View File

@ -10,6 +10,7 @@ import org.gcube.portlets.admin.accountingmanager.client.event.StateChangeEvent;
import org.gcube.portlets.admin.accountingmanager.client.monitor.AccountingMonitor; import org.gcube.portlets.admin.accountingmanager.client.monitor.AccountingMonitor;
import org.gcube.portlets.admin.accountingmanager.client.properties.AccountingFilterProperties; import org.gcube.portlets.admin.accountingmanager.client.properties.AccountingFilterProperties;
import org.gcube.portlets.admin.accountingmanager.client.properties.GenresDataProperties; import org.gcube.portlets.admin.accountingmanager.client.properties.GenresDataProperties;
import org.gcube.portlets.admin.accountingmanager.client.properties.GenresDataPropertiesCombo;
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources; import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerServiceAsync; import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerServiceAsync;
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData; import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
@ -127,6 +128,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
private FieldLabel comboChartTypeLabel; private FieldLabel comboChartTypeLabel;
private ListStore<ChartType> storeComboChartType; private ListStore<ChartType> storeComboChartType;
private ComboBox<ChartType> comboChartType; private ComboBox<ChartType> comboChartType;
private ListStore<GenresData> storeComboScope;
private ComboBox<GenresData> comboScope;
private FieldLabel comboScopeLabel;
private ListStore<FilterKey> storeComboTopFilterKey; private ListStore<FilterKey> storeComboTopFilterKey;
private ComboBox<FilterKey> comboTopFilterKey; private ComboBox<FilterKey> comboTopFilterKey;
private FieldLabel comboTopFilterKeyLabel; private FieldLabel comboTopFilterKeyLabel;
@ -278,17 +282,17 @@ public class ActiveFiltersPanel extends SimpleContainer {
comboFilterKey = new ComboBox<FilterKey>(storeComboFilterKey, filterKeyPropertiesCombo.key()); comboFilterKey = new ComboBox<FilterKey>(storeComboFilterKey, filterKeyPropertiesCombo.key());
comboFilterKey.setClearValueOnParseError(false); comboFilterKey.setClearValueOnParseError(false);
comboFilterKey.setEditable(false); comboFilterKey.setEditable(false);
comboFilterKey.addValidator(new EmptyValidator<FilterKey>(){ comboFilterKey.addValidator(new EmptyValidator<FilterKey>() {
@Override @Override
public List<EditorError> validate(Editor<FilterKey> editor, FilterKey value) { public List<EditorError> validate(Editor<FilterKey> editor, FilterKey value) {
if (value == null || value.getKey()==null || value.getKey().isEmpty()) { if (value == null || value.getKey() == null || value.getKey().isEmpty()) {
List<EditorError> errors = new ArrayList<EditorError>(); List<EditorError> errors = new ArrayList<EditorError>();
errors.add(new DefaultEditorError(editor, getMessages().blankText(), "")); errors.add(new DefaultEditorError(editor, getMessages().blankText(), ""));
return errors; return errors;
} }
return null; return null;
} }
}); });
comboFilterKey.setTriggerAction(TriggerAction.ALL); comboFilterKey.setTriggerAction(TriggerAction.ALL);
addHandlersForComboFilterKey(filterKeyPropertiesCombo.key()); addHandlersForComboFilterKey(filterKeyPropertiesCombo.key());
@ -316,7 +320,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
// comboFilterValue.setFinishEditOnEnter(false); // comboFilterValue.setFinishEditOnEnter(false);
// comboFilterValue.setAutoValidate(true); // comboFilterValue.setAutoValidate(true);
comboFilterValue.addValidator(new EmptyValidator<String>()); comboFilterValue.addValidator(new EmptyValidator<String>());
comboFilterValue.setTriggerAction(TriggerAction.ALL); comboFilterValue.setTriggerAction(TriggerAction.ALL);
// final TextField valueField = new TextField(); // final TextField valueField = new TextField();
@ -385,9 +389,10 @@ public class ActiveFiltersPanel extends SimpleContainer {
@Override @Override
public void onCompleteEdit(CompleteEditEvent<AccountingFilter> event) { public void onCompleteEdit(CompleteEditEvent<AccountingFilter> event) {
try { try {
//GridCell cell = event.getEditCell(); // GridCell cell = event.getEditCell();
//int rowIndex = cell.getRow(); // int rowIndex = cell.getRow();
//AccountingFilter editingFilter = storeFilter.get(rowIndex); // AccountingFilter editingFilter =
// storeFilter.get(rowIndex);
if (addStatus) { if (addStatus) {
addStatus = false; addStatus = false;
@ -482,9 +487,21 @@ public class ActiveFiltersPanel extends SimpleContainer {
// comboFilterValue.addValidator(new EmptyValidator<String>()); // comboFilterValue.addValidator(new EmptyValidator<String>());
comboChartType.setTriggerAction(TriggerAction.ALL); comboChartType.setTriggerAction(TriggerAction.ALL);
addHandlersForComboChartType(comboChartTypeLabelProvider); addHandlersForComboChartType(comboChartTypeLabelProvider);
comboChartTypeLabel = new FieldLabel(comboChartType, "Chart"); comboChartTypeLabel = new FieldLabel(comboChartType, "Chart");
//TODO ScopeCombo for Top and Basic
GenresDataPropertiesCombo genresDataPropertiesCombo = GWT.create(GenresDataPropertiesCombo.class);
storeComboScope = new ListStore<GenresData>(genresDataPropertiesCombo.id());
comboScope = new ComboBox<GenresData>(storeComboScope, genresDataPropertiesCombo.label());
comboScope.setClearValueOnParseError(false);
comboScope.setEditable(false);
comboScope.setTriggerAction(TriggerAction.ALL);
addHandlersForComboScope(genresDataPropertiesCombo.label());
comboScopeLabel = new FieldLabel(comboScope, "Scope");
// FileterKeyCombo for Top Chart // FileterKeyCombo for Top Chart
storeComboTopFilterKey = new ListStore<FilterKey>(filterKeyPropertiesCombo.id()); storeComboTopFilterKey = new ListStore<FilterKey>(filterKeyPropertiesCombo.id());
@ -572,6 +589,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
VerticalLayoutContainer vlc = new VerticalLayoutContainer(); VerticalLayoutContainer vlc = new VerticalLayoutContainer();
vlc.add(comboChartTypeLabel, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(comboChartTypeLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(comboScopeLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(gridGenres, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(gridGenres, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(noContextLabel, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(noContextLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(comboTopFilterKeyLabel, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(comboTopFilterKeyLabel, new VerticalLayoutData(1, -1, new Margins(0)));
@ -588,6 +606,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
add(fieldSet, new MarginData(0)); add(fieldSet, new MarginData(0));
comboChartTypeLabel.setVisible(false); comboChartTypeLabel.setVisible(false);
comboScopeLabel.setVisible(false);
gridGenres.setVisible(false); gridGenres.setVisible(false);
noContextLabel.setVisible(false); noContextLabel.setVisible(false);
comboTopFilterKeyLabel.setVisible(false); comboTopFilterKeyLabel.setVisible(false);
@ -695,6 +714,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
storeComboTopFilterKey.clear(); storeComboTopFilterKey.clear();
storeComboTopFilterKey.addAll(accountingStateData.getAvailableFilterKeys()); storeComboTopFilterKey.addAll(accountingStateData.getAvailableFilterKeys());
storeComboTopFilterKey.commitChanges(); storeComboTopFilterKey.commitChanges();
ChartType chartType = accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType(); ChartType chartType = accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType();
@ -725,7 +745,29 @@ public class ActiveFiltersPanel extends SimpleContainer {
.getSeriesRequest().getAccountingFilterDefinition() instanceof AccountingFilterBasic) { .getSeriesRequest().getAccountingFilterDefinition() instanceof AccountingFilterBasic) {
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) accountingStateData.getSeriesRequest() AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) accountingStateData.getSeriesRequest()
.getAccountingFilterDefinition(); .getAccountingFilterDefinition();
if(accountingStateData.getAvailableContext().getContexts()!=null&&
!accountingStateData.getAvailableContext().getContexts().isEmpty()){
ArrayList<String> scopesAvailables=accountingStateData.getAvailableContext().getContexts();
ArrayList<GenresData> scopes=new ArrayList<>();
for(String scopeAvailable:scopesAvailables){
scopes.add(new GenresData(scopeAvailable));
}
storeComboScope.clear();
storeComboScope.addAll(scopes);
storeComboScope.commitChanges();
if(accountingFilterBasic.getScope()!=null&&!accountingFilterBasic.getScope().isEmpty()){
comboScope.setValue(new GenresData(accountingFilterBasic.getScope()));
} else {
comboScope.setValue(storeComboScope.get(0));
}
} else{
storeComboScope.clear();
storeComboScope.commitChanges();
}
if (accountingFilterBasic.getFilters() != null) { if (accountingFilterBasic.getFilters() != null) {
List<AccountingFilter> filters = accountingFilterBasic.getFilters(); List<AccountingFilter> filters = accountingFilterBasic.getFilters();
storeFilter.clear(); storeFilter.clear();
@ -762,6 +804,26 @@ public class ActiveFiltersPanel extends SimpleContainer {
storeFilter.commitChanges(); storeFilter.commitChanges();
seq = 0; seq = 0;
if(accountingStateData.getAvailableContext().getContexts()!=null&&
!accountingStateData.getAvailableContext().getContexts().isEmpty()){
ArrayList<String> scopesAvailables=accountingStateData.getAvailableContext().getContexts();
ArrayList<GenresData> scopes=new ArrayList<>();
for(String scopeAvailable:scopesAvailables){
scopes.add(new GenresData(scopeAvailable));
}
storeComboScope.clear();
storeComboScope.addAll(scopes);
storeComboScope.commitChanges();
comboScope.setValue(storeComboScope.get(0));
} else{
storeComboScope.clear();
storeComboScope.commitChanges();
}
if (accountingStateData.getRootScope()) { if (accountingStateData.getRootScope()) {
noContextToggle.reset(); noContextToggle.reset();
noContextNo.setValue(true); noContextNo.setValue(true);
@ -773,7 +835,10 @@ public class ActiveFiltersPanel extends SimpleContainer {
} }
} }
comboChartType.setValue(ChartType.Basic); comboChartType.setValue(ChartType.Basic);
comboScopeLabel.setVisible(true);
gridGenres.setVisible(false); gridGenres.setVisible(false);
comboTopFilterKey.reset(); comboTopFilterKey.reset();
comboTopFilterKeyLabel.setVisible(false); comboTopFilterKeyLabel.setVisible(false);
@ -793,6 +858,32 @@ public class ActiveFiltersPanel extends SimpleContainer {
.getSeriesRequest().getAccountingFilterDefinition() instanceof AccountingFilterTop) { .getSeriesRequest().getAccountingFilterDefinition() instanceof AccountingFilterTop) {
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) accountingStateData.getSeriesRequest() AccountingFilterTop accountingFilterTop = (AccountingFilterTop) accountingStateData.getSeriesRequest()
.getAccountingFilterDefinition(); .getAccountingFilterDefinition();
if(accountingStateData.getAvailableContext().getContexts()!=null&&
!accountingStateData.getAvailableContext().getContexts().isEmpty()){
ArrayList<String> scopesAvailables=accountingStateData.getAvailableContext().getContexts();
ArrayList<GenresData> scopes=new ArrayList<>();
for(String scopeAvailable:scopesAvailables){
scopes.add(new GenresData(scopeAvailable));
}
storeComboScope.clear();
storeComboScope.addAll(scopes);
storeComboScope.commitChanges();
if(accountingFilterTop.getScope()!=null&&!accountingFilterTop.getScope().isEmpty()){
comboScope.setValue(new GenresData(accountingFilterTop.getScope()));
} else {
comboScope.setValue(storeComboScope.get(0));
}
} else{
storeComboScope.clear();
storeComboScope.commitChanges();
comboScope.reset();
}
if (accountingFilterTop.getFilterKey() != null) { if (accountingFilterTop.getFilterKey() != null) {
comboTopFilterKey.setValue(accountingFilterTop.getFilterKey()); comboTopFilterKey.setValue(accountingFilterTop.getFilterKey());
topNumber.setValue(accountingFilterTop.getTopNumber()); topNumber.setValue(accountingFilterTop.getTopNumber());
@ -826,6 +917,27 @@ public class ActiveFiltersPanel extends SimpleContainer {
seq = 0; seq = 0;
} }
} else { } else {
if(accountingStateData.getAvailableContext().getContexts()!=null&&
!accountingStateData.getAvailableContext().getContexts().isEmpty()){
ArrayList<String> scopesAvailables=accountingStateData.getAvailableContext().getContexts();
ArrayList<GenresData> scopes=new ArrayList<>();
for(String scopeAvailable:scopesAvailables){
scopes.add(new GenresData(scopeAvailable));
}
storeComboScope.clear();
storeComboScope.addAll(scopes);
storeComboScope.commitChanges();
comboScope.setValue(storeComboScope.get(0));
} else{
storeComboScope.clear();
storeComboScope.commitChanges();
comboScope.reset();
}
comboScopeLabel.setVisible(true);
comboTopFilterKey.reset(); comboTopFilterKey.reset();
showOthersToggle.reset(); showOthersToggle.reset();
showOthersNo.setValue(true); showOthersNo.setValue(true);
@ -929,6 +1041,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
} }
comboChartType.setValue(ChartType.Context); comboChartType.setValue(ChartType.Context);
comboScopeLabel.setVisible(false);
gridGenres.setVisible(true); gridGenres.setVisible(true);
labelGenresCol.setHeader("Scope"); labelGenresCol.setHeader("Scope");
gridGenres.getView().refresh(true); gridGenres.getView().refresh(true);
@ -1058,6 +1171,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
} }
comboChartType.setValue(ChartType.Spaces); comboChartType.setValue(ChartType.Spaces);
comboScopeLabel.setVisible(false);
gridGenres.setVisible(true); gridGenres.setVisible(true);
labelGenresCol.setHeader("Space"); labelGenresCol.setHeader("Space");
gridGenres.getView().refresh(true); gridGenres.getView().refresh(true);
@ -1134,6 +1248,16 @@ public class ActiveFiltersPanel extends SimpleContainer {
// TODO // TODO
private AccountingFilterDefinition getActiveFiltersForBasic() { private AccountingFilterDefinition getActiveFiltersForBasic() {
String scope=null;
if(comboScopeLabel!=null&&comboScopeLabel.isVisible()){
GenresData genresData=comboScope.getCurrentValue();
if(genresData!=null){
scope=genresData.getLabel();
}
}
Log.debug("Scope selected: "+scope);
Boolean noContextValue = false; Boolean noContextValue = false;
if (noContextLabel != null && noContextLabel.isVisible()) { if (noContextLabel != null && noContextLabel.isVisible()) {
noContextValue = noContextYes.getValue(); noContextValue = noContextYes.getValue();
@ -1142,8 +1266,10 @@ public class ActiveFiltersPanel extends SimpleContainer {
} }
Log.debug("noContextValue: " + noContextValue); Log.debug("noContextValue: " + noContextValue);
if (storeFilter == null || storeFilter.size() <= 0) { if (storeFilter == null || storeFilter.size() <= 0) {
return new AccountingFilterBasic(noContextValue); return new AccountingFilterBasic(scope, noContextValue);
} else { } else {
List<AccountingFilter> filtersActives = storeFilter.getAll(); List<AccountingFilter> filtersActives = storeFilter.getAll();
ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>(); ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>();
@ -1154,23 +1280,32 @@ public class ActiveFiltersPanel extends SimpleContainer {
} }
if (filtersReady.size() > 0) { if (filtersReady.size() > 0) {
return new AccountingFilterBasic(filtersReady, noContextValue); return new AccountingFilterBasic(scope, filtersReady, noContextValue);
} else { } else {
return new AccountingFilterBasic(noContextValue); return new AccountingFilterBasic(scope, noContextValue);
} }
} }
} }
private AccountingFilterDefinition getActiveFiltersForTop() { private AccountingFilterDefinition getActiveFiltersForTop() {
String scope=null;
if(comboScopeLabel!=null&&comboScopeLabel.isVisible()){
GenresData genresData=comboScope.getCurrentValue();
if(genresData!=null){
scope=genresData.getLabel();
}
}
Log.debug("Scope selected: "+scope);
Boolean showOthersValue = showOthersYes.getValue(); Boolean showOthersValue = showOthersYes.getValue();
Integer topN = topNumber.getCurrentValue(); Integer topN = topNumber.getCurrentValue();
FilterKey filterKey = comboTopFilterKey.getCurrentValue(); FilterKey filterKey = comboTopFilterKey.getCurrentValue();
if (filterKey == null) { if (filterKey == null) {
return new AccountingFilterTop(showOthersValue, topN); return new AccountingFilterTop(scope, showOthersValue, topN);
} else { } else {
if (storeFilter == null || storeFilter.size() <= 0) { if (storeFilter == null || storeFilter.size() <= 0) {
return new AccountingFilterTop(filterKey, null, showOthersValue, topN); return new AccountingFilterTop(scope, filterKey, null, showOthersValue, topN);
} else { } else {
List<AccountingFilter> filtersActives = storeFilter.getAll(); List<AccountingFilter> filtersActives = storeFilter.getAll();
ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>(); ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>();
@ -1180,9 +1315,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
} }
} }
if (filtersReady.size() > 0) { if (filtersReady.size() > 0) {
return new AccountingFilterTop(filterKey, filtersReady, showOthersValue, topN); return new AccountingFilterTop(scope, filterKey, filtersReady, showOthersValue, topN);
} else { } else {
return new AccountingFilterTop(filterKey, null, showOthersValue, topN); return new AccountingFilterTop(scope, filterKey, null, showOthersValue, topN);
} }
} }
@ -1546,4 +1681,20 @@ public class ActiveFiltersPanel extends SimpleContainer {
seq = 0; seq = 0;
} }
private void addHandlersForComboScope(final LabelProvider<GenresData> labelProvider) {
comboScope.addSelectionHandler(new SelectionHandler<GenresData>() {
public void onSelection(SelectionEvent<GenresData> event) {
Log.debug("Scope selected: " + event.getSelectedItem());
updateScope(event.getSelectedItem());
}
});
}
private void updateScope(GenresData selectedFilterKey) {
}
} }

View File

@ -0,0 +1,24 @@
package org.gcube.portlets.admin.accountingmanager.client.properties;
import org.gcube.portlets.admin.accountingmanager.shared.data.GenresData;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author giancarlo
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface GenresDataPropertiesCombo extends
PropertyAccess<GenresData> {
@Path("id")
ModelKeyProvider<GenresData> id();
LabelProvider<GenresData> label();
}

View File

@ -24,20 +24,17 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* *
* *
*/ */
public class AccountingCommandBasic implements public class AccountingCommandBasic implements AccountingCommand<SeriesResponse> {
AccountingCommand<SeriesResponse> { private static final Logger logger = LoggerFactory.getLogger(AccountingCommandBasic.class);
private static final Logger logger = LoggerFactory
.getLogger(AccountingCommandBasic.class);
private AccountingQueryBasic accountingQueryBasic; private AccountingQueryBasic accountingQueryBasic;
private AccountingType accountingType; private AccountingType accountingType;
public AccountingCommandBasic(AccountingQueryBasic accountingQueryBasic, public AccountingCommandBasic(AccountingQueryBasic accountingQueryBasic, AccountingType accountingType) {
AccountingType accountingType) {
this.accountingQueryBasic = accountingQueryBasic; this.accountingQueryBasic = accountingQueryBasic;
this.accountingType = accountingType; this.accountingType = accountingType;
} }
@ -45,41 +42,43 @@ public class AccountingCommandBasic implements
@Override @Override
public SeriesResponse execute() throws ServiceException { public SeriesResponse execute() throws ServiceException {
try { try {
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
.getInstance();
SortedMap<Calendar, Info> sm=null; if (accountingQueryBasic.getScope() != null && !accountingQueryBasic.getScope().isEmpty()) {
AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryBasic.getScope());
}
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
SortedMap<Calendar, Info> sm = null;
if (accountingQueryBasic.isNoContext()) { if (accountingQueryBasic.isNoContext()) {
logger.debug("Execute NoContextTimeSeries()"); logger.debug("Execute NoContextTimeSeries()");
sm = apq.getNoContextTimeSeries(accountingQueryBasic.getType(), sm = apq.getNoContextTimeSeries(accountingQueryBasic.getType(),
accountingQueryBasic.getTemporalConstraint(), accountingQueryBasic.getTemporalConstraint(), accountingQueryBasic.getFilters(), true);
accountingQueryBasic.getFilters(), true);
} else { } else {
logger.debug("Execute TimeSeries()"); logger.debug("Execute TimeSeries()");
sm = apq.getTimeSeries( sm = apq.getTimeSeries(accountingQueryBasic.getType(), accountingQueryBasic.getTemporalConstraint(),
accountingQueryBasic.getType(),
accountingQueryBasic.getTemporalConstraint(),
accountingQueryBasic.getFilters(), true); accountingQueryBasic.getFilters(), true);
} }
if (accountingQueryBasic.getScope() != null && !accountingQueryBasic.getScope().isEmpty()) {
AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
}
if (sm == null || sm.values() == null) { if (sm == null || sm.values() == null) {
throw new ServiceException( throw new ServiceException("Error retrieving info: sorted map is null!");
"Error retrieving info: sorted map is null!");
} }
List<Info> infos = new ArrayList<>(sm.values()); List<Info> infos = new ArrayList<>(sm.values());
logger.debug("Retrieved Infos"); logger.debug("Retrieved Infos");
logger.debug("Infos: " + infos); logger.debug("Infos: " + infos);
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder( SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(accountingType, infos);
accountingType, infos);
SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector(); SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector();
seriesResponseDirector seriesResponseDirector.setSeriesResponseBuilder(seriesResponseBuilder);
.setSeriesResponseBuilder(seriesResponseBuilder);
seriesResponseDirector.constructSeriesResponse(); seriesResponseDirector.constructSeriesResponse();
SeriesResponse seriesResponse = seriesResponseDirector SeriesResponse seriesResponse = seriesResponseDirector.getSeriesResponse();
.getSeriesResponse();
if (seriesResponse == null) { if (seriesResponse == null) {
throw new ServiceException("Error creating series response!"); throw new ServiceException("Error creating series response!");
@ -87,16 +86,14 @@ public class AccountingCommandBasic implements
logger.debug("SeriesResponse Created: " + seriesResponse); logger.debug("SeriesResponse Created: " + seriesResponse);
return seriesResponse; return seriesResponse;
} catch (Throwable e) { } catch (Throwable e) {
logger.error("Error in AccountingCommandBasic(): " logger.error("Error in AccountingCommandBasic(): " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new ServiceException("No data available!"); throw new ServiceException("No data available!");
} }
} }
private SeriesResponseBuilder getSeriesResponseBuilder( private SeriesResponseBuilder getSeriesResponseBuilder(AccountingType accountingType, List<Info> infos)
AccountingType accountingType, List<Info> infos)
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");

View File

@ -23,19 +23,17 @@ import org.slf4j.LoggerFactory;
/** /**
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* *
* *
*/ */
public class AccountingCommandTop implements AccountingCommand<SeriesResponse> { public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
private static final Logger logger = LoggerFactory private static final Logger logger = LoggerFactory.getLogger(AccountingCommandTop.class);
.getLogger(AccountingCommandTop.class);
private AccountingQueryTop accountingQueryTop; private AccountingQueryTop accountingQueryTop;
private AccountingType accountingType; private AccountingType accountingType;
public AccountingCommandTop(AccountingQueryTop accountingQueryTop, public AccountingCommandTop(AccountingQueryTop accountingQueryTop, AccountingType accountingType) {
AccountingType accountingType) {
this.accountingQueryTop = accountingQueryTop; this.accountingQueryTop = accountingQueryTop;
this.accountingType = accountingType; this.accountingType = accountingType;
} }
@ -43,46 +41,42 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
@Override @Override
public SeriesResponse execute() throws ServiceException { public SeriesResponse execute() throws ServiceException {
try { try {
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
.getInstance();
logger.debug("Query TopValues: " if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
+ accountingQueryTop.getFilterKey().getKey()); AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryTop.getScope());
}
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
logger.debug("Query TopValues: " + accountingQueryTop.getFilterKey().getKey());
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM; SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
if (accountingQueryTop.getShowOthers()) { if (accountingQueryTop.getShowOthers()) {
topSM= apq topSM = apq.getTopValues(accountingQueryTop.getType(), accountingQueryTop.getTemporalConstraint(),
.getTopValues(accountingQueryTop.getType(), accountingQueryTop.getFilters(), accountingQueryTop.getFilterKey().getKey(), null, true, 0);
accountingQueryTop.getTemporalConstraint(),
accountingQueryTop.getFilters(),
accountingQueryTop.getFilterKey().getKey(),
null, true, 0);
} else { } else {
topSM= apq topSM = apq.getTopValues(accountingQueryTop.getType(), accountingQueryTop.getTemporalConstraint(),
.getTopValues(accountingQueryTop.getType(), accountingQueryTop.getFilters(), accountingQueryTop.getFilterKey().getKey(), null, true,
accountingQueryTop.getTemporalConstraint(), accountingQueryTop.getTopNumber());
accountingQueryTop.getFilters(), }
accountingQueryTop.getFilterKey().getKey(),
null, true, accountingQueryTop.getTopNumber()); if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
} }
if (topSM == null) { if (topSM == null) {
throw new ServiceException( throw new ServiceException("Error retrieving info for top: sorted map is null!");
"Error retrieving info for top: sorted map is null!");
} }
logger.debug("TopSM: " + topSM); logger.debug("TopSM: " + topSM);
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder( SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(accountingType, topSM);
accountingType, topSM);
SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector(); SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector();
seriesResponseDirector seriesResponseDirector.setSeriesResponseBuilder(seriesResponseBuilder);
.setSeriesResponseBuilder(seriesResponseBuilder);
seriesResponseDirector.constructSeriesResponse(); seriesResponseDirector.constructSeriesResponse();
SeriesResponse seriesResponse = seriesResponseDirector SeriesResponse seriesResponse = seriesResponseDirector.getSeriesResponse();
.getSeriesResponse();
if (seriesResponse == null) { if (seriesResponse == null) {
throw new ServiceException("Error creating series response!"); throw new ServiceException("Error creating series response!");
@ -91,33 +85,35 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
return seriesResponse; return seriesResponse;
} catch (Throwable e) { } catch (Throwable e) {
logger.error("Error in AccountingCommandTop(): " logger.error("Error in AccountingCommandTop(): " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new ServiceException("No data available!"); throw new ServiceException("No data available!");
} }
} }
private SeriesResponseBuilder getSeriesResponseBuilder( private SeriesResponseBuilder getSeriesResponseBuilder(AccountingType accountingType,
AccountingType accountingType, SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) throws ServiceException {
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM)
throws ServiceException {
if (accountingType == null) { if (accountingType == null) {
throw new ServiceException("Error accounting type is null"); throw new ServiceException("Error accounting type is null");
} }
switch (accountingType) { switch (accountingType) {
case JOB: case JOB:
return new SeriesResponse4JobTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(), topSM); return new SeriesResponse4JobTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
topSM);
case PORTLET: case PORTLET:
return new SeriesResponse4PortletTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM); return new SeriesResponse4PortletTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
topSM);
case SERVICE: case SERVICE:
return new SeriesResponse4ServiceTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM); return new SeriesResponse4ServiceTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
topSM);
case STORAGE: case STORAGE:
return new SeriesResponse4StorageTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM); return new SeriesResponse4StorageTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
topSM);
case TASK: case TASK:
return new SeriesResponse4TaskTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM); return new SeriesResponse4TaskTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
topSM);
default: default:
throw new ServiceException("Error request type is unknow!"); throw new ServiceException("Error request type is unknow!");

View File

@ -21,13 +21,12 @@ import org.slf4j.LoggerFactory;
/** /**
* Accounting Query 4 Job * Accounting Query 4 Job
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* *
* *
*/ */
public class AccountingQuery4Job extends AccountingQueryBuilder { public class AccountingQuery4Job extends AccountingQueryBuilder {
protected static Logger logger = LoggerFactory protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Job.class);
.getLogger(AccountingQuery4Job.class);
private SeriesRequest seriesRequest; private SeriesRequest seriesRequest;
public AccountingQuery4Job(SeriesRequest seriesRequest) { public AccountingQuery4Job(SeriesRequest seriesRequest) {
@ -37,21 +36,17 @@ public class AccountingQuery4Job 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 +57,14 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
endCalendar.set(GregorianCalendar.SECOND, 59); endCalendar.set(GregorianCalendar.SECOND, 59);
endCalendar.set(GregorianCalendar.MILLISECOND, 999); endCalendar.set(GregorianCalendar.MILLISECOND, 999);
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,15 +72,13 @@ public class AccountingQuery4Job 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( invocation = new AccountingQueryBasic(AggregatedJobUsageRecord.class, accountingFilterBasic.getScope(),
AggregatedJobUsageRecord.class, temporalConstraint, accountingFilterBasic.isNoContext(), temporalConstraint, filters);
filters, accountingFilterBasic.isNoContext());
} else { } else {
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) { if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
@ -98,18 +88,14 @@ public class AccountingQuery4Job 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( invocation = new AccountingQueryTop(AggregatedJobUsageRecord.class, accountingFilterTop.getScope(),
AggregatedJobUsageRecord.class, accountingFilterTop.getFilterKey(), accountingFilterTop.getShowOthers(),
accountingFilterTop.getFilterKey(), accountingFilterTop.getTopNumber(), temporalConstraint, filters);
accountingFilterTop.getShowOthers(),
accountingFilterTop.getTopNumber(),
temporalConstraint, filters);
} else { } else {
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) { if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
@ -118,20 +104,16 @@ public class AccountingQuery4Job 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 AccountingQueryContext( invocation = new AccountingQueryContext(AggregatedJobUsageRecord.class,
AggregatedJobUsageRecord.class, accountingFilterContext.getContext(), temporalConstraint, filters);
accountingFilterContext.getContext(),
temporalConstraint, filters);
} else { } else {
logger.error("Invalid Request: " + seriesRequest); logger.error("Invalid Request: " + seriesRequest);
throw new ServiceException( throw new ServiceException("Invalid Request!");
"Invalid Request!");
} }
} }

View File

@ -21,13 +21,12 @@ import org.slf4j.LoggerFactory;
/** /**
* Accounting Query 4 Portlet * Accounting Query 4 Portlet
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* *
* *
*/ */
public class AccountingQuery4Portlet extends AccountingQueryBuilder { public class AccountingQuery4Portlet extends AccountingQueryBuilder {
protected static Logger logger = LoggerFactory protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Portlet.class);
.getLogger(AccountingQuery4Portlet.class);
private SeriesRequest seriesRequest; private SeriesRequest seriesRequest;
public AccountingQuery4Portlet(SeriesRequest seriesRequest) { public AccountingQuery4Portlet(SeriesRequest seriesRequest) {
@ -36,21 +35,17 @@ public class AccountingQuery4Portlet 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!");
@ -61,17 +56,14 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
endCalendar.set(GregorianCalendar.SECOND, 59); endCalendar.set(GregorianCalendar.SECOND, 59);
endCalendar.set(GregorianCalendar.MILLISECOND, 999); endCalendar.set(GregorianCalendar.MILLISECOND, 999);
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();
@ -79,15 +71,14 @@ public class AccountingQuery4Portlet 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( invocation = new AccountingQueryBasic(AggregatedPortletUsageRecord.class,
AggregatedPortletUsageRecord.class, temporalConstraint, accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
filters,accountingFilterBasic.isNoContext()); filters);
} else { } else {
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) { if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
@ -97,18 +88,15 @@ public class AccountingQuery4Portlet 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( invocation = new AccountingQueryTop(AggregatedPortletUsageRecord.class,
AggregatedPortletUsageRecord.class, accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
accountingFilterTop.getFilterKey(), accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
accountingFilterTop.getShowOthers(), filters);
accountingFilterTop.getTopNumber(),
temporalConstraint, filters);
} else { } else {
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) { if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
@ -117,20 +105,16 @@ public class AccountingQuery4Portlet 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 AccountingQueryContext( invocation = new AccountingQueryContext(AggregatedPortletUsageRecord.class,
AggregatedPortletUsageRecord.class, accountingFilterContext.getContext(), temporalConstraint, filters);
accountingFilterContext.getContext(),
temporalConstraint, filters);
} else { } else {
logger.error("Invalid Request: " + seriesRequest); logger.error("Invalid Request: " + seriesRequest);
throw new ServiceException( throw new ServiceException("Invalid Request!");
"Invalid Request!");
} }
} }

View File

@ -21,13 +21,12 @@ import org.slf4j.LoggerFactory;
/** /**
* Accounting Query 4 Service * Accounting Query 4 Service
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* *
* *
*/ */
public class AccountingQuery4Service extends AccountingQueryBuilder { public class AccountingQuery4Service extends AccountingQueryBuilder {
protected static Logger logger = LoggerFactory protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Service.class);
.getLogger(AccountingQuery4Service.class);
private SeriesRequest seriesRequest; private SeriesRequest seriesRequest;
public AccountingQuery4Service(SeriesRequest seriesRequest) { public AccountingQuery4Service(SeriesRequest seriesRequest) {
@ -37,21 +36,17 @@ public class AccountingQuery4Service 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 +57,14 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
endCalendar.set(GregorianCalendar.SECOND, 59); endCalendar.set(GregorianCalendar.SECOND, 59);
endCalendar.set(GregorianCalendar.MILLISECOND, 999); endCalendar.set(GregorianCalendar.MILLISECOND, 999);
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,15 +72,14 @@ public class AccountingQuery4Service 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( invocation = new AccountingQueryBasic(AggregatedServiceUsageRecord.class,
AggregatedServiceUsageRecord.class, temporalConstraint, accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
filters, accountingFilterBasic.isNoContext()); filters);
} else { } else {
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) { if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
@ -98,18 +89,15 @@ public class AccountingQuery4Service 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( invocation = new AccountingQueryTop(AggregatedServiceUsageRecord.class,
AggregatedServiceUsageRecord.class, accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
accountingFilterTop.getFilterKey(), accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
accountingFilterTop.getShowOthers(), filters);
accountingFilterTop.getTopNumber(),
temporalConstraint, filters);
} else { } else {
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) { if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
@ -118,20 +106,16 @@ public class AccountingQuery4Service 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 AccountingQueryContext( invocation = new AccountingQueryContext(AggregatedServiceUsageRecord.class,
AggregatedServiceUsageRecord.class, accountingFilterContext.getContext(), temporalConstraint, filters);
accountingFilterContext.getContext(),
temporalConstraint, filters);
} else { } else {
logger.error("Invalid Request: " + seriesRequest); logger.error("Invalid Request: " + seriesRequest);
throw new ServiceException( throw new ServiceException("Invalid Request!");
"Invalid Request!");
} }
} }

View File

@ -21,13 +21,12 @@ import org.slf4j.LoggerFactory;
/** /**
* Accounting Query 4 Storage * Accounting Query 4 Storage
* *
* @author Giancarlo Panichi * @author Giancarlo Panichi
* *
* *
*/ */
public class AccountingQuery4Storage extends AccountingQueryBuilder { public class AccountingQuery4Storage extends AccountingQueryBuilder {
protected static Logger logger = LoggerFactory protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Storage.class);
.getLogger(AccountingQuery4Storage.class);
private SeriesRequest seriesRequest; private SeriesRequest seriesRequest;
public AccountingQuery4Storage(SeriesRequest seriesRequest) { public AccountingQuery4Storage(SeriesRequest seriesRequest) {
@ -37,21 +36,17 @@ public class AccountingQuery4Storage 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 +57,14 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
endCalendar.set(GregorianCalendar.SECOND, 59); endCalendar.set(GregorianCalendar.SECOND, 59);
endCalendar.set(GregorianCalendar.MILLISECOND, 999); endCalendar.set(GregorianCalendar.MILLISECOND, 999);
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,15 +72,14 @@ public class AccountingQuery4Storage 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( invocation = new AccountingQueryBasic(AggregatedStorageUsageRecord.class,
AggregatedStorageUsageRecord.class, temporalConstraint, accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
filters,accountingFilterBasic.isNoContext()); filters);
} else { } else {
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) { if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
@ -98,18 +89,15 @@ public class AccountingQuery4Storage 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( invocation = new AccountingQueryTop(AggregatedStorageUsageRecord.class,
AggregatedStorageUsageRecord.class, accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
accountingFilterTop.getFilterKey(), accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
accountingFilterTop.getShowOthers(), filters);
accountingFilterTop.getTopNumber(),
temporalConstraint, filters);
} else { } else {
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) { if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
@ -118,20 +106,16 @@ public class AccountingQuery4Storage 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 AccountingQueryContext( invocation = new AccountingQueryContext(AggregatedStorageUsageRecord.class,
AggregatedStorageUsageRecord.class, accountingFilterContext.getContext(), temporalConstraint, filters);
accountingFilterContext.getContext(),
temporalConstraint, filters);
} else { } else {
logger.error("Invalid Request: " + seriesRequest); logger.error("Invalid Request: " + seriesRequest);
throw new ServiceException( throw new ServiceException("Invalid Request!");
"Invalid Request!");
} }
} }

View File

@ -15,18 +15,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 boolean noContext;
private TemporalConstraint temporalConstraint; private TemporalConstraint temporalConstraint;
private ArrayList<Filter> filters; private ArrayList<Filter> filters;
private boolean noContext;
public AccountingQueryBasic( public AccountingQueryBasic(Class<? extends AggregatedUsageRecord<?, ?>> type, String scope, boolean noContext,
Class<? extends AggregatedUsageRecord<?, ?>> type, TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
TemporalConstraint temporalConstraint, ArrayList<Filter> filters,
boolean noContext) {
super(); super();
chartType = ChartType.Basic; chartType = ChartType.Basic;
this.type = type; this.type = type;
this.temporalConstraint = temporalConstraint; this.temporalConstraint = temporalConstraint;
this.scope = scope;
this.filters = filters; this.filters = filters;
this.noContext = noContext; this.noContext = noContext;
} }
@ -47,6 +47,14 @@ public class AccountingQueryBasic extends AccountingQuery {
this.temporalConstraint = temporalConstraint; this.temporalConstraint = temporalConstraint;
} }
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public ArrayList<Filter> getFilters() { public ArrayList<Filter> getFilters() {
return filters; return filters;
} }
@ -65,11 +73,8 @@ public class AccountingQueryBasic extends AccountingQuery {
@Override @Override
public String toString() { public String toString() {
return "AccountingQueryBasic [type=" + type + ", temporalConstraint=" return "AccountingQueryBasic [type=" + type + ", temporalConstraint=" + temporalConstraint + ", scope=" + scope
+ temporalConstraint + ", filters=" + filters + ", noContext=" + ", filters=" + filters + ", noContext=" + noContext + "]";
+ noContext + "]";
} }
} }

View File

@ -20,8 +20,7 @@ public class AccountingQueryContext extends AccountingQuery {
private TemporalConstraint temporalConstraint; private TemporalConstraint temporalConstraint;
private ArrayList<Filter> filters; private ArrayList<Filter> filters;
public AccountingQueryContext( public AccountingQueryContext(Class<? extends AggregatedUsageRecord<?, ?>> type, Context context,
Class<? extends AggregatedUsageRecord<?, ?>> type, Context context,
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) { TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
super(); super();
chartType = ChartType.Context; chartType = ChartType.Context;
@ -65,9 +64,8 @@ public class AccountingQueryContext extends AccountingQuery {
@Override @Override
public String toString() { public String toString() {
return "AccountingQueryContext [type=" + type + ", context=" + context return "AccountingQueryContext [type=" + type + ", context=" + context + ", temporalConstraint="
+ ", temporalConstraint=" + temporalConstraint + ", filters=" + temporalConstraint + ", filters=" + filters + "]";
+ filters + "]";
} }
} }

View File

@ -15,19 +15,20 @@ 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 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, public AccountingQueryTop(Class<? extends AggregatedUsageRecord<?, ?>> type, String scope, FilterKey filterKey,
FilterKey filterKey, Boolean showOthers, Integer topNumber, Boolean showOthers, Integer topNumber, TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
super(); super();
chartType = ChartType.Top; chartType = ChartType.Top;
this.type = type; this.type = type;
this.scope = scope;
this.temporalConstraint = temporalConstraint; this.temporalConstraint = temporalConstraint;
this.filters = filters; this.filters = filters;
this.filterKey = filterKey; this.filterKey = filterKey;
@ -35,14 +36,22 @@ public class AccountingQueryTop extends AccountingQuery {
this.topNumber = topNumber; this.topNumber = topNumber;
} }
public Class<? extends AggregatedUsageRecord<?,?>> getType() { public Class<? extends AggregatedUsageRecord<?, ?>> getType() {
return type; return type;
} }
public void setType(Class<? extends AggregatedUsageRecord<?,?>> type) { public void setType(Class<? extends AggregatedUsageRecord<?, ?>> type) {
this.type = type; this.type = type;
} }
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public TemporalConstraint getTemporalConstraint() { public TemporalConstraint getTemporalConstraint() {
return temporalConstraint; return temporalConstraint;
} }
@ -66,7 +75,6 @@ public class AccountingQueryTop extends AccountingQuery {
public void setFilterKey(FilterKey filterKey) { public void setFilterKey(FilterKey filterKey) {
this.filterKey = filterKey; this.filterKey = filterKey;
} }
public Boolean getShowOthers() { public Boolean getShowOthers() {
return showOthers; return showOthers;
@ -86,12 +94,9 @@ public class AccountingQueryTop extends AccountingQuery {
@Override @Override
public String toString() { public String toString() {
return "AccountingQueryTop [type=" + type + ", filterKey=" + filterKey return "AccountingQueryTop [type=" + type + ", scope=" + scope + ", filterKey=" + filterKey + ", topNumber="
+ ", topNumber=" + topNumber + ", showOthers=" + showOthers + topNumber + ", showOthers=" + showOthers + ", temporalConstraint=" + temporalConstraint + ", filters="
+ ", temporalConstraint=" + temporalConstraint + ", filters="
+ filters + "]"; + filters + "]";
} }
} }

View File

@ -14,6 +14,7 @@ public class AccountingFilterBasic extends AccountingFilterDefinition implements
private static final long serialVersionUID = -6805006183397381154L; private static final long serialVersionUID = -6805006183397381154L;
private ArrayList<AccountingFilter> filters; private ArrayList<AccountingFilter> filters;
private String scope;
private Boolean noContext; private Boolean noContext;
public AccountingFilterBasic() { public AccountingFilterBasic() {
@ -21,24 +22,39 @@ public class AccountingFilterBasic extends AccountingFilterDefinition implements
this.chartType = ChartType.Basic; this.chartType = ChartType.Basic;
noContext = false; noContext = false;
filters = null; filters = null;
scope=null;
} }
public AccountingFilterBasic(boolean noContenxt) { public AccountingFilterBasic(String scope, boolean noContenxt) {
super(); super();
chartType = ChartType.Basic; chartType = ChartType.Basic;
this.filters = null; this.filters = null;
this.scope=scope;
this.noContext = noContenxt; this.noContext = noContenxt;
} }
public AccountingFilterBasic(ArrayList<AccountingFilter> filters, public AccountingFilterBasic(String scope, ArrayList<AccountingFilter> filters,
boolean noContenxt) { boolean noContenxt) {
super(); super();
chartType = ChartType.Basic; chartType = ChartType.Basic;
this.scope=scope;
this.filters = filters; this.filters = filters;
this.noContext = noContenxt; this.noContext = noContenxt;
} }
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public Boolean getNoContext() {
return noContext;
}
public ArrayList<AccountingFilter> getFilters() { public ArrayList<AccountingFilter> getFilters() {
return filters; return filters;
@ -58,8 +74,10 @@ public class AccountingFilterBasic extends AccountingFilterDefinition implements
@Override @Override
public String toString() { public String toString() {
return "AccountingFilterBasic [filters=" + filters + ", noContext=" return "AccountingFilterBasic [filters=" + filters + ", scope=" + scope + ", noContext=" + noContext
+ noContext + "]"; + ", chartType=" + chartType + "]";
} }
} }

View File

@ -13,6 +13,7 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
Serializable { Serializable {
private static final long serialVersionUID = -6805006183397381154L; private static final long serialVersionUID = -6805006183397381154L;
private String scope;
private FilterKey filterKey; private FilterKey filterKey;
private Boolean showOthers; private Boolean showOthers;
private Integer topNumber; private Integer topNumber;
@ -21,6 +22,7 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
public AccountingFilterTop() { public AccountingFilterTop() {
super(); super();
this.chartType = ChartType.Top; this.chartType = ChartType.Top;
scope=null;
showOthers = false; showOthers = false;
topNumber = 5; topNumber = 5;
filterKey = null; filterKey = null;
@ -28,9 +30,10 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
} }
public AccountingFilterTop(Boolean showOthers,Integer topNumber) { public AccountingFilterTop(String scope, Boolean showOthers,Integer topNumber) {
super(); super();
this.chartType = ChartType.Top; this.chartType = ChartType.Top;
this.scope=scope;
this.showOthers = showOthers; this.showOthers = showOthers;
this.topNumber = topNumber; this.topNumber = topNumber;
filterKey = null; filterKey = null;
@ -39,11 +42,12 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
} }
public AccountingFilterTop(FilterKey filterKey, public AccountingFilterTop(String scope, FilterKey filterKey,
ArrayList<AccountingFilter> filters, Boolean showOthers, ArrayList<AccountingFilter> filters, Boolean showOthers,
Integer topNumber) { Integer topNumber) {
super(); super();
chartType = ChartType.Top; chartType = ChartType.Top;
this.scope=scope;
this.filterKey = filterKey; this.filterKey = filterKey;
this.filters = filters; this.filters = filters;
this.showOthers = showOthers; this.showOthers = showOthers;
@ -51,6 +55,14 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
} }
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public FilterKey getFilterKey() { public FilterKey getFilterKey() {
return filterKey; return filterKey;
} }
@ -85,9 +97,10 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
@Override @Override
public String toString() { public String toString() {
return "AccountingFilterTop [filterKey=" + filterKey + ", showOthers=" return "AccountingFilterTop [scope=" + scope + ", filterKey=" + filterKey + ", showOthers=" + showOthers
+ showOthers + ", topNumber=" + topNumber + ", filters=" + ", topNumber=" + topNumber + ", filters=" + filters + ", chartType=" + chartType + "]";
+ filters + "]";
} }
} }