Skip to content

Commit 725d2a5

Browse files
author
Marin
committed
Add an import feature at cases to update the survey token responses #13199
1 parent 3e8297a commit 725d2a5

File tree

17 files changed

+298
-1
lines changed

17 files changed

+298
-1
lines changed

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public interface Captions {
8585
String actionImportAllContinents = "actionImportAllContinents";
8686
String actionImportAllCountries = "actionImportAllCountries";
8787
String actionImportAllSubcontinents = "actionImportAllSubcontinents";
88+
String actionImportSurveyTokenResponses = "actionImportSurveyTokenResponses";
8889
String actionImportSurveyTokens = "actionImportSurveyTokens";
8990
String actionLastModifiedByLabel = "actionLastModifiedByLabel";
9091
String actionLeaveBulkEditMode = "actionLeaveBulkEditMode";

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ public interface Strings {
706706
String headingImportRegions = "headingImportRegions";
707707
String headingImportSelfReports = "headingImportSelfReports";
708708
String headingImportSubcontinents = "headingImportSubcontinents";
709+
String headingImportSurveyTokenResponses = "headingImportSurveyTokenResponses";
709710
String headingImportSurveyTokens = "headingImportSurveyTokens";
710711
String headingImportTravelEntries = "headingImportTravelEntries";
711712
String headingIncorrectDateRange = "headingIncorrectDateRange";

sormas-api/src/main/java/de/symeda/sormas/api/importexport/ImportFacade.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public interface ImportFacade {
7575

7676
void generateSurveyTokenImportTemplateFile(List<FeatureConfigurationDto> featureConfigurations) throws IOException, NoSuchFieldException;
7777

78+
void generateSurveyTokenResponsesImportTemplateFile(List<FeatureConfigurationDto> featureConfigurations) throws IOException, NoSuchFieldException;
79+
7880
String getCaseImportTemplateFileName();
7981

8082
String getCaseImportTemplateFilePath();
@@ -158,4 +160,6 @@ public interface ImportFacade {
158160
String getSelfReportImportTemplateFileName();
159161

160162
String getSurveyTokenImportTemplateFilePath();
163+
164+
String getSurveyTokenResponsesImportTemplateFilePath();
161165
}

sormas-api/src/main/java/de/symeda/sormas/api/survey/SurveyTokenCriteria.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class SurveyTokenCriteria extends BaseCriteria {
2424

2525
private SurveyReferenceDto survey;
2626
private String tokenLike;
27+
private String token;
2728
private CaseReferenceDto caseAssignedTo;
2829

2930
public SurveyReferenceDto getSurvey() {
@@ -47,6 +48,14 @@ public void setTokenLike(String tokenLike) {
4748
this.tokenLike = tokenLike;
4849
}
4950

51+
public String getToken() {
52+
return token;
53+
}
54+
55+
public void setToken(String token) {
56+
this.token = token;
57+
}
58+
5059
public SurveyTokenCriteria tokenLike(String tokenLike) {
5160
setTokenLike(tokenLike);
5261
return this;

sormas-api/src/main/java/de/symeda/sormas/api/survey/SurveyTokenFacade.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ public interface SurveyTokenFacade {
3939

4040
String getSurveyTokensImportTemplateFileName();
4141

42+
String getSurveyTokenResponsesImportTemplateFilePath();
43+
44+
String getSurveyTokenResponsesImportTemplateFileName();
45+
4246
}

sormas-api/src/main/resources/captions.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ actionConfirmAction = Confirm action
199199
actionAefiSelectPrimarySuspectVaccination = Select Suspect Vaccination
200200
actionAefiAssignNewReportingIdNumber = "Assign New AEFI ID"
201201
actionImportSurveyTokens = Import survey tokens
202+
actionImportSurveyTokenResponses = Import survey token responses
202203
activityAsCaseFlightNumber=Flight number
203204
ActivityAsCase=Activity as case
204205
ActivityAsCase.startDate=Start of activity

sormas-api/src/main/resources/strings.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,7 @@ headingAefiInvestigationFormSubHeading=(Only for Serious Adverse Events Followin
910910
headingSurveySideComponent=Surveys
911911
headingCaseSurveyDetails=Survey details
912912
headingImportSurveyTokens = Import Survey Tokens
913+
headingImportSurveyTokenResponses = Import Survey Token Responses
913914

914915
# Info texts
915916
infoActivityAsCaseInvestigation = <i>Please document ALL relevant activities after infection:</i>

sormas-backend/src/main/java/de/symeda/sormas/backend/common/StartupShutdownService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,12 @@ private void createImportTemplateFiles(List<FeatureConfigurationDto> featureConf
10241024
} catch (IOException | NoSuchFieldException e) {
10251025
logger.error("Could not create survey token import template .csv file.");
10261026
}
1027+
1028+
try {
1029+
importFacade.generateSurveyTokenResponsesImportTemplateFile(featureConfigurations);
1030+
} catch (IOException | NoSuchFieldException e) {
1031+
logger.error("Could not create survey token responses import template .csv file.");
1032+
}
10271033
}
10281034

10291035
private void createMissingDiseaseConfigurations() {

sormas-backend/src/main/java/de/symeda/sormas/backend/importexport/ImportFacadeEjb.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public class ImportFacadeEjb implements ImportFacade {
222222
private static final String ENVIRONMENT_IMPORT_TEMPLATE_FILE_NAME = "import_environment_template.csv";
223223
private static final String SELF_REPORT_IMPORT_TEMPLATE_FILE_NAME = "import_self_report_template.csv";
224224
private static final String SURVEY_TOKENS_IMPORT_TEMPLATE_FILE_NAME = "import_survey_tokens_template.csv";
225+
private static final String SURVEY_TOKEN_RESPONSES_IMPORT_TEMPLATE_FILE_NAME = "import_survey_token_responses_template.csv";
225226

226227
private static final String ALL_COUNTRIES_IMPORT_FILE_NAME = "sormas_import_all_countries.csv";
227228
private static final String ALL_SUBCONTINENTS_IMPORT_FILE_NAME = "sormas_import_all_subcontinents.csv";
@@ -572,6 +573,30 @@ public void generateSurveyTokenImportTemplateFile(List<FeatureConfigurationDto>
572573
writeTemplate(Paths.get(getSurveyTokenImportTemplateFilePath()), importColumns, false);
573574
}
574575

576+
@Override
577+
public void generateSurveyTokenResponsesImportTemplateFile(List<FeatureConfigurationDto> featureConfigurations) throws IOException, NoSuchFieldException {
578+
579+
createExportDirectoryIfNecessary();
580+
581+
char separator = configFacade.getCsvSeparator();
582+
List<ImportColumn> importColumns = new ArrayList<>();
583+
584+
appendListOfFields(
585+
importColumns,
586+
SurveyTokenDto.class,
587+
"",
588+
separator,
589+
featureConfigurations,
590+
SurveyTokenDto.SURVEY,
591+
SurveyTokenDto.ASSIGNMENT_DATE,
592+
SurveyTokenDto.CASE_ASSIGNED_TO,
593+
SurveyTokenDto.GENERATED_DOCUMENT,
594+
SurveyTokenDto.RECIPIENT_EMAIL);
595+
596+
writeTemplate(Paths.get(getSurveyTokenResponsesImportTemplateFilePath()), importColumns, false);
597+
598+
}
599+
575600
@Override
576601
public String getCaseImportTemplateFileName() {
577602
return getImportTemplateFileName(CASE_IMPORT_TEMPLATE_FILE_NAME);
@@ -944,6 +969,11 @@ public String getSurveyTokenImportTemplateFilePath() {
944969
return getImportTemplateFilePath(SURVEY_TOKENS_IMPORT_TEMPLATE_FILE_NAME);
945970
}
946971

972+
@Override
973+
public String getSurveyTokenResponsesImportTemplateFilePath() {
974+
return getImportTemplateFilePath(SURVEY_TOKEN_RESPONSES_IMPORT_TEMPLATE_FILE_NAME);
975+
}
976+
947977
@Override
948978
public String getSelfReportImportTemplateFileName() {
949979
return getImportTemplateFileName(SELF_REPORT_IMPORT_TEMPLATE_FILE_NAME);

sormas-backend/src/main/java/de/symeda/sormas/backend/survey/SurveyTokenFacadeEjb.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public class SurveyTokenFacadeEjb implements SurveyTokenFacade {
8787

8888
private static final String SURVEY_TOKEN_IMPORT_TEMPLATE_FILE_NAME = "import_survey_tokens_template.csv";
8989

90+
private static final String SURVEY_TOKEN_RESPONSES_IMPORT_TEMPLATE_FILE_NAME = "import_survey_token_responses_template.csv";
91+
9092
@Override
9193
@RightsAllowed({
9294
UserRight._SURVEY_TOKEN_CREATE,
@@ -173,6 +175,16 @@ public String getSurveyTokensImportTemplateFileName() {
173175
return getImportTemplateFileName(SURVEY_TOKEN_IMPORT_TEMPLATE_FILE_NAME);
174176
}
175177

178+
@Override
179+
public String getSurveyTokenResponsesImportTemplateFilePath() {
180+
return getImportTemplateFilePath(SURVEY_TOKEN_RESPONSES_IMPORT_TEMPLATE_FILE_NAME);
181+
}
182+
183+
@Override
184+
public String getSurveyTokenResponsesImportTemplateFileName() {
185+
return getImportTemplateFileName(SURVEY_TOKEN_RESPONSES_IMPORT_TEMPLATE_FILE_NAME);
186+
}
187+
176188

177189
private String getImportTemplateFilePath(String baseFilename) {
178190
java.nio.file.Path exportDirectory = Paths.get(configFacade.getGeneratedFilesPath());

0 commit comments

Comments
 (0)