From c2f955cab8467f37c801c898d4337cde5aa64eb4 Mon Sep 17 00:00:00 2001
From: DavidCroftDKFZ <46788708+DavidCroftDKFZ@users.noreply.github.com>
Date: Mon, 16 Sep 2024 16:28:04 +0200
Subject: [PATCH] Added option that just logs into Directory without further
actions
For testing purposes only.
Also removed a logging statement that caused problems in mock mode.
---
README.md | 1 +
pom.xml | 2 +-
.../directory/DirectoryApi.java | 13 +++----------
.../directory_sync_service/fhir/FhirApi.java | 1 -
.../service/Configuration.java | 6 +++++-
.../service/DirectorySyncJob.java | 3 ++-
.../sync/DiagnosisCorrections.java | 2 +-
.../samply/directory_sync_service/sync/Sync.java | 14 ++++++++++----
src/main/resources/application.yml | 3 +--
9 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/README.md b/README.md
index d32dcc5..3040a5a 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,7 @@ First, you will need to set up the environment variables for this:
| DS_DIRECTORY_MAX_FACTS | Max number of star model hypercubes to be generated | |
| DS_DIRECTORY_ALLOW_STAR_MODEL | Set to 'True' to send star model info to Directory | False |
| DS_DIRECTORY_MOCK | Set to 'True' mock a Directory. In this mode, directory-sync will not contact the Directory. All Directory-related methods will simply return plausible fake values. | False |
+| DS_DIRECTORY_ONLY_LOGIN | Set to 'True' to log in to the Directory, without carrying out any further actions. | False |
| DS_FHIR_STORE_URL | URL for FHIR store | http://bridgehead-bbmri-blaze:8080 |
| DS_TIMER_CRON | Execution interval for Directory sync, cron format | |
| DS_RETRY_MAX | Maximum number of retries when sync fails | 10 |
diff --git a/pom.xml b/pom.xml
index a1d3f51..9bc5536 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
- * Returns null if something goes wrong.
- *
- * @return new DirectoryApi object.
+ * been a long pause since the last API call to the Directory.
*/
public void relogin() {
- logger.info("login: logging back in");
+ logger.info("login: logging in");
if (mockDirectory)
// Don't try logging in if we are mocking
diff --git a/src/main/java/de/samply/directory_sync_service/fhir/FhirApi.java b/src/main/java/de/samply/directory_sync_service/fhir/FhirApi.java
index a858e56..9fc676c 100644
--- a/src/main/java/de/samply/directory_sync_service/fhir/FhirApi.java
+++ b/src/main/java/de/samply/directory_sync_service/fhir/FhirApi.java
@@ -97,7 +97,6 @@ public static Optional
* @param fhirApi
* @param directoryApi
* @param defaultCollectionId Default collection ID. May be null.
diff --git a/src/main/java/de/samply/directory_sync_service/sync/Sync.java b/src/main/java/de/samply/directory_sync_service/sync/Sync.java
index 9c90580..a2011fd 100644
--- a/src/main/java/de/samply/directory_sync_service/sync/Sync.java
+++ b/src/main/java/de/samply/directory_sync_service/sync/Sync.java
@@ -37,7 +37,7 @@ public class Sync {
*
* @throws IOException
*/
- public static void syncWithDirectoryFailover(String retryMax, String retryInterval, String fhirStoreUrl, String directoryUrl, String directoryUserName, String directoryUserPass, String directoryDefaultCollectionId, boolean directoryAllowStarModel, int directoryMinDonors, int directoryMaxFacts, boolean directoryMock) {
+ public static void syncWithDirectoryFailover(String retryMax, String retryInterval, String fhirStoreUrl, String directoryUrl, String directoryUserName, String directoryUserPass, String directoryDefaultCollectionId, boolean directoryAllowStarModel, int directoryMinDonors, int directoryMaxFacts, boolean directoryMock, boolean directoryOnlyLogin) {
for (int retryNum = 0; retryNum < Integer.parseInt(retryMax); retryNum++) {
if (retryNum > 0) {
try {
@@ -47,17 +47,23 @@ public static void syncWithDirectoryFailover(String retryMax, String retryInterv
}
logger.info("syncWithDirectoryFailover: retrying sync, attempt " + retryNum + " of " + retryMax);
}
- if (syncWithDirectory(retryMax, retryInterval, fhirStoreUrl, directoryUrl, directoryUserName, directoryUserPass, directoryDefaultCollectionId, directoryAllowStarModel, directoryMinDonors, directoryMaxFacts, directoryMock))
+ if (syncWithDirectory(fhirStoreUrl, directoryUrl, directoryUserName, directoryUserPass, directoryDefaultCollectionId, directoryAllowStarModel, directoryMinDonors, directoryMaxFacts, directoryMock, directoryOnlyLogin))
break;
}
}
- private static boolean syncWithDirectory(String retryMax, String retryInterval, String fhirStoreUrl, String directoryUrl, String directoryUserName, String directoryUserPass, String directoryDefaultCollectionId, boolean directoryAllowStarModel, int directoryMinDonors, int directoryMaxFacts, boolean directoryMock) {
+ private static boolean syncWithDirectory(String fhirStoreUrl, String directoryUrl, String directoryUserName, String directoryUserPass, String directoryDefaultCollectionId, boolean directoryAllowStarModel, int directoryMinDonors, int directoryMaxFacts, boolean directoryMock, boolean directoryOnlyLogin) {
Map