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

Commit 54dba9a

Browse files
author
jenkins
committed
[GITFLOW]merging 'release-1.51.0' into 'master'
2 parents 38465a1 + 7c9aa1f commit 54dba9a

596 files changed

Lines changed: 16244 additions & 4480 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SERVER_CUSTOMIZATION.md

Lines changed: 36 additions & 32 deletions
Large diffs are not rendered by default.

SERVER_DEV_SETUP.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
# Installing a SORMAS Server for development
4-
**Note: This guide explains how to configure a SORMAS server on Linux and Windows systems for development. Please note that there is no database setup because the script supposes the use of the Docker Postgresql image (see [SORMAS-Docker][https://github.com/hzi-braunschweig/SORMAS-Docker]).**
4+
**Note: This guide explains how to configure a SORMAS server on Linux and Windows systems for development. Please note that there is no database setup because the script supposes the use of the Docker Postgresql image (see [SORMAS-Docker](https://github.com/hzi-braunschweig/SORMAS-Docker)).**
55

66
## Content
77
* [Prerequisites](#prerequisites)
@@ -50,6 +50,10 @@ See [Keycloak](SERVER_SETUP.md#keycloak-server) for how to install Docker locall
5050

5151
If you are doing active development on Keycloak (themes, authentication mechanisms, translations, etc.) it's recommended to install the standalone variant.
5252

53+
## VAADIN Debug Mode
54+
55+
To enable [VAADIN Debug Mode](https://vaadin.com/docs/v8/framework/advanced/advanced-debug.html), go to ``sormas-ui/src/main/webapp/WEB-INF/web.xml`` and set ``productionMode`` to ``false``.
56+
Make sure not to commit your changes to these files, for example by using .gitignore. To access the debug Window, got to <url>/sormas-ui/?debug. You may need to log in as admin once first.
5357

5458
## Other components
5559

sormas-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<parent>
33
<groupId>de.symeda.sormas</groupId>
44
<artifactId>sormas-base</artifactId>
5-
<version>1.50.0</version>
5+
<version>1.51.0</version>
66
<relativePath>../sormas-base</relativePath>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>

sormas-api/src/main/java/de/symeda/sormas/api/ConfigFacade.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import javax.ejb.Remote;
2121

22+
import de.symeda.sormas.api.externaljournal.PatientDiaryConfig;
23+
import de.symeda.sormas.api.externaljournal.SymptomJournalConfig;
2224
import de.symeda.sormas.api.region.GeoLatLon;
2325

2426
@Remote
@@ -88,17 +90,15 @@ public interface ConfigFacade {
8890

8991
int getMapZoom();
9092

91-
String getGeocodingOsgtsEndpoint();
93+
String getGeocodingServiceUrlTemplate();
9294

93-
String getSymptomJournalUrl();
95+
String getGeocodingLongitudeJsonPath();
9496

95-
String getSymptomJournalAuthUrl();
97+
String getGeocodingLatitudeJsonPath();
9698

97-
String getSymptomJournalClientId();
99+
SymptomJournalConfig getSymptomJournalConfig();
98100

99-
String getSymptomJournalSecret();
100-
101-
String getPatientDiaryUrl();
101+
PatientDiaryConfig getPatientDiaryConfig();
102102

103103
String getSormasToSormasUserPassword();
104104

@@ -109,4 +109,8 @@ public interface ConfigFacade {
109109
String getSurvnetGatewayUrl();
110110

111111
String getAuthenticationProvider();
112+
113+
boolean isExternalJournalActive();
114+
115+
int getDashboardMapMarkerLimit();
112116
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
package de.symeda.sormas.api;
2+
3+
import java.lang.reflect.InvocationTargetException;
4+
import java.lang.reflect.Method;
5+
import java.util.Arrays;
6+
import java.util.HashMap;
7+
import java.util.Map;
8+
9+
import de.symeda.sormas.api.utils.DataHelper;
10+
11+
public class EntityDtoAccessHelper {
12+
13+
public static Object getPropertyValue(HasUuid entity, String propertyKey) throws InvocationTargetException, IllegalAccessException {
14+
if (entity == null) {
15+
return null;
16+
}
17+
Class<? extends HasUuid> entityClass = entity.getClass();
18+
while (entityClass != null) {
19+
Method[] declaredMethods = entityClass.getDeclaredMethods();
20+
for (Method method : declaredMethods) {
21+
String methodName = method.getName();
22+
if (methodName.startsWith("get") || methodName.startsWith("is")) {
23+
String propertyName = methodName.replaceAll("(^(is|get))|((Reference)?Dto$)", "").toUpperCase();
24+
if (propertyName.equals(propertyKey.toUpperCase())) {
25+
return method.invoke(entity);
26+
}
27+
}
28+
}
29+
Class<?> superclass = entityClass.getSuperclass();
30+
entityClass = HasUuid.class.isAssignableFrom(superclass) ? (Class<? extends HasUuid>) superclass : null;
31+
}
32+
throw new IllegalArgumentException("No property " + propertyKey + " in class " + entity.getClass().getSimpleName());
33+
}
34+
35+
public static Object getPropertyPathValue(HasUuid entity, String propertyPath) {
36+
return getPropertyPathValue(entity, propertyPath, null);
37+
}
38+
39+
public static Object getPropertyPathValue(HasUuid entity, String propertyPath, IReferenceDtoResolver referenceDtoResolver) {
40+
String[] propertyKeys = propertyPath.split("[.]");
41+
Object currentEntity = entity;
42+
for (int i = 0; i < propertyKeys.length; i++) {
43+
if (currentEntity == null) {
44+
return null;
45+
}
46+
boolean isResolvable = referenceDtoResolver != null && ReferenceDto.class.isAssignableFrom(currentEntity.getClass());
47+
48+
if (!HasUuid.class.isAssignableFrom(currentEntity.getClass())) {
49+
String errorPropertyPath = entity.getClass().getSimpleName() + "." + String.join(".", Arrays.copyOfRange(propertyKeys, 0, i));
50+
throw new IllegalArgumentException(errorPropertyPath + " is not an EntityDto or ReferenceDto");
51+
}
52+
Object propertyValue = null;
53+
try {
54+
propertyValue = getPropertyValue((HasUuid) currentEntity, propertyKeys[i]);
55+
} catch (InvocationTargetException | IllegalAccessException e) {
56+
throw new IllegalArgumentException(e);
57+
} catch (IllegalArgumentException e) {
58+
if (!isResolvable) {
59+
throw e;
60+
}
61+
}
62+
if (propertyValue != null) {
63+
currentEntity = propertyValue;
64+
} else {
65+
if (isResolvable) {
66+
try {
67+
currentEntity = getPropertyValue(referenceDtoResolver.resolve((ReferenceDto) currentEntity), propertyKeys[i]);
68+
} catch (InvocationTargetException | IllegalAccessException e) {
69+
throw new IllegalArgumentException(e);
70+
}
71+
} else {
72+
currentEntity = null;
73+
}
74+
}
75+
}
76+
return currentEntity;
77+
}
78+
79+
public static String getPropertyPathValueString(HasUuid entity, String propertyPath, IReferenceDtoResolver referenceDtoResolver) {
80+
return DataHelper.valueToString(getPropertyPathValue(entity, propertyPath, referenceDtoResolver));
81+
}
82+
83+
public interface IReferenceDtoResolver {
84+
85+
EntityDto resolve(ReferenceDto referenceDto);
86+
}
87+
88+
public static class CachedReferenceDtoResolver implements IReferenceDtoResolver {
89+
90+
private Map<String, EntityDto> referenceCache = new HashMap<>();
91+
private IReferenceDtoResolver referenceDtoResolver;
92+
93+
public CachedReferenceDtoResolver(IReferenceDtoResolver referenceDtoResolver) {
94+
this.referenceDtoResolver = referenceDtoResolver;
95+
}
96+
97+
public EntityDto resolve(ReferenceDto referenceDto) {
98+
if (referenceDto != null) {
99+
EntityDto entityDto = referenceCache.get(referenceDto.getUuid());
100+
if (entityDto != null) {
101+
return entityDto;
102+
}
103+
}
104+
if (referenceDtoResolver != null) {
105+
EntityDto resolvedEntity = referenceDtoResolver.resolve(referenceDto);
106+
addReference(referenceDto, resolvedEntity);
107+
return resolvedEntity;
108+
}
109+
return null;
110+
}
111+
112+
public void addReference(ReferenceDto referenceDto, EntityDto entityDto) {
113+
if (referenceDto != null && entityDto != null) {
114+
referenceCache.put(referenceDto.getUuid(), entityDto);
115+
}
116+
}
117+
}
118+
}

sormas-api/src/main/java/de/symeda/sormas/api/FacadeProvider.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@
3636
import de.symeda.sormas.api.contact.ContactFacade;
3737
import de.symeda.sormas.api.disease.DiseaseConfigurationFacade;
3838
import de.symeda.sormas.api.disease.DiseaseFacade;
39+
import de.symeda.sormas.api.docgeneneration.QuarantineOrderFacade;
3940
import de.symeda.sormas.api.epidata.EpiDataFacade;
4041
import de.symeda.sormas.api.event.EventFacade;
4142
import de.symeda.sormas.api.event.EventParticipantFacade;
43+
import de.symeda.sormas.api.externaljournal.ExternalJournalFacade;
4244
import de.symeda.sormas.api.facility.FacilityFacade;
4345
import de.symeda.sormas.api.feature.FeatureConfigurationFacade;
4446
import de.symeda.sormas.api.geocoding.GeocodingFacade;
@@ -304,7 +306,15 @@ public static AreaFacade getAreaFacade() {
304306
return get().lookupEjbRemote(AreaFacade.class);
305307
}
306308

307-
@SuppressWarnings("unchecked")
309+
public static QuarantineOrderFacade getQuarantineOrderFacade() {
310+
return get().lookupEjbRemote(QuarantineOrderFacade.class);
311+
}
312+
313+
public static ExternalJournalFacade getExternalJournalFacade() {
314+
return get().lookupEjbRemote(ExternalJournalFacade.class);
315+
}
316+
317+
@SuppressWarnings("unchecked")
308318
public <P> P lookupEjbRemote(Class<P> clazz) {
309319
try {
310320
return (P) get().ic.lookup(buildJndiLookupName(clazz));
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package de.symeda.sormas.api;
2+
3+
import de.symeda.sormas.api.i18n.I18nProperties;
4+
5+
public enum VisitOrigin {
6+
USER,
7+
EXTERNAL_JOURNAL;
8+
9+
public String getName() {
10+
return this.name();
11+
}
12+
13+
public String toString() {
14+
return I18nProperties.getEnumCaption(this);
15+
}
16+
}

sormas-api/src/main/java/de/symeda/sormas/api/campaign/CampaignFacade.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package de.symeda.sormas.api.campaign;
22

3+
import java.util.Date;
34
import java.util.List;
45

56
import javax.ejb.Remote;
@@ -12,7 +13,7 @@ public interface CampaignFacade {
1213

1314
List<CampaignIndexDto> getIndexList(CampaignCriteria campaignCriteria, Integer first, Integer max, List<SortProperty> sortProperties);
1415

15-
List<CampaignReferenceDto> getAllCampaignsAsReference();
16+
List<CampaignReferenceDto> getAllActiveCampaignsAsReference();
1617

1718
CampaignReferenceDto getLastStartedCampaign();
1819

@@ -33,4 +34,12 @@ public interface CampaignFacade {
3334
CampaignReferenceDto getReferenceByUuid(String uuid);
3435

3536
boolean exists(String uuid);
37+
38+
List<CampaignDto> getAllAfter(Date campaignChangeDate);
39+
40+
List<CampaignDto> getByUuids(List<String> uuids);
41+
42+
List<String> getAllActiveUuids();
43+
44+
void validate(CampaignReferenceDto campaignReferenceDto);
3645
}

sormas-api/src/main/java/de/symeda/sormas/api/campaign/data/CampaignFormDataFacade.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import de.symeda.sormas.api.utils.SortProperty;
2727

2828
import javax.ejb.Remote;
29+
30+
import java.util.Date;
2931
import java.util.List;
3032

3133
@Remote
@@ -50,4 +52,8 @@ public interface CampaignFormDataFacade {
5052
long count(CampaignFormDataCriteria criteria);
5153

5254
List<CampaignDiagramDataDto> getDiagramData(List<CampaignDiagramSeries> diagramSeries, CampaignDiagramCriteria campaignDiagramCriteria);
55+
56+
List<String> getAllActiveUuids();
57+
58+
List<CampaignFormDataDto> getAllActiveAfter(Date date);
5359
}

0 commit comments

Comments
 (0)