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

Commit 5dd7408

Browse files
author
barnabartha
committed
Merge branch 'development' into feature-2890-CampaignDataByJurisdiction
# Conflicts: # sormas-ui/src/main/java/de/symeda/sormas/ui/campaign/campaigndata/CampaignFormDataEditForm.java
2 parents 0da0d23 + 207f823 commit 5dd7408

49 files changed

Lines changed: 1795 additions & 495 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ The following properties are currently configurable:
3131
* **Rscript executable** *(rscript.executable)*: The location of the Rscript executable. If you've installed Rscript on your server and specify the path here (the default should work for Linux systems as long as you've used the default install path), network diagrams for transmission chains will be shown in the web app.
3232
* **Symptom journal interface**: Properties used to connect to an external symptom journal service. *interface.symptomjournal.url* is the URL to the website that SORMAS should connect to; *interface.symptomjournal.authurl* is the URL used to authenticate SORMAS at the external service; *interface.symptomjournal.clientid* and *interface.symptomjournal.secret* are the credentials used for the authentication process.
3333
* **Custom branding**: Properties used to apply a custom branding to SORMAS that overrides its name and default logo. Using these properties also alters the sidebar and adds another customizable area to it. If you want to use this feature, set *custombranding* to true. *custombranding.name* is the name that you want to use, *custombranding.logo.path* is the path to the logo that should be used.
34+
* **Geocoding** Properties used to integrate an external geocoding service for obtaining the geo coordinates of addresses.
35+
*geocodingServiceUrlTemplate* is the url for searching for address details, *${street}*, *${houseNumber}*, *${postalCode}*, and *${city}* placeholders will be replaced with the actual address fields when searching;
36+
*geocodingLongitudeJsonPath* and *geocodingLatitudeJsonPath* are used to obtain the longitude and latitude of the address in the result of the geocoding service request
3437

3538
## Importing Infrastructure Data
3639
When you start a SORMAS server for the first time, some default infrastructure data is generated to ensure that the server is usable and the default users can be created. It is recommended (and, unless you're working on a demo server, necessary) to archive this default data and import the official infrastructure data of the country or part of the country that you intend to use SORMAS in instead.

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ public interface ConfigFacade {
9090

9191
int getMapZoom();
9292

93-
String getGeocodingOsgtsEndpoint();
93+
String getGeocodingServiceUrlTemplate();
94+
95+
String getGeocodingLongitudeJsonPath();
96+
97+
String getGeocodingLatitudeJsonPath();
9498

9599
SymptomJournalConfig getSymptomJournalConfig();
96100

Lines changed: 76 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,83 @@
11
package de.symeda.sormas.api.campaign.diagram;
22

33
import java.io.Serializable;
4+
import java.util.Objects;
45

56
public class CampaignDashboardElement implements Serializable {
67

7-
private String diagramId;
8-
private String tabId;
9-
private Integer order;
10-
private Integer width;
11-
private Integer height;
12-
13-
public CampaignDashboardElement() {
14-
}
15-
16-
public CampaignDashboardElement(String diagramId, String tabId, Integer order, Integer width, Integer height) {
17-
this.diagramId = diagramId;
18-
this.tabId = tabId;
19-
this.order = order;
20-
this.width = width;
21-
this.height = height;
22-
}
23-
24-
public String getDiagramId() {
25-
return diagramId;
26-
}
27-
28-
public void setDiagramId(String diagramId) {
29-
this.diagramId = diagramId;
30-
}
31-
32-
public String getTabId() {
33-
return tabId;
34-
}
35-
36-
public void setTabId(String tabId) {
37-
this.tabId = tabId;
38-
}
39-
40-
public Integer getOrder() {
41-
return order;
42-
}
43-
44-
public void setOrder(Integer order) {
45-
this.order = order;
46-
}
47-
48-
public Integer getWidth() {
49-
return width;
50-
}
51-
52-
public void setWidth(Integer width) {
53-
this.width = width;
54-
}
55-
56-
public Integer getHeight() {
57-
return height;
58-
}
59-
60-
public void setHeight(Integer height) {
61-
this.height = height;
62-
}
8+
private String diagramId;
9+
private String tabId;
10+
private Integer order;
11+
private Integer width;
12+
private Integer height;
13+
14+
public CampaignDashboardElement() {
15+
}
16+
17+
public CampaignDashboardElement(String diagramId, String tabId, Integer order, Integer width, Integer height) {
18+
this.diagramId = diagramId;
19+
this.tabId = tabId;
20+
this.order = order;
21+
this.width = width;
22+
this.height = height;
23+
}
24+
25+
public String getDiagramId() {
26+
return diagramId;
27+
}
28+
29+
public void setDiagramId(String diagramId) {
30+
this.diagramId = diagramId;
31+
}
32+
33+
public String getTabId() {
34+
return tabId;
35+
}
36+
37+
public void setTabId(String tabId) {
38+
this.tabId = tabId;
39+
}
40+
41+
public Integer getOrder() {
42+
return order;
43+
}
44+
45+
public void setOrder(Integer order) {
46+
this.order = order;
47+
}
48+
49+
public Integer getWidth() {
50+
return width;
51+
}
52+
53+
public void setWidth(Integer width) {
54+
this.width = width;
55+
}
56+
57+
public Integer getHeight() {
58+
return height;
59+
}
60+
61+
public void setHeight(Integer height) {
62+
this.height = height;
63+
}
64+
65+
@Override
66+
public boolean equals(Object o) {
67+
if (this == o)
68+
return true;
69+
if (o == null || getClass() != o.getClass())
70+
return false;
71+
CampaignDashboardElement that = (CampaignDashboardElement) o;
72+
return Objects.equals(diagramId, that.diagramId)
73+
&& Objects.equals(tabId, that.tabId)
74+
&& Objects.equals(order, that.order)
75+
&& Objects.equals(width, that.width)
76+
&& Objects.equals(height, that.height);
77+
}
78+
79+
@Override
80+
public int hashCode() {
81+
return Objects.hash(diagramId, tabId, order, width, height);
82+
}
6383
}

sormas-api/src/main/java/de/symeda/sormas/api/campaign/form/CampaignFormMetaFacade.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package de.symeda.sormas.api.campaign.form;
22

3-
import javax.ejb.Remote;
43
import java.io.IOException;
54
import java.util.Date;
65
import java.util.List;
76

8-
import de.symeda.sormas.api.campaign.data.CampaignFormDataDto;
7+
import javax.ejb.Remote;
98

109
@Remote
1110
public interface CampaignFormMetaFacade {
@@ -28,6 +27,8 @@ CampaignFormMetaDto buildCampaignFormMetaFromJson(String formId, String language
2827

2928
CampaignFormMetaDto getCampaignFormMetaByUuid(String campaignFormUuid);
3029

30+
List<CampaignFormMetaReferenceDto> getCampaignFormMetasAsReferencesByCampaign(String uuid);
31+
3132
List<CampaignFormMetaDto> getAllAfter(Date campaignFormMetaChangeDate);
3233

3334
List<String> getAllUuids();

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ public interface Captions {
139139
String Campaign_creatingUser = "Campaign.creatingUser";
140140
String Campaign_description = "Campaign.description";
141141
String Campaign_district = "Campaign.district";
142+
String Campaign_edit = "Campaign.edit";
142143
String Campaign_endDate = "Campaign.endDate";
143144
String Campaign_name = "Campaign.name";
144145
String Campaign_region = "Campaign.region";
145146
String Campaign_startDate = "Campaign.startDate";
147+
String Campaign_viewForms = "Campaign.viewForms";
146148
String campaignActiveCampaigns = "campaignActiveCampaigns";
147149
String campaignAdditionalChart = "campaignAdditionalChart";
148150
String campaignAdditionalForm = "campaignAdditionalForm";

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ Campaign.description=Description
211211
Campaign.startDate=Start date
212212
Campaign.endDate=End date
213213
Campaign.creatingUser=Creating user
214+
Campaign.viewForms=Open
215+
Campaign.edit=Edit
214216
Campaign.area=Area
215217
Campaign.region=Region
216218
Campaign.district=District

sormas-backend/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@
187187
<artifactId>microprofile-config-api</artifactId>
188188
</dependency>
189189

190+
<!-- JsonPath -->
191+
<dependency>
192+
<groupId>com.jayway.jsonpath</groupId>
193+
<artifactId>json-path</artifactId>
194+
<version>2.4.0</version>
195+
</dependency>
196+
190197
</dependencies>
191198

192199
<build>

sormas-backend/src/main/java/de/symeda/sormas/backend/campaign/data/CampaignFormDataFacadeEjb.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,10 @@ public List<CampaignDiagramDataDto> getDiagramData(List<CampaignDiagramSeries> d
322322
final String districtFilter = district != null ? " AND " + CampaignFormData.DISTRICT + "." + District.UUID + " = '" + district.getUuid() + "'" : "";
323323
final String campaignFilter = campaign != null ? " AND " + Campaign.TABLE_NAME + "." + Campaign.UUID + " = '" + campaign.getUuid() + "'" : "";
324324
final String jurisdictionGrouping =
325-
(district != null ? ", " + Community.TABLE_NAME + "." + Community.UUID + ", " + Community.TABLE_NAME + "." + Community.NAME :
326-
region != null ? ", " + District.TABLE_NAME + "." + District.UUID + ", " + District.TABLE_NAME + "." + District.NAME : "")
327-
+ ", " + Region.TABLE_NAME + "." + Region.UUID + ", " + Region.TABLE_NAME + "." + Region.NAME;
325+
district != null ? ", " + Community.TABLE_NAME + "." + Community.UUID + ", " + Community.TABLE_NAME + "." + Community.NAME :
326+
region != null ? ", " + District.TABLE_NAME + "." + District.UUID + ", " + District.TABLE_NAME + "." + District.NAME :
327+
area != null ? ", " + Region.TABLE_NAME + "." + Region.UUID + ", " + Region.TABLE_NAME + "." + Region.NAME :
328+
", " + Area.TABLE_NAME + "." + Area.UUID + ", " + Area.TABLE_NAME + "." + Area.NAME;
328329
//@formatter:on
329330

330331
// SELECT
@@ -358,13 +359,15 @@ public List<CampaignDiagramDataDto> getDiagramData(List<CampaignDiagramSeries> d
358359
selectBuilder.append(", null as fieldId, null as fieldCaption, count(formId) as sumValue,");
359360
}
360361

361-
selectBuilder.append(Region.TABLE_NAME)
362-
.append(".")
363-
.append(Region.UUID)
364-
.append(", ")
365-
.append(Region.TABLE_NAME)
366-
.append(".")
367-
.append(Region.NAME);
362+
if (district != null) {
363+
appendInfrastructureSelection(selectBuilder, Community.TABLE_NAME, Community.NAME);
364+
} else if (region != null) {
365+
appendInfrastructureSelection(selectBuilder, District.TABLE_NAME, District.NAME);
366+
} else if (area != null) {
367+
appendInfrastructureSelection(selectBuilder, Region.TABLE_NAME, Region.NAME);
368+
} else {
369+
appendInfrastructureSelection(selectBuilder, Area.TABLE_NAME, Area.NAME);
370+
}
368371

369372
// JOINS
370373
StringBuilder joinBuilder = new StringBuilder(" LEFT JOIN ").append(CampaignFormMeta.TABLE_NAME)
@@ -494,6 +497,10 @@ public List<CampaignDiagramDataDto> getDiagramData(List<CampaignDiagramSeries> d
494497
return resultData;
495498
}
496499

500+
private void appendInfrastructureSelection(StringBuilder sb, String tableNameField, String nameField) {
501+
sb.append(tableNameField).append(".").append(AbstractDomainObject.UUID).append(", ").append(tableNameField).append(".").append(nameField);
502+
}
503+
497504
@Override
498505
public long count(CampaignFormDataCriteria criteria) {
499506
CriteriaBuilder cb = em.getCriteriaBuilder();

sormas-backend/src/main/java/de/symeda/sormas/backend/campaign/form/CampaignFormMetaFacadeEjb.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,14 @@ public List<CampaignFormMetaDto> getByUuids(List<String> uuids) {
143143
return service.getByUuids(uuids).stream().map(campaignFormMeta -> toDto(campaignFormMeta)).collect(Collectors.toList());
144144
}
145145

146+
@Override
147+
public List<CampaignFormMetaReferenceDto> getCampaignFormMetasAsReferencesByCampaign(String uuid) {
148+
return service.getCampaignFormMetasAsReferencesByCampaign(uuid);
149+
}
150+
146151
@Override
147-
public void validateAllFormMetas() {
148-
List<CampaignFormMeta> forms = service.getAll();
152+
public void validateAllFormMetas() {
153+
List<CampaignFormMeta> forms = service.getAll();
149154

150155
for (CampaignFormMeta form : forms) {
151156
try {

sormas-backend/src/main/java/de/symeda/sormas/backend/campaign/form/CampaignFormMetaService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
import javax.persistence.criteria.CriteriaBuilder;
99
import javax.persistence.criteria.CriteriaQuery;
1010
import javax.persistence.criteria.From;
11+
import javax.persistence.criteria.Join;
1112
import javax.persistence.criteria.Predicate;
1213
import javax.persistence.criteria.Root;
1314

15+
import de.symeda.sormas.api.campaign.form.CampaignFormMetaReferenceDto;
1416
import de.symeda.sormas.backend.campaign.Campaign;
1517
import de.symeda.sormas.backend.common.AbstractAdoService;
1618
import de.symeda.sormas.backend.common.AbstractDomainObject;
@@ -52,4 +54,15 @@ public List<CampaignFormMeta> getAllAfter(Date since, User user) {
5254
List<CampaignFormMeta> resultList = em.createQuery(cq).getResultList();
5355
return resultList;
5456
}
57+
58+
public List<CampaignFormMetaReferenceDto> getCampaignFormMetasAsReferencesByCampaign(String uuid) {
59+
CriteriaBuilder cb = em.getCriteriaBuilder();
60+
CriteriaQuery<CampaignFormMetaReferenceDto> cq = cb.createQuery(CampaignFormMetaReferenceDto.class);
61+
Root<Campaign> campaignRoot = cq.from(Campaign.class);
62+
Join<Campaign, CampaignFormMeta> campaignFormMetaJoin = campaignRoot.join(Campaign.CAMPAIGN_FORM_METAS);
63+
Predicate filter = cb.equal(campaignRoot.get(Campaign.UUID), uuid);
64+
cq = cq.where(filter);
65+
cq.multiselect(campaignFormMetaJoin.get(CampaignFormMeta.UUID), campaignFormMetaJoin.get(CampaignFormMeta.FORM_NAME));
66+
return em.createQuery(cq).getResultList();
67+
}
5568
}

0 commit comments

Comments
 (0)