SUPPORT-8525:refactor

This commit is contained in:
adel.kalimullin 2024-12-13 14:04:47 +03:00 committed by adel.ka
parent 9a3edb9109
commit 14802da159
6 changed files with 46 additions and 27 deletions

View file

@ -14,7 +14,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import ru.micord.ervu_dashboard.exception.DashboardException;
import ru.micord.ervu_dashboard.exception.AppInitializeException;
import javax.sql.DataSource;
@ -70,7 +70,7 @@ public class AppConfig {
return connection.getMetaData().getUserName();
}
catch (SQLException e) {
throw new DashboardException(e);
throw new AppInitializeException(e);
}
}
@ -85,10 +85,10 @@ public class AppConfig {
LOGGER.info("ervu_dashboard schema was created");
} catch (SQLException e) {
connection.rollback();
throw new DashboardException(e);
throw new AppInitializeException(e);
}
} catch (SQLException e) {
throw new DashboardException(e);
throw new AppInitializeException(e);
}
}
}

View file

@ -22,7 +22,7 @@ import component.chart.service.SingleChartDataSetService;
import component.chart.service.impl.AbstractChartDatasetService;
import ru.micord.ervu_dashboard.component.chart.label.RoundLabelConfiguration;
import ru.micord.ervu_dashboard.component.filter.FilterReferences;
import ru.micord.ervu_dashboard.exception.DashboardException;
import ru.micord.ervu_dashboard.exception.ChartDataLoadException;
import ru.micord.ervu_dashboard.model.chart.round.RoundAggregationData;
import ru.micord.ervu_dashboard.model.chart.round.RoundChartColumnSort;
import ru.micord.ervu_dashboard.model.chart.round.RoundChartDataDto;
@ -112,7 +112,7 @@ public class RoundSingleChartDataSetService extends AbstractChartDatasetService
}
catch (InterruptedException | ExecutionException e) {
executorService.shutdownNow();
throw new DashboardException(e);
throw new ChartDataLoadException(e);
}
}

View file

@ -0,0 +1,19 @@
package ru.micord.ervu_dashboard.exception;
/**
* @author Adel Kalimullin
*/
public class AppInitializeException extends RuntimeException{
public AppInitializeException(String message){
super(message);
}
public AppInitializeException(String message, Throwable cause){
super(message, cause);
}
public AppInitializeException(Throwable cause) {
super(cause);
}
}

View file

@ -0,0 +1,19 @@
package ru.micord.ervu_dashboard.exception;
/**
* @author Adel Kalimullin
*/
public class ChartDataLoadException extends RuntimeException {
public ChartDataLoadException(String message, Throwable cause) {
super(message, cause);
}
public ChartDataLoadException(Throwable cause) {
super(cause);
}
public ChartDataLoadException(String message) {
super(message);
}
}

View file

@ -1,19 +0,0 @@
package ru.micord.ervu_dashboard.exception;
/**
* @author Adel Kalimullin
*/
public class DashboardException extends RuntimeException{
public DashboardException(String message){
super(message);
}
public DashboardException(String message, Throwable cause){
super(message, cause);
}
public DashboardException(Throwable cause) {
super(cause);
}
}

View file

@ -13,7 +13,7 @@ import component.field.dataconvert.DataConverterProvider;
import component.field.loading.FieldDefaultValue;
import component.field.loading.LoadType;
import model.FieldData;
import ru.micord.ervu_dashboard.exception.DashboardException;
import ru.micord.ervu_dashboard.exception.AppInitializeException;
import ru.cg.webbpm.modules.database.api.bean.TableRow;
import ru.cg.webbpm.modules.database.api.dao.LoadDao;
@ -47,7 +47,7 @@ public class ProjectDefaultValueLoaderServiceImpl extends AbstractDefaultValueLo
return entry.getValue().getDefaultValueColumn();
}
catch (Exception e) {
throw new DashboardException(
throw new AppInitializeException(
String.format("Cannot load values for object with id = %s",
entry.getKey()
), e);