Skip to content

Commit ca11010

Browse files
Gennadiy Anisimovchrisknoll
Gennadiy Anisimov
authored andcommitted
Allow to skip connection check for certain sources
Addresses #2359
1 parent 6a43da5 commit ca11010

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Diff for: src/main/java/org/ohdsi/webapi/source/Source.java

+12
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ public class Source extends CommonEntity<Integer> implements Serializable {
113113
@Column(name = "is_cache_enabled")
114114
private boolean isCacheEnabled;
115115

116+
@Column(name = "check_connection")
117+
private boolean checkConnection;
118+
119+
116120
public String getTableQualifier(DaimonType daimonType) {
117121
String result = getTableQualifierOrNull(daimonType);
118122
if (result == null)
@@ -251,6 +255,14 @@ public void setIsCacheEnabled(boolean isCacheEnabled) {
251255
this.isCacheEnabled = isCacheEnabled;
252256
}
253257

258+
public boolean isCheckConnection() {
259+
return checkConnection;
260+
}
261+
262+
public void setCheckConnection(boolean checkConnection) {
263+
this.checkConnection = checkConnection;
264+
}
265+
254266
@Override
255267
public boolean equals(Object o) {
256268

Diff for: src/main/java/org/ohdsi/webapi/source/SourceService.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ public <T> Map<T, Source> getSourcesMap(SourceMapKey<T> mapKey) {
104104

105105
public void checkConnection(Source source) {
106106

107-
final JdbcTemplate jdbcTemplate = getSourceJdbcTemplate(source);
108-
jdbcTemplate.execute(SqlTranslate.translateSql("select 1;", source.getSourceDialect()).replaceAll(";$", ""));
107+
if (source.isCheckConnection()) {
108+
final JdbcTemplate jdbcTemplate = getSourceJdbcTemplate(source);
109+
jdbcTemplate.execute(SqlTranslate.translateSql("select 1;", source.getSourceDialect()).replaceAll(";$", ""));
110+
}
109111
}
110112

111113
public Source getPrioritySourceForDaimon(SourceDaimon.DaimonType daimonType) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE ${ohdsiSchema}.source
2+
ADD COLUMN check_connection boolean not null DEFAULT true;

0 commit comments

Comments
 (0)