Commit 237cdb3a authored by oleg.pahhomov's avatar oleg.pahhomov

Merge branch 'develop'

parents d1255f13 82012111
......@@ -2,7 +2,7 @@ package ee.stat.dashboard.controller.admin;
import ee.stat.dashboard.config.security.RoleString;
import ee.stat.dashboard.controller.Response;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.enums.GraphTypeEnum;
import ee.stat.dashboard.service.admin.WidgetAdminSaveService;
import ee.stat.dashboard.service.admin.WidgetAdminService;
......
......@@ -2,7 +2,7 @@ package ee.stat.dashboard.controller.element.dto;
import ee.stat.dashboard.controller.element.ElementStrategy;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.controller.Response;
import ee.stat.dashboard.model.classifier.ClassifierCode;
import ee.stat.dashboard.service.element.ElementService;
......
package ee.stat.dashboard.controller.publics;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.controller.Response;
import ee.stat.dashboard.controller.user.UserSessionHolder;
import ee.stat.dashboard.config.security.StatUser;
......@@ -10,7 +10,6 @@ import ee.stat.dashboard.service.dashboard.DashboardService;
import ee.stat.dashboard.service.dashboard.dto.DashboardResponse;
import ee.stat.dashboard.service.dashboard.dto.UserDashboardDto;
import ee.stat.dashboard.service.dashboard.dto.UserWidgetsDto;
import ee.stat.dashboard.util.ResponseUtil;
import lombok.AllArgsConstructor;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.GetMapping;
......
package ee.stat.dashboard.controller.publics;
import ee.stat.dashboard.controller.admin.FilterType;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.controller.Response;
import ee.stat.dashboard.controller.user.UserSessionHolder;
import ee.stat.dashboard.config.security.StatUser;
......
package ee.stat.dashboard.controller.publics.dto;
import ee.stat.dashboard.model.widget.back.enums.Language;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
......
package ee.stat.dashboard.model.classifier;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import lombok.Getter;
import lombok.Setter;
......
package ee.stat.dashboard.model.classifier;
import com.fasterxml.jackson.annotation.JsonIgnore;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import lombok.Getter;
import lombok.Setter;
......
package ee.stat.dashboard.model.dashboard;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import lombok.Getter;
import lombok.Setter;
......
......@@ -26,7 +26,15 @@ public class Dimension {
}
@JsonIgnore
public String getValue(int num) {
public String getValueId(int num) {
if (isEmpty(values)){
return null;
}
return values.get(num).getId();
}
@JsonIgnore
public String getValueName(int num) {
if (isEmpty(values)){
return null;
}
......
......@@ -2,7 +2,7 @@ package ee.stat.dashboard.model.widget.back;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.json.CoordinatedResponses;
import lombok.Getter;
import lombok.Setter;
......@@ -11,12 +11,9 @@ import org.hibernate.annotations.TypeDef;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
@Getter
@Setter
......
package ee.stat.dashboard.model.widget.back;
import com.fasterxml.jackson.annotation.JsonIgnore;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.enums.AxisOrder;
import ee.stat.dashboard.model.widget.back.enums.TimePart;
import ee.stat.dashboard.model.widget.front.enums.FilterDisplay;
......@@ -15,7 +15,6 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
......
......@@ -2,7 +2,7 @@ package ee.stat.dashboard.model.widget.back;
import com.fasterxml.jackson.annotation.JsonIgnore;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import lombok.Getter;
import lombok.Setter;
......@@ -10,7 +10,6 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.time.LocalDateTime;
import java.util.Objects;
@Getter
......
package ee.stat.dashboard.model.widget.back;
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.statresponse.StatResponse;
import ee.stat.dashboard.model.widget.back.enums.GraphTypeEnum;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Type;
......@@ -11,14 +10,9 @@ import org.hibernate.annotations.TypeDef;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
@Getter
@Setter
......
......@@ -2,7 +2,7 @@ package ee.stat.dashboard.model.widget.back;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.enums.TimePeriod;
import ee.stat.dashboard.model.widget.back.enums.WidgetStatus;
import lombok.Getter;
......
package ee.stat.dashboard.controller.publics.dto;
package ee.stat.dashboard.model.widget.back.enums;
public enum Language {
ET, EN;
......
package ee.stat.dashboard.model.widget.front;
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.enums.GraphTypeEnum;
import lombok.Getter;
import lombok.Setter;
......@@ -15,7 +15,6 @@ import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.time.LocalDate;
import java.util.Objects;
@Getter
......
package ee.stat.dashboard.repository.custom;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.Widget;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......
package ee.stat.dashboard.repository.custom;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.Widget;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
......
package ee.stat.dashboard.service.admin;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.classifier.Domain;
import ee.stat.dashboard.model.dashboard.Dashboard;
import ee.stat.dashboard.model.widget.back.Widget;
......
......@@ -44,7 +44,8 @@ public class WidgetAdminSaveService {
diagramBuilder.createNewDiagramForUpdater(widget.getId());
return "";
} catch (Exception e) {
log.error("error creating diagram for widget {}: {}", widget.getId(), e.getMessage(), e);
Throwable error = e.getCause() != null ? e.getCause() : e;
log.error("error creating diagram for widget {}: {}", widget.getId(), e.getMessage(), error);
return format("Error creating diagram for widget %s: %s", e.getClass(), e.getMessage());
}
}
......
package ee.stat.dashboard.service.admin.dashboard;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.service.admin.dashboard.dto.DashboardAdminResponse;
import lombok.AllArgsConstructor;
import org.springframework.cache.Cache;
......@@ -19,12 +19,12 @@ public class DashboardCacheManager {
@Caching(evict = {
@CacheEvict(value = "DashboardServiceCache_findAllByLevel", allEntries = true),
@CacheEvict(value = "DashboardServiceCache_findById", key = "#dashboard"),
@CacheEvict(value = "DashboardServiceCache_findAllFromByTo", key = "#dashboard"),
@CacheEvict(value = "DashboardServiceCache_findById", key = "#dashboard.id"),
@CacheEvict(value = "DashboardServiceCache_findAllFromByTo", key = "#dashboard.id"),
@CacheEvict(value = "DashboardServiceCache_findAllFromByTo", condition = "#dashboard.parentId != null", key = "#dashboard.parentId"),
@CacheEvict(value = "DashboardServiceCache_findAllToByFrom", key = "#dashboard"),
@CacheEvict(value = "DashboardServiceCache_findAllToByFrom", key = "#dashboard.id"),
@CacheEvict(value = "DashboardServiceCache_findAllToByFrom", condition = "#dashboard.parentId != null", key = "#dashboard.parentId"),
@CacheEvict(value = "ElementServiceCache_findAllDashboardRegions", key = "#dashboard"),
@CacheEvict(value = "ElementServiceCache_findAllDashboardRegions", key = "#dashboard.id"),
})
public void update(DashboardAdminResponse dashboard) {
updateDomainServiceCache(dashboard.getId(), cacheManager.getCache("DomainService_loadDomainsAndWidgets"));
......@@ -40,7 +40,7 @@ public class DashboardCacheManager {
private void updateDomainServiceCache(Long dashboardId, Cache cache) {
if (cache != null) {
for (Language value : Language.values()) {
cache.evict(dashboardId.toString() + value);
cache.evict(dashboardId.toString() + value.name());
}
}
}
......
package ee.stat.dashboard.service.admin.widget;
import ee.stat.dashboard.config.props.ExcelConfig;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.Excel;
import ee.stat.dashboard.model.widget.back.ExcelData;
import ee.stat.dashboard.model.widget.back.enums.ExcelType;
......
package ee.stat.dashboard.service.admin.widget;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.Filter;
import ee.stat.dashboard.model.widget.back.FilterValue;
import ee.stat.dashboard.model.widget.back.GraphType;
......@@ -21,10 +21,8 @@ import ee.stat.dashboard.service.admin.widget.dto.GraphTypeAdminDto;
import ee.stat.dashboard.service.admin.widget.dto.StatDbDataAdminDto;
import ee.stat.dashboard.util.StatListUtil;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
......
......@@ -5,9 +5,11 @@ import ee.stat.dashboard.service.admin.widget.dto.FilterAdminDto;
import ee.stat.dashboard.service.admin.widget.dto.FilterValueAdminDto;
import ee.stat.dashboard.service.admin.widget.dto.GraphTypeAdminDto;
import ee.stat.dashboard.service.admin.widget.dto.WidgetAdminResponse;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.stereotype.Service;
import static ee.stat.dashboard.model.widget.front.enums.FilterDisplay.AXIS;
import static ee.stat.dashboard.model.widget.front.enums.FilterDisplay.LEGEND;
import static ee.stat.dashboard.model.widget.front.enums.FilterDisplay.MENU;
import static ee.stat.dashboard.util.ResponseUtil.badRequest;
import static java.lang.String.format;
import static org.apache.commons.collections4.CollectionUtils.isNotEmpty;
......@@ -48,8 +50,7 @@ public class GraphTypeValidator {
}
private void validateFiltersAccordingToGraphType(GraphTypeAdminDto graphTypeDto) {
long countOfAxis = graphTypeDto.getFilters().stream().filter(f -> f.getType().equals(FilterDisplay.AXIS)).count();
if (countOfAxis != 1) {
if (getCount(graphTypeDto, AXIS) != 1) {
throw badRequest(graphTypeWName(graphTypeDto), "If filters are defined only 1 axis must be set").get();
}
if (graphTypeDto.getType().isLineOrBarOrStackedOrArea()) {
......@@ -61,12 +62,10 @@ public class GraphTypeValidator {
throw badRequest(graphTypeWName(graphTypeDto), "Map, Vertical, Pie, Treemap, Radar or Pyramid should have axis set NOT as time").get();
}
}
long countOfLegends = graphTypeDto.getFilters().stream().filter(f -> f.getType().equals(FilterDisplay.LEGEND)).count();
if (countOfLegends > 1) {
if (getCount(graphTypeDto, LEGEND) > 1) {
throw badRequest(graphTypeWName(graphTypeDto), "If filters are defined up to 1 legend can be set").get();
}
long countOfLegendOrMenu = graphTypeDto.getFilters().stream().filter(f -> f.getType().equals(FilterDisplay.LEGEND) || f.getType().equals(FilterDisplay.MENU)).count();
if (countOfLegendOrMenu > 4) {
if (getCount(graphTypeDto, LEGEND, MENU) > 4) {
throw badRequest(graphTypeWName(graphTypeDto), "If filters are defined 4 is the max amount of menu + legend filters").get();
}
long countOfRegions = graphTypeDto.getFilters().stream().filter(f -> isTrue(f.getRegion())).count();
......@@ -81,10 +80,19 @@ public class GraphTypeValidator {
private boolean axisIsTime(GraphTypeAdminDto graphTypeDto) {
return graphTypeDto.getFilters().stream()
.filter(f -> f.getType().equals(FilterDisplay.AXIS))
.filter(f -> f.getType() != null && f.getType().equals(AXIS))
.anyMatch(f -> isTrue(f.getTime()));
}
private long getCount(GraphTypeAdminDto graphTypeDto, FilterDisplay axis) {
return graphTypeDto.getFilters().stream().filter(f -> f.getType() != null && f.getType().equals(axis)).count();
}
private long getCount(GraphTypeAdminDto graphTypeDto, FilterDisplay f1, FilterDisplay f2) {
return graphTypeDto.getFilters().stream().filter(f -> f.getType() != null &&
(f.getType().equals(f1) || f.getType().equals(f2))).count();
}
public void validateFilter(FilterAdminDto filterDto) {
if (filterDto.getType() == null) {
throw badRequest(FILTER, "no type").get();
......
......@@ -35,24 +35,20 @@ public class WidgetValidator {
if (widget.getPeriods() != null && widget.getPeriods() < 1) {
throw badRequest("widget", "periods should be positive").get();
}
if (widget.getStatDb() != null)
if (widget.getStatDb() != null) {
if (widget.getStatDb().getCube() == null) {
throw badRequest("widget excel", "no filename").get();
}
if (isNotEmpty(widget.getGraphTypes())) {
if (isEmpty(widget.getDimensions())) {
throw badRequest("widget", "no dimensions").get();
if (isNotEmpty(widget.getGraphTypes())) {
if (isEmpty(widget.getDimensions())) {
throw badRequest("widget", "no dimensions").get();
}
}
}
if (widget.getExcel() != null) {
if (widget.getExcel().getFilename() == null) {
throw badRequest("widget excel", "no filename").get();
}
if (widget.getStatDb() == null) {
if (isNotEmpty(widget.getGraphTypes())){
}
}
}
}
}
package ee.stat.dashboard.service.admin.widget.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.widget.back.enums.AxisOrder;
import ee.stat.dashboard.model.widget.back.enums.TimePart;
import ee.stat.dashboard.model.widget.front.Period;
......
package ee.stat.dashboard.service.dashboard;
import ee.stat.dashboard.config.security.StatUser;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.dashboard.Dashboard;
import ee.stat.dashboard.model.user.UserDashboard;
import ee.stat.dashboard.repository.UserDashboardRepository;
......
......@@ -2,7 +2,7 @@ package ee.stat.dashboard.service.dashboard;
import ee.stat.dashboard.config.security.StatUser;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.dashboard.Dashboard;
import ee.stat.dashboard.service.dashboard.dto.DashboardResponse;
import ee.stat.dashboard.service.element.DomainService;
......
package ee.stat.dashboard.service.dashboard.dto;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.dashboard.DashboardStatus;
import ee.stat.dashboard.model.dashboard.DashboardType;
import ee.stat.dashboard.service.element.dto.DomainResponse;
......
package ee.stat.dashboard.service.element;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.classifier.Domain;
import ee.stat.dashboard.service.element.dto.DomainResponse;
import lombok.AllArgsConstructor;
......
package ee.stat.dashboard.service.element;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.classifier.Domain;
import ee.stat.dashboard.model.widget.back.Widget;
import ee.stat.dashboard.model.widget.back.enums.WidgetStatus;
......@@ -10,7 +10,6 @@ import ee.stat.dashboard.service.element.dto.DomainResponse;
import ee.stat.dashboard.service.widget.widget.WidgetConverter;
import ee.stat.dashboard.service.widget.widget.dto.WidgetResponse;
import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
......@@ -29,7 +28,7 @@ public class DomainService {
private WidgetConverter widgetConverter;
private DomainConverter domainConverter;
@Cacheable(value = "DomainService_loadDomainsAndWidgets", key = "#dashboardId.toString().concat('-').concat(#lang.name())")
@Cacheable(value = "DomainService_loadDomainsAndWidgets", key = "#dashboardId.toString().concat(#lang.name())")
public List<DomainResponse> loadDomainsAndWidgets(Long dashboardId, Language lang) {
return domainRepository.findByDashboardAndLevelOrderByOrderNr(dashboardId, 0).stream()
.map(topDomain -> mapDomainWithChildrenAndWidgets(topDomain, lang))
......@@ -53,7 +52,7 @@ public class DomainService {
domain.setSubElements(allToByFrom);
}
List<Widget> widgets = widgetRepository.findWidgetsByDomain(domain.getId(), lang);
if (CollectionUtils.isNotEmpty(widgets)) {
if (isNotEmpty(widgets)) {
domain.setWidgets(map(widgets, lang));
}
}
......
......@@ -2,7 +2,7 @@ package ee.stat.dashboard.service.element;
import ee.stat.dashboard.config.props.ElementConfig;
import ee.stat.dashboard.controller.element.ElementStrategy;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.classifier.ClassifierCode;
import ee.stat.dashboard.model.classifier.Element;
import ee.stat.dashboard.service.element.dto.ElementResponse;
......
package ee.stat.dashboard.service.statdata;
import ee.stat.dashboard.config.props.StatConfig;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.service.statdata.xml.AllowedDimensions;
import ee.stat.dashboard.service.statdata.xml.XmlDimension;
import ee.stat.dashboard.service.statdata.xml.XmlValue;
......
package ee.stat.dashboard.service.statdata;
import ee.stat.dashboard.config.props.StatConfig;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.service.statdata.xml.StatLinksResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......
package ee.stat.dashboard.service.statdata.xml;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import lombok.Getter;
import lombok.Setter;
......
package ee.stat.dashboard.service.statdata.xml;
import com.fasterxml.jackson.annotation.JsonIgnore;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.service.widget.coordinates.converters.SdmxDateConverter;
import lombok.Getter;
import lombok.NoArgsConstructor;
......
package ee.stat.dashboard.service.statdata.xml;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
......
package ee.stat.dashboard.service.statsync;
import com.fasterxml.jackson.databind.ObjectMapper;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.process.ProcessLog;
import ee.stat.dashboard.model.statresponse.StatResponse;
import ee.stat.dashboard.model.widget.back.Filter;
......
......@@ -9,6 +9,7 @@ import ee.stat.dashboard.repository.WidgetRepository;
import ee.stat.dashboard.service.process.ProcessLoggingService;
import ee.stat.dashboard.service.statsync.dto.ProcessResult;
import ee.stat.dashboard.service.statsync.dto.StatDbUpdaterException;
import ee.stat.dashboard.service.widget.CalculationException;
import ee.stat.dashboard.service.widget.diagram.DiagramBuilder;
import ee.stat.dashboard.service.widget.diagram.GraphBuilderException;
import lombok.AllArgsConstructor;
......@@ -45,7 +46,7 @@ public class StatDbsUpdater {
}
} catch (Exception e) {
processResult.incrementFailed();
if (e instanceof StatDbUpdaterException || e instanceof GraphBuilderException) {
if (e instanceof StatDbUpdaterException || e instanceof CalculationException) {
processLoggingService.log(processLog, widget, LogStatus.ERROR, e.getMessage(), statDb.getCube(), e.getCause());
} else {
processLoggingService.log(processLog, widget, LogStatus.ERROR, format("Unexpected exception for widget: %s, %s",
......
package ee.stat.dashboard.service.statsync.dto;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.statresponse.StatResponse;
import lombok.Getter;
import lombok.Setter;
......
package ee.stat.dashboard.service.widget;
public class CalculationException extends Exception {
public CalculationException(String message) {
super(message);
}
public CalculationException(String message, Throwable cause) {
super(message, cause);
}
}
......@@ -2,7 +2,7 @@ package ee.stat.dashboard.service.widget.coordinates;
import com.google.common.collect.Lists;
import ee.stat.dashboard.config.props.ExcelConfig;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.json.CoordinatedResponse;
import ee.stat.dashboard.model.json.CoordinatedResponses;
import ee.stat.dashboard.model.json.DataPoint;
......@@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static ee.stat.dashboard.service.widget.coordinates.CoordinateUtil.setDimensions;
import static org.apache.commons.collections4.CollectionUtils.isEmpty;
......
package ee.stat.dashboard.service.widget.coordinates;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.json.CoordinatedResponse;
import ee.stat.dashboard.model.json.DataPoint;
import ee.stat.dashboard.model.widget.back.Filter;
......
package ee.stat.dashboard.service.widget.coordinates;
import ee.stat.dashboard.service.widget.CalculationException;
public class RawDataException extends CalculationException {
public RawDataException(String message) {
super(message);
}
public RawDataException(String message, Throwable cause) {
super(message, cause);
}
}
package ee.stat.dashboard.service.widget.coordinates;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import ee.stat.dashboard.model.json.CoordinatedResponse;
import ee.stat.dashboard.model.json.CoordinatedResponses;
import ee.stat.dashboard.model.widget.back.Excel;
import ee.stat.dashboard.model.widget.back.Filter;
import ee.stat.dashboard.model.widget.back.StatDb;
import ee.stat.dashboard.model.widget.back.StatDbData;
import ee.stat.dashboard.service.widget.coordinates.dto.MergeResponse;
import ee.stat.dashboard.service.widget.diagram.GraphBuilderException;
......@@ -30,7 +29,7 @@ public class RawDataTransformer {
private SdmxToCoordinates sdmxToCoordinates;
private FilterService filterService;
public MergeResponse transformRowData(List<StatDbData> statDbData, List<Excel> excels, List<Filter> filters, Language lang) throws GraphBuilderException {
public MergeResponse transformRowData(List<StatDbData> statDbData, List<Excel> excels, List<Filter> filters, Language lang) throws RawDataException {