Commit 53ec75ab authored by oleg.pahhomov's avatar oleg.pahhomov

SA0140-380 default values only for menu filter

parent 9e111337
......@@ -101,14 +101,7 @@ public class WidgetSaveImporter {
graph.setVerticalRule(tourismVerticalRule(widget));
}
GraphType savedGraph = graphTypeRepository.save(graph);
List<Filter> filters;
if (graph.getType().isLineOrBarOrStackedOrArea()) {
filters = saveRegularFilters(result, savedWidget, savedGraph);
} else if (graph.getType().isMapOrVerticalOrPieOrTreemapOrRadarOrPyramid()) {
filters = saveMapFilters(result, savedWidget, savedGraph);
} else {
throw new IllegalStateException("unknown type");
}
List<Filter> filters = saveFilters(result, savedWidget, graph, savedGraph);
if (result.hasCube()) {
StatDb statDb = result.getStatDb();
......@@ -126,6 +119,16 @@ public class WidgetSaveImporter {
return savedWidget.getId();
}
private List<Filter> saveFilters(ImportResult result, Widget savedWidget, GraphType graph, GraphType savedGraph) {
if (graph.getType().isLineOrBarOrStackedOrArea()) {
return saveRegularFilters(result, savedWidget, savedGraph);
} else if (graph.getType().isMapOrVerticalOrPieOrTreemapOrRadarOrPyramid()) {
return saveMapFilters(result, savedWidget, savedGraph);
} else {
throw new IllegalStateException("unknown type");
}
}
private List<Filter> saveRegularFilters(ImportResult result, Widget savedWidget, GraphType savedGraph) {
List<Filter> filters = notEmpty(result);
filters.add(timeFilter(FilterDisplay.AXIS, result.getFilters().size()));
......@@ -137,6 +140,9 @@ public class WidgetSaveImporter {
List<FilterValue> values = getTimeFilterValues(savedWidget, savedGraph, filter, newFilter);
values.forEach(v -> v.setOrderNr(values.indexOf(v)));
if (!newFilter.getType().isMenu()) {
values.forEach(v -> v.setSelected(false));
}
saveValues(filterRepository.save(newFilter), values);
newFilter.setValues(values);
newFilters.add(newFilter);
......@@ -156,6 +162,9 @@ public class WidgetSaveImporter {
List<FilterValue> values = getFilterValues(savedWidget, savedGraph, newFilter);
values.forEach(v -> v.setOrderNr(values.indexOf(v)));
if (!newFilter.getType().isMenu()) {
values.forEach(v -> v.setSelected(false));
}
saveValues(filterRepository.save(newFilter), values);
newFilter.setValues(values);
newFilters.add(newFilter);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment