use of de.symeda.sormas.app.backend.common.DaoException in project SORMAS-Project by hzi-braunschweig.
the class TestEntityCreator method createCase.
public static Case createCase(Person person) {
Disease disease = Disease.EVD;
Region region = DatabaseHelper.getRegionDao().queryUuid(TestHelper.REGION_UUID);
District district = DatabaseHelper.getDistrictDao().queryUuid(TestHelper.DISTRICT_UUID);
Community community = DatabaseHelper.getCommunityDao().queryUuid(TestHelper.COMMUNITY_UUID);
Facility facility = DatabaseHelper.getFacilityDao().queryUuid(TestHelper.FACILITY_UUID);
CaseClassification caseClassification = CaseClassification.SUSPECT;
InvestigationStatus investigationStatus = InvestigationStatus.PENDING;
Case caze = DatabaseHelper.getCaseDao().build(person);
caze.setDisease(disease);
caze.setResponsibleRegion(region);
caze.setResponsibleDistrict(district);
caze.setResponsibleCommunity(community);
caze.setHealthFacility(facility);
caze.setFacilityType(FacilityType.HOSPITAL);
caze.setCaseClassification(caseClassification);
caze.setInvestigationStatus(investigationStatus);
caze.setReportDate(new Date());
try {
DatabaseHelper.getCaseDao().saveAndSnapshot(caze);
DatabaseHelper.getCaseDao().accept(caze);
} catch (DaoException e) {
throw new RuntimeException(e);
}
return DatabaseHelper.getCaseDao().queryForIdWithEmbedded(caze.getId());
}
use of de.symeda.sormas.app.backend.common.DaoException in project SORMAS-Project by hzi-braunschweig.
the class TestEntityCreator method createEvent.
public static Event createEvent() {
String eventTitle = "FirstEventTitle";
String eventDesc = "FirstEventDescription";
Date eventDate = DateHelper.subtractDays(new Date(), 2);
Date eventInvestigationStartDate = DateHelper.subtractDays(new Date(), 1);
Date eventInvestigationEndDate = new Date();
TypeOfPlace typeOfPlace = TypeOfPlace.PUBLIC_PLACE;
String srcFirstName = "Emil";
String srcLastName = "Mpenza";
String srcTelNo = "0150123123123";
Event event = DatabaseHelper.getEventDao().build();
event.setEventTitle(eventTitle);
event.setEventInvestigationStartDate(eventInvestigationStartDate);
event.setEventInvestigationEndDate(eventInvestigationEndDate);
event.setEventDesc(eventDesc);
event.setStartDate(eventDate);
event.setTypeOfPlace(typeOfPlace);
event.setSrcFirstName(srcFirstName);
event.setSrcLastName(srcLastName);
event.setSrcTelNo(srcTelNo);
try {
DatabaseHelper.getEventDao().saveAndSnapshot(event);
DatabaseHelper.getEventDao().accept(event);
} catch (DaoException e) {
throw new RuntimeException(e);
}
return DatabaseHelper.getEventDao().queryForIdWithEmbedded(event.getId());
}
use of de.symeda.sormas.app.backend.common.DaoException in project SORMAS-Project by hzi-braunschweig.
the class TestEntityCreator method createSampleTest.
public static PathogenTest createSampleTest(Sample sample) {
PathogenTestType pathogenTestType = PathogenTestType.RAPID_TEST;
PathogenTestResultType pathogenTestResultType = PathogenTestResultType.NEGATIVE;
Date sampleTestDateTime = new Date();
PathogenTest pathogenTest = DatabaseHelper.getSampleTestDao().build(sample);
pathogenTest.setTestType(pathogenTestType);
pathogenTest.setTestResult(pathogenTestResultType);
pathogenTest.setTestDateTime(sampleTestDateTime);
try {
DatabaseHelper.getSampleTestDao().saveAndSnapshot(pathogenTest);
DatabaseHelper.getSampleTestDao().accept(pathogenTest);
} catch (DaoException e) {
throw new RuntimeException(e);
}
return DatabaseHelper.getSampleTestDao().queryForIdWithEmbedded(pathogenTest.getId());
}
use of de.symeda.sormas.app.backend.common.DaoException in project SORMAS-Project by hzi-braunschweig.
the class TestEntityCreator method createWeeklyReport.
public static WeeklyReport createWeeklyReport(EpiWeek epiWeek) {
WeeklyReport weeklyReport;
try {
weeklyReport = DatabaseHelper.getWeeklyReportDao().build(epiWeek);
DatabaseHelper.getWeeklyReportDao().saveAndSnapshot(weeklyReport);
} catch (DaoException e) {
throw new RuntimeException(e);
}
return DatabaseHelper.getWeeklyReportDao().queryForIdWithEmbedded(weeklyReport.getId());
}
use of de.symeda.sormas.app.backend.common.DaoException in project SORMAS-Project by hzi-braunschweig.
the class TestEntityCreator method createSample.
public static Sample createSample(Case caze) {
if (caze == null) {
caze = createCase();
}
Date sampleDateTime = DateHelper.subtractDays(new Date(), 1);
Facility lab = DatabaseHelper.getFacilityDao().queryForAll().get(0);
SampleMaterial material = SampleMaterial.BLOOD;
Sample sample = DatabaseHelper.getSampleDao().build(caze);
sample.setSampleDateTime(sampleDateTime);
sample.setLab(lab);
sample.setSampleMaterial(material);
try {
DatabaseHelper.getSampleDao().saveAndSnapshot(sample);
DatabaseHelper.getSampleDao().accept(sample);
} catch (DaoException e) {
throw new RuntimeException(e);
}
return DatabaseHelper.getSampleDao().queryForIdWithEmbedded(sample.getId());
}
Aggregations