Skip to content

Commit b4da2d8

Browse files
committed
merged sql migrations
1 parent dbe3977 commit b4da2d8

6 files changed

Lines changed: 129 additions & 18 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/ExternalMessageDto.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import java.util.ArrayList;
1919
import java.util.Date;
2020
import java.util.List;
21-
import java.util.Objects;
2221

2322
import javax.annotation.Nullable;
2423
import javax.validation.constraints.Size;
@@ -1033,4 +1032,14 @@ public String getModeOfTransmissionType() {
10331032
public void setModeOfTransmissionType(String modeOfTransmissionType) {
10341033
this.modeOfTransmissionType = modeOfTransmissionType;
10351034
}
1035+
1036+
@Nullable
1037+
public ExternalSurveyResponseData getSurveyResponseData() {
1038+
return surveyResponseData;
1039+
}
1040+
1041+
public ExternalMessageDto setSurveyResponseData(@Nullable ExternalSurveyResponseData surveyResponseData) {
1042+
this.surveyResponseData = surveyResponseData;
1043+
return this;
1044+
}
10361045
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,6 @@ public interface Captions {
686686
String CaseData_department = "CaseData.department";
687687
String CaseData_differentPlaceOfStayJurisdiction = "CaseData.differentPlaceOfStayJurisdiction";
688688
String CaseData_differentPointOfEntryJurisdiction = "CaseData.differentPointOfEntryJurisdiction";
689-
String CaseData_disease = "CaseData.disease";
690689
String CaseData_diseaseDetails = "CaseData.diseaseDetails";
691690
String CaseData_diseaseVariant = "CaseData.diseaseVariant";
692691
String CaseData_district = "CaseData.district";
@@ -2965,6 +2964,7 @@ public interface Captions {
29652964
String surveyResponsePatchDictionary = "surveyResponsePatchDictionary";
29662965
String surveyResponseProcessingResult = "surveyResponseProcessingResult";
29672966
String surveyResponseSubmittedValue = "surveyResponseSubmittedValue";
2967+
String surveyResponseUuid = "surveyResponseUuid";
29682968
String surveyResponseValidFields = "surveyResponseValidFields";
29692969
String surveySend = "surveySend";
29702970
String surveySurveyList = "surveySurveyList";

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,6 +3831,7 @@ surveyResponseFailureCause=Failure Cause
38313831
surveyResponseDescription=Description
38323832
surveyResponseCaseLink=Case
38333833
surveyResponseApplied=Applied
3834+
surveyResponseUuid=Survey Response ID
38343835
surveyResponseGeneralInfo=External Message General Info
38353836
surveyResponseMetadata=Metadata
38363837
surveyResponsePatchDictionary=Patch Dictionary
@@ -3841,3 +3842,10 @@ surveyResponseIgnoreField=Ignore
38413842
surveyResponseKeyName=Field Key
38423843
actionCorrectAndReprocess=Correct & Reprocess
38433844
actionSaveAndReprocess=Save & Reprocess
3845+
surveyResponseExternalSurveyId=External Survey ID
3846+
surveyResponseToken=Token
3847+
surveyResponseRespondentId=Respondent ID
3848+
surveyResponseResponseReceivedDate=Response Received
3849+
surveyResponseReplacementStrategy=Replacement Strategy
3850+
surveyResponseEmptyValueBehavior=Empty Value Behavior
3851+
surveyResponsePatchedInCaseOfFailures=Patched in Case of Failures

sormas-api/src/test/resources/logback-test.xml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@
66
<!-- allow JMX configuration (http://logback.qos.ch/manual/jmxConfig.html) -->
77
<!-- <jmxConfigurator /> -->
88

9-
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
10-
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
11-
<Pattern>%date %-5level \(%C.java:%L\) - %msg%n</Pattern>
9+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
10+
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
11+
<Pattern>%date %-5level \(%C.java:%L\) - %msg%n</Pattern>
1212
</encoder>
13-
</appender>
13+
</appender>
14+
<logger name="de.symeda.sormas" level="ERROR"/>
1415

15-
<!-- Don't log ArchUnit internal debug logs -->
16-
<logger name="com.tngtech.archunit" level="WARN" />
16+
<root level="warn">
17+
<appender-ref ref="STDOUT"/>
18+
</root>
19+
<!-- Don't log ArchUnit internal debug logs -->
20+
<logger name="com.tngtech.archunit" level="WARN"/>
1721

1822
<root level="warn">
19-
<appender-ref ref="STDOUT" />
23+
<appender-ref ref="STDOUT"/>
2024
</root>
2125

2226
</configuration>

sormas-backend/src/main/resources/sql/sormas_schema.sql

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15886,4 +15886,101 @@ ALTER TABLE symptoms_history ADD COLUMN IF NOT EXISTS dysuria varchar(255
1588615886
ALTER TABLE symptoms_history ADD COLUMN IF NOT EXISTS eyeirritation varchar(255);
1588715887

1588815888
INSERT INTO schema_version (version_number, comment) VALUES (628, '#13917 - Salmonellosis Symptoms: constipation, dysuria, eye irritation');
15889+
15890+
-- Surveys
15891+
ALTER TABLE surveys
15892+
ADD COLUMN externalid TEXT;
15893+
15894+
-- Survey tokens
15895+
ALTER TABLE surveytokens
15896+
ADD COLUMN externalrespondentid TEXT;
15897+
15898+
-- Surveys
15899+
ALTER TABLE symptoms
15900+
ADD COLUMN IF NOT EXISTS lossOfAppetite TEXT;
15901+
ALTER TABLE symptoms
15902+
ADD COLUMN IF NOT EXISTS flatulence TEXT;
15903+
ALTER TABLE symptoms
15904+
ADD COLUMN IF NOT EXISTS smellyBurps TEXT;
15905+
ALTER TABLE symptoms
15906+
ADD COLUMN IF NOT EXISTS coughingAttacks TEXT;
15907+
ALTER TABLE symptoms
15908+
ADD COLUMN IF NOT EXISTS coughingAtNight TEXT;
15909+
ALTER TABLE symptoms
15910+
ADD COLUMN IF NOT EXISTS abdominalCramps TEXT;
15911+
15912+
-- ExternalMessage
15913+
ALTER TABLE externalmessage
15914+
ADD COLUMN IF NOT EXISTS additionalDataType TEXT;
15915+
ALTER TABLE externalmessage
15916+
ADD COLUMN IF NOT EXISTS additionalDataJson JSONB;
15917+
15918+
15919+
-- system configuration for surveys
15920+
15921+
DO
15922+
$$ DECLARE
15923+
general_category_id bigint;
15924+
15925+
BEGIN
15926+
-- Get GENERAL category id
15927+
-- General category should always exist
15928+
SELECT id
15929+
INTO general_category_id
15930+
FROM systemconfigurationcategory
15931+
WHERE name = 'GENERAL_CATEGORY';
15932+
15933+
INSERT INTO systemconfigurationvalue(config_key, config_value, value_description, category_id, value_optional, value_pattern,
15934+
value_encrypt, data_provider, validation_message, changedate, creationdate, id,
15935+
uuid)
15936+
VALUES ('NG_SUVEY_BASE_URI', null, 'i18n/infoSystemConfigurationValueDescriptionNgSurveyBaseURI', general_category_id, true,
15937+
'', false, null,
15938+
'i18n/systemConfigurationValueInvalidValue', now(), now(), nextval('entity_seq'), generate_base32_uuid());
15939+
15940+
15941+
INSERT INTO systemconfigurationvalue(config_key, config_value, value_description, category_id, value_optional, value_pattern,
15942+
value_encrypt, data_provider, validation_message, changedate, creationdate, id,
15943+
uuid)
15944+
VALUES ('NG_SUVEY_ENCRYPTED_TOKEN', null, 'i18n/infoSystemConfigurationValueDescriptionNgSurveyEncryptedToken', general_category_id, true,
15945+
'', true, null,
15946+
'i18n/systemConfigurationValueInvalidValue', now(), now(), nextval('entity_seq'), generate_base32_uuid());
15947+
15948+
INSERT INTO systemconfigurationvalue(config_key, config_value, value_description, category_id, value_optional, value_pattern,
15949+
value_encrypt, data_provider, validation_message, changedate, creationdate, id,
15950+
uuid)
15951+
VALUES ('NG_SUVEY_FIELD_PREFIX', '_so', 'i18n/infoSystemConfigurationValueDescriptionNgSurveyFieldPrefix', general_category_id, true,
15952+
'', true, null,
15953+
'i18n/systemConfigurationValueInvalidValue', now(), now(), nextval('entity_seq'), generate_base32_uuid());
15954+
15955+
15956+
15957+
INSERT INTO systemconfigurationvalue(config_key, config_value, value_description, category_id, value_optional, value_pattern,
15958+
value_encrypt, data_provider, validation_message, changedate, creationdate, id,
15959+
uuid)
15960+
VALUES ('SURVEY_PERIOD_INTERVAL_DAYS', '5', 'i18n/infoSystemConfigurationValueDescriptionSurveyPeriodIntervalDays', general_category_id, true,
15961+
'', true, null,
15962+
'i18n/systemConfigurationValueInvalidValue', now(), now(), nextval('entity_seq'), generate_base32_uuid());
15963+
15964+
15965+
15966+
END $$
15967+
LANGUAGE plpgsql;
15968+
15969+
-- index to avoid full table scan when checking for survey duplicates
15970+
CREATE INDEX idx_externalmessage_report_id
15971+
ON externalmessage (reportid);
15972+
15973+
UPDATE featureconfiguration
15974+
SET properties = '{"FETCH_MODE":false,"FORCE_AUTOMATIC_PROCESSING":true,"SURVEY_FETCH_ENABLED":true}'
15975+
where featuretype = 'EXTERNAL_MESSAGES';
15976+
15977+
15978+
INSERT INTO userroles_userrights (userrole_id, userright) SELECT id, 'EXTERNAL_MESSAGE_SURVEY_RESPONSE_VIEW' FROM public.userroles WHERE userroles.linkeddefaultuserrole in ('ADMIN');
15979+
INSERT INTO userroles_userrights (userrole_id, userright) SELECT id, 'EXTERNAL_MESSAGE_SURVEY_RESPONSE_PROCESS' FROM public.userroles WHERE userroles.linkeddefaultuserrole in ('ADMIN');
15980+
INSERT INTO userroles_userrights (userrole_id, userright) SELECT id, 'EXTERNAL_MESSAGE_SURVEY_RESPONSE_DELETE' FROM public.userroles WHERE userroles.linkeddefaultuserrole in ('ADMIN');
15981+
15982+
15983+
INSERT INTO schema_version (version_number, comment)
15984+
VALUES (629, '#13832 - External Survey facade');
15985+
1588915986
-- *** Insert new sql commands BEFORE this line. Remember to always consider _history tables. ***

sormas-backend/src/main/resources/sql/sormas_schema_next.sql

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ALTER TABLE surveys
66

77
-- Survey tokens
88
ALTER TABLE surveytokens
9-
ADD COLUMN external_respondent_id TEXT;
9+
ADD COLUMN externalrespondentid TEXT;
1010

1111
-- Surveys
1212
ALTER TABLE symptoms
@@ -65,19 +65,12 @@ VALUES ('NG_SUVEY_FIELD_PREFIX', '_so', 'i18n/infoSystemConfigurationValueDescri
6565
'', true, null,
6666
'i18n/systemConfigurationValueInvalidValue', now(), now(), nextval('entity_seq'), generate_base32_uuid());
6767

68-
INSERT INTO systemconfigurationvalue(config_key, config_value, value_description, category_id, value_optional, value_pattern,
69-
value_encrypt, data_provider, validation_message, changedate, creationdate, id,
70-
uuid)
71-
VALUES ('SURVEY_AS_EXTERNAL_MESSAGE_ADAPTER_JNDI_KEY', 'java:global/sormas-esante-adapter/SurveyExternalMessageAdapterFacadeEjb', 'i18n/infoSystemConfigurationValueDescriptionSurveyJDNI', general_category_id, true,
72-
'', true, null,
73-
'i18n/systemConfigurationValueInvalidValue', now(), now(), nextval('entity_seq'), generate_base32_uuid());
74-
7568

7669

7770
INSERT INTO systemconfigurationvalue(config_key, config_value, value_description, category_id, value_optional, value_pattern,
7871
value_encrypt, data_provider, validation_message, changedate, creationdate, id,
7972
uuid)
80-
VALUES ('SURVEY_PERIOD_INTERVAL_DAYS', '4', 'i18n/infoSystemConfigurationValueDescriptionSurveyPeriodIntervalDays', general_category_id, true,
73+
VALUES ('SURVEY_PERIOD_INTERVAL_DAYS', '5', 'i18n/infoSystemConfigurationValueDescriptionSurveyPeriodIntervalDays', general_category_id, true,
8174
'', true, null,
8275
'i18n/systemConfigurationValueInvalidValue', now(), now(), nextval('entity_seq'), generate_base32_uuid());
8376

0 commit comments

Comments
 (0)