Skip to content

Commit

Permalink
[GITFLOW]merging 'release-0.17.0' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ciSymeda committed Mar 21, 2018
2 parents 619e346 + 9c7efc4 commit 3f9d3c3
Show file tree
Hide file tree
Showing 87 changed files with 2,200 additions and 985 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Project Structure
<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">SORMAS- Surveillance Outbreak Response Management and Analysis System</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://www.helmholtz-hzi.de/de/forschung/forschungsprojekte/ansicht/projekt/detail/sormas/" property="cc:attributionName" rel="cc:attributionURL">Helmholtz Centre for Infection Research (HZI)</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="www.sormas.org" rel="dct:source">www.sormas.org</a>.
The project consists of the following modules:

- sormas-api: general business logic and definitions for data exchange between app and server
Expand Down Expand Up @@ -67,7 +68,7 @@ For information on what libs are used see pom.xml in sormas-base project: https:
* Edit sql/sormas_schema.sql
* ``Remove everything until after the INSERT with the read schema version``
* ``Surround the remaining with BEGIN; and COMMIT;``
* Update the Database schema: ``psql -U sormas_user -W sormas_db < sql/sormas_schema.sql``
* Update the Database schema: ``psql -U sormas_user -h localhost -W sormas_db < sql/sormas_schema.sql``
* If something goes wrong, restorte the database using ``pg_restore -U sormas_user -Fc -d sormas_db < sormas_db_....``

#### Web Applications
Expand Down
2 changes: 1 addition & 1 deletion sormas-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>0.16.0</version>
<version>0.17.0</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public interface ConfigFacade {

String getSmsAuthSecret();

String getExportPath();
String getTempFilesPath();

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static int getIncubationPeriodDays(Disease disease, PlagueType plagueType
case EVD:
case MEASLES:
case MONKEYPOX:
case LASSA:
case OTHER:
return 21;
case AVIAN_INFLUENCA:
Expand All @@ -53,7 +54,6 @@ public static int getIncubationPeriodDays(Disease disease, PlagueType plagueType
return 10;
case PLAGUE:
return 7;
case LASSA:
case YELLOW_FEVER:
return 6;
case CHOLERA:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import de.symeda.sormas.api.epidata.EpiDataFacade;
import de.symeda.sormas.api.event.EventFacade;
import de.symeda.sormas.api.event.EventParticipantFacade;
import de.symeda.sormas.api.export.ExportFacade;
import de.symeda.sormas.api.facility.FacilityFacade;
import de.symeda.sormas.api.hospitalization.HospitalizationFacade;
import de.symeda.sormas.api.importexport.ImportExportFacade;
import de.symeda.sormas.api.outbreak.OutbreakFacade;
import de.symeda.sormas.api.person.PersonFacade;
import de.symeda.sormas.api.region.CommunityFacade;
Expand Down Expand Up @@ -137,8 +137,8 @@ public static ConfigFacade getConfigFacade() {
return get().lookupEjbRemote(ConfigFacade.class);
}

public static ExportFacade getExportFacade() {
return get().lookupEjbRemote(ExportFacade.class);
public static ImportExportFacade getImportExportFacade() {
return get().lookupEjbRemote(ImportExportFacade.class);
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import java.util.Date;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.person.PresentCondition;
import de.symeda.sormas.api.region.DistrictReferenceDto;
import de.symeda.sormas.api.region.RegionReferenceDto;
import de.symeda.sormas.api.user.UserRole;

public class CaseCriteria implements Serializable {
Expand All @@ -15,6 +15,7 @@ public class CaseCriteria implements Serializable {
private UserRole reportingUserRole;
private Disease disease;
private CaseOutcome outcome;
private RegionReferenceDto region;
private DistrictReferenceDto district;
private Date newCaseDateFrom;
private Date newCaseDateTo;
Expand All @@ -34,6 +35,11 @@ public CaseCriteria diseaseEquals(Disease disease) {
return this;
}

public CaseCriteria regionEquals(RegionReferenceDto region) {
this.region = region;
return this;
}

public CaseCriteria districtEquals(DistrictReferenceDto district) {
this.district = district;
return this;
Expand All @@ -57,6 +63,10 @@ public Disease getDisease() {
return disease;
}

public RegionReferenceDto getRegion() {
return region;
}

public DistrictReferenceDto getDistrict() {
return district;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public interface CaseFacade {

List<CaseDataDto> getByUuids(List<String> uuids);

List<DashboardCaseDto> getNewCasesForDashboard(DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);
List<DashboardCaseDto> getNewCasesForDashboard(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);

List<MapCaseDto> getCasesForMap(DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);
List<MapCaseDto> getCasesForMap(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);

List<StatisticsCaseDto> getCasesForStatistics(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.caze.MapCaseDto;
import de.symeda.sormas.api.region.DistrictReferenceDto;
import de.symeda.sormas.api.region.RegionReferenceDto;
import de.symeda.sormas.api.user.UserReferenceDto;
import de.symeda.sormas.api.visit.VisitReferenceDto;

Expand All @@ -32,7 +33,7 @@ public interface ContactFacade {

List<ContactDto> getByUuids(List<String> uuids);

List<MapContactDto> getContactsForMap(DistrictReferenceDto districtRef, Disease disease, Date fromDate, Date toDate, String userUuid, List<MapCaseDto> mapCaseDtos);
List<MapContactDto> getContactsForMap(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date fromDate, Date toDate, String userUuid, List<MapCaseDto> mapCaseDtos);

void deleteContact(ContactReferenceDto contactRef, String userUuid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.region.DistrictReferenceDto;
import de.symeda.sormas.api.region.RegionReferenceDto;
import de.symeda.sormas.api.user.UserReferenceDto;

@Remote
Expand All @@ -16,7 +17,7 @@ public interface EventFacade {

List<EventDto> getAllEventsBetween(Date fromDate, Date toDate, DistrictReferenceDto districtRef, Disease disease, String userUuid);

List<DashboardEventDto> getNewEventsForDashboard(DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);
List<DashboardEventDto> getNewEventsForDashboard(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);

EventDto getEventByUuid(String uuid);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ public interface FacilityFacade {
FacilityDto getByUuid(String uuid);

List<String> getAllUuids(String userUuid);

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.symeda.sormas.api.export;
package de.symeda.sormas.api.importexport;

import de.symeda.sormas.api.I18nProperties;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.symeda.sormas.api.export;
package de.symeda.sormas.api.importexport;

public enum DatabaseTableType {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package de.symeda.sormas.api.importexport;

import java.io.IOException;
import java.util.List;

import javax.ejb.Remote;

import de.symeda.sormas.api.utils.ExportErrorException;

@Remote
public interface ImportExportFacade {

/**
* Exports the passed database tables as .csv files to the export folder specified in the
* properties file, creates a zip archive containing these .csv files and returns the path
* to the zip archive that can then be used to offer it as a download.
*/
String generateDatabaseExportArchive(List<DatabaseTable> databaseTables) throws ExportErrorException, IOException;

/**
* Creates a .csv file with one row containing all relevant column names of the case entity
* and its sub-entities and returns the path to the .csv file that can then be used to offer
* it as a download.
*/
void generateCaseImportTemplateFile() throws IOException;

String getCaseImportTemplateFilePath();

String getSormasImportGuideFilePath();

String importCasesFromCsvFile(String csvFilePath, String userUuid) throws IOException, InvalidColumnException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.symeda.sormas.api.importexport;

public class InvalidColumnException extends Exception {

private static final long serialVersionUID = -1597100047088745699L;

private String columnName;

public InvalidColumnException(String columnName) {
super();
this.columnName = columnName;
}

public String getColumnName() {
return columnName;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ public interface PersonFacade {
List<String> getAllUuids(String userUuid);

List<PersonDto> getByUuids(List<String> uuids);

PersonDto buildPerson();
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public interface CommunityFacade {

List<String> getAllUuids(String userUuid);

CommunityReferenceDto getCommunityReferenceByUuid(String uuid);}
CommunityReferenceDto getCommunityReferenceByUuid(String uuid);

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ public interface DistrictFacade {
List<DistrictReferenceDto> getAllAsReference();

List<String> getAllUuids(String userUuid);

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ public interface RegionFacade {
RegionReferenceDto getRegionReferenceByUuid(String uuid);

List<String> getAllUuids(String userUuid);

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.caze.CaseReferenceDto;
import de.symeda.sormas.api.region.DistrictReferenceDto;
import de.symeda.sormas.api.region.RegionReferenceDto;

@Remote
public interface SampleFacade {
Expand All @@ -30,7 +31,7 @@ public interface SampleFacade {

List<SampleDto> getByUuids(List<String> uuids);

List<DashboardSampleDto> getNewSamplesForDashboard(DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);
List<DashboardSampleDto> getNewSamplesForDashboard(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);

void deleteSample(SampleReferenceDto sampleRef, String userUuid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.region.DistrictReferenceDto;
import de.symeda.sormas.api.region.RegionReferenceDto;

@Remote
public interface SampleTestFacade {
Expand All @@ -23,7 +24,7 @@ public interface SampleTestFacade {

List<SampleTestDto> getByUuids(List<String> uuids);

List<DashboardTestResultDto> getNewTestResultsForDashboard(DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);
List<DashboardTestResultDto> getNewTestResultsForDashboard(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date from, Date to, String userUuid);

void deleteSampleTest(SampleTestReferenceDto sampleTestRef, String userUuid);
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public enum UserRight {
CASE_DELETE(
ADMIN
),
CASE_IMPORT(
ADMIN
),
SAMPLE_CREATE(
ADMIN,
NATIONAL_USER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public final class DateHelper {

private static final SimpleDateFormat SHORT_DATE_FORMAT = new SimpleDateFormat("dd/MM/yy");
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy");
private static final SimpleDateFormat DATE_FORMAT_DOTS = new SimpleDateFormat("dd.MM.yyyy");
private static final SimpleDateFormat DATE_FORMAT_HYPHEN = new SimpleDateFormat("dd-MM-yyyy");
private static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat("dd/MM/yyyy HH:mm");
private static final SimpleDateFormat SHORT_DATE_TIME_FORMAT = new SimpleDateFormat("dd/MM/yyyy HH:mm");
private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm");
Expand Down Expand Up @@ -60,6 +62,31 @@ public static Date parseDate(String date) {
return null;
}
}

public static Date parseDateWithException(String date) throws ParseException {
if (date != null) {
try {
SimpleDateFormat dateFormat = clone(DATE_FORMAT);
dateFormat.setLenient(false);
return dateFormat.parse(date);
} catch (ParseException e) {
// Try next format
}
try {
SimpleDateFormat dateFormat = clone(DATE_FORMAT_DOTS);
dateFormat.setLenient(false);
return dateFormat.parse(date);
} catch (ParseException e) {
// Try next format
}
// If this fails, an exception is thrown
SimpleDateFormat dateFormat = clone(DATE_FORMAT_HYPHEN);
dateFormat.setLenient(false);
return dateFormat.parse(date);
} else {
return null;
}
}

public static String formatShortDate(Date date) {
if (date != null) {
Expand Down
2 changes: 1 addition & 1 deletion sormas-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>0.16.0</version>
<version>0.17.0</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
7 changes: 6 additions & 1 deletion sormas-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>sormas-base</artifactId>
<groupId>de.symeda.sormas</groupId>
<version>0.16.0</version>
<version>0.17.0</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -50,6 +50,11 @@
<artifactId>client</artifactId>
</dependency>

<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
</dependency>

<!-- Testing -->

<dependency>
Expand Down
Loading

0 comments on commit 3f9d3c3

Please sign in to comment.