69: Create new Accounting Portlet
Task-Url: https://support.d4science.org/issues/69 Updated Filters git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@117629 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a54249c9c8
commit
42bf14730e
|
@ -4,6 +4,9 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="accounting-manager-theme-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/accounting-manager-theme/accounting-manager-theme">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="java-output-path" value="/accounting-manager/target/accounting-manager-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
<property name="context-root" value="accounting-manager"/>
|
||||
</wb-module>
|
||||
|
|
18
pom.xml
18
pom.xml
|
@ -207,10 +207,20 @@
|
|||
<artifactId>session-checker</artifactId>
|
||||
<version>[0.2.0-SNAPSHOT,1.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Common Encryption -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-encryption</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Accounting Lib -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-lib</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Accounting Analytics -->
|
||||
<dependency>
|
||||
|
|
|
@ -95,15 +95,15 @@ public class AccountingManager implements EntryPoint {
|
|||
|
||||
//Filters
|
||||
FiltersPanel filtersPanel=new FiltersPanel(eventBus);
|
||||
BorderLayoutData westData = new BorderLayoutData(310);
|
||||
BorderLayoutData westData = new BorderLayoutData(410);
|
||||
westData.setCollapsible(false);
|
||||
westData.setSplit(false);
|
||||
westData.setFloatable(false);
|
||||
westData.setCollapseMini(false);
|
||||
westData.setMargins(new Margins(2, 7, 2, 7));
|
||||
westData.setCollapseHidden(true);
|
||||
westData.setMaxSize(310);
|
||||
westData.setMinSize(310);
|
||||
westData.setMaxSize(410);
|
||||
westData.setMinSize(410);
|
||||
mainPanelLayout.setWestWidget(filtersPanel, westData);
|
||||
filtersPanel.expand();
|
||||
filtersPanel.enable();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.event.AccountingMenuEvent;
|
||||
|
@ -19,6 +20,7 @@ import org.gcube.portlets.admin.accountingmanager.shared.Constants;
|
|||
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.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerSessionExpiredException;
|
||||
|
@ -56,7 +58,7 @@ public class AccountingManagerController {
|
|||
accountingType = AccountingType.STORAGE;
|
||||
accountingState = new AccountingState();
|
||||
AccountingStateData accountingStateData = new AccountingStateData(
|
||||
accountingType, null, null);
|
||||
accountingType, null, null,null);
|
||||
accountingState.setState(accountingType, accountingStateData);
|
||||
init();
|
||||
}
|
||||
|
@ -230,7 +232,7 @@ public class AccountingManagerController {
|
|||
public void showDefault(){
|
||||
createDefaultChart(AccountingType.STORAGE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void createDefaultChart(AccountingType accountingType) {
|
||||
accountingMonitor = new AccountingMonitor();
|
||||
|
@ -242,25 +244,60 @@ public class AccountingManagerController {
|
|||
this.accountingType = accountingType;
|
||||
|
||||
AccountingStateData accountingStateData = new AccountingStateData(
|
||||
accountingType, seriesRequest, null);
|
||||
accountingType, seriesRequest, null,null);
|
||||
accountingState.setState(accountingType,
|
||||
accountingStateData);
|
||||
|
||||
callDefaultSeriesRequest(accountingStateData);
|
||||
|
||||
retrieveFilterKey();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void callDefaultSeriesRequest(final AccountingStateData accountingStateData) {
|
||||
private void retrieveFilterKey() {
|
||||
|
||||
AccountingManagerServiceAsync.INSTANCE.getFilterKeys(accountingType,
|
||||
new AsyncCallback<ArrayList<FilterKey>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof AccountingManagerSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error retrieving filter keys for "+accountingType+":"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving filter keys",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<FilterKey> result) {
|
||||
Log.debug("FilterKeys: " + result);
|
||||
AccountingStateData accountingStateData=accountingState.getState(accountingType);
|
||||
accountingStateData.setAvailableFilterKeys(result);
|
||||
accountingState.setState(accountingType,
|
||||
accountingStateData);
|
||||
callDefaultSeriesRequest();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void callDefaultSeriesRequest() {
|
||||
|
||||
AccountingManagerServiceAsync.INSTANCE.getSeries(
|
||||
accountingStateData.getAccountingType(),
|
||||
accountingStateData.getSeriesRequest(),
|
||||
accountingType,
|
||||
accountingState.getState(accountingType).getSeriesRequest(),
|
||||
new AsyncCallback<SeriesResponse>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(SeriesResponse seriesResponse) {
|
||||
Log.debug("SeriesResponse: " + seriesResponse);
|
||||
AccountingStateData accountingStateData=accountingState.getState(accountingType);
|
||||
accountingStateData.setSeriesResponse(seriesResponse);
|
||||
accountingState.setState(accountingType,
|
||||
accountingStateData);
|
||||
|
@ -278,10 +315,11 @@ public class AccountingManagerController {
|
|||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error:" + caught.getLocalizedMessage());
|
||||
caught.printStackTrace();
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
StateChangeEvent stateChangeEvent = new StateChangeEvent(
|
||||
StateChangeType.Restore, accountingStateData);
|
||||
StateChangeType.Restore, accountingState.getState(accountingType));
|
||||
eventBus.fireEvent(stateChangeEvent);
|
||||
|
||||
}
|
||||
|
@ -307,7 +345,7 @@ public class AccountingManagerController {
|
|||
accountingMonitor = new AccountingMonitor();
|
||||
accountingStateData.setSeriesRequest(seriesRequest);
|
||||
accountingState.setState(accountingType, accountingStateData);
|
||||
callSeriesRequest(accountingStateData);
|
||||
callSeriesRequest();
|
||||
|
||||
}
|
||||
|
||||
|
@ -318,16 +356,16 @@ public class AccountingManagerController {
|
|||
|
||||
}
|
||||
|
||||
private void callSeriesRequest(final AccountingStateData accountingStateData) {
|
||||
|
||||
private void callSeriesRequest() {
|
||||
AccountingManagerServiceAsync.INSTANCE.getSeries(
|
||||
accountingStateData.getAccountingType(),
|
||||
accountingStateData.getSeriesRequest(),
|
||||
accountingType,
|
||||
accountingState.getState(accountingType).getSeriesRequest(),
|
||||
new AsyncCallback<SeriesResponse>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(SeriesResponse seriesResponse) {
|
||||
Log.debug("SeriesResponse: " + seriesResponse);
|
||||
AccountingStateData accountingStateData=accountingState.getState(accountingType);
|
||||
accountingStateData.setSeriesResponse(seriesResponse);
|
||||
accountingState.setState(accountingType,
|
||||
accountingStateData);
|
||||
|
@ -347,7 +385,7 @@ public class AccountingManagerController {
|
|||
Log.error("Error:" + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
|
||||
caught.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
|||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
import com.sencha.gxt.widget.core.client.form.validator.EmptyValidator;
|
||||
import com.sencha.gxt.widget.core.client.form.validator.MaxDateValidator;
|
||||
import com.sencha.gxt.widget.core.client.info.Info;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -63,51 +62,7 @@ public class AccountingPeriodPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
private void create() {
|
||||
startDate = new DateField();
|
||||
startDate.addValidator(new MaxDateValidator(new Date()));
|
||||
startDate.addValidator(new EmptyValidator<Date>());
|
||||
startDate.addParseErrorHandler(new ParseErrorEvent.ParseErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void onParseError(ParseErrorEvent event) {
|
||||
Info.display("Parse Error", event.getErrorValue()
|
||||
+ " could not be parsed as a date");
|
||||
|
||||
}
|
||||
});
|
||||
startDate.addValueChangeHandler(new ValueChangeHandler<Date>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Date> event) {
|
||||
String v = event.getValue() == null ? "Nothing"
|
||||
: DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)
|
||||
.format(event.getValue());
|
||||
Info.display("Start Date Selected", v);
|
||||
}
|
||||
});
|
||||
|
||||
FieldLabel startDateLabel = new FieldLabel(startDate, "Start Date");
|
||||
|
||||
endDate = new DateField();
|
||||
endDate.addValidator(new EmptyValidator<Date>());
|
||||
endDate.addParseErrorHandler(new ParseErrorEvent.ParseErrorHandler() {
|
||||
@Override
|
||||
public void onParseError(ParseErrorEvent event) {
|
||||
Info.display("Parse Error", event.getErrorValue()
|
||||
+ " could not be parsed as a date");
|
||||
}
|
||||
});
|
||||
endDate.addValueChangeHandler(new ValueChangeHandler<Date>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Date> event) {
|
||||
String v = event.getValue() == null ? "Nothing"
|
||||
: DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)
|
||||
.format(event.getValue());
|
||||
Info.display("End Date Selected", v);
|
||||
}
|
||||
});
|
||||
|
||||
FieldLabel endDateLabel = new FieldLabel(endDate, "End Date");
|
||||
|
||||
|
||||
// Aggreagation Mode
|
||||
AccountingPeriodModePropertiesCombo props = GWT
|
||||
.create(AccountingPeriodModePropertiesCombo.class);
|
||||
|
@ -128,12 +83,59 @@ public class AccountingPeriodPanel extends SimpleContainer {
|
|||
|
||||
FieldLabel periodModeLabel = new FieldLabel(comboPeriodMode,
|
||||
"Aggregation");
|
||||
|
||||
//
|
||||
startDate = new DateField();
|
||||
startDate.addValidator(new MaxDateValidator(new Date()));
|
||||
startDate.addValidator(new EmptyValidator<Date>());
|
||||
startDate.addParseErrorHandler(new ParseErrorEvent.ParseErrorHandler() {
|
||||
|
||||
@Override
|
||||
public void onParseError(ParseErrorEvent event) {
|
||||
Log.debug("Parse Error", event.getErrorValue()
|
||||
+ " could not be parsed as a date");
|
||||
|
||||
}
|
||||
});
|
||||
startDate.addValueChangeHandler(new ValueChangeHandler<Date>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Date> event) {
|
||||
String v = event.getValue() == null ? "Nothing"
|
||||
: DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)
|
||||
.format(event.getValue());
|
||||
Log.debug("Start Date Selected "+ v);
|
||||
}
|
||||
});
|
||||
|
||||
FieldLabel startDateLabel = new FieldLabel(startDate, "Start Date");
|
||||
|
||||
endDate = new DateField();
|
||||
endDate.addValidator(new EmptyValidator<Date>());
|
||||
endDate.addParseErrorHandler(new ParseErrorEvent.ParseErrorHandler() {
|
||||
@Override
|
||||
public void onParseError(ParseErrorEvent event) {
|
||||
Log.debug("Parse Error", event.getErrorValue()
|
||||
+ " could not be parsed as a date");
|
||||
}
|
||||
});
|
||||
endDate.addValueChangeHandler(new ValueChangeHandler<Date>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Date> event) {
|
||||
String v = event.getValue() == null ? "Nothing"
|
||||
: DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)
|
||||
.format(event.getValue());
|
||||
Log.debug("End Date Selected "+ v);
|
||||
}
|
||||
});
|
||||
|
||||
FieldLabel endDateLabel = new FieldLabel(endDate, "End Date");
|
||||
|
||||
|
||||
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
||||
vlc.add(periodModeLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(startDateLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(endDateLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vlc.add(periodModeLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
|
||||
FieldSet fieldSet = new FieldSet();
|
||||
fieldSet.setHeadingHtml("<b>Temporal Constraint</b>");
|
||||
fieldSet.setCollapsible(false);
|
||||
|
@ -163,13 +165,6 @@ public class AccountingPeriodPanel extends SimpleContainer {
|
|||
.addSelectionHandler(new SelectionHandler<AccountingPeriodMode>() {
|
||||
public void onSelection(
|
||||
SelectionEvent<AccountingPeriodMode> event) {
|
||||
Info.display(
|
||||
"Aggregation",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem())
|
||||
+ "!"));
|
||||
Log.debug("ComboPeriodMode selected: "
|
||||
+ event.getSelectedItem());
|
||||
|
||||
|
|
|
@ -3,17 +3,13 @@ package org.gcube.portlets.admin.accountingmanager.client.filters;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.event.StateChangeEvent;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.properties.AccountingFilterProperties;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerServiceAsync;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.state.AccountingStateData;
|
||||
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.AccountingType;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerSessionExpiredException;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
|
@ -22,7 +18,6 @@ import com.google.gwt.editor.client.Editor.Path;
|
|||
import com.google.gwt.event.shared.EventBus;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
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.Style.SelectionMode;
|
||||
|
@ -39,6 +34,7 @@ import com.sencha.gxt.dnd.core.client.GridDragSource;
|
|||
import com.sencha.gxt.dnd.core.client.GridDropTarget;
|
||||
import com.sencha.gxt.widget.core.client.button.ButtonBar;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
|
@ -75,9 +71,11 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
private Grid<AccountingFilter> grid;
|
||||
private ListStore<AccountingFilter> store;
|
||||
private boolean addStatus;
|
||||
private List<FilterKey> filterKeys;
|
||||
private AccountingStateData accountingStateData;
|
||||
private ListStore<FilterKey> storeComboFilterKey;
|
||||
private GridRowEditing<AccountingFilter> editing;
|
||||
private TextButton addButton;
|
||||
private int seq;
|
||||
|
||||
public interface FilterKeyPropertiesCombo extends PropertyAccess<FilterKey> {
|
||||
|
||||
|
@ -87,13 +85,11 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
LabelProvider<FilterKey> key();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface FilterKeyTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value);
|
||||
}
|
||||
|
||||
|
||||
public ActiveFiltersPanel(EventBus eventBus) {
|
||||
super();
|
||||
|
@ -115,22 +111,22 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
.create(AccountingFilterProperties.class);
|
||||
|
||||
ColumnConfig<AccountingFilter, FilterKey> keyColumn = new ColumnConfig<AccountingFilter, FilterKey>(
|
||||
props.key(), 130, "Key");
|
||||
|
||||
props.filterKey(), 130, "Key");
|
||||
keyColumn.setMenuDisabled(true);
|
||||
keyColumn.setCell(new AbstractCell<FilterKey>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, FilterKey value, SafeHtmlBuilder sb) {
|
||||
public void render(Context context, FilterKey value,
|
||||
SafeHtmlBuilder sb) {
|
||||
FilterKeyTemplates filterKeyTemplates = GWT
|
||||
.create(FilterKeyTemplates.class);
|
||||
sb.append(filterKeyTemplates.format(value.getKey()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
ColumnConfig<AccountingFilter, String> valueColumn = new ColumnConfig<AccountingFilter, String>(
|
||||
props.value(), 130, "Value");
|
||||
|
||||
valueColumn.setMenuDisabled(true);
|
||||
ArrayList<ColumnConfig<AccountingFilter, ?>> l = new ArrayList<ColumnConfig<AccountingFilter, ?>>();
|
||||
l.add(keyColumn);
|
||||
l.add(valueColumn);
|
||||
|
@ -152,7 +148,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
grid.setColumnReordering(false);
|
||||
grid.getView().setAutoExpandColumn(valueColumn);
|
||||
grid.getView().setSortingEnabled(false);
|
||||
|
||||
|
||||
GridDragSource<AccountingFilter> ds = new GridDragSource<AccountingFilter>(
|
||||
grid);
|
||||
ds.addDragStartHandler(new DndDragStartHandler() {
|
||||
|
@ -187,53 +183,22 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
final TextField valueField = new TextField();
|
||||
valueField.addValidator(new EmptyValidator<String>());
|
||||
|
||||
final GridRowEditing<AccountingFilter> editing = new GridRowEditing<AccountingFilter>(
|
||||
grid);
|
||||
editing = new GridRowEditing<AccountingFilter>(grid);
|
||||
editing.addEditor(keyColumn, comboFilterKey);
|
||||
editing.addEditor(valueColumn, valueField);
|
||||
|
||||
final TextButton addButton = new TextButton("Add Filter");
|
||||
// addButton.setIcon(ResourceBundle.INSTANCE.columnAdd24());
|
||||
|
||||
|
||||
addButton = new TextButton("Add Filter");
|
||||
addButton.setIcon(AccountingManagerResources.INSTANCE.accountingFilter24());
|
||||
addButton.setIconAlign(IconAlign.RIGHT);
|
||||
addButton.setToolTip("Add Filter");
|
||||
addButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
List<AccountingFilter> filtersSet=store.getAll();
|
||||
FilterKey fk=null;
|
||||
|
||||
if(filterKeys==null|| filterKeys.size()<0){
|
||||
|
||||
} else {
|
||||
for(FilterKey availableFilterKey:filterKeys){
|
||||
boolean isSet=false;
|
||||
for(AccountingFilter filterSet:filtersSet){
|
||||
if(availableFilterKey.getKey().compareTo(filterSet.getFilterKey().getKey())==0){
|
||||
isSet=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isSet){
|
||||
fk=availableFilterKey;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
AccountingFilter newAccountingFilter = new AccountingFilter(
|
||||
fk, "");
|
||||
|
||||
editing.cancelEditing();
|
||||
addStatus = true;
|
||||
editing.getCancelButton().setVisible(false);
|
||||
store.add(newAccountingFilter);
|
||||
|
||||
int row = store.indexOf(newAccountingFilter);
|
||||
editing.startEditing(new GridCell(row, 0));
|
||||
|
||||
addNewFilter(event);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
TextButton deleteBtn = new TextButton("Delete");
|
||||
|
@ -262,8 +227,8 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
@Override
|
||||
public void onBeforeStartEdit(
|
||||
BeforeStartEditEvent<AccountingFilter> event) {
|
||||
addButton.setEnabled(false);
|
||||
// setEnableNextButton(false);
|
||||
editingBeforeStart(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -273,7 +238,6 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
public void onCancelEdit(CancelEditEvent<AccountingFilter> event) {
|
||||
store.rejectChanges();
|
||||
addButton.setEnabled(true);
|
||||
// setEnableNextButton(true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -284,44 +248,15 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
@Override
|
||||
public void onCompleteEdit(CompleteEditEvent<AccountingFilter> event) {
|
||||
try {
|
||||
|
||||
String value = valueField.getCurrentValue();
|
||||
Log.debug("Current Value: " + value);
|
||||
|
||||
boolean exist = false;
|
||||
GridCell cell = event.getEditCell();
|
||||
int rowIndex = cell.getRow();
|
||||
AccountingFilter newFilter = store.get(rowIndex);
|
||||
|
||||
Log.debug("Store: " + store.getAll().toString());
|
||||
for (AccountingFilter filter : store.getAll()) {
|
||||
if (newFilter.getId().compareTo(filter.getId()) != 0) {
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (addStatus) {
|
||||
addStatus = false;
|
||||
}
|
||||
|
||||
Log.debug("Exist: " + exist);
|
||||
if (exist) {
|
||||
Log.debug("AddStatus: " + addStatus);
|
||||
if (addStatus) {
|
||||
addStatus = false;
|
||||
store.remove(rowIndex);
|
||||
store.commitChanges();
|
||||
} else {
|
||||
store.rejectChanges();
|
||||
}
|
||||
UtilsGXT3
|
||||
.alert("Attention",
|
||||
"This label is already present, please choose another(case insensitive)!");
|
||||
} else {
|
||||
store.commitChanges();
|
||||
}
|
||||
|
||||
store.commitChanges();
|
||||
|
||||
|
||||
|
||||
editing.getCancelButton().setVisible(true);
|
||||
addButton.setEnabled(true);
|
||||
// setEnableNextButton(true);
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in RuleOnTableNewDefinitionCard: "
|
||||
|
@ -333,7 +268,7 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
|
||||
//
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(addButton);
|
||||
toolBar.add(addButton, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
VerticalLayoutContainer vlc = new VerticalLayoutContainer();
|
||||
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
@ -381,40 +316,52 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
|
||||
private void onRestoreStateChange(StateChangeEvent event) {
|
||||
if (event.getAccountingStateData() != null) {
|
||||
accountingStateData=event.getAccountingStateData();
|
||||
retrieveFilterKey(event.getAccountingStateData().getAccountingType());
|
||||
|
||||
accountingStateData = event.getAccountingStateData();
|
||||
changeActiveFilters();
|
||||
|
||||
} else {
|
||||
accountingStateData=null;
|
||||
accountingStateData = null;
|
||||
seq=0;
|
||||
}
|
||||
Log.debug("Set seq to: "+seq);
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
|
||||
private void changeActiveFilters() {
|
||||
storeComboFilterKey.clear();
|
||||
storeComboFilterKey.addAll(filterKeys);
|
||||
storeComboFilterKey
|
||||
.addAll(accountingStateData.getAvailableFilterKeys());
|
||||
storeComboFilterKey.commitChanges();
|
||||
|
||||
if (accountingStateData.getSeriesRequest() != null) {
|
||||
List<AccountingFilter> filters = accountingStateData.getSeriesRequest().getFilters();
|
||||
|
||||
if (accountingStateData.getSeriesRequest() != null
|
||||
&& accountingStateData.getSeriesRequest().getFilters() != null) {
|
||||
List<AccountingFilter> filters = accountingStateData
|
||||
.getSeriesRequest().getFilters();
|
||||
store.clear();
|
||||
store.addAll(filters);
|
||||
seq=0;
|
||||
for(AccountingFilter filter:filters){
|
||||
if(filter.getId()>seq){
|
||||
seq=filter.getId();
|
||||
};
|
||||
}
|
||||
store.commitChanges();
|
||||
} else {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
seq=0;
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<AccountingFilter> getActiveFilters() {
|
||||
public ArrayList<AccountingFilter> getActiveFilters() {
|
||||
try {
|
||||
|
||||
if (store == null || store.size() <= 0) {
|
||||
return null;
|
||||
} else {
|
||||
return store.getAll();
|
||||
return new ArrayList<AccountingFilter>(store.getAll());
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
|
@ -425,32 +372,83 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
}
|
||||
|
||||
private void retrieveFilterKey(AccountingType accountingType) {
|
||||
private void addNewFilter(SelectEvent event) {
|
||||
List<AccountingFilter> filtersSet = store.getAll();
|
||||
FilterKey fk = null;
|
||||
|
||||
AccountingManagerServiceAsync.INSTANCE.getFilterKeys(accountingType,
|
||||
new AsyncCallback<ArrayList<FilterKey>>() {
|
||||
if (accountingStateData == null
|
||||
|| accountingStateData.getAvailableFilterKeys() == null
|
||||
|| accountingStateData.getAvailableFilterKeys().size() < 0) {
|
||||
UtilsGXT3.info("No key available", "No key available");
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof AccountingManagerSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error retrieving filter keys:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving filter keys",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
} else {
|
||||
List<FilterKey> remainingFilterKeys = new ArrayList<FilterKey>(
|
||||
accountingStateData.getAvailableFilterKeys());
|
||||
List<FilterKey> removableFilterKeys = new ArrayList<FilterKey>();
|
||||
|
||||
}
|
||||
for (AccountingFilter filterSet : filtersSet) {
|
||||
removableFilterKeys.add(filterSet.getFilterKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<FilterKey> result) {
|
||||
Log.debug("FilterKeys: " + result);
|
||||
filterKeys = result;
|
||||
changeActiveFilters();
|
||||
}
|
||||
});
|
||||
remainingFilterKeys.removeAll(removableFilterKeys);
|
||||
|
||||
if (remainingFilterKeys.size() > 0) {
|
||||
fk = remainingFilterKeys.get(0);
|
||||
seq++;
|
||||
AccountingFilter newAccountingFilter = new AccountingFilter(seq,fk,
|
||||
"");
|
||||
Log.debug("newAccountingFilter: "+newAccountingFilter);
|
||||
editing.cancelEditing();
|
||||
addStatus = true;
|
||||
editing.getCancelButton().setVisible(false);
|
||||
store.add(newAccountingFilter);
|
||||
int row = store.indexOf(newAccountingFilter);
|
||||
|
||||
storeComboFilterKey.clear();
|
||||
storeComboFilterKey.addAll(remainingFilterKeys);
|
||||
storeComboFilterKey.commitChanges();
|
||||
|
||||
editing.startEditing(new GridCell(row, 0));
|
||||
} else {
|
||||
UtilsGXT3.info("No key available", "No key available");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void editingBeforeStart(BeforeStartEditEvent<AccountingFilter> event) {
|
||||
GridCell cell = event.getEditCell();
|
||||
int rowIndex = cell.getRow();
|
||||
AccountingFilter editingFilter = store.get(rowIndex);
|
||||
|
||||
List<AccountingFilter> filtersSet = store.getAll();
|
||||
|
||||
List<FilterKey> remainingFilterKeys = null;
|
||||
if (accountingStateData == null
|
||||
|| accountingStateData.getAvailableFilterKeys() == null) {
|
||||
remainingFilterKeys = new ArrayList<FilterKey>();
|
||||
} else {
|
||||
remainingFilterKeys = new ArrayList<FilterKey>(
|
||||
accountingStateData.getAvailableFilterKeys());
|
||||
|
||||
}
|
||||
|
||||
List<FilterKey> setFilterKeys = new ArrayList<FilterKey>();
|
||||
|
||||
for (AccountingFilter filterSet : filtersSet) {
|
||||
if (filterSet.getFilterKey().getKey()
|
||||
.compareTo(editingFilter.getFilterKey().getKey()) != 0) {
|
||||
setFilterKeys.add(filterSet.getFilterKey());
|
||||
}
|
||||
}
|
||||
|
||||
remainingFilterKeys.removeAll(setFilterKeys);
|
||||
|
||||
storeComboFilterKey.clear();
|
||||
storeComboFilterKey.addAll(remainingFilterKeys);
|
||||
storeComboFilterKey.commitChanges();
|
||||
|
||||
addButton.setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.filters;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.client.event.FiltersChangeEvent;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.resource.AccountingManagerResources;
|
||||
|
@ -91,7 +91,7 @@ public class FiltersPanel extends FramedPanel {
|
|||
protected void updateChart() {
|
||||
AccountingPeriod accountingPeriod = accountPeriodPanel
|
||||
.getAccountingPeriod();
|
||||
List<AccountingFilter> activeFilters=activeFiltersPanel.getActiveFilters();
|
||||
ArrayList<AccountingFilter> activeFilters=activeFiltersPanel.getActiveFilters();
|
||||
|
||||
if (accountingPeriod != null) {
|
||||
SeriesRequest seriesRequest = new SeriesRequest(accountingPeriod,activeFilters);
|
||||
|
|
|
@ -18,7 +18,7 @@ public interface AccountingFilterProperties extends
|
|||
|
||||
ModelKeyProvider<AccountingFilter> id();
|
||||
|
||||
ValueProvider<AccountingFilter, FilterKey> key();
|
||||
ValueProvider<AccountingFilter, FilterKey> filterKey();
|
||||
|
||||
ValueProvider<AccountingFilter, String> value();
|
||||
|
||||
|
|
|
@ -107,13 +107,16 @@ public interface AccountingManagerResources extends ClientBundle {
|
|||
@Source("accounting-reload_48.png")
|
||||
ImageResource accountingReload48();
|
||||
|
||||
@Source("accounting-chart-variable-axis_16.png")
|
||||
ImageResource accountingChartVariableAxis16();
|
||||
|
||||
@Source("accounting-chart-variable-axis_24.png")
|
||||
ImageResource accountingChartVariableAxis24();
|
||||
|
||||
@Source("accounting-chart-variable-axis_32.png")
|
||||
ImageResource accountingChartVariableAxis32();
|
||||
|
||||
@Source("accounting-filter_24.png")
|
||||
ImageResource accountingFilter24();
|
||||
|
||||
@Source("accounting-filter_32.png")
|
||||
ImageResource accountingFilter32();
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 615 B |
Binary file not shown.
After Width: | Height: | Size: 818 B |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -1,8 +1,10 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.client.state;
|
||||
|
||||
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.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesResponse;
|
||||
|
||||
|
@ -13,22 +15,25 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesRes
|
|||
*
|
||||
*/
|
||||
public class AccountingStateData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4853602427569285252L;
|
||||
|
||||
private static final long serialVersionUID = -2080165745912743812L;
|
||||
private AccountingType accountingType;
|
||||
private SeriesRequest seriesRequest;
|
||||
private SeriesResponse seriesResponse;
|
||||
|
||||
private ArrayList<FilterKey> availableFilterKeys;
|
||||
|
||||
public AccountingStateData() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AccountingStateData(AccountingType accountingType,
|
||||
SeriesRequest seriesRequest, SeriesResponse seriesResponse) {
|
||||
SeriesRequest seriesRequest, SeriesResponse seriesResponse,
|
||||
ArrayList<FilterKey> availableFilterKeys) {
|
||||
super();
|
||||
this.accountingType = accountingType;
|
||||
this.seriesRequest = seriesRequest;
|
||||
this.seriesResponse = seriesResponse;
|
||||
this.availableFilterKeys = availableFilterKeys;
|
||||
}
|
||||
|
||||
public AccountingType getAccountingType() {
|
||||
|
@ -55,11 +60,23 @@ public class AccountingStateData implements Serializable {
|
|||
this.seriesResponse = seriesResponse;
|
||||
}
|
||||
|
||||
public ArrayList<FilterKey> getAvailableFilterKeys() {
|
||||
return availableFilterKeys;
|
||||
}
|
||||
|
||||
public void setAvailableFilterKeys(ArrayList<FilterKey> availableFilterKeys) {
|
||||
this.availableFilterKeys = availableFilterKeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingStateData [accountingType=" + accountingType
|
||||
+ ", seriesRequest=" + seriesRequest + ", seriesResponse="
|
||||
+ seriesResponse + "]";
|
||||
+ seriesResponse + ", availableFilterKeys="
|
||||
+ availableFilterKeys + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
return new ArrayList<FilterKey>();
|
||||
case SERVICE:
|
||||
return new ArrayList<FilterKey>(Arrays.asList(new FilterKey("consumerId"),
|
||||
new FilterKey("host"), new FilterKey("scope"), new FilterKey("serviceName")));
|
||||
new FilterKey("host"), new FilterKey("scope"), new FilterKey("serviceName"),new FilterKey("serviceClass")));
|
||||
|
||||
case STORAGE:
|
||||
return new ArrayList<FilterKey>(Arrays.asList(new FilterKey("consumerId"),
|
||||
|
|
|
@ -63,7 +63,7 @@ public class AccountingCaller {
|
|||
|
||||
|
||||
List<Info> infos = rrq.getInfo(query.getType(),
|
||||
query.getTemporalConstraint(), null, true);
|
||||
query.getTemporalConstraint(), query.getFilters(), true);
|
||||
if (infos == null) {
|
||||
throw new AccountingManagerServiceException(
|
||||
"Error retrieving list of info: list is null!");
|
||||
|
|
|
@ -1,59 +1,62 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.SingleUsageRecord;
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class AccountingQuery {
|
||||
|
||||
private Class<? extends SingleUsageRecord> type;
|
||||
private Class<? extends AggregatedUsageRecord> type;
|
||||
private TemporalConstraint temporalConstraint;
|
||||
|
||||
|
||||
public AccountingQuery(Class<? extends SingleUsageRecord> type, TemporalConstraint temporalConstraint) {
|
||||
private ArrayList<Filter> filters;
|
||||
|
||||
|
||||
public AccountingQuery(Class<? extends AggregatedUsageRecord> type,
|
||||
TemporalConstraint temporalConstraint, ArrayList<Filter> filters) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
|
||||
public Class<? extends SingleUsageRecord> getType() {
|
||||
public Class<? extends AggregatedUsageRecord> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public void setType(Class<? extends SingleUsageRecord> type) {
|
||||
public void setType(Class<? extends AggregatedUsageRecord> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
public TemporalConstraint getTemporalConstraint() {
|
||||
return temporalConstraint;
|
||||
}
|
||||
|
||||
|
||||
public void setTemporalConstraint(TemporalConstraint temporalConstraint) {
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
}
|
||||
|
||||
public ArrayList<Filter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(ArrayList<Filter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingQuery [type=" + type + ", temporalConstraint="
|
||||
+ temporalConstraint + "]";
|
||||
+ temporalConstraint + ", filters=" + filters + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||
|
||||
import org.gcube.accounting.aggregation.AggregatedJobUsageRecord;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.usagerecords.JobUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||
|
@ -34,7 +34,7 @@ public class AccountingQuery4Job extends AccountingQueryBuilder {
|
|||
.getPeriod()));
|
||||
|
||||
AccountingQuery invocation = new AccountingQuery(
|
||||
JobUsageRecord.class, temporalConstraint);
|
||||
AggregatedJobUsageRecord.class, temporalConstraint,null);
|
||||
|
||||
accountingQuerySpec.setOp(invocation);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||
|
||||
import org.gcube.accounting.aggregation.AggregatedPortletUsageRecord;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.usagerecords.PortletUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||
|
@ -34,7 +34,7 @@ public class AccountingQuery4Portlet extends AccountingQueryBuilder {
|
|||
.getPeriod()));
|
||||
|
||||
AccountingQuery invocation = new AccountingQuery(
|
||||
PortletUsageRecord.class, temporalConstraint);
|
||||
AggregatedPortletUsageRecord.class, temporalConstraint,null);
|
||||
|
||||
accountingQuerySpec.setOp(invocation);
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.accounting.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.usagerecords.ServiceUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -32,10 +36,23 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
seriesRequest.getAccountingPeriod().getEndDate().getTime(),
|
||||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()));
|
||||
|
||||
ArrayList<AccountingFilter> accountingFilters = seriesRequest
|
||||
.getFilters();
|
||||
|
||||
ArrayList<Filter> filters=null;
|
||||
if (accountingFilters != null) {
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
||||
AccountingQuery invocation = new AccountingQuery(
|
||||
ServiceUsageRecord.class, temporalConstraint);
|
||||
|
||||
AggregatedServiceUsageRecord.class, temporalConstraint, filters);
|
||||
|
||||
accountingQuerySpec.setOp(invocation);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.accounting.aggregation.AggregatedStorageUsageRecord;
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -33,8 +37,21 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
PeriodModeMap.getMode(seriesRequest.getAccountingPeriod()
|
||||
.getPeriod()));
|
||||
|
||||
ArrayList<AccountingFilter> accountingFilters = seriesRequest
|
||||
.getFilters();
|
||||
|
||||
ArrayList<Filter> filters=null;
|
||||
if (accountingFilters != null) {
|
||||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
||||
AccountingQuery invocation = new AccountingQuery(
|
||||
StorageUsageRecord.class, temporalConstraint);
|
||||
AggregatedStorageUsageRecord.class, temporalConstraint, filters);
|
||||
|
||||
accountingQuerySpec.setOp(invocation);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.server.amservice.query;
|
||||
|
||||
import org.gcube.accounting.aggregation.AggregatedStorageUsageRecord;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
import org.gcube.accounting.datamodel.usagerecords.StorageUsageRecord;
|
||||
import org.gcube.portlets.admin.accountingmanager.server.amservice.PeriodModeMap;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.query.SeriesRequest;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerServiceException;
|
||||
|
@ -34,7 +34,7 @@ public class AccountingQuery4Task extends AccountingQueryBuilder {
|
|||
.getPeriod()));
|
||||
|
||||
AccountingQuery invocation = new AccountingQuery(
|
||||
StorageUsageRecord.class, temporalConstraint);
|
||||
AggregatedStorageUsageRecord.class, temporalConstraint,null);
|
||||
|
||||
accountingQuerySpec.setOp(invocation);
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.io.Serializable;
|
|||
public class AccountingFilter implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7200526591393559078L;
|
||||
private int id;
|
||||
private FilterKey filterKey;
|
||||
private String value;
|
||||
|
||||
|
@ -18,18 +19,19 @@ public class AccountingFilter implements Serializable {
|
|||
super();
|
||||
}
|
||||
|
||||
public AccountingFilter(FilterKey filterKey, String value) {
|
||||
public AccountingFilter(int id, FilterKey filterKey, String value) {
|
||||
super();
|
||||
this.id=id;
|
||||
this.filterKey = filterKey;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
if (filterKey != null) {
|
||||
return filterKey.getId();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public FilterKey getFilterKey() {
|
||||
|
@ -50,8 +52,8 @@ public class AccountingFilter implements Serializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilter [filterKey=" + filterKey + ", value=" + value
|
||||
+ "]";
|
||||
return "AccountingFilter [id=" + id + ", filterKey=" + filterKey
|
||||
+ ", value=" + value + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.io.Serializable;
|
|||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class FilterKey implements Serializable {
|
||||
public class FilterKey implements Serializable, Comparable<FilterKey> {
|
||||
|
||||
private static final long serialVersionUID = 7200526591393559078L;
|
||||
private String key;
|
||||
|
@ -35,9 +35,25 @@ public class FilterKey implements Serializable {
|
|||
this.key = key;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(FilterKey filterKey) {
|
||||
if(filterKey==null && key==null){
|
||||
return 0;
|
||||
} else {
|
||||
if(filterKey==null && key!=null){
|
||||
return 1;
|
||||
} else {
|
||||
return key.compareTo(filterKey.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FilterKey [key=" + key + "]";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data.query;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingPeriod;
|
||||
|
@ -16,14 +16,14 @@ public class SeriesRequest implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = -109538024097615414L;
|
||||
private AccountingPeriod accountingPeriod;
|
||||
private List<AccountingFilter> filters;
|
||||
private ArrayList<AccountingFilter> filters;
|
||||
|
||||
public SeriesRequest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SeriesRequest(AccountingPeriod accountingPeriod,
|
||||
List<AccountingFilter> filters) {
|
||||
ArrayList<AccountingFilter> filters) {
|
||||
super();
|
||||
this.accountingPeriod = accountingPeriod;
|
||||
this.filters = filters;
|
||||
|
@ -37,11 +37,11 @@ public class SeriesRequest implements Serializable {
|
|||
this.accountingPeriod = accountingPeriod;
|
||||
}
|
||||
|
||||
public List<AccountingFilter> getFilters() {
|
||||
public ArrayList<AccountingFilter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(List<AccountingFilter> filters) {
|
||||
public void setFilters(ArrayList<AccountingFilter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,8 @@ public class SeriesRequest implements Serializable {
|
|||
return "SeriesRequest [accountingPeriod=" + accountingPeriod
|
||||
+ ", filters=" + filters + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||
|
||||
<!-- Debug CSS style -->
|
||||
<!-- <set-configuration-property name="CssResource.style"
|
||||
value="pretty" /> -->
|
||||
<!-- <set-configuration-property name="CssResource.style" value="pretty"
|
||||
/> -->
|
||||
|
||||
<!--<inherits name="org.moxieapps.gwt.highcharts.Highcharts"/> -->
|
||||
<inherits name='com.github.highcharts4gwt.highcharts' />
|
||||
|
@ -48,18 +48,20 @@
|
|||
name="locale" values="es" /> <set-property name="locale" value="en, it, es"
|
||||
/> <set-property-fallback name="locale" value="en" /> -->
|
||||
|
||||
<!-- <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
|
||||
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
|
||||
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
|
||||
/> -->
|
||||
|
||||
<!--
|
||||
<set-property name="log_ConsoleLogger" value="ENABLED" />
|
||||
<set-property name="log_DivLogger" value="ENABLED" />
|
||||
<set-property name="log_GWTLogger" value="ENABLED" />
|
||||
<set-property name="log_SystemLogger" value="ENABLED" /> -->
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED"
|
||||
/> -->
|
||||
|
||||
|
||||
|
||||
<set-property name="log_ConsoleLogger" value="DISABLED" />
|
||||
<set-property name="log_DivLogger" value="DISABLED" />
|
||||
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="DISABLED"
|
||||
/> -->
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 615 B |
Binary file not shown.
After Width: | Height: | Size: 818 B |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue