514: Accounting Manager - List of Possible Values for a Filter by Key
Task-Url: https://support.d4science.org/issues/514 Updated support on client git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@117765 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
898971273a
commit
72510d6a43
|
@ -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>
|
||||
|
|
|
@ -128,7 +128,7 @@ public class AccountingManagerController {
|
|||
|
||||
}
|
||||
|
||||
protected void checkLocale() {
|
||||
private void checkLocale() {
|
||||
String[] locales = LocaleInfo.getAvailableLocaleNames();
|
||||
|
||||
for (String locale : locales) {
|
||||
|
|
|
@ -3,21 +3,29 @@ 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.resource.AccountingManagerResources;
|
||||
import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerServiceAsync;
|
||||
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.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.exception.AccountingManagerSessionExpiredException;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
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;
|
||||
|
@ -49,7 +57,6 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
import com.sencha.gxt.widget.core.client.form.validator.EmptyValidator;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
|
@ -73,9 +80,13 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
private boolean addStatus;
|
||||
private AccountingStateData accountingStateData;
|
||||
private ListStore<FilterKey> storeComboFilterKey;
|
||||
private ComboBox<FilterKey> comboFilterKey;
|
||||
private ListStore<FilterValue> storeComboFilterValue;
|
||||
private GridRowEditing<AccountingFilter> editing;
|
||||
private TextButton addButton;
|
||||
private int seq;
|
||||
|
||||
|
||||
|
||||
public interface FilterKeyPropertiesCombo extends PropertyAccess<FilterKey> {
|
||||
|
||||
|
@ -85,12 +96,29 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
LabelProvider<FilterKey> key();
|
||||
|
||||
}
|
||||
|
||||
public interface FilterValuePropertiesCombo extends PropertyAccess<FilterValue> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<FilterValue> id();
|
||||
|
||||
LabelProvider<FilterValue> value();
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface FilterKeyTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value);
|
||||
}
|
||||
|
||||
interface FilterValueTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ActiveFiltersPanel(EventBus eventBus) {
|
||||
super();
|
||||
Log.debug("ActiveFiltersPanel");
|
||||
|
@ -116,17 +144,29 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
keyColumn.setCell(new AbstractCell<FilterKey>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, FilterKey value,
|
||||
public void render(Context context, FilterKey filterKey,
|
||||
SafeHtmlBuilder sb) {
|
||||
FilterKeyTemplates filterKeyTemplates = GWT
|
||||
.create(FilterKeyTemplates.class);
|
||||
sb.append(filterKeyTemplates.format(value.getKey()));
|
||||
sb.append(filterKeyTemplates.format(filterKey.getKey()));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<AccountingFilter, String> valueColumn = new ColumnConfig<AccountingFilter, String>(
|
||||
props.value(), 130, "Value");
|
||||
ColumnConfig<AccountingFilter, FilterValue> valueColumn = new ColumnConfig<AccountingFilter, FilterValue>(
|
||||
props.filterValue(), 130, "Value");
|
||||
valueColumn.setMenuDisabled(true);
|
||||
valueColumn.setCell(new AbstractCell<FilterValue>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, FilterValue filterValue,
|
||||
SafeHtmlBuilder sb) {
|
||||
FilterValueTemplates filterValueTemplates = GWT
|
||||
.create(FilterValueTemplates.class);
|
||||
sb.append(filterValueTemplates.format(filterValue.getValue()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ArrayList<ColumnConfig<AccountingFilter, ?>> l = new ArrayList<ColumnConfig<AccountingFilter, ?>>();
|
||||
l.add(keyColumn);
|
||||
l.add(valueColumn);
|
||||
|
@ -168,24 +208,40 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
dt.setAllowSelfAsSource(true);
|
||||
|
||||
// EDITING //
|
||||
//Key
|
||||
FilterKeyPropertiesCombo filterKeyPropertiesCombo = GWT
|
||||
.create(FilterKeyPropertiesCombo.class);
|
||||
|
||||
storeComboFilterKey = new ListStore<FilterKey>(
|
||||
filterKeyPropertiesCombo.id());
|
||||
//
|
||||
ComboBox<FilterKey> comboFilterKey = new ComboBox<FilterKey>(
|
||||
|
||||
comboFilterKey = new ComboBox<FilterKey>(
|
||||
storeComboFilterKey, filterKeyPropertiesCombo.key());
|
||||
comboFilterKey.setClearValueOnParseError(false);
|
||||
|
||||
comboFilterKey.setTriggerAction(TriggerAction.ALL);
|
||||
addHandlersForComboFilterKey(filterKeyPropertiesCombo.key());
|
||||
|
||||
//Value
|
||||
FilterValuePropertiesCombo filterValuePropertiesCombo = GWT
|
||||
.create(FilterValuePropertiesCombo.class);
|
||||
|
||||
final TextField valueField = new TextField();
|
||||
valueField.addValidator(new EmptyValidator<String>());
|
||||
storeComboFilterValue = new ListStore<FilterValue>(
|
||||
filterValuePropertiesCombo.id());
|
||||
|
||||
ComboBox<FilterValue> comboFilterValue = new ComboBox<FilterValue>(
|
||||
storeComboFilterValue, filterValuePropertiesCombo.value());
|
||||
comboFilterValue.setClearValueOnParseError(false);
|
||||
comboFilterValue.addValidator(new EmptyValidator<FilterValue>());
|
||||
comboFilterValue.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
|
||||
//final TextField valueField = new TextField();
|
||||
//valueField.addValidator(new EmptyValidator<String>());
|
||||
|
||||
editing = new GridRowEditing<AccountingFilter>(grid);
|
||||
editing.addEditor(keyColumn, comboFilterKey);
|
||||
editing.addEditor(valueColumn, valueField);
|
||||
editing.addEditor(valueColumn, comboFilterValue);
|
||||
|
||||
|
||||
addButton = new TextButton("Add Filter");
|
||||
|
@ -253,8 +309,6 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
store.commitChanges();
|
||||
|
||||
|
||||
|
||||
editing.getCancelButton().setVisible(true);
|
||||
addButton.setEnabled(true);
|
||||
|
||||
|
@ -389,25 +443,26 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
for (AccountingFilter filterSet : filtersSet) {
|
||||
removableFilterKeys.add(filterSet.getFilterKey());
|
||||
}
|
||||
|
||||
|
||||
remainingFilterKeys.removeAll(removableFilterKeys);
|
||||
|
||||
if (remainingFilterKeys.size() > 0) {
|
||||
|
||||
|
||||
if (remainingFilterKeys.size() > 0) {
|
||||
fk = remainingFilterKeys.get(0);
|
||||
seq++;
|
||||
AccountingFilter newAccountingFilter = new AccountingFilter(seq,fk,
|
||||
"");
|
||||
new FilterValue());
|
||||
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");
|
||||
|
@ -415,6 +470,38 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void retrieveFilterValuesByKey(FilterKey filterKey){
|
||||
AccountingManagerServiceAsync.INSTANCE.getFilterValues(filterKey,
|
||||
new AsyncCallback<ArrayList<FilterValue>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof AccountingManagerSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error retrieving filter values:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving filter values",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<FilterValue> result) {
|
||||
Log.debug("FilterValues: " + result);
|
||||
storeComboFilterValue.clear();
|
||||
storeComboFilterValue.addAll(result);
|
||||
storeComboFilterValue.commitChanges();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void editingBeforeStart(BeforeStartEditEvent<AccountingFilter> event) {
|
||||
GridCell cell = event.getEditCell();
|
||||
|
@ -447,9 +534,31 @@ public class ActiveFiltersPanel extends SimpleContainer {
|
|||
storeComboFilterKey.clear();
|
||||
storeComboFilterKey.addAll(remainingFilterKeys);
|
||||
storeComboFilterKey.commitChanges();
|
||||
|
||||
|
||||
if(editingFilter.getFilterKey()!=null){
|
||||
retrieveFilterValuesByKey(editingFilter.getFilterKey());
|
||||
}
|
||||
|
||||
addButton.setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
private void addHandlersForComboFilterKey(
|
||||
final LabelProvider<FilterKey> labelProvider) {
|
||||
comboFilterKey.addSelectionHandler(new SelectionHandler<FilterKey>() {
|
||||
public void onSelection(SelectionEvent<FilterKey> event) {
|
||||
Log.debug("FilterKey selected: " + event.getSelectedItem());
|
||||
updateFilterKey(event.getSelectedItem());
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void updateFilterKey(FilterKey selectedFilterKey) {
|
||||
retrieveFilterValuesByKey(selectedFilterKey);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.admin.accountingmanager.client.properties;
|
|||
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.AccountingFilter;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterKey;
|
||||
import org.gcube.portlets.admin.accountingmanager.shared.data.FilterValue;
|
||||
|
||||
import com.sencha.gxt.core.client.ValueProvider;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
|
@ -20,6 +21,6 @@ public interface AccountingFilterProperties extends
|
|||
|
||||
ValueProvider<AccountingFilter, FilterKey> filterKey();
|
||||
|
||||
ValueProvider<AccountingFilter, String> value();
|
||||
ValueProvider<AccountingFilter, FilterValue> filterValue();
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ 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.FilterValue;
|
||||
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.AccountingManagerServiceException;
|
||||
|
@ -51,5 +52,16 @@ public interface AccountingManagerService extends RemoteService {
|
|||
*/
|
||||
public ArrayList<FilterKey> getFilterKeys(AccountingType accountingType)
|
||||
throws AccountingManagerServiceException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filterKey filter on values
|
||||
* @return
|
||||
* @throws AccountingManagerServiceException
|
||||
*/
|
||||
public ArrayList<FilterValue> getFilterValues(FilterKey filterKey)
|
||||
throws AccountingManagerServiceException;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ 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.FilterValue;
|
||||
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.session.UserInfo;
|
||||
|
@ -52,4 +53,12 @@ public interface AccountingManagerServiceAsync {
|
|||
void getFilterKeys(AccountingType accountingType,
|
||||
AsyncCallback<ArrayList<FilterKey>> callback);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param filterKey filter on values
|
||||
* @param callback
|
||||
*/
|
||||
void getFilterValues(FilterKey filterKey,
|
||||
AsyncCallback<ArrayList<FilterValue>> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ import org.gcube.portlets.admin.accountingmanager.shared.data.response.SeriesRes
|
|||
*
|
||||
*/
|
||||
public class AccountingStateData implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -2080165745912743812L;
|
||||
private AccountingType accountingType;
|
||||
private SeriesRequest seriesRequest;
|
||||
private SeriesResponse seriesResponse;
|
||||
private ArrayList<FilterKey> availableFilterKeys;
|
||||
|
||||
|
||||
public AccountingStateData() {
|
||||
super();
|
||||
}
|
||||
|
@ -76,7 +76,4 @@ public class AccountingStateData implements Serializable {
|
|||
+ availableFilterKeys + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.portlets.admin.accountingmanager.client.rpc.AccountingManagerSe
|
|||
import org.gcube.portlets.admin.accountingmanager.server.amservice.AccountingCaller;
|
||||
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.FilterValue;
|
||||
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.AccountingManagerServiceException;
|
||||
|
@ -21,7 +22,13 @@ import org.slf4j.LoggerFactory;
|
|||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
|
||||
/**
|
||||
* The server side implementation of the RPC service.
|
||||
* AccountingManagerServiceImpl
|
||||
*
|
||||
* Support service request
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
||||
|
@ -96,7 +103,11 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<FilterKey> getFilterKeys(AccountingType accountingType)
|
||||
throws AccountingManagerServiceException {
|
||||
|
@ -136,5 +147,41 @@ public class AccountingManagerServiceImpl extends RemoteServiceServlet
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<FilterValue> getFilterValues(FilterKey filterKey)
|
||||
throws AccountingManagerServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
SessionUtil.getAslSession(session);
|
||||
|
||||
if (filterKey == null) {
|
||||
return new ArrayList<FilterValue>();
|
||||
}
|
||||
|
||||
switch(filterKey.getKey()){
|
||||
case "consumerId":
|
||||
return new ArrayList<FilterValue>(Arrays.asList(new FilterValue("giancarlo.panichi"),
|
||||
new FilterValue("gianpaolo.coro"), new FilterValue("luca.frosini")));
|
||||
default:
|
||||
return new ArrayList<FilterValue>();
|
||||
}
|
||||
|
||||
|
||||
} catch (AccountingManagerServiceException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
logger.error("getFilterValues(): " + e.getLocalizedMessage(), e);
|
||||
throw new AccountingManagerServiceException(e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class AccountingQuery4Service extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getValue());
|
||||
.getKey(), accountigFilters.getFilterValue().getValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class AccountingQuery4Storage extends AccountingQueryBuilder {
|
|||
filters = new ArrayList<Filter>();
|
||||
for (AccountingFilter accountigFilters : accountingFilters) {
|
||||
Filter filter = new Filter(accountigFilters.getFilterKey()
|
||||
.getKey(), accountigFilters.getValue());
|
||||
.getKey(), accountigFilters.getFilterValue().getValue());
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,17 +13,17 @@ public class AccountingFilter implements Serializable {
|
|||
private static final long serialVersionUID = 7200526591393559078L;
|
||||
private int id;
|
||||
private FilterKey filterKey;
|
||||
private String value;
|
||||
private FilterValue filterValue;
|
||||
|
||||
public AccountingFilter() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AccountingFilter(int id, FilterKey filterKey, String value) {
|
||||
public AccountingFilter(int id, FilterKey filterKey, FilterValue filterValue) {
|
||||
super();
|
||||
this.id=id;
|
||||
this.filterKey = filterKey;
|
||||
this.value = value;
|
||||
this.filterValue = filterValue;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
|
@ -42,18 +42,18 @@ public class AccountingFilter implements Serializable {
|
|||
this.filterKey = filterKey;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
public FilterValue getFilterValue() {
|
||||
return filterValue;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
public void setFilterValue(FilterValue filterValue) {
|
||||
this.filterValue = filterValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AccountingFilter [id=" + id + ", filterKey=" + filterKey
|
||||
+ ", value=" + value + "]";
|
||||
+ ", filterValue=" + filterValue + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package org.gcube.portlets.admin.accountingmanager.shared.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class FilterValue implements Serializable, Comparable<FilterValue> {
|
||||
|
||||
private static final long serialVersionUID = -346123619404369336L;
|
||||
private String value;
|
||||
|
||||
|
||||
public FilterValue(){
|
||||
super();
|
||||
value="";
|
||||
}
|
||||
|
||||
public FilterValue(String value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getId(){
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(FilterValue filterValue) {
|
||||
if(filterValue==null && value==null){
|
||||
return 0;
|
||||
} else {
|
||||
if(filterValue==null && value!=null){
|
||||
return 1;
|
||||
} else {
|
||||
return value.compareTo(filterValue.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FilterValue [value=" + value + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -48,7 +48,6 @@
|
|||
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" />
|
||||
|
|
Loading…
Reference in New Issue