Updated support for Context

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@134208 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-11-15 16:37:24 +00:00
parent 7fc2885395
commit 617879cb8a
14 changed files with 3887 additions and 201 deletions

View File

@ -23,6 +23,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBa
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriod;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriodMode;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
@ -346,12 +347,49 @@ public class AccountingManagerController {
accountingStateData.setAvailableFilterKeys(result);
accountingState.setState(accountingType,
accountingStateData);
callDefaultSeriesRequest();
retrieveContext();
}
});
}
private void retrieveContext() {
AccountingManagerServiceAsync.INSTANCE.getContext(
new AsyncCallback<Context>() {
@Override
public void onFailure(Throwable caught) {
accountingMonitor.hide();
if (caught instanceof SessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error retrieving contexts for "
+ accountingType + ":"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving contexts ",
caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(Context result) {
Log.debug("Available Context: " + result);
AccountingClientStateData accountingStateData = accountingState
.getState(accountingType);
accountingStateData.setAvailableContext(result);
accountingState.setState(accountingType,
accountingStateData);
callDefaultSeriesRequest();
}
});
}
private void callDefaultSeriesRequest() {
AccountingManagerServiceAsync.INSTANCE.getSeries(accountingType,

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.admin.accountingmanager.client.event.SessionExpiredEve
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.ContextDataProperties;
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;
@ -16,9 +17,11 @@ import org.gcube.portlets.admin.accountingmanager.client.type.SessionExpiredType
import org.gcube.portlets.admin.accountingmanager.client.utils.UtilsGXT3;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterBasic;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterContext;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterDefinition;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
import org.gcube.portlets.admin.accountingmanager.shared.data.ChartType;
import org.gcube.portlets.admin.accountingmanager.shared.data.ContextData;
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesRequest;
@ -39,6 +42,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HasValue;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
import com.sencha.gxt.core.client.IdentityValueProvider;
import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.util.Margins;
@ -76,6 +80,7 @@ import com.sencha.gxt.widget.core.client.form.FieldSet;
import com.sencha.gxt.widget.core.client.form.IntegerSpinnerField;
import com.sencha.gxt.widget.core.client.form.Radio;
import com.sencha.gxt.widget.core.client.form.StringComboBox;
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid;
@ -96,8 +101,11 @@ public class ActiveFiltersPanel extends SimpleContainer {
private static final int TOP_NUMBER_MAX = 10;
private static final int TOP_NUMBER_MIN = 1;
private EventBus eventBus;
private Grid<AccountingFilter> grid;
private ListStore<AccountingFilter> store;
private Grid<AccountingFilter> gridFilter;
private ListStore<AccountingFilter> storeFilter;
private Grid<ContextData> gridContext;
private ListStore<ContextData> storeContext;
private CheckBoxSelectionModel<ContextData> smContext;
private boolean addStatus;
private AccountingClientStateData accountingStateData;
private ListStore<FilterKey> storeComboFilterKey;
@ -113,11 +121,11 @@ public class ActiveFiltersPanel extends SimpleContainer {
private ComboBox<FilterKey> comboTopFilterKey;
private FieldLabel comboTopFilterKeyLabel;
private ToolBar toolBar;
//private CheckBox showOthers;
// private CheckBox showOthers;
private FieldLabel showOthersLabel;
private IntegerSpinnerField topNumber;
private FieldLabel topNumberLabel;
private FilterKey filterKey;
private boolean cancelValue;
private AccountingMonitor accountingMonitor;
@ -125,8 +133,6 @@ public class ActiveFiltersPanel extends SimpleContainer {
private Radio showOthersNo;
private ToggleGroup showOthersToggle;
public interface FilterKeyPropertiesCombo extends PropertyAccess<FilterKey> {
@Path("id")
@ -223,23 +229,23 @@ public class ActiveFiltersPanel extends SimpleContainer {
ColumnModel<AccountingFilter> columns = new ColumnModel<AccountingFilter>(
l);
store = new ListStore<AccountingFilter>(props.id());
storeFilter = new ListStore<AccountingFilter>(props.id());
final GridSelectionModel<AccountingFilter> sm = new GridSelectionModel<AccountingFilter>();
sm.setSelectionMode(SelectionMode.SINGLE);
grid = new Grid<AccountingFilter>(store, columns);
grid.setSelectionModel(sm);
grid.getView().setStripeRows(true);
grid.getView().setColumnLines(true);
grid.getView().setAutoFill(true);
grid.setBorders(false);
grid.setColumnReordering(false);
grid.getView().setAutoExpandColumn(valueColumn);
grid.getView().setSortingEnabled(false);
gridFilter = new Grid<AccountingFilter>(storeFilter, columns);
gridFilter.setSelectionModel(sm);
gridFilter.getView().setStripeRows(true);
gridFilter.getView().setColumnLines(true);
gridFilter.getView().setAutoFill(true);
gridFilter.setBorders(false);
gridFilter.setColumnReordering(false);
gridFilter.getView().setAutoExpandColumn(valueColumn);
gridFilter.getView().setSortingEnabled(false);
GridDragSource<AccountingFilter> ds = new GridDragSource<AccountingFilter>(
grid);
gridFilter);
ds.addDragStartHandler(new DndDragStartHandler() {
@Override
@ -252,7 +258,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
}
});
GridDropTarget<AccountingFilter> dt = new GridDropTarget<AccountingFilter>(
grid);
gridFilter);
dt.setFeedback(Feedback.BOTH);
dt.setAllowSelfAsSource(true);
@ -301,7 +307,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
// final TextField valueField = new TextField();
// valueField.addValidator(new EmptyValidator<String>());
editing = new GridRowEditing<AccountingFilter>(grid);
editing = new GridRowEditing<AccountingFilter>(gridFilter);
editing.addEditor(keyColumn, comboFilterKey);
editing.addEditor(valueColumn, comboFilterValue);
@ -327,8 +333,8 @@ public class ActiveFiltersPanel extends SimpleContainer {
editing.cancelEditing();
store.remove(rowIndex);
store.commitChanges();
storeFilter.remove(rowIndex);
storeFilter.commitChanges();
editing.getCancelButton().setVisible(true);
addButton.setEnabled(true);
@ -354,7 +360,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
@Override
public void onCancelEdit(CancelEditEvent<AccountingFilter> event) {
store.rejectChanges();
storeFilter.rejectChanges();
addButton.setEnabled(true);
}
@ -373,7 +379,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
if (addStatus) {
addStatus = false;
}
store.commitChanges();
storeFilter.commitChanges();
editing.getCancelButton().setVisible(true);
addButton.setEnabled(true);
@ -397,7 +403,6 @@ public class ActiveFiltersPanel extends SimpleContainer {
@Override
public String getKey(ChartType item) {
// TODO Auto-generated method stub
return item.name();
}
@ -414,6 +419,39 @@ public class ActiveFiltersPanel extends SimpleContainer {
};
// /Grid Context
ContextDataProperties propsContextData = GWT
.create(ContextDataProperties.class);
ColumnConfig<ContextData, String> labelCol = new ColumnConfig<ContextData, String>(
propsContextData.label(), 356, "Scope");
IdentityValueProvider<ContextData> identity = new IdentityValueProvider<ContextData>();
smContext = new CheckBoxSelectionModel<ContextData>(identity);
List<ColumnConfig<ContextData, ?>> lContext = new ArrayList<ColumnConfig<ContextData, ?>>();
lContext.add(smContext.getColumn());
lContext.add(labelCol);
ColumnModel<ContextData> cmContextData = new ColumnModel<ContextData>(
lContext);
storeContext = new ListStore<ContextData>(propsContextData.id());
gridContext = new Grid<ContextData>(storeContext, cmContextData);
sm.setSelectionMode(SelectionMode.MULTI);
gridContext.setSelectionModel(smContext);
gridContext.getView().setStripeRows(true);
gridContext.getView().setColumnLines(true);
gridContext.getView().setAutoFill(true);
gridContext.setBorders(false);
gridContext.setColumnReordering(false);
gridContext.getView().setAutoExpandColumn(labelCol);
gridContext.getView().setSortingEnabled(true);
// /
comboChartType = new ComboBox<>(storeComboChartType,
comboChartTypeLabelProvider);
comboChartType.setClearValueOnParseError(false);
@ -442,38 +480,39 @@ public class ActiveFiltersPanel extends SimpleContainer {
addHandlersForComboTopFilterKey(filterKeyPropertiesCombo.key());
comboTopFilterKeyLabel = new FieldLabel(comboTopFilterKey, "Key");
//ShowOthers
showOthersYes=new Radio();
// ShowOthers
showOthersYes = new Radio();
showOthersYes.setBoxLabel("Yes");
showOthersNo=new Radio();
showOthersNo = new Radio();
showOthersNo.setBoxLabel("No");
showOthersNo.setValue(true);
showOthersToggle=new ToggleGroup();
showOthersToggle = new ToggleGroup();
showOthersToggle.add(showOthersYes);
showOthersToggle.add(showOthersNo);
showOthersToggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
@Override
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
ToggleGroup group=(ToggleGroup) event.getSource();
Radio radio=(Radio) group.getValue();
Log.debug("ShowOthers selected: "+radio.getBoxLabel());
}
});
HBoxLayoutContainer hp=new HBoxLayoutContainer();
showOthersToggle
.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
@Override
public void onValueChange(
ValueChangeEvent<HasValue<Boolean>> event) {
ToggleGroup group = (ToggleGroup) event.getSource();
Radio radio = (Radio) group.getValue();
Log.debug("ShowOthers selected: " + radio.getBoxLabel());
}
});
HBoxLayoutContainer hp = new HBoxLayoutContainer();
hp.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
hp.setPack(BoxLayoutPack.START);
hp.add(showOthersYes, new BoxLayoutData(new Margins(0)));
hp.add(showOthersNo, new BoxLayoutData(new Margins(0)));
showOthersLabel = new FieldLabel(hp, "Show Others");
//
topNumber = new IntegerSpinnerField();
topNumber.setMaxValue(TOP_NUMBER_MAX);
@ -482,7 +521,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
topNumber.setAllowBlank(false);
topNumber.setValue(TOP_NUMBER_DEFAULT);
topNumber.setEditable(false);
topNumberLabel = new FieldLabel(topNumber, "Number");
// //
@ -490,12 +529,13 @@ public class ActiveFiltersPanel extends SimpleContainer {
vlc.add(comboChartTypeLabel, new VerticalLayoutData(1, -1, new Margins(
0)));
vlc.add(gridContext, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(comboTopFilterKeyLabel, new VerticalLayoutData(1, -1,
new Margins(0)));
vlc.add(showOthersLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(topNumberLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(grid, new VerticalLayoutData(1, 1, new Margins(0)));
vlc.add(gridFilter, new VerticalLayoutData(1, 1, new Margins(0)));
FieldSet fieldSet = new FieldSet();
fieldSet.setHeadingHtml("<b>Active Filters</b>");
@ -503,6 +543,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
fieldSet.add(vlc);
add(fieldSet, new MarginData(0));
gridContext.setVisible(false);
comboTopFilterKeyLabel.setVisible(false);
showOthersLabel.setVisible(false);
topNumberLabel.setVisible(false);
@ -520,7 +561,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
}
});
eventBus.addHandler(AccountingPeriodEvent.TYPE,
new AccountingPeriodEvent.AccountingPeriodEventHandler() {
@ -533,7 +574,6 @@ public class ActiveFiltersPanel extends SimpleContainer {
});
}
private void doStateChangeCommand(StateChangeEvent event) {
if (event.getStateChangeType() == null) {
return;
@ -574,9 +614,8 @@ public class ActiveFiltersPanel extends SimpleContainer {
.getAvailableFilterKeys());
storeComboTopFilterKey.commitChanges();
ChartType chartType = accountingStateData
.getSeriesRequest().getAccountingFilterDefinition()
.getChartType();
ChartType chartType = accountingStateData.getSeriesRequest()
.getAccountingFilterDefinition().getChartType();
switch (chartType) {
case Basic:
@ -585,7 +624,9 @@ public class ActiveFiltersPanel extends SimpleContainer {
case Top:
changeActiveFiltersForTop();
break;
case Context:
changeActiveFiltersForContext();
break;
default:
changeActiveFiltersForBasic();
break;
@ -605,26 +646,27 @@ public class ActiveFiltersPanel extends SimpleContainer {
if (accountingFilterBasic.getFilters() != null) {
List<AccountingFilter> filters = accountingFilterBasic
.getFilters();
store.clear();
store.addAll(filters);
storeFilter.clear();
storeFilter.addAll(filters);
seq = 0;
for (AccountingFilter filter : filters) {
if (filter.getId() > seq) {
seq = filter.getId();
}
}
store.commitChanges();
storeFilter.commitChanges();
} else {
store.clear();
store.commitChanges();
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
}
} else {
store.clear();
store.commitChanges();
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
}
comboChartType.setValue(ChartType.Basic);
gridContext.setVisible(false);
comboTopFilterKey.reset();
comboTopFilterKeyLabel.setVisible(false);
showOthersToggle.reset();
@ -664,26 +706,150 @@ public class ActiveFiltersPanel extends SimpleContainer {
topNumber.setValue(TOP_NUMBER_DEFAULT);
}
store.clear();
store.commitChanges();
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
comboChartType.setValue(ChartType.Top);
gridContext.setVisible(false);
comboTopFilterKeyLabel.setVisible(true);
showOthersLabel.setVisible(true);
topNumberLabel.setVisible(true);
forceLayout();
}
// TODO
private void changeActiveFiltersForContext() {
if (accountingStateData.getSeriesRequest() != null
&& accountingStateData.getSeriesRequest()
.getAccountingFilterDefinition() != null
&& accountingStateData.getSeriesRequest()
.getAccountingFilterDefinition() instanceof AccountingFilterContext) {
AccountingFilterContext accountingFilterContext = (AccountingFilterContext) accountingStateData
.getSeriesRequest().getAccountingFilterDefinition();
if (accountingStateData.getAvailableContext() != null
&& accountingStateData.getAvailableContext().getContexts() != null
&& !accountingStateData.getAvailableContext().getContexts()
.isEmpty()) {
if (accountingFilterContext.getContext() != null
&& accountingFilterContext.getContext().getContexts() != null
&& !accountingFilterContext.getContext().getContexts()
.isEmpty()) {
ArrayList<String> contexts = accountingStateData
.getAvailableContext().getContexts();
ArrayList<ContextData> ctx = new ArrayList<ContextData>();
for (String context : contexts) {
ContextData contextData = new ContextData(context);
ctx.add(contextData);
}
storeContext.clear();
storeContext.addAll(ctx);
storeContext.commitChanges();
smContext.deselectAll();
for (String c : accountingFilterContext.getContext()
.getContexts()) {
for (ContextData contextData : storeContext.getAll()) {
if (c.compareTo(contextData.getContextData()) == 0) {
smContext.select(contextData, false);
break;
}
}
}
smContext.refresh();
} else {
repopulatesContexts();
}
} else {
resetContexts();
}
if (accountingFilterContext.getFilters() != null) {
List<AccountingFilter> filters = accountingFilterContext
.getFilters();
storeFilter.clear();
storeFilter.addAll(filters);
seq = 0;
for (AccountingFilter filter : filters) {
if (filter.getId() > seq) {
seq = filter.getId();
}
}
storeFilter.commitChanges();
} else {
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
}
} else {
reconfigureContext();
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
}
comboChartType.setValue(ChartType.Context);
gridContext.setVisible(true);
comboTopFilterKey.reset();
comboTopFilterKeyLabel.setVisible(false);
showOthersToggle.reset();
showOthersNo.setValue(true);
showOthersLabel.setVisible(false);
topNumber.reset();
topNumberLabel.setVisible(false);
forceLayout();
}
private void reconfigureContext(){
if (accountingStateData.getAvailableContext() != null
&& accountingStateData.getAvailableContext().getContexts() != null
&& !accountingStateData.getAvailableContext().getContexts()
.isEmpty()){
repopulatesContexts();
} else {
resetContexts();
}
}
private void resetContexts() {
storeContext.clear();
storeContext.commitChanges();
smContext.deselectAll();
smContext.refresh();
}
private void repopulatesContexts() {
ArrayList<String> contexts = accountingStateData
.getAvailableContext().getContexts();
ArrayList<ContextData> ctx = new ArrayList<ContextData>();
for (String context : contexts) {
ContextData contextData = new ContextData(context);
ctx.add(contextData);
}
storeContext.clear();
storeContext.addAll(ctx);
storeContext.commitChanges();
smContext.selectAll();
smContext.refresh();
}
public AccountingFilterDefinition getActiveFilters() {
try {
ChartType chartType = comboChartType
.getCurrentValue();
ChartType chartType = comboChartType.getCurrentValue();
switch (chartType) {
case Basic:
return getActiveFiltersForBasic();
case Top:
return getActiveFiltersForTop();
case Context:
return getActiveFiltersForContext();
default:
return null;
@ -699,10 +865,10 @@ public class ActiveFiltersPanel extends SimpleContainer {
}
private AccountingFilterDefinition getActiveFiltersForBasic() {
if (store == null || store.size() <= 0) {
if (storeFilter == null || storeFilter.size() <= 0) {
return new AccountingFilterBasic();
} else {
List<AccountingFilter> filtersActives = store.getAll();
List<AccountingFilter> filtersActives = storeFilter.getAll();
ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>();
for (AccountingFilter filter : filtersActives) {
if (filter.getFilterValue() != null
@ -724,13 +890,14 @@ public class ActiveFiltersPanel extends SimpleContainer {
if (filterKey == null) {
return new AccountingFilterTop();
} else {
Boolean showOthersValue=showOthersYes.getValue();
Boolean showOthersValue = showOthersYes.getValue();
Integer topN = topNumber.getCurrentValue();
if (store == null || store.size() <= 0) {
return new AccountingFilterTop(filterKey, null, showOthersValue, topN);
if (storeFilter == null || storeFilter.size() <= 0) {
return new AccountingFilterTop(filterKey, null,
showOthersValue, topN);
} else {
List<AccountingFilter> filtersActives = store.getAll();
List<AccountingFilter> filtersActives = storeFilter.getAll();
ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>();
for (AccountingFilter filter : filtersActives) {
if (filter.getFilterValue() != null
@ -740,9 +907,10 @@ public class ActiveFiltersPanel extends SimpleContainer {
}
if (filtersReady.size() > 0) {
return new AccountingFilterTop(filterKey, filtersReady,
showOthersValue,topN);
showOthersValue, topN);
} else {
return new AccountingFilterTop(filterKey, null, showOthersValue, topN);
return new AccountingFilterTop(filterKey, null,
showOthersValue, topN);
}
}
@ -750,8 +918,36 @@ public class ActiveFiltersPanel extends SimpleContainer {
}
private AccountingFilterDefinition getActiveFiltersForContext() {
ArrayList<String> contextsSelected = new ArrayList<String>();
if (storeContext != null && storeContext.size() > 0
&& smContext != null) {
List<ContextData> selected = smContext.getSelectedItems();
for (ContextData cd : selected) {
contextsSelected.add(cd.getContextData());
}
}
org.gcube.portlets.admin.accountingmanager.shared.data.Context context = new org.gcube.portlets.admin.accountingmanager.shared.data.Context(
contextsSelected);
List<AccountingFilter> filtersActives = storeFilter.getAll();
ArrayList<AccountingFilter> filtersReady = new ArrayList<AccountingFilter>();
for (AccountingFilter filter : filtersActives) {
if (filter.getFilterValue() != null
&& !filter.getFilterValue().isEmpty()) {
filtersReady.add(filter);
}
}
if (filtersReady.size() > 0) {
return new AccountingFilterContext(context, filtersReady);
} else {
return new AccountingFilterContext(context, null);
}
}
private void addNewFilter(SelectEvent event) {
List<AccountingFilter> filtersSet = store.getAll();
List<AccountingFilter> filtersSet = storeFilter.getAll();
FilterKey fk = null;
if (accountingStateData == null
@ -769,8 +965,8 @@ public class ActiveFiltersPanel extends SimpleContainer {
}
if (comboChartType.getCurrentValue() != null
&& comboChartType.getCurrentValue().compareTo(
ChartType.Top) == 0) {
&& comboChartType.getCurrentValue()
.compareTo(ChartType.Top) == 0) {
if (comboTopFilterKey.getCurrentValue() != null) {
removableFilterKeys
.add(comboTopFilterKey.getCurrentValue());
@ -781,15 +977,12 @@ public class ActiveFiltersPanel extends SimpleContainer {
if (remainingFilterKeys.size() > 0) {
/*
if (comboChartType.getCurrentValue() != null
&& comboChartType.getCurrentValue().compareTo(
ChartType.Top) == 0) {
if(!(store.getAll().size()<2)){
UtilsGXT3.info("Attention", "You can add at most 2 filters for top chart!");
return;
}
}
*/
* if (comboChartType.getCurrentValue() != null &&
* comboChartType.getCurrentValue().compareTo( ChartType.Top) ==
* 0) { if(!(store.getAll().size()<2)){
* UtilsGXT3.info("Attention",
* "You can add at most 2 filters for top chart!"); return; } }
*/
fk = remainingFilterKeys.get(0);
seq++;
AccountingFilter newAccountingFilter = new AccountingFilter(
@ -798,8 +991,8 @@ public class ActiveFiltersPanel extends SimpleContainer {
editing.cancelEditing();
addStatus = true;
editing.getCancelButton().setVisible(false);
store.add(newAccountingFilter);
int row = store.indexOf(newAccountingFilter);
storeFilter.add(newAccountingFilter);
int row = storeFilter.indexOf(newAccountingFilter);
storeComboFilterKey.clear();
storeComboFilterKey.addAll(remainingFilterKeys);
@ -815,22 +1008,22 @@ public class ActiveFiltersPanel extends SimpleContainer {
private void retrieveFilterValuesByKey(FilterKey filterKey,
final boolean cancelValue) {
this.filterKey=filterKey;
this.cancelValue=cancelValue;
AccountingPeriodRequestEvent event=new AccountingPeriodRequestEvent();
this.filterKey = filterKey;
this.cancelValue = cancelValue;
AccountingPeriodRequestEvent event = new AccountingPeriodRequestEvent();
eventBus.fireEvent(event);
}
private void manageAccountingPeriodEvent(AccountingPeriodEvent event) {
if(event==null|| event.getAccountingPeriod()==null){
if (event == null || event.getAccountingPeriod() == null) {
Log.debug("AccountingPeriod not valid");
return;
}
accountingMonitor=new AccountingMonitor();
accountingMonitor = new AccountingMonitor();
FilterValuesRequest requestFilterValue = new FilterValuesRequest(
filterKey, accountingStateData.getAccountingType(), event.getAccountingPeriod());
filterKey, accountingStateData.getAccountingType(),
event.getAccountingPeriod());
AccountingManagerServiceAsync.INSTANCE.getFilterValues(
requestFilterValue,
@ -868,14 +1061,13 @@ public class ActiveFiltersPanel extends SimpleContainer {
}
});
}
private void editingBeforeStart(BeforeStartEditEvent<AccountingFilter> event) {
GridCell cell = event.getEditCell();
int rowIndex = cell.getRow();
AccountingFilter editingFilter = store.get(rowIndex);
AccountingFilter editingFilter = storeFilter.get(rowIndex);
List<AccountingFilter> filtersSet = store.getAll();
List<AccountingFilter> filtersSet = storeFilter.getAll();
List<FilterKey> remainingFilterKeys = null;
if (accountingStateData == null
@ -890,8 +1082,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
List<FilterKey> setFilterKeys = new ArrayList<FilterKey>();
if (comboChartType.getCurrentValue() != null
&& comboChartType.getCurrentValue().compareTo(
ChartType.Top) == 0) {
&& comboChartType.getCurrentValue().compareTo(ChartType.Top) == 0) {
if (comboTopFilterKey.getCurrentValue() != null) {
setFilterKeys.add(comboTopFilterKey.getCurrentValue());
}
@ -935,24 +1126,23 @@ public class ActiveFiltersPanel extends SimpleContainer {
private void addHandlersForComboChartType(
final LabelProvider<ChartType> labelProvider) {
comboChartType
.addSelectionHandler(new SelectionHandler<ChartType>() {
public void onSelection(
SelectionEvent<ChartType> event) {
Log.debug("FilterKey selected: "
+ event.getSelectedItem());
updateComboChartType(event.getSelectedItem());
}
comboChartType.addSelectionHandler(new SelectionHandler<ChartType>() {
public void onSelection(SelectionEvent<ChartType> event) {
Log.debug("FilterKey selected: " + event.getSelectedItem());
updateComboChartType(event.getSelectedItem());
}
});
});
}
private void updateComboChartType(ChartType chartType) {
if(chartType==null){
if (chartType == null) {
return;
}
switch (chartType) {
case Basic:
gridContext.setVisible(false);
comboTopFilterKey.reset();
comboTopFilterKeyLabel.setVisible(false);
showOthersToggle.reset();
@ -960,12 +1150,13 @@ public class ActiveFiltersPanel extends SimpleContainer {
showOthersLabel.setVisible(false);
topNumber.reset();
topNumberLabel.setVisible(false);
store.clear();
store.commitChanges();
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
forceLayout();
break;
case Top:
gridContext.setVisible(false);
comboTopFilterKey.reset();
if (accountingStateData != null
&& accountingStateData.getAvailableFilterKeys() != null
@ -980,11 +1171,26 @@ public class ActiveFiltersPanel extends SimpleContainer {
topNumber.reset();
topNumber.setValue(TOP_NUMBER_DEFAULT);
topNumberLabel.setVisible(true);
store.clear();
store.commitChanges();
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
forceLayout();
break;
case Context:
reconfigureContext();
gridContext.setVisible(true);
comboTopFilterKey.reset();
comboTopFilterKeyLabel.setVisible(false);
showOthersToggle.reset();
showOthersNo.setValue(true);
showOthersLabel.setVisible(false);
topNumber.reset();
topNumberLabel.setVisible(false);
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
forceLayout();
break;
default:
break;
@ -1006,8 +1212,8 @@ public class ActiveFiltersPanel extends SimpleContainer {
}
private void updateTopFilterKey(FilterKey selectedFilterKey) {
store.clear();
store.commitChanges();
storeFilter.clear();
storeFilter.commitChanges();
seq = 0;
}

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartBasicPanel;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartContextPanel;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.job.JobChartTopPanel;
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesJob;
@ -70,6 +71,9 @@ public class AccountingChart4Job extends AccountingChartBuilder {
return new JobChartTopPanel(eventBus, accountingStateData);
case Basic:
return new JobChartBasicPanel(eventBus, accountingStateData);
case Context:
return new JobChartContextPanel(eventBus, accountingStateData);
default:
return null;
}

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service.ServiceChartBasicPanel;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service.ServiceChartContextPanel;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.service.ServiceChartTopPanel;
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
@ -70,6 +71,9 @@ public class AccountingChart4Service extends AccountingChartBuilder {
return new ServiceChartTopPanel(eventBus,accountingStateData);
case Basic:
return new ServiceChartBasicPanel(eventBus, accountingStateData);
case Context:
return new ServiceChartContextPanel(eventBus, accountingStateData);
default:
return null;

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.admin.accountingmanager.client.maindata.charts;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.storage.StorageChartBasicPanel;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.storage.StorageChartContextPanel;
import org.gcube.portlets.admin.accountingmanager.client.maindata.charts.storage.StorageChartTopPanel;
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingClientStateData;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
@ -19,10 +20,10 @@ import com.sencha.gxt.widget.core.client.container.SimpleContainer;
public class AccountingChart4Storage extends AccountingChartBuilder {
private EventBus eventBus;
private AccountingClientStateData accountingStateData;
public AccountingChart4Storage(EventBus eventBus, AccountingClientStateData accountingStateData) {
this.eventBus=eventBus;
public AccountingChart4Storage(EventBus eventBus,
AccountingClientStateData accountingStateData) {
this.eventBus = eventBus;
this.accountingStateData = accountingStateData;
}
@ -51,16 +52,14 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
}
private SimpleContainer createStorageChartPanel()
throws ChartDrawException {
private SimpleContainer createStorageChartPanel() throws ChartDrawException {
if (accountingStateData == null
|| accountingStateData.getSeriesRequest() == null
|| accountingStateData.getSeriesRequest()
.getAccountingFilterDefinition() == null
|| accountingStateData.getSeriesRequest()
.getAccountingFilterDefinition()
.getChartType() == null) {
.getAccountingFilterDefinition().getChartType() == null) {
return null;
}
@ -69,11 +68,11 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
case Top:
return new StorageChartTopPanel(eventBus, accountingStateData);
//createStorageChart(new StorageChart4Top(accountingStateData));
case Basic:
return new StorageChartBasicPanel(eventBus, accountingStateData);
//createStorageChart(new StorageChart4Basic(
//accountingStateData));
case Context:
return new StorageChartContextPanel(eventBus, accountingStateData);
default:
return null;
@ -81,5 +80,4 @@ public class AccountingChart4Storage extends AccountingChartBuilder {
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.admin.accountingmanager.client.properties;
import org.gcube.portlets.admin.accountingmanager.shared.data.ContextData;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface ContextDataProperties extends PropertyAccess<ContextData> {
@Path("contextData")
ModelKeyProvider<org.gcube.portlets.admin.accountingmanager.shared.data.ContextData> id();
ValueProvider<ContextData, String> label();
}

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
@ -21,6 +22,7 @@ public class AccountingClientStateData implements Serializable {
private SeriesRequest seriesRequest;
private SeriesResponse seriesResponse;
private ArrayList<FilterKey> availableFilterKeys;
private Context availableContext;
public AccountingClientStateData() {
super();
@ -68,13 +70,21 @@ public class AccountingClientStateData implements Serializable {
this.availableFilterKeys = availableFilterKeys;
}
public Context getAvailableContext() {
return availableContext;
}
public void setAvailableContext(Context availableContext) {
this.availableContext = availableContext;
}
@Override
public String toString() {
return "AccountingClientStateData [accountingType=" + accountingType
+ ", seriesRequest=" + seriesRequest + ", seriesResponse="
+ seriesResponse + ", availableFilterKeys="
+ availableFilterKeys + "]";
+ availableFilterKeys + ", availableContext="
+ availableContext + "]";
}
}

View File

@ -112,53 +112,55 @@ public class SessionUtil {
}
}
public static Context getContext(ASLSession aslSession)
throws ServiceException {
try {
logger.info("Current context is " + aslSession.getScope());
ArrayList<String> contexts = new ArrayList<>();
contexts.add(aslSession.getScope());
GroupManager gm = new LiferayGroupManager();
long currentGroupId = gm
.getGroupIdFromInfrastructureScope(aslSession.getScope());
GCubeGroup currentGroup = gm.getGroup(currentGroupId);
// three cases
if (gm.isVRE(currentGroupId)) {
// do nothing
} else if (gm.isVO(currentGroupId)) {
// iterate over its vres
List<GCubeGroup> children = currentGroup.getChildren();
for (GCubeGroup gCubeGroup : children) {
contexts.add(gm.getInfrastructureScope(gCubeGroup
.getGroupId()));
}
if (Constants.DEBUG_MODE) {
contexts.add(aslSession.getScope());
} else {
contexts.add(aslSession.getScope());
GroupManager gm = new LiferayGroupManager();
long currentGroupId = gm
.getGroupIdFromInfrastructureScope(aslSession
.getScope());
GCubeGroup currentGroup = gm.getGroup(currentGroupId);
// is root
List<GCubeGroup> children = currentGroup.getChildren();
for (GCubeGroup gCubeGroup : children) {
contexts.add(gm.getInfrastructureScope(gCubeGroup
.getGroupId()));
// three cases
if (gm.isVRE(currentGroupId)) {
// get the vo children
List<GCubeGroup> childrenVO = gCubeGroup.getChildren();
for (GCubeGroup voChildren : childrenVO) {
contexts.add(gm.getInfrastructureScope(voChildren
// do nothing
} else if (gm.isVO(currentGroupId)) {
// iterate over its vres
List<GCubeGroup> children = currentGroup.getChildren();
for (GCubeGroup gCubeGroup : children) {
contexts.add(gm.getInfrastructureScope(gCubeGroup
.getGroupId()));
}
} else {
// is root
List<GCubeGroup> children = currentGroup.getChildren();
for (GCubeGroup gCubeGroup : children) {
contexts.add(gm.getInfrastructureScope(gCubeGroup
.getGroupId()));
// get the vo children
List<GCubeGroup> childrenVO = gCubeGroup.getChildren();
for (GCubeGroup voChildren : childrenVO) {
contexts.add(gm.getInfrastructureScope(voChildren
.getGroupId()));
}
}
}
}
// add the current scope too
Context context = new Context(contexts);

View File

@ -12,6 +12,7 @@ import java.util.List;
import org.gcube.accounting.analytics.TemporalConstraint;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilterTop;
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingType;
import org.gcube.portlets.admin.accountingmanager.shared.data.Context;
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValuesRequest;
@ -21,17 +22,23 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesRes
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesService;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesStorage;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobBasic;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobContext;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobData;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataContext;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDataTop;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobDefinition;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.job.SeriesJobTop;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceBasic;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceContext;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceData;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataContext;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDataTop;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceDefinition;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.service.SeriesServiceTop;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageBasic;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageContext;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageData;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataContext;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDataTop;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageDefinition;
import org.gcube.portlets.admin.accountingmanager.shared.data.response.storage.SeriesStorageTop;
@ -133,9 +140,9 @@ public class AccountingCallerTester implements AccountingCallerInterface {
+ " , seriesRequest=" + seriesRequest + "]");
SeriesResponse seriesResponse = null;
Calendar startCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
Calendar startCalendar = GregorianCalendar
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
try {
startCalendar.setTime(sdf.parse(seriesRequest
.getAccountingPeriod().getStartDate()));
@ -144,13 +151,13 @@ public class AccountingCallerTester implements AccountingCallerInterface {
throw new ServiceException("Start Date not valid!");
}
Calendar endCalendar = GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
//GregorianCalendar endCalendar = new GregorianCalendar();
//.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
//GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
Calendar endCalendar = GregorianCalendar
.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
// GregorianCalendar endCalendar = new GregorianCalendar();
// .getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
// GregorianCalendar.getInstance(TemporalConstraint.DEFAULT_TIME_ZONE);
try {
endCalendar.setTime(sdf.parse(seriesRequest
.getAccountingPeriod().getEndDate()));
@ -208,6 +215,27 @@ public class AccountingCallerTester implements AccountingCallerInterface {
accountingFilterTop.getTopNumber(),
seriesJobDataTopList);
break;
case Context:
// AccountingFilterContext accountingFilterContext =
// (AccountingFilterContext) seriesRequest
// .getAccountingFilterDefinition();
ArrayList<SeriesJobDataContext> seriesJobDataContextList = new ArrayList<>();
ArrayList<String> contexts = new ArrayList<>();
for (int i = 0; i < 20; i++) {
String scope = new String("VRE " + i);
contexts.add(scope);
SeriesJobDataContext seriesJobDataContext = new SeriesJobDataContext(
scope, seriesJobData);
seriesJobDataContextList.add(seriesJobDataContext);
}
Context context = new Context(contexts);
serieJobDefinition = new SeriesJobContext(context,
seriesJobDataContextList);
break;
default:
break;
@ -285,13 +313,14 @@ public class AccountingCallerTester implements AccountingCallerInterface {
ArrayList<SeriesServiceDataTop> seriesServiceDataTopList = new ArrayList<>();
if (accountingFilterTop.getShowOthers()) {
try {
startCalendar.setTime(sdf.parse(seriesRequest
.getAccountingPeriod().getStartDate()));
} catch (ParseException e) {
e.printStackTrace();
throw new ServiceException("Start Date not valid!");
throw new ServiceException(
"Start Date not valid!");
}
try {
@ -299,11 +328,12 @@ public class AccountingCallerTester implements AccountingCallerInterface {
.getAccountingPeriod().getEndDate()));
} catch (ParseException e) {
e.printStackTrace();
throw new ServiceException("End Date not valid!");
throw new ServiceException(
"End Date not valid!");
}
int k=0;
int k = 0;
switch (seriesRequest.getAccountingPeriod()
.getPeriod()) {
case DAILY:
@ -319,7 +349,7 @@ public class AccountingCallerTester implements AccountingCallerInterface {
}
break;
case MONTHLY:
k=0;
k = 0;
while (startCalendar.compareTo(endCalendar) <= 0) {
SeriesServiceDataTop seriesServiceDataTop1 = new SeriesServiceDataTop(
new FilterValue("User" + k),
@ -331,7 +361,7 @@ public class AccountingCallerTester implements AccountingCallerInterface {
}
break;
case YEARLY:
k=0;
k = 0;
while (startCalendar.compareTo(endCalendar) <= 0) {
SeriesServiceDataTop seriesServiceDataTop1 = new SeriesServiceDataTop(
new FilterValue("User" + k),
@ -363,6 +393,26 @@ public class AccountingCallerTester implements AccountingCallerInterface {
accountingFilterTop.getTopNumber(),
seriesServiceDataTopList);
break;
case Context:
// AccountingFilterContext accountingFilterContext =
// (AccountingFilterContext) seriesRequest
// .getAccountingFilterDefinition();
ArrayList<SeriesServiceDataContext> seriesServiceDataContextList = new ArrayList<>();
ArrayList<String> contexts = new ArrayList<>();
for (int i = 0; i < 20; i++) {
String scope = new String("VRE " + i);
contexts.add(scope);
SeriesServiceDataContext seriesServiceDataContext = new SeriesServiceDataContext(
scope, seriesServiceData);
seriesServiceDataContextList
.add(seriesServiceDataContext);
}
Context context = new Context(contexts);
serieServiceDefinition = new SeriesServiceContext(
context, seriesServiceDataContextList);
default:
break;
@ -378,33 +428,34 @@ public class AccountingCallerTester implements AccountingCallerInterface {
.getChartType() != null) {
ArrayList<SeriesStorageData> seriesStorageData = new ArrayList<>();
for (int i = 0; i < 30; i++) {
//Valori variabili
// Valori variabili
SeriesStorageData data = new SeriesStorageData(
new Date(),
new Double(1024 * 1024 * Math.random())
.longValue(), new Double(
100 * Math.random()).longValue());
//Valori Fissi
// Valori Fissi
/*
SeriesStorageData data = new SeriesStorageData(
new Date(),
new Double(1024 * 1024)
.longValue(), new Double(
100).longValue());*/
* SeriesStorageData data = new SeriesStorageData( new
* Date(), new Double(1024 * 1024) .longValue(), new
* Double( 100).longValue());
*/
seriesStorageData.add(data);
}
switch (seriesRequest.getAccountingFilterDefinition()
.getChartType()) {
case Basic:
for(SeriesStorageData serieStorageData:seriesStorageData){
serieStorageData.setDataVolume(serieStorageData.getDataVolume()*1000);
serieStorageData.setOperationCount(serieStorageData.getOperationCount()*1000);
for (SeriesStorageData serieStorageData : seriesStorageData) {
serieStorageData.setDataVolume(serieStorageData
.getDataVolume() * 1000);
serieStorageData.setOperationCount(serieStorageData
.getOperationCount() * 1000);
}
serieStorageDefinition = new SeriesStorageBasic(
seriesStorageData);
break;
@ -436,6 +487,27 @@ public class AccountingCallerTester implements AccountingCallerInterface {
accountingFilterTop.getTopNumber(),
seriesStorageDataTopList);
break;
case Context:
// AccountingFilterContext accountingFilterContext =
// (AccountingFilterContext) seriesRequest
// .getAccountingFilterDefinition();
ArrayList<SeriesStorageDataContext> seriesStorageDataContextList = new ArrayList<>();
ArrayList<String> contexts = new ArrayList<>();
for (int i = 0; i < 20; i++) {
String scope = new String("VRE " + i);
contexts.add(scope);
SeriesStorageDataContext seriesStorageDataContext = new SeriesStorageDataContext(
scope, seriesStorageData);
seriesStorageDataContextList
.add(seriesStorageDataContext);
}
Context context = new Context(contexts);
serieStorageDefinition = new SeriesStorageContext(
context, seriesStorageDataContextList);
break;
default:
break;

View File

@ -29,8 +29,14 @@ public class BuildEnableTabs {
AccountingType.SERVICE, null);
enableTabList.add(enableTabData);
} else {
EnableTabsJAXB enableTabsJAXB = InformationSystemUtils
EnableTabsJAXB enableTabsJAXB=null;
try {
enableTabsJAXB= InformationSystemUtils
.retrieveEnableTab(scope);
} catch(ServiceException e){
logger.info(e.getLocalizedMessage());
}
logger.debug("Enable Tabs: " + enableTabsJAXB);
if (enableTabsJAXB != null && enableTabsJAXB.getEnableTabs() != null
&& !enableTabsJAXB.getEnableTabs().isEmpty()) {
@ -52,10 +58,10 @@ public class BuildEnableTabs {
}
}
} else {
String error = "Error retrieving AccountingManager resource for get enable tabs in scope: "
+ scope;
logger.error(error);
throw new ServiceException(error);
logger.info("AccountingManager use default configuration for scope: "+scope);
EnableTab enableTabData = new EnableTab(
AccountingType.SERVICE, null);
enableTabList.add(enableTabData);
}
}

View File

@ -0,0 +1,46 @@
package org.gcube.portlets.admin.accountingmanager.shared.data;
import java.io.Serializable;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class ContextData implements Serializable {
private static final long serialVersionUID = -6337819958414362393L;
private String contextData;
public ContextData() {
super();
}
public ContextData(String context) {
super();
this.contextData = context;
}
public String getContextData() {
return contextData;
}
public void setContextData(String contextData) {
this.contextData = contextData;
}
public String getLabel() {
return contextData;
}
public void setLabel(String contextData) {
this.contextData = contextData;
}
@Override
public String toString() {
return "ContextData [contextData=" + contextData + "]";
}
}