Skip to content

Commit

Permalink
Add check_connection flag to SourceRequest (#2380)
Browse files Browse the repository at this point in the history
* Add check_connection flag to SourceRequest

Related to #2359

* Fix putting constant on left side of equality operator

---------

Co-authored-by: Gennadiy Anisimov <[email protected]>
  • Loading branch information
ganisimov and Gennadiy Anisimov authored Jul 30, 2024
1 parent 5481088 commit 93b2152
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public Source convert(SourceRequest request) {
source.setKeyfileName(request.getKeyfileName());
source.setKrbAdminServer(request.getKrbAdminServer());
source.setKrbAuthMethod(KerberosAuthMechanism.getByName(request.getKrbAuthMethod()));
if (request.isCheckConnection() != null) {
source.setCheckConnection(request.isCheckConnection());
}
return source;
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/ohdsi/webapi/source/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class Source extends CommonEntity<Integer> implements Serializable {
private boolean isCacheEnabled;

@Column(name = "check_connection")
private boolean checkConnection;
private boolean checkConnection = true;


public String getTableQualifier(DaimonType daimonType) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/ohdsi/webapi/source/SourceController.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ public SourceInfo updateSource(@PathParam("sourceId") Integer sourceId, @FormDat
}
setKeyfileData(updated, source, file);
transformIfRequired(updated);
if (request.isCheckConnection() == null) {
updated.setCheckConnection(source.isCheckConnection());
}
updated.setModifiedBy(getCurrentUser());
updated.setModifiedDate(new Date());

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/org/ohdsi/webapi/source/SourceRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class SourceRequest {
private String krbAdminServer;
private Collection<SourceDaimon> daimons;
private String keyfileName;
private Boolean checkConnection;

public String getName() {

Expand Down Expand Up @@ -111,4 +112,12 @@ public void setKeyfileName(String keyfileName) {

this.keyfileName = keyfileName;
}

public Boolean isCheckConnection() {
return checkConnection;
}

public void setCheckConnection(Boolean checkConnection) {
this.checkConnection = checkConnection;
}
}

0 comments on commit 93b2152

Please sign in to comment.