Commit 82012111 authored by oleg.pahhomov's avatar oleg.pahhomov

SA0140-281 refactor error messages

parent 27463c57
......@@ -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;
......
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;
......
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;
......
......@@ -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 {
try {
List<CoordinatedResponse> responses = rawDataTransformer(filters, statDbData, excels, lang);
List<Filter> filtersWithValues = filterService.filtersWithValues(filters);
......@@ -39,7 +38,7 @@ public class RawDataTransformer {
//todo2 MUST set dim1 and dim2's to be of the same type
return ResponseMerger.mergeToSingleResponse(modifiedResponses);
} catch (Exception e){
throw new GraphBuilderException(format("Raw data transformer problem: %s", e.getMessage()), e);
throw new RawDataException(format("Raw data transformer problem: %s", e.getMessage()), e);
}
}
......
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.classifier.ClassifierCode;
import ee.stat.dashboard.model.json.CoordinatedResponse;
import ee.stat.dashboard.model.json.DataPoint;
......@@ -24,6 +24,7 @@ import java.util.Objects;
import java.util.Optional;
import static ee.stat.dashboard.service.widget.coordinates.CoordinateUtil.setDimensions;
import static java.lang.String.*;
import static java.util.stream.Collectors.toList;
@Service
......@@ -81,16 +82,17 @@ public class SdmxToCoordinates {
for (int i = 0; i < indexes.size(); i++) {
Dimension dimension = observations.get(i);
String name = dimension.getName();
String value = dimension.getValue(indexes.get(i)).replace(".", "").trim();
if (name.equals(timeFilter.getName(lang))) {
String value = dimension.getValueId(indexes.get(i)).replace(".", "").trim();
if (SdmxDateConverter.sdmxYear(value)) {
dataPoint.setYear(SdmxDateConverter.fromYear(value));
} else if (SdmxDateConverter.sdmxUnderYear(value)) {
dataPoint.setDate(SdmxDateConverter.fromSdmxUnderYear(value));
} else {
throw new IllegalStateException("");
throw new IllegalStateException(format("Unknown sdmx date length %s for %s", value.length(), value));
}
} else if (dimension.dimensionMatters()) {
String value = dimension.getValueName(indexes.get(i)).replace(".", "").trim();
if (timePartFilterOp.isPresent() && name.equals(timePartFilterOp.get().getName(lang))) {
setTimePart(lang, dataPoint, value, timePartFilterOp.get());
if (dataPoint.hasNoMonthOrQuarter()) {
......
package ee.stat.dashboard.service.widget.coordinates.converters;
import ee.stat.dashboard.controller.publics.dto.Language;
import ee.stat.dashboard.model.widget.back.enums.Language;
import java.time.Month;
......
......@@ -7,6 +7,9 @@ import ee.stat.dashboard.model.widget.front.enums.DiagramStatus;
import ee.stat.dashboard.repository.DiagramDataRepository;
import ee.stat.dashboard.repository.DiagramRepository;
import ee.stat.dashboard.repository.WidgetRepository;
import ee.stat.dashboard.service.widget.CalculationException;
import ee.stat.dashboard.service.widget.coordinates.RawDataException;
import ee.stat.dashboard.service.widget.grouper.GraphGroupingException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -38,7 +41,7 @@ public class DiagramBuilder {
* throws process exception
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void createNewDiagramForUpdater(Long widgetId) throws GraphBuilderException {
public void createNewDiagramForUpdater(Long widgetId) throws CalculationException {
Widget widget = widgetRepository.findById(widgetId).orElseThrow(RuntimeException::new);
Diagram diagram = buildDiagramInner(widget);
......@@ -63,7 +66,7 @@ public class DiagramBuilder {
}
}
private Diagram buildDiagramInner(Widget widget) throws GraphBuilderException {
private Diagram buildDiagramInner(Widget widget) throws GraphBuilderException, RawDataException, GraphGroupingException {
Diagram diagram = new Diagram();
Long widgetId = widget.getId();
......
package ee.stat.dashboard.service.widget.diagram;
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.widget.back.Excel;
import ee.stat.dashboard.model.widget.back.Filter;
......@@ -15,12 +15,12 @@ import ee.stat.dashboard.model.widget.front.Period;
import ee.stat.dashboard.repository.ExcelRepository;
import ee.stat.dashboard.repository.GraphTypeRepository;
import ee.stat.dashboard.repository.StatDbDataRepository;
import ee.stat.dashboard.service.widget.coordinates.RawDataException;
import ee.stat.dashboard.service.widget.coordinates.RawDataTransformer;
import ee.stat.dashboard.service.widget.coordinates.dto.MergeResponse;
import ee.stat.dashboard.service.widget.grouper.DatapointGrouper;
import ee.stat.dashboard.service.widget.grouper.GraphGroupingException;
import ee.stat.dashboard.service.widget.widget.FilterService;
import ee.stat.dashboard.service.widget.widget.dto.FilterDto;
import ee.stat.dashboard.service.widget.widget.dto.FilterValueDto;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
......@@ -45,7 +45,7 @@ public class GraphBuilder {
private StatDbDataRepository statDbDataRepository;
private ExcelRepository excelRepository;
public List<DiagramData> buildDiagramGraphs(Widget widget) throws GraphBuilderException {
public List<DiagramData> buildDiagramGraphs(Widget widget) throws GraphBuilderException, RawDataException, GraphGroupingException {
List<Excel> excels = excelRepository.findByWidgetAndExcelTypeIn(widget.getId(), asList(WIDGET_META_AND_DATA, DATA));
List<DiagramData> data = new ArrayList<>();
......@@ -55,7 +55,7 @@ public class GraphBuilder {
return data;
}
private DiagramData mapDiagramGraph(Widget widget, List<Excel> excels, GraphType graphType) throws GraphBuilderException {
private DiagramData mapDiagramGraph(Widget widget, List<Excel> excels, GraphType graphType) throws GraphBuilderException, RawDataException, GraphGroupingException {
List<StatDbData> statDbData = statDbDataRepository.findByGraphType(graphType.getId());
DiagramData diagramData = new DiagramData();
diagramData.setWidget(widget.getId());
......@@ -71,7 +71,7 @@ public class GraphBuilder {
return diagramData;
}
private Graph buildGraphData(Language lang, Widget widget, List<Filter> dbFilters, MergeResponse mergeResponse, GraphTypeEnum graphType) throws GraphBuilderException {
private Graph buildGraphData(Language lang, Widget widget, List<Filter> dbFilters, MergeResponse mergeResponse, GraphTypeEnum graphType) throws GraphBuilderException, GraphGroupingException {
CoordinatedResponse response = mergeResponse.getResponse();
if (widget.getDivisor() != null && widget.getDivisor().signum() != 0) {
......
package ee.stat.dashboard.service.widget.diagram;
public class GraphBuilderException extends Exception{