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:
parent
bf8394056a
commit
a7cbb9d9d6
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</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>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -45,5 +45,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/accounting-manager-1.10.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/accounting-manager-1.11.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="accounting-manager-1.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="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<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"
|
||||
date="2018-10-01">
|
||||
<Change>Updated to StorageHub [Ticket #12474]</Change>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.portlets.admin</groupId>
|
||||
<artifactId>accounting-manager</artifactId>
|
||||
<version>1.10.0-SNAPSHOT</version>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
|
||||
|
|
|
@ -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.properties.AccountingFilterProperties;
|
||||
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.rpc.AccountingManagerServiceAsync;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
|
||||
|
@ -127,6 +128,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
private FieldLabel comboChartTypeLabel;
|
||||
private ListStore<ChartType> storeComboChartType;
|
||||
private ComboBox<ChartType> comboChartType;
|
||||
private ListStore<GenresData> storeComboScope;
|
||||
private ComboBox<GenresData> comboScope;
|
||||
private FieldLabel comboScopeLabel;
|
||||
private ListStore<FilterKey> storeComboTopFilterKey;
|
||||
private ComboBox<FilterKey> comboTopFilterKey;
|
||||
private FieldLabel comboTopFilterKeyLabel;
|
||||
|
@ -387,7 +391,8 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
try {
|
||||
// GridCell cell = event.getEditCell();
|
||||
// int rowIndex = cell.getRow();
|
||||
//AccountingFilter editingFilter = storeFilter.get(rowIndex);
|
||||
// AccountingFilter editingFilter =
|
||||
// storeFilter.get(rowIndex);
|
||||
|
||||
if (addStatus) {
|
||||
addStatus = false;
|
||||
|
@ -482,9 +487,21 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
// comboFilterValue.addValidator(new EmptyValidator<String>());
|
||||
comboChartType.setTriggerAction(TriggerAction.ALL);
|
||||
addHandlersForComboChartType(comboChartTypeLabelProvider);
|
||||
|
||||
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
|
||||
storeComboTopFilterKey = new ListStore<FilterKey>(filterKeyPropertiesCombo.id());
|
||||
|
||||
|
@ -572,6 +589,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
||||
|
||||
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(noContextLabel, 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));
|
||||
comboChartTypeLabel.setVisible(false);
|
||||
comboScopeLabel.setVisible(false);
|
||||
gridGenres.setVisible(false);
|
||||
noContextLabel.setVisible(false);
|
||||
comboTopFilterKeyLabel.setVisible(false);
|
||||
|
@ -696,6 +715,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
storeComboTopFilterKey.addAll(accountingStateData.getAvailableFilterKeys());
|
||||
storeComboTopFilterKey.commitChanges();
|
||||
|
||||
|
||||
ChartType chartType = accountingStateData.getSeriesRequest().getAccountingFilterDefinition().getChartType();
|
||||
|
||||
switch (chartType) {
|
||||
|
@ -726,6 +746,28 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) accountingStateData.getSeriesRequest()
|
||||
.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) {
|
||||
List<AccountingFilter> filters = accountingFilterBasic.getFilters();
|
||||
storeFilter.clear();
|
||||
|
@ -762,6 +804,26 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
storeFilter.commitChanges();
|
||||
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()) {
|
||||
noContextToggle.reset();
|
||||
noContextNo.setValue(true);
|
||||
|
@ -773,7 +835,10 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
comboChartType.setValue(ChartType.Basic);
|
||||
comboScopeLabel.setVisible(true);
|
||||
gridGenres.setVisible(false);
|
||||
comboTopFilterKey.reset();
|
||||
comboTopFilterKeyLabel.setVisible(false);
|
||||
|
@ -793,6 +858,32 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
.getSeriesRequest().getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
AccountingFilterTop accountingFilterTop = (AccountingFilterTop) accountingStateData.getSeriesRequest()
|
||||
.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) {
|
||||
comboTopFilterKey.setValue(accountingFilterTop.getFilterKey());
|
||||
topNumber.setValue(accountingFilterTop.getTopNumber());
|
||||
|
@ -826,6 +917,27 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
seq = 0;
|
||||
}
|
||||
} 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();
|
||||
showOthersToggle.reset();
|
||||
showOthersNo.setValue(true);
|
||||
|
@ -929,6 +1041,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
comboChartType.setValue(ChartType.Context);
|
||||
comboScopeLabel.setVisible(false);
|
||||
gridGenres.setVisible(true);
|
||||
labelGenresCol.setHeader("Scope");
|
||||
gridGenres.getView().refresh(true);
|
||||
|
@ -1058,6 +1171,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
|
||||
}
|
||||
comboChartType.setValue(ChartType.Spaces);
|
||||
comboScopeLabel.setVisible(false);
|
||||
gridGenres.setVisible(true);
|
||||
labelGenresCol.setHeader("Space");
|
||||
gridGenres.getView().refresh(true);
|
||||
|
@ -1134,6 +1248,16 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
|
||||
// TODO
|
||||
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;
|
||||
if (noContextLabel != null && noContextLabel.isVisible()) {
|
||||
noContextValue = noContextYes.getValue();
|
||||
|
@ -1142,8 +1266,10 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
Log.debug("noContextValue: " + noContextValue);
|
||||
|
||||
|
||||
|
||||
if (storeFilter == null || storeFilter.size() <= 0) {
|
||||
return new AccountingFilterBasic(noContextValue);
|
||||
return new AccountingFilterBasic(scope, noContextValue);
|
||||
} else {
|
||||
List<AccountingFilter> filtersActives = storeFilter.getAll();
|
||||
ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>();
|
||||
|
@ -1154,23 +1280,32 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
if (filtersReady.size() > 0) {
|
||||
return new AccountingFilterBasic(filtersReady, noContextValue);
|
||||
return new AccountingFilterBasic(scope, filtersReady, noContextValue);
|
||||
} else {
|
||||
return new AccountingFilterBasic(noContextValue);
|
||||
return new AccountingFilterBasic(scope, noContextValue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
Integer topN = topNumber.getCurrentValue();
|
||||
FilterKey filterKey = comboTopFilterKey.getCurrentValue();
|
||||
if (filterKey == null) {
|
||||
return new AccountingFilterTop(showOthersValue, topN);
|
||||
return new AccountingFilterTop(scope, showOthersValue, topN);
|
||||
} else {
|
||||
if (storeFilter == null || storeFilter.size() <= 0) {
|
||||
return new AccountingFilterTop(filterKey, null, showOthersValue, topN);
|
||||
return new AccountingFilterTop(scope, filterKey, null, showOthersValue, topN);
|
||||
} else {
|
||||
List<AccountingFilter> filtersActives = storeFilter.getAll();
|
||||
ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>();
|
||||
|
@ -1180,9 +1315,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
}
|
||||
if (filtersReady.size() > 0) {
|
||||
return new AccountingFilterTop(filterKey, filtersReady, showOthersValue, topN);
|
||||
return new AccountingFilterTop(scope, filterKey, filtersReady, showOthersValue, topN);
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
|
@ -28,16 +28,13 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*
|
||||
*/
|
||||
public class AccountingCommandBasic implements
|
||||
AccountingCommand<SeriesResponse> {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(AccountingCommandBasic.class);
|
||||
public class AccountingCommandBasic implements AccountingCommand<SeriesResponse> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(AccountingCommandBasic.class);
|
||||
|
||||
private AccountingQueryBasic accountingQueryBasic;
|
||||
private AccountingType accountingType;
|
||||
|
||||
public AccountingCommandBasic(AccountingQueryBasic accountingQueryBasic,
|
||||
AccountingType accountingType) {
|
||||
public AccountingCommandBasic(AccountingQueryBasic accountingQueryBasic, AccountingType accountingType) {
|
||||
this.accountingQueryBasic = accountingQueryBasic;
|
||||
this.accountingType = accountingType;
|
||||
}
|
||||
|
@ -45,41 +42,43 @@ public class AccountingCommandBasic implements
|
|||
@Override
|
||||
public SeriesResponse execute() throws ServiceException {
|
||||
try {
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||
.getInstance();
|
||||
|
||||
if (accountingQueryBasic.getScope() != null && !accountingQueryBasic.getScope().isEmpty()) {
|
||||
AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryBasic.getScope());
|
||||
}
|
||||
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||
|
||||
SortedMap<Calendar, Info> sm = null;
|
||||
if (accountingQueryBasic.isNoContext()) {
|
||||
logger.debug("Execute NoContextTimeSeries()");
|
||||
sm = apq.getNoContextTimeSeries(accountingQueryBasic.getType(),
|
||||
accountingQueryBasic.getTemporalConstraint(),
|
||||
accountingQueryBasic.getFilters(), true);
|
||||
accountingQueryBasic.getTemporalConstraint(), accountingQueryBasic.getFilters(), true);
|
||||
} else {
|
||||
logger.debug("Execute TimeSeries()");
|
||||
sm = apq.getTimeSeries(
|
||||
accountingQueryBasic.getType(),
|
||||
accountingQueryBasic.getTemporalConstraint(),
|
||||
sm = apq.getTimeSeries(accountingQueryBasic.getType(), accountingQueryBasic.getTemporalConstraint(),
|
||||
accountingQueryBasic.getFilters(), true);
|
||||
|
||||
}
|
||||
|
||||
if (accountingQueryBasic.getScope() != null && !accountingQueryBasic.getScope().isEmpty()) {
|
||||
AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
||||
}
|
||||
|
||||
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!");
|
||||
}
|
||||
|
||||
List<Info> infos = new ArrayList<>(sm.values());
|
||||
logger.debug("Retrieved Infos");
|
||||
logger.debug("Infos: " + infos);
|
||||
|
||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
||||
accountingType, infos);
|
||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(accountingType, infos);
|
||||
|
||||
SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector();
|
||||
seriesResponseDirector
|
||||
.setSeriesResponseBuilder(seriesResponseBuilder);
|
||||
seriesResponseDirector.setSeriesResponseBuilder(seriesResponseBuilder);
|
||||
seriesResponseDirector.constructSeriesResponse();
|
||||
SeriesResponse seriesResponse = seriesResponseDirector
|
||||
.getSeriesResponse();
|
||||
SeriesResponse seriesResponse = seriesResponseDirector.getSeriesResponse();
|
||||
|
||||
if (seriesResponse == null) {
|
||||
throw new ServiceException("Error creating series response!");
|
||||
|
@ -87,16 +86,14 @@ public class AccountingCommandBasic implements
|
|||
logger.debug("SeriesResponse Created: " + seriesResponse);
|
||||
return seriesResponse;
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error in AccountingCommandBasic(): "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error in AccountingCommandBasic(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("No data available!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private SeriesResponseBuilder getSeriesResponseBuilder(
|
||||
AccountingType accountingType, List<Info> infos)
|
||||
private SeriesResponseBuilder getSeriesResponseBuilder(AccountingType accountingType, List<Info> infos)
|
||||
throws ServiceException {
|
||||
if (accountingType == null) {
|
||||
throw new ServiceException("Error accounting type is null");
|
||||
|
|
|
@ -28,14 +28,12 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(AccountingCommandTop.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(AccountingCommandTop.class);
|
||||
|
||||
private AccountingQueryTop accountingQueryTop;
|
||||
private AccountingType accountingType;
|
||||
|
||||
public AccountingCommandTop(AccountingQueryTop accountingQueryTop,
|
||||
AccountingType accountingType) {
|
||||
public AccountingCommandTop(AccountingQueryTop accountingQueryTop, AccountingType accountingType) {
|
||||
this.accountingQueryTop = accountingQueryTop;
|
||||
this.accountingType = accountingType;
|
||||
}
|
||||
|
@ -43,46 +41,42 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
@Override
|
||||
public SeriesResponse execute() throws ServiceException {
|
||||
try {
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory
|
||||
.getInstance();
|
||||
|
||||
logger.debug("Query TopValues: "
|
||||
+ accountingQueryTop.getFilterKey().getKey());
|
||||
if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
|
||||
AccountingPersistenceQueryFactory.getForcedQueryScope().set(accountingQueryTop.getScope());
|
||||
}
|
||||
|
||||
AccountingPersistenceQuery apq = AccountingPersistenceQueryFactory.getInstance();
|
||||
|
||||
logger.debug("Query TopValues: " + accountingQueryTop.getFilterKey().getKey());
|
||||
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM;
|
||||
|
||||
if (accountingQueryTop.getShowOthers()) {
|
||||
topSM= apq
|
||||
.getTopValues(accountingQueryTop.getType(),
|
||||
accountingQueryTop.getTemporalConstraint(),
|
||||
accountingQueryTop.getFilters(),
|
||||
accountingQueryTop.getFilterKey().getKey(),
|
||||
null, true, 0);
|
||||
topSM = apq.getTopValues(accountingQueryTop.getType(), accountingQueryTop.getTemporalConstraint(),
|
||||
accountingQueryTop.getFilters(), accountingQueryTop.getFilterKey().getKey(), null, true, 0);
|
||||
} else {
|
||||
topSM= apq
|
||||
.getTopValues(accountingQueryTop.getType(),
|
||||
accountingQueryTop.getTemporalConstraint(),
|
||||
accountingQueryTop.getFilters(),
|
||||
accountingQueryTop.getFilterKey().getKey(),
|
||||
null, true, accountingQueryTop.getTopNumber());
|
||||
topSM = apq.getTopValues(accountingQueryTop.getType(), accountingQueryTop.getTemporalConstraint(),
|
||||
accountingQueryTop.getFilters(), accountingQueryTop.getFilterKey().getKey(), null, true,
|
||||
accountingQueryTop.getTopNumber());
|
||||
}
|
||||
|
||||
if (accountingQueryTop.getScope() != null && !accountingQueryTop.getScope().isEmpty()) {
|
||||
AccountingPersistenceQueryFactory.getForcedQueryScope().remove();
|
||||
}
|
||||
|
||||
if (topSM == null) {
|
||||
throw new ServiceException(
|
||||
"Error retrieving info for top: sorted map is null!");
|
||||
throw new ServiceException("Error retrieving info for top: sorted map is null!");
|
||||
}
|
||||
|
||||
logger.debug("TopSM: " + topSM);
|
||||
|
||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(
|
||||
accountingType, topSM);
|
||||
SeriesResponseBuilder seriesResponseBuilder = getSeriesResponseBuilder(accountingType, topSM);
|
||||
|
||||
SeriesResponseDirector seriesResponseDirector = new SeriesResponseDirector();
|
||||
seriesResponseDirector
|
||||
.setSeriesResponseBuilder(seriesResponseBuilder);
|
||||
seriesResponseDirector.setSeriesResponseBuilder(seriesResponseBuilder);
|
||||
seriesResponseDirector.constructSeriesResponse();
|
||||
SeriesResponse seriesResponse = seriesResponseDirector
|
||||
.getSeriesResponse();
|
||||
SeriesResponse seriesResponse = seriesResponseDirector.getSeriesResponse();
|
||||
|
||||
if (seriesResponse == null) {
|
||||
throw new ServiceException("Error creating series response!");
|
||||
|
@ -91,33 +85,35 @@ public class AccountingCommandTop implements AccountingCommand<SeriesResponse> {
|
|||
return seriesResponse;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Error in AccountingCommandTop(): "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.error("Error in AccountingCommandTop(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("No data available!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private SeriesResponseBuilder getSeriesResponseBuilder(
|
||||
AccountingType accountingType,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM)
|
||||
throws ServiceException {
|
||||
private SeriesResponseBuilder getSeriesResponseBuilder(AccountingType accountingType,
|
||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> topSM) throws ServiceException {
|
||||
if (accountingType == null) {
|
||||
throw new ServiceException("Error accounting type is null");
|
||||
}
|
||||
|
||||
switch (accountingType) {
|
||||
case JOB:
|
||||
return new SeriesResponse4JobTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(), topSM);
|
||||
return new SeriesResponse4JobTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
case PORTLET:
|
||||
return new SeriesResponse4PortletTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM);
|
||||
return new SeriesResponse4PortletTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
case SERVICE:
|
||||
return new SeriesResponse4ServiceTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM);
|
||||
return new SeriesResponse4ServiceTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
case STORAGE:
|
||||
return new SeriesResponse4StorageTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM);
|
||||
return new SeriesResponse4StorageTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
case TASK:
|
||||
return new SeriesResponse4TaskTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),topSM);
|
||||
return new SeriesResponse4TaskTop(accountingQueryTop.getShowOthers(), accountingQueryTop.getTopNumber(),
|
||||
topSM);
|
||||
default:
|
||||
throw new ServiceException("Error request type is unknow!");
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class AccountingQuery4Job extends AccountingQueryBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingQuery4Job.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Job.class);
|
||||
private SeriesRequest seriesRequest;
|
||||
|
||||
public AccountingQuery4Job(SeriesRequest seriesRequest) {
|
||||
|
@ -37,21 +36,17 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
@Override
|
||||
public void buildOpEx() throws ServiceException {
|
||||
|
||||
Calendar startCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Start Date not valid!");
|
||||
}
|
||||
|
||||
Calendar endCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("End Date not valid!");
|
||||
|
@ -62,17 +57,14 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
endCalendar.set(GregorianCalendar.SECOND, 59);
|
||||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||
startCalendar.getTimeInMillis(), endCalendar.getTimeInMillis(),
|
||||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()));
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(startCalendar.getTimeInMillis(),
|
||||
endCalendar.getTimeInMillis(), PeriodModeMap.getMode(seriesRequest.getAccountingPeriod().getPeriod()));
|
||||
|
||||
ArrayList<Filter> filters = null;
|
||||
ArrayList<AccountingFilter> accountingFilters = null;
|
||||
AccountingQuery invocation = null;
|
||||
|
||||
if (seriesRequest != null
|
||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest != null && seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterBasic) {
|
||||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
|
@ -80,15 +72,13 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryBasic(
|
||||
AggregatedJobUsageRecord.class, temporalConstraint,
|
||||
filters, accountingFilterBasic.isNoContext());
|
||||
invocation = new AccountingQueryBasic(AggregatedJobUsageRecord.class, accountingFilterBasic.getScope(),
|
||||
accountingFilterBasic.isNoContext(), temporalConstraint, filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
|
@ -98,18 +88,14 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryTop(
|
||||
AggregatedJobUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
invocation = new AccountingQueryTop(AggregatedJobUsageRecord.class, accountingFilterTop.getScope(),
|
||||
accountingFilterTop.getFilterKey(), accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(), temporalConstraint, filters);
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
|
@ -118,20 +104,16 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedJobUsageRecord.class,
|
||||
accountingFilterContext.getContext(),
|
||||
temporalConstraint, filters);
|
||||
invocation = new AccountingQueryContext(AggregatedJobUsageRecord.class,
|
||||
accountingFilterContext.getContext(), temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingQuery4Portlet.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Portlet.class);
|
||||
private SeriesRequest seriesRequest;
|
||||
|
||||
public AccountingQuery4Portlet(SeriesRequest seriesRequest) {
|
||||
|
@ -36,21 +35,17 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
|
||||
@Override
|
||||
public void buildOpEx() throws ServiceException {
|
||||
Calendar startCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Start Date not valid!");
|
||||
}
|
||||
|
||||
Calendar endCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("End Date not valid!");
|
||||
|
@ -61,17 +56,14 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
endCalendar.set(GregorianCalendar.SECOND, 59);
|
||||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||
startCalendar.getTimeInMillis(), endCalendar.getTimeInMillis(),
|
||||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()));
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(startCalendar.getTimeInMillis(),
|
||||
endCalendar.getTimeInMillis(), PeriodModeMap.getMode(seriesRequest.getAccountingPeriod().getPeriod()));
|
||||
|
||||
ArrayList<Filter> filters = null;
|
||||
ArrayList<AccountingFilter> accountingFilters = null;
|
||||
AccountingQuery invocation = null;
|
||||
|
||||
if (seriesRequest != null
|
||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest != null && seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterBasic) {
|
||||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
|
@ -79,15 +71,14 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryBasic(
|
||||
AggregatedPortletUsageRecord.class, temporalConstraint,
|
||||
filters,accountingFilterBasic.isNoContext());
|
||||
invocation = new AccountingQueryBasic(AggregatedPortletUsageRecord.class,
|
||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
||||
filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
|
@ -97,18 +88,15 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryTop(
|
||||
AggregatedPortletUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
invocation = new AccountingQueryTop(AggregatedPortletUsageRecord.class,
|
||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||
filters);
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
|
@ -117,20 +105,16 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedPortletUsageRecord.class,
|
||||
accountingFilterContext.getContext(),
|
||||
temporalConstraint, filters);
|
||||
invocation = new AccountingQueryContext(AggregatedPortletUsageRecord.class,
|
||||
accountingFilterContext.getContext(), temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class AccountingQuery4Service extends AccountingQueryBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingQuery4Service.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Service.class);
|
||||
private SeriesRequest seriesRequest;
|
||||
|
||||
public AccountingQuery4Service(SeriesRequest seriesRequest) {
|
||||
|
@ -37,21 +36,17 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
@Override
|
||||
public void buildOpEx() throws ServiceException {
|
||||
|
||||
Calendar startCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Start Date not valid!");
|
||||
}
|
||||
|
||||
Calendar endCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("End Date not valid!");
|
||||
|
@ -62,17 +57,14 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
endCalendar.set(GregorianCalendar.SECOND, 59);
|
||||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||
startCalendar.getTimeInMillis(), endCalendar.getTimeInMillis(),
|
||||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()));
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(startCalendar.getTimeInMillis(),
|
||||
endCalendar.getTimeInMillis(), PeriodModeMap.getMode(seriesRequest.getAccountingPeriod().getPeriod()));
|
||||
|
||||
ArrayList<Filter> filters = null;
|
||||
ArrayList<AccountingFilter> accountingFilters = null;
|
||||
AccountingQuery invocation = null;
|
||||
|
||||
if (seriesRequest != null
|
||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest != null && seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterBasic) {
|
||||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
|
@ -80,15 +72,14 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryBasic(
|
||||
AggregatedServiceUsageRecord.class, temporalConstraint,
|
||||
filters, accountingFilterBasic.isNoContext());
|
||||
invocation = new AccountingQueryBasic(AggregatedServiceUsageRecord.class,
|
||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
||||
filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
|
@ -98,18 +89,15 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryTop(
|
||||
AggregatedServiceUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
invocation = new AccountingQueryTop(AggregatedServiceUsageRecord.class,
|
||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||
filters);
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
|
@ -118,20 +106,16 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedServiceUsageRecord.class,
|
||||
accountingFilterContext.getContext(),
|
||||
temporalConstraint, filters);
|
||||
invocation = new AccountingQueryContext(AggregatedServiceUsageRecord.class,
|
||||
accountingFilterContext.getContext(), temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
*/
|
||||
public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
||||
protected static Logger logger = LoggerFactory
|
||||
.getLogger(AccountingQuery4Storage.class);
|
||||
protected static Logger logger = LoggerFactory.getLogger(AccountingQuery4Storage.class);
|
||||
private SeriesRequest seriesRequest;
|
||||
|
||||
public AccountingQuery4Storage(SeriesRequest seriesRequest) {
|
||||
|
@ -37,21 +36,17 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
@Override
|
||||
public void buildOpEx() throws ServiceException {
|
||||
|
||||
Calendar startCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getStartDate()));
|
||||
startCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getStartDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Start Date not valid!");
|
||||
}
|
||||
|
||||
Calendar endCalendar = GregorianCalendar
|
||||
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
|
||||
try {
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod()
|
||||
.getEndDate()));
|
||||
endCalendar.setTime(sdf.parse(seriesRequest.getAccountingPeriod().getEndDate()));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("End Date not valid!");
|
||||
|
@ -62,17 +57,14 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
endCalendar.set(GregorianCalendar.SECOND, 59);
|
||||
endCalendar.set(GregorianCalendar.MILLISECOND, 999);
|
||||
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(
|
||||
startCalendar.getTimeInMillis(), endCalendar.getTimeInMillis(),
|
||||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()));
|
||||
TemporalConstraint temporalConstraint = new TemporalConstraint(startCalendar.getTimeInMillis(),
|
||||
endCalendar.getTimeInMillis(), PeriodModeMap.getMode(seriesRequest.getAccountingPeriod().getPeriod()));
|
||||
|
||||
ArrayList<Filter> filters = null;
|
||||
ArrayList<AccountingFilter> accountingFilters = null;
|
||||
AccountingQuery invocation = null;
|
||||
|
||||
if (seriesRequest != null
|
||||
&& seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest != null && seriesRequest.getAccountingFilterDefinition() != null) {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterBasic) {
|
||||
AccountingFilterBasic accountingFilterBasic = (AccountingFilterBasic) seriesRequest
|
||||
.getAccountingFilterDefinition();
|
||||
|
@ -80,15 +72,14 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryBasic(
|
||||
AggregatedStorageUsageRecord.class, temporalConstraint,
|
||||
filters,accountingFilterBasic.isNoContext());
|
||||
invocation = new AccountingQueryBasic(AggregatedStorageUsageRecord.class,
|
||||
accountingFilterBasic.getScope(), accountingFilterBasic.isNoContext(), temporalConstraint,
|
||||
filters);
|
||||
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterTop) {
|
||||
|
@ -98,18 +89,15 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryTop(
|
||||
AggregatedStorageUsageRecord.class,
|
||||
accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(),
|
||||
accountingFilterTop.getTopNumber(),
|
||||
temporalConstraint, filters);
|
||||
invocation = new AccountingQueryTop(AggregatedStorageUsageRecord.class,
|
||||
accountingFilterTop.getScope(), accountingFilterTop.getFilterKey(),
|
||||
accountingFilterTop.getShowOthers(), accountingFilterTop.getTopNumber(), temporalConstraint,
|
||||
filters);
|
||||
} else {
|
||||
if (seriesRequest.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
|
||||
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) seriesRequest
|
||||
|
@ -118,20 +106,16 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
if (accountingFilters != null) {
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters
|
||||
.getFilterKey().getKey(),
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey().getKey(),
|
||||
accountigFilters.getFilterValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
invocation = new AccountingQueryContext(
|
||||
AggregatedStorageUsageRecord.class,
|
||||
accountingFilterContext.getContext(),
|
||||
temporalConstraint, filters);
|
||||
invocation = new AccountingQueryContext(AggregatedStorageUsageRecord.class,
|
||||
accountingFilterContext.getContext(), temporalConstraint, filters);
|
||||
} else {
|
||||
logger.error("Invalid Request: " + seriesRequest);
|
||||
throw new ServiceException(
|
||||
"Invalid Request!");
|
||||
throw new ServiceException("Invalid Request!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,18 +15,18 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
|
|||
*/
|
||||
public class AccountingQueryBasic extends AccountingQuery {
|
||||
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
||||
private String scope;
|
||||
private boolean noContext;
|
||||
private TemporalConstraint temporalConstraint;
|
||||
private ArrayList<Filter> filters;
|
||||
private boolean noContext;
|
||||
|
||||
public AccountingQueryBasic(
|
||||
Class<? extends AggregatedUsageRecord<?, ?>> type,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters,
|
||||
boolean noContext) {
|
||||
public AccountingQueryBasic(Class<? extends AggregatedUsageRecord<?, ?>> type, String scope, boolean noContext,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Basic;
|
||||
this.type = type;
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
this.scope = scope;
|
||||
this.filters = filters;
|
||||
this.noContext = noContext;
|
||||
}
|
||||
|
@ -47,6 +47,14 @@ public class AccountingQueryBasic extends AccountingQuery {
|
|||
this.temporalConstraint = temporalConstraint;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public ArrayList<Filter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
@ -65,11 +73,8 @@ public class AccountingQueryBasic extends AccountingQuery {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQueryBasic [type=" + type + ", temporalConstraint="
|
||||
+ temporalConstraint + ", filters=" + filters + ", noContext="
|
||||
+ noContext + "]";
|
||||
return "AccountingQueryBasic [type=" + type + ", temporalConstraint=" + temporalConstraint + ", scope=" + scope
|
||||
+ ", filters=" + filters + ", noContext=" + noContext + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -20,8 +20,7 @@ public class AccountingQueryContext extends AccountingQuery {
|
|||
private TemporalConstraint temporalConstraint;
|
||||
private ArrayList<Filter> filters;
|
||||
|
||||
public AccountingQueryContext(
|
||||
Class<? extends AggregatedUsageRecord<?, ?>> type, Context context,
|
||||
public AccountingQueryContext(Class<? extends AggregatedUsageRecord<?, ?>> type, Context context,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Context;
|
||||
|
@ -65,9 +64,8 @@ public class AccountingQueryContext extends AccountingQuery {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQueryContext [type=" + type + ", context=" + context
|
||||
+ ", temporalConstraint=" + temporalConstraint + ", filters="
|
||||
+ filters + "]";
|
||||
return "AccountingQueryContext [type=" + type + ", context=" + context + ", temporalConstraint="
|
||||
+ temporalConstraint + ", filters=" + filters + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -16,18 +16,19 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
|||
*/
|
||||
public class AccountingQueryTop extends AccountingQuery {
|
||||
private Class<? extends AggregatedUsageRecord<?, ?>> type;
|
||||
private String scope;
|
||||
private FilterKey filterKey;
|
||||
private Integer topNumber;
|
||||
private Boolean showOthers;
|
||||
private TemporalConstraint temporalConstraint;
|
||||
private ArrayList<Filter> filters;
|
||||
|
||||
public AccountingQueryTop(Class<? extends AggregatedUsageRecord<?,?>> type,
|
||||
FilterKey filterKey, Boolean showOthers, Integer topNumber,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
public AccountingQueryTop(Class<? extends AggregatedUsageRecord<?, ?>> type, String scope, FilterKey filterKey,
|
||||
Boolean showOthers, Integer topNumber, TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
chartType = ChartType.Top;
|
||||
this.type = type;
|
||||
this.scope = scope;
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
this.filters = filters;
|
||||
this.filterKey = filterKey;
|
||||
|
@ -43,6 +44,14 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public TemporalConstraint getTemporalConstraint() {
|
||||
return temporalConstraint;
|
||||
}
|
||||
|
@ -67,7 +76,6 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
this.filterKey = filterKey;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getShowOthers() {
|
||||
return showOthers;
|
||||
}
|
||||
|
@ -86,12 +94,9 @@ public class AccountingQueryTop extends AccountingQuery {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQueryTop [type=" + type + ", filterKey=" + filterKey
|
||||
+ ", topNumber=" + topNumber + ", showOthers=" + showOthers
|
||||
+ ", temporalConstraint=" + temporalConstraint + ", filters="
|
||||
return "AccountingQueryTop [type=" + type + ", scope=" + scope + ", filterKey=" + filterKey + ", topNumber="
|
||||
+ topNumber + ", showOthers=" + showOthers + ", temporalConstraint=" + temporalConstraint + ", filters="
|
||||
+ filters + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -14,6 +14,7 @@ public class AccountingFilterBasic extends AccountingFilterDefinition implements
|
|||
|
||||
private static final long serialVersionUID = -6805006183397381154L;
|
||||
private ArrayList<AccountingFilter> filters;
|
||||
private String scope;
|
||||
private Boolean noContext;
|
||||
|
||||
public AccountingFilterBasic() {
|
||||
|
@ -21,25 +22,40 @@ public class AccountingFilterBasic extends AccountingFilterDefinition implements
|
|||
this.chartType = ChartType.Basic;
|
||||
noContext = false;
|
||||
filters = null;
|
||||
scope=null;
|
||||
}
|
||||
|
||||
public AccountingFilterBasic(boolean noContenxt) {
|
||||
public AccountingFilterBasic(String scope, boolean noContenxt) {
|
||||
super();
|
||||
chartType = ChartType.Basic;
|
||||
this.filters = null;
|
||||
this.scope=scope;
|
||||
this.noContext = noContenxt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public AccountingFilterBasic(ArrayList<AccountingFilter> filters,
|
||||
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() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public Boolean getNoContext() {
|
||||
return noContext;
|
||||
}
|
||||
|
||||
public ArrayList<AccountingFilter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
@ -58,8 +74,10 @@ public class AccountingFilterBasic extends AccountingFilterDefinition implements
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilterBasic [filters=" + filters + ", noContext="
|
||||
+ noContext + "]";
|
||||
return "AccountingFilterBasic [filters=" + filters + ", scope=" + scope + ", noContext=" + noContext
|
||||
+ ", chartType=" + chartType + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
|
|||
Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6805006183397381154L;
|
||||
private String scope;
|
||||
private FilterKey filterKey;
|
||||
private Boolean showOthers;
|
||||
private Integer topNumber;
|
||||
|
@ -21,6 +22,7 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
|
|||
public AccountingFilterTop() {
|
||||
super();
|
||||
this.chartType = ChartType.Top;
|
||||
scope=null;
|
||||
showOthers = false;
|
||||
topNumber = 5;
|
||||
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();
|
||||
this.chartType = ChartType.Top;
|
||||
this.scope=scope;
|
||||
this.showOthers = showOthers;
|
||||
this.topNumber = topNumber;
|
||||
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,
|
||||
Integer topNumber) {
|
||||
super();
|
||||
chartType = ChartType.Top;
|
||||
this.scope=scope;
|
||||
this.filterKey = filterKey;
|
||||
this.filters = filters;
|
||||
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() {
|
||||
return filterKey;
|
||||
}
|
||||
|
@ -85,9 +97,10 @@ public class AccountingFilterTop extends AccountingFilterDefinition implements
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilterTop [filterKey=" + filterKey + ", showOthers="
|
||||
+ showOthers + ", topNumber=" + topNumber + ", filters="
|
||||
+ filters + "]";
|
||||
return "AccountingFilterTop [scope=" + scope + ", filterKey=" + filterKey + ", showOthers=" + showOthers
|
||||
+ ", topNumber=" + topNumber + ", filters=" + filters + ", chartType=" + chartType + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue