Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit a6635aa

Browse files
lgallgal
authored andcommitted
Merge remote-tracking branch 'origin/development' into 3409_prohibition-to-work-fields
# Conflicts: # sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java # sormas-backend/src/main/resources/sql/sormas_schema.sql
2 parents 5173d4a + e5e70e5 commit a6635aa

12 files changed

Lines changed: 190 additions & 55 deletions

File tree

DEVELOPMENT_ENVIRONMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
- Clone the SORMAS-Project repository and open the project in IntelliJ
5252
- make sure the under "File -> Project Structure -> Modules" all the modules (except the android app - this should not be added) are recognized, if not add the modules with +
5353
- Make sure under "File -> Settings -> Plugins" Glassfish & Ant integrations are enabled (look into the "Installed" tab)
54-
- Install the Vaadin Designer plugin
54+
- Install the Vaadin plugin (not the Vaadin Designer plugin!)
5555
- Make a copy of "build.properties.example" contained in "sormas-base", rename it to "build.properties" and set "glassfish.domain.root" to the location of the sormas domain located in the "glassfish/domains" folder inside your payara installation
5656
- Run "Maven install" on the sormas-base project
5757
- Add a Payara server to IntelliJ:

sormas-api/src/main/java/de/symeda/sormas/api/event/EventIndexDto.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class EventIndexDto extends PseudonymizableIndexDto implements Serializab
4545
public static final String SRC_LAST_NAME = "srcLastName";
4646
public static final String SRC_TEL_NO = "srcTelNo";
4747
public static final String REPORT_DATE_TIME = "reportDateTime";
48+
public static final String REGION = "region";
49+
public static final String DISTRICT = "district";
50+
public static final String COMMUNITY = "community";
51+
public static final String ADDRESS = "address";
4852

4953
private String uuid;
5054
private EventStatus eventStatus;
@@ -247,6 +251,22 @@ public void setParticipantCount(long participantCount) {
247251
this.participantCount = participantCount;
248252
}
249253

254+
public String getRegion() {
255+
return getEventLocation().getRegion();
256+
}
257+
258+
public String getDistrict() {
259+
return getEventLocation().getDistrict();
260+
}
261+
262+
public String getCommunity() {
263+
return getEventLocation().getCommunity();
264+
}
265+
266+
public String getAddress() {
267+
return getEventLocation().getAddress();
268+
}
269+
250270
public EventReferenceDto toReference() {
251271
return new EventReferenceDto(getUuid(), getDisease(), getDiseaseDetails(), getEventStatus(), getEventInvestigationStatus(), getStartDate());
252272
}
@@ -302,6 +322,22 @@ public EventIndexLocation(
302322
this.additionalInformation = additionalInformation;
303323
}
304324

325+
public String getRegion() {
326+
return regionName;
327+
}
328+
329+
public String getDistrict() {
330+
return districtName;
331+
}
332+
333+
public String getCommunity() {
334+
return communityName;
335+
}
336+
337+
public String getAddress() {
338+
return LocationReferenceDto.buildCaption(city, street, houseNumber, additionalInformation);
339+
}
340+
305341
@Override
306342
public String toString() {
307343
return LocationReferenceDto.buildCaption(regionName, districtName, communityName, city, street, houseNumber, additionalInformation);

sormas-api/src/main/java/de/symeda/sormas/api/location/LocationReferenceDto.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,40 @@ public static String buildCaption(
8787
stringBuilder.append(street);
8888
}
8989
if (!DataHelper.isNullOrEmpty(houseNumber)) {
90+
if (stringBuilder.length() > 0 && DataHelper.isNullOrEmpty(street)) {
91+
stringBuilder.append(", ");
92+
}
93+
stringBuilder.append(houseNumber);
94+
}
95+
if (!DataHelper.isNullOrEmpty(additionalInformation)) {
96+
if (stringBuilder.length() > 0) {
97+
stringBuilder.append(", ");
98+
}
99+
stringBuilder.append(additionalInformation);
100+
}
101+
return stringBuilder.toString();
102+
}
103+
104+
public static String buildCaption(String city, String street, String houseNumber, String additionalInformation) {
105+
106+
StringBuilder stringBuilder = new StringBuilder();
107+
108+
if (!DataHelper.isNullOrEmpty(city)) {
109+
if (stringBuilder.length() > 0) {
110+
stringBuilder.append(", ");
111+
}
112+
stringBuilder.append(city);
113+
}
114+
if (!DataHelper.isNullOrEmpty(street)) {
90115
if (stringBuilder.length() > 0) {
91116
stringBuilder.append(", ");
92117
}
118+
stringBuilder.append(street);
119+
}
120+
if (!DataHelper.isNullOrEmpty(houseNumber)) {
121+
if (stringBuilder.length() > 0 && DataHelper.isNullOrEmpty(street)) {
122+
stringBuilder.append(", ");
123+
}
93124
stringBuilder.append(houseNumber);
94125
}
95126
if (!DataHelper.isNullOrEmpty(additionalInformation)) {

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,10 +1775,8 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
17751775
getDao(EpiData.class).executeRaw("DROP TABLE tmp_epidata;");
17761776
case 247:
17771777
currentVersion = 247;
1778-
1779-
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD column multidaycontact boolean default false;");
1780-
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD column firstcontactdate timestamp;");
1781-
1778+
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD column multiDayContact boolean default false;");
1779+
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD column firstContactDate timestamp;");
17821780
case 248:
17831781
currentVersion = 248;
17841782

@@ -1790,8 +1788,6 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
17901788
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN nosocomialOutbreak boolean DEFAULT false");
17911789
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN infectionSetting varchar(255)");
17921790

1793-
break;
1794-
17951791
case 250:
17961792
currentVersion = 250;
17971793

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/contact/ContactDtoHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public void fillInnerFromDto(Contact target, ContactDto source) {
8888
target.setContactOfficer(DatabaseHelper.getUserDao().getByReferenceDto(source.getContactOfficer()));
8989

9090
target.setMultiDayContact(source.isMultiDayContact());
91+
target.setFirstContactDate(source.getFirstContactDate());
9192
target.setLastContactDate(source.getLastContactDate());
9293
target.setContactIdentificationSource(source.getContactIdentificationSource());
9394
target.setContactIdentificationSourceDetails(source.getContactIdentificationSourceDetails());
@@ -210,6 +211,8 @@ public void fillInnerFromAdo(ContactDto target, Contact source) {
210211
}
211212
target.setReportDateTime(source.getReportDateTime());
212213

214+
target.setMultiDayContact(source.isMultiDayContact());
215+
target.setFirstContactDate(source.getFirstContactDate());
213216
target.setLastContactDate(source.getLastContactDate());
214217
target.setContactIdentificationSource(source.getContactIdentificationSource());
215218
target.setContactIdentificationSourceDetails(source.getContactIdentificationSourceDetails());

sormas-backend/src/main/java/de/symeda/sormas/backend/event/EventFacadeEjb.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,24 @@ public List<EventIndexDto> getIndexList(EventCriteria eventCriteria, Integer fir
296296
order.add(sortProperty.ascending ? cb.asc(expression) : cb.desc(expression));
297297
expression = community.get(Community.NAME);
298298
break;
299+
case EventIndexDto.REGION:
300+
expression = region.get(Region.NAME);
301+
break;
302+
case EventIndexDto.DISTRICT:
303+
expression = district.get(District.NAME);
304+
break;
305+
case EventIndexDto.COMMUNITY:
306+
expression = community.get(Community.NAME);
307+
break;
308+
case EventIndexDto.ADDRESS:
309+
expression = location.get(Location.CITY);
310+
order.add(sortProperty.ascending ? cb.asc(expression) : cb.desc(expression));
311+
expression = location.get(Location.STREET);
312+
order.add(sortProperty.ascending ? cb.asc(expression) : cb.desc(expression));
313+
expression = location.get(Location.HOUSE_NUMBER);
314+
order.add(sortProperty.ascending ? cb.asc(expression) : cb.desc(expression));
315+
expression = location.get(Location.ADDITIONAL_INFORMATION);
316+
break;
299317
default:
300318
throw new IllegalArgumentException(sortProperty.propertyName);
301319
}

sormas-backend/src/main/java/de/symeda/sormas/backend/sormastosormas/SormasToSormasShareInfo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import javax.persistence.Column;
2222
import javax.persistence.Entity;
23+
import javax.persistence.FetchType;
2324
import javax.persistence.JoinColumn;
2425
import javax.persistence.ManyToOne;
2526

@@ -54,7 +55,7 @@ public class SormasToSormasShareInfo extends AbstractDomainObject {
5455

5556
private String comment;
5657

57-
@ManyToOne
58+
@ManyToOne(fetch = FetchType.LAZY)
5859
@JoinColumn
5960
public Case getCaze() {
6061
return caze;
@@ -64,7 +65,7 @@ public void setCaze(Case caze) {
6465
this.caze = caze;
6566
}
6667

67-
@ManyToOne
68+
@ManyToOne(fetch = FetchType.LAZY)
6869
@JoinColumn
6970
public Contact getContact() {
7071
return contact;
@@ -74,7 +75,7 @@ public void setContact(Contact contact) {
7475
this.contact = contact;
7576
}
7677

77-
@ManyToOne
78+
@ManyToOne(fetch = FetchType.LAZY)
7879
@JoinColumn
7980
public Sample getSample() {
8081
return sample;

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5982,6 +5982,13 @@ ALTER TABLE person_history
59825982

59835983
INSERT INTO schema_version (version_number, comment) VALUES (285, 'SurvNet Adaptations - Create new field “name of guardians” for persons #3413');
59845984

5985+
-- 2020-12-08 SurvNet Adaptations - Add multi day contat to contact history #3408
5986+
5987+
ALTER TABLE contact_history ADD column multidaycontact boolean;
5988+
ALTER TABLE contact_history ADD column firstcontactdate timestamp;
5989+
5990+
INSERT INTO schema_version (version_number, comment) VALUES (286, 'Add date of first contact for contact history #3408');
5991+
59855992
-- 2020-11-25 SurvNet Adaptations - Create new field “Prohibition to work” for case and contact #3409
59865993
ALTER TABLE cases
59875994
ADD COLUMN prohibitiontowork varchar(255),
@@ -6003,6 +6010,6 @@ ALTER TABLE contact_history
60036010
ADD COLUMN prohibitiontoworkfrom timestamp,
60046011
ADD COLUMN prohibitiontoworkuntil timestamp;
60056012

6006-
INSERT INTO schema_version (version_number, comment) VALUES (286, 'Create new field “Prohibition to work” for case and contact #3409');
6013+
INSERT INTO schema_version (version_number, comment) VALUES (287, 'Create new field “Prohibition to work” for case and contact #3409');
60076014

60086015
-- *** Insert new sql commands BEFORE this line ***

sormas-ui/src/main/java/de/symeda/sormas/ui/AboutView.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,15 @@ public AboutView() {
119119
FileDownloader dataDictionaryDownloader = new FileDownloader(new ClassResource("/doc/SORMAS_Data_Dictionary.xlsx"));
120120
dataDictionaryDownloader.extend(dataDictionaryButton);
121121

122-
Link technicalManualLink = new Link(
123-
I18nProperties.getCaption(Captions.aboutTechnicalManual),
124-
new ExternalResource("https://github.com/hzi-braunschweig/SORMAS-Project/files/2585973/SORMAS_Technical_Manual_Webversion_20180911.pdf"));
125-
technicalManualLink.setTargetName("_blank");
126-
documentsLayout.addComponent(technicalManualLink);
122+
// This link is hidden until an updated version of the document is provided
123+
/*
124+
* Link technicalManualLink = new Link(
125+
* I18nProperties.getCaption(Captions.aboutTechnicalManual),
126+
* new ExternalResource(
127+
* "https://github.com/hzi-braunschweig/SORMAS-Project/files/2585973/SORMAS_Technical_Manual_Webversion_20180911.pdf"));
128+
* technicalManualLink.setTargetName("_blank");
129+
* documentsLayout.addComponent(technicalManualLink);
130+
*/
127131

128132
setSizeFull();
129133
setStyleName("about-view");

sormas-ui/src/main/java/de/symeda/sormas/ui/events/EventController.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
import java.util.ArrayList;
2121
import java.util.Collection;
2222
import java.util.List;
23-
24-
import org.apache.commons.text.StringEscapeUtils;
25-
23+
import com.vaadin.data.provider.DataProvider;
24+
import com.vaadin.data.provider.ListDataProvider;
2625
import com.vaadin.navigator.Navigator;
2726
import com.vaadin.server.Page;
2827
import com.vaadin.server.Sizeable;
@@ -44,7 +43,11 @@
4443
import de.symeda.sormas.api.event.EventCriteria;
4544
import de.symeda.sormas.api.event.EventDto;
4645
import de.symeda.sormas.api.event.EventIndexDto;
46+
import de.symeda.sormas.api.event.EventParticipantCriteria;
4747
import de.symeda.sormas.api.event.EventParticipantDto;
48+
import de.symeda.sormas.api.event.EventParticipantFacade;
49+
import de.symeda.sormas.api.event.EventParticipantIndexDto;
50+
import de.symeda.sormas.api.event.EventParticipantReferenceDto;
4851
import de.symeda.sormas.api.event.EventReferenceDto;
4952
import de.symeda.sormas.api.i18n.Captions;
5053
import de.symeda.sormas.api.i18n.I18nProperties;
@@ -60,6 +63,8 @@
6063
import de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent.CommitListener;
6164
import de.symeda.sormas.ui.utils.VaadinUiUtil;
6265

66+
import org.apache.commons.text.StringEscapeUtils;
67+
6368
public class EventController {
6469

6570
public void registerViews(Navigator navigator) {
@@ -105,7 +110,7 @@ public void onCommit() {
105110

106111
EventReferenceDto eventReferenceDto = new EventReferenceDto(selectedEvent.getUuid());
107112
if (!eventIndexDto.contains(selectedEvent)) {
108-
createEventParticipantWithCase(eventReferenceDto, caseDataDto, caseRef);
113+
linkCaseToEvent(eventReferenceDto, caseDataDto, caseRef);
109114
}
110115
} else {
111116
create(caseRef);
@@ -153,7 +158,19 @@ public void selectOrCreateEvent(ContactDto contact) {
153158
VaadinUiUtil.showModalPopupWindow(component, I18nProperties.getString(Strings.headingPickOrCreateEvent));
154159
}
155160

156-
public void createEventParticipantWithCase(EventReferenceDto eventReferenceDto, CaseDataDto caseDataDto, CaseReferenceDto caseRef) {
161+
public void linkCaseToEvent(EventReferenceDto eventReferenceDto, CaseDataDto caseDataDto, CaseReferenceDto caseRef) {
162+
// Check whether Person is already enlisted as EventParticipant in this Event
163+
EventParticipantReferenceDto eventParticipantRef =
164+
FacadeProvider.getEventParticipantFacade().getReferenceByEventAndPerson(eventReferenceDto.getUuid(), caseDataDto.getPerson().getUuid());
165+
if (eventParticipantRef != null) {
166+
EventParticipantDto eventParticipant =
167+
FacadeProvider.getEventParticipantFacade().getEventParticipantByUuid(eventParticipantRef.getUuid());
168+
eventParticipant.setResultingCase(caseRef);
169+
FacadeProvider.getEventParticipantFacade().saveEventParticipant(eventParticipant);
170+
return;
171+
}
172+
173+
// Create new EventParticipant for this Person
157174
PersonDto personDto = FacadeProvider.getPersonFacade().getPersonByUuid(caseDataDto.getPerson().getUuid());
158175
EventParticipantDto eventParticipantDto;
159176
eventParticipantDto =
@@ -242,7 +259,7 @@ public void onCommit() {
242259
if (caseRef != null) {
243260
EventReferenceDto createdEvent = new EventReferenceDto(dto.getUuid());
244261

245-
createEventParticipantWithCase(createdEvent, finalCaseDataDto, caseRef);
262+
linkCaseToEvent(createdEvent, finalCaseDataDto, caseRef);
246263
SormasUI.refreshView();
247264
} else {
248265
navigateToParticipants(dto.getUuid());

0 commit comments

Comments
 (0)