Fixed the problems caused by serialization

This commit is contained in:
Lennart Hensler committed 2014-08-07 09:48:51 +02:00
1 parent 5caeb9e334
commit 9bdfbff531
11 files changed
+35 -25

No files matched your search

@@ -21,6 +21,6 @@ public interface QueryDefinitionDeprecated extends Serializable {
public List<DimensionIdentifier> getDimensionsToGroupBy();
public Map<DimensionIdentifier, Iterable<?>> getSelection();
public Map<DimensionIdentifier, Iterable<? extends Serializable>> getSelection();
}
@@ -1,7 +1,7 @@
package com.sap.sailing.datamining.shared.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -24,7 +24,7 @@ public class QueryDefinitionDeprecatedImpl implements QueryDefinitionDeprecated
private DataTypes dataType;
private List<DimensionIdentifier> dimensionsToGroupBy;
private Map<DimensionIdentifier, Iterable<?>> selectionMappedByDimension;
private Map<DimensionIdentifier, Iterable<? extends Serializable>> selectionMappedByDimension;
/**
* Constructor for the GWT-Serialization. Don't use this!
@@ -40,7 +40,7 @@ public class QueryDefinitionDeprecatedImpl implements QueryDefinitionDeprecated
this.dataType = dataType;
dimensionsToGroupBy = new ArrayList<DimensionIdentifier>();
selectionMappedByDimension = new HashMap<DimensionIdentifier, Iterable<?>>();
selectionMappedByDimension = new HashMap<DimensionIdentifier, Iterable<? extends Serializable>>();
}
@Override
@@ -74,7 +74,7 @@ public class QueryDefinitionDeprecatedImpl implements QueryDefinitionDeprecated
}
@Override
public Map<DimensionIdentifier, Iterable<?>> getSelection() {
public Map<DimensionIdentifier, Iterable<? extends Serializable>> getSelection() {
return selectionMappedByDimension;
}
@@ -82,7 +82,7 @@ public class QueryDefinitionDeprecatedImpl implements QueryDefinitionDeprecated
dimensionsToGroupBy.add(dimension);
}
public void setSelectionFor(DimensionIdentifier dimension, Collection<?> selection) {
public void setSelectionFor(DimensionIdentifier dimension, Iterable<? extends Serializable> selection) {
selectionMappedByDimension.put(dimension, selection);
}
@@ -1,5 +1,6 @@
package com.sap.sailing.datamining;
import java.io.Serializable;
import java.util.Map.Entry;
import com.sap.sailing.datamining.shared.DimensionIdentifier;
@@ -14,7 +15,7 @@ public class QueryDefinitionConverter {
DeprecatedEnumsToFunctionDTOConverter.getFunctionDTOFor(queryDefinitionDeprecated.getStatisticType()),
queryDefinitionDeprecated.getAggregatorType());
for (Entry<DimensionIdentifier, Iterable<?>> filterSelectionEntry : queryDefinitionDeprecated.getSelection()
for (Entry<DimensionIdentifier, Iterable<? extends Serializable>> filterSelectionEntry : queryDefinitionDeprecated.getSelection()
.entrySet()) {
queryDefinition.setFilterSelectionFor(
DeprecatedEnumsToFunctionDTOConverter.getFunctionDTOFor(filterSelectionEntry.getKey()),
@@ -1,5 +1,6 @@
package com.sap.sailing.datamining.factories;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -43,7 +44,7 @@ public final class SailingDataRetrieverFactory {
* @return The first processor of the retrieval chain.
*/
@SuppressWarnings("unchecked")
public static <DataSourceType, ElementType> Processor<DataSourceType> createRetrievalProcessorChain(SailingDataRetrievalLevels dataRetrievalLevel, Processor<ElementType> groupingProcessor, Map<FunctionDTO, Iterable<?>> filterSelection, FunctionProvider functionProvider) {
public static <DataSourceType, ElementType> Processor<DataSourceType> createRetrievalProcessorChain(SailingDataRetrievalLevels dataRetrievalLevel, Processor<ElementType> groupingProcessor, Map<FunctionDTO, Iterable<? extends Serializable>> filterSelection, FunctionProvider functionProvider) {
Processor<?> resultReceiver = groupingProcessor;
for (int i = dataRetrievalLevel.ordinal(); i >= 0; i--) {
resultReceiver = createDataRetrieverFor(SailingDataRetrievalLevels.values()[i], resultReceiver, filterSelection, functionProvider);
@@ -55,7 +56,7 @@ public final class SailingDataRetrieverFactory {
/* The way this method is used should guarantee, that the result receiver matches the new processor
*/
private static Processor<?> createDataRetrieverFor(SailingDataRetrievalLevels dataRetrievalLevel,
Processor<?> resultReceiver, Map<FunctionDTO, Iterable<?>> filterSelection, FunctionProvider functionProvider) {
Processor<?> resultReceiver, Map<FunctionDTO, Iterable<? extends Serializable>> filterSelection, FunctionProvider functionProvider) {
ThreadPoolExecutor executor = DataMiningActivator.getExecutor();
switch (dataRetrievalLevel) {
@@ -83,9 +84,9 @@ public final class SailingDataRetrieverFactory {
}
private static <BaseDataType> FilterCriteria<BaseDataType> getFilterCriteriaForBaseDataType(Class<BaseDataType> baseDataType,
Map<FunctionDTO, Iterable<?>> filterSelection, FunctionProvider functionProvider) {
Map<FunctionDTO, Iterable<? extends Serializable>> filterSelection, FunctionProvider functionProvider) {
CompoundFilterCriteria<BaseDataType> criteria = null;
for (Entry<FunctionDTO, Iterable<?>> filterSelectionEntry : filterSelection.entrySet()) {
for (Entry<FunctionDTO, Iterable<? extends Serializable>> filterSelectionEntry : filterSelection.entrySet()) {
Function<?> function = functionProvider.getFunctionForDTO(filterSelectionEntry.getKey());
if (baseDataType.equals(function.getDeclaringType())) {
if (criteria == null) {
@@ -1,5 +1,6 @@
package com.sap.sailing.gwt.ui.datamining;
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
@@ -11,7 +12,7 @@ public interface SelectionProvider<SettingsType> extends Component<SettingsType>
public void addSelectionChangedListener(SelectionChangedListener listener);
public Map<DimensionIdentifier, Collection<?>> getSelection();
public Map<DimensionIdentifier, Collection<? extends Serializable>> getSelection();
public void applySelection(QueryDefinitionDeprecated queryDefinition);
@@ -1,5 +1,6 @@
package com.sap.sailing.gwt.ui.datamining.selection;
import java.io.Serializable;
import java.util.Collection;
import java.util.Map.Entry;
@@ -79,7 +80,7 @@ public class QueryDefinitionProviderWithControls extends AbstractQueryDefinition
break;
}
for (Entry<DimensionIdentifier, Collection<?>> selectionEntry : selectionProvider.getSelection().entrySet()) {
for (Entry<DimensionIdentifier, Collection<? extends Serializable>> selectionEntry : selectionProvider.getSelection().entrySet()) {
queryDTO.setSelectionFor(selectionEntry.getKey(), selectionEntry.getValue());
}
@@ -1,5 +1,6 @@
package com.sap.sailing.gwt.ui.datamining.selection;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -127,10 +128,10 @@ public class RefreshingSelectionTablesPanel implements SelectionProvider<Refresh
}
@Override
public Map<DimensionIdentifier, Collection<?>> getSelection() {
Map<DimensionIdentifier, Collection<?>> selection = new HashMap<DimensionIdentifier, Collection<?>>();
public Map<DimensionIdentifier, Collection<? extends Serializable>> getSelection() {
Map<DimensionIdentifier, Collection<? extends Serializable>> selection = new HashMap<DimensionIdentifier, Collection<? extends Serializable>>();
for (SelectionTable<?, ?> table : tablesMappedByDimension.values()) {
Collection<?> specificSelection = table.getSelectionAsValues();
Collection<? extends Serializable> specificSelection = table.getSelectionAsValues();
if (!specificSelection.isEmpty()) {
selection.put(table.getDimension(), specificSelection);
}
@@ -140,7 +141,7 @@ public class RefreshingSelectionTablesPanel implements SelectionProvider<Refresh
@Override
public void applySelection(QueryDefinitionDeprecated queryDefinition) {
for (Entry<DimensionIdentifier, Iterable<?>> selectionEntry : queryDefinition.getSelection().entrySet()) {
for (Entry<DimensionIdentifier, Iterable<? extends Serializable>> selectionEntry : queryDefinition.getSelection().entrySet()) {
SelectionTable<?, ?> selectionTable = tablesMappedByDimension.get(selectionEntry.getKey());
selectionTable.setSelection((Iterable<?>) selectionEntry.getValue());
}
@@ -1,5 +1,6 @@
package com.sap.sailing.gwt.ui.datamining.selection;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -15,7 +16,7 @@ import com.google.gwt.view.client.SelectionChangeEvent;
import com.sap.sailing.datamining.shared.DimensionIdentifier;
import com.sap.sse.gwt.client.panels.AbstractFilterablePanel;
public abstract class SelectionTable<ContentType, ValueType> extends FlowPanel {
public abstract class SelectionTable<ContentType, ValueType extends Serializable> extends FlowPanel {
private DimensionIdentifier dimension;
private Collection<ContentType> allData;
@@ -125,7 +126,7 @@ public abstract class SelectionTable<ContentType, ValueType> extends FlowPanel {
return newContentKeys;
}
public Collection<?> getSelectionAsValues() {
public Collection<? extends Serializable> getSelectionAsValues() {
Collection<ValueType> selectionAsValues = new HashSet<ValueType>();
for (ContentType content : selectionModel.getSelectedSet()) {
selectionAsValues.add(getValue(content));
@@ -1,8 +1,10 @@
package com.sap.sailing.gwt.ui.datamining.selection;
import java.io.Serializable;
import com.sap.sailing.datamining.shared.DimensionIdentifier;
public class SimpleSelectionTable<ContentType> extends SelectionTable<ContentType, ContentType> {
public class SimpleSelectionTable<ContentType extends Serializable> extends SelectionTable<ContentType, ContentType> {
public SimpleSelectionTable(String title, DimensionIdentifier dimension) {
super(title, dimension);
@@ -1,5 +1,6 @@
package com.sap.sse.datamining.shared;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@@ -10,7 +11,7 @@ public interface QueryDefinition {
public String getLocaleInfoName();
public Map<FunctionDTO, Iterable<?>> getFilterSelection();
public Map<FunctionDTO, Iterable<? extends Serializable>> getFilterSelection();
public List<FunctionDTO> getDimensionsToGroupBy();
@@ -1,5 +1,6 @@
package com.sap.sse.datamining.shared.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -12,20 +13,20 @@ import com.sap.sse.datamining.shared.dto.FunctionDTO;
public class QueryDefinitionImpl implements QueryDefinition {
private final String localeInfoName;
private final Map<FunctionDTO, Iterable<?>> filterSelection;
private final Map<FunctionDTO, Iterable<? extends Serializable>> filterSelection;
private final List<FunctionDTO> dimensionsToGroupBy;
private final FunctionDTO extractionFunction;
private final AggregatorType aggregatorType;
public QueryDefinitionImpl(String localeInfoName, FunctionDTO extractionFunction, AggregatorType aggregatorType) {
this.localeInfoName = localeInfoName;
this.filterSelection = new HashMap<FunctionDTO, Iterable<?>>();
this.filterSelection = new HashMap<FunctionDTO, Iterable<? extends Serializable>>();
this.dimensionsToGroupBy = new ArrayList<FunctionDTO>();
this.extractionFunction = extractionFunction;
this.aggregatorType = aggregatorType;
}
public void setFilterSelectionFor(FunctionDTO dimension, Iterable<?> selection) {
public void setFilterSelectionFor(FunctionDTO dimension, Iterable<? extends Serializable> selection) {
filterSelection.put(dimension, selection);
}
@@ -39,7 +40,7 @@ public class QueryDefinitionImpl implements QueryDefinition {
}
@Override
public Map<FunctionDTO, Iterable<?>> getFilterSelection() {
public Map<FunctionDTO, Iterable<? extends Serializable>> getFilterSelection() {
return filterSelection;
}