Search in sources :

Example 1 with Person

use of de.symeda.sormas.app.backend.person.Person in project SORMAS-Project by hzi-braunschweig.

the class ContactDtoHelper method fillInnerFromAdo.

@Override
public void fillInnerFromAdo(ContactDto target, Contact source) {
    if (source.getPerson() != null) {
        Person person = DatabaseHelper.getPersonDao().queryForId(source.getPerson().getId());
        target.setPerson(PersonDtoHelper.toReferenceDto(person));
    } else {
        target.setPerson(null);
    }
    if (source.getRegion() != null) {
        Region region = DatabaseHelper.getRegionDao().queryForId(source.getRegion().getId());
        target.setRegion(RegionDtoHelper.toReferenceDto(region));
    } else {
        target.setRegion(null);
    }
    if (source.getDistrict() != null) {
        District district = DatabaseHelper.getDistrictDao().queryForId(source.getDistrict().getId());
        target.setDistrict(DistrictDtoHelper.toReferenceDto(district));
    } else {
        target.setDistrict(null);
    }
    if (source.getCommunity() != null) {
        Community community = DatabaseHelper.getCommunityDao().queryForId(source.getCommunity().getId());
        target.setCommunity(CommunityDtoHelper.toReferenceDto(community));
    } else {
        target.setCommunity(null);
    }
    if (source.getCaseUuid() != null) {
        target.setCaze(new CaseReferenceDto(source.getCaseUuid()));
    } else {
        target.setCaze(null);
    }
    if (source.getResultingCaseUuid() != null) {
        target.setResultingCase(new CaseReferenceDto(source.getResultingCaseUuid()));
    } else {
        target.setResultingCase(null);
    }
    target.setDisease(source.getDisease());
    target.setDiseaseDetails(source.getDiseaseDetails());
    if (source.getReportingUser() != null) {
        User user = DatabaseHelper.getUserDao().queryForId(source.getReportingUser().getId());
        target.setReportingUser(UserDtoHelper.toReferenceDto(user));
    } else {
        target.setReportingUser(null);
    }
    target.setReportDateTime(source.getReportDateTime());
    target.setMultiDayContact(source.isMultiDayContact());
    target.setFirstContactDate(source.getFirstContactDate());
    target.setLastContactDate(source.getLastContactDate());
    target.setContactIdentificationSource(source.getContactIdentificationSource());
    target.setContactIdentificationSourceDetails(source.getContactIdentificationSourceDetails());
    target.setTracingApp(source.getTracingApp());
    target.setTracingAppDetails(source.getTracingAppDetails());
    target.setContactProximity(source.getContactProximity());
    target.setContactClassification(source.getContactClassification());
    target.setContactStatus(source.getContactStatus());
    target.setRelationToCase(source.getRelationToCase());
    target.setRelationDescription(source.getRelationDescription());
    target.setFollowUpStatus(source.getFollowUpStatus());
    target.setFollowUpComment(source.getFollowUpComment());
    target.setFollowUpUntil(source.getFollowUpUntil());
    if (source.getContactOfficer() != null) {
        User user = DatabaseHelper.getUserDao().queryForId(source.getContactOfficer().getId());
        target.setContactOfficer(UserDtoHelper.toReferenceDto(user));
    } else {
        target.setContactOfficer(null);
    }
    target.setDescription(source.getDescription());
    target.setReportLat(source.getReportLat());
    target.setReportLon(source.getReportLon());
    target.setReportLatLonAccuracy(source.getReportLatLonAccuracy());
    target.setExternalID(source.getExternalID());
    target.setExternalToken(source.getExternalToken());
    target.setInternalToken(source.getInternalToken());
    target.setHighPriority(source.isHighPriority());
    target.setImmunosuppressiveTherapyBasicDisease(source.getImmunosuppressiveTherapyBasicDisease());
    target.setImmunosuppressiveTherapyBasicDiseaseDetails(source.getImmunosuppressiveTherapyBasicDiseaseDetails());
    target.setCareForPeopleOver60(source.getCareForPeopleOver60());
    target.setQuarantine(source.getQuarantine());
    target.setQuarantineTypeDetails(source.getQuarantineTypeDetails());
    target.setQuarantineFrom(source.getQuarantineFrom());
    target.setQuarantineTo(source.getQuarantineTo());
    target.setCaseIdExternalSystem(source.getCaseIdExternalSystem());
    target.setCaseOrEventInformation(source.getCaseOrEventInformation());
    target.setQuarantineHelpNeeded(source.getQuarantineHelpNeeded());
    target.setQuarantineOrderedVerbally(source.isQuarantineOrderedVerbally());
    target.setQuarantineOrderedOfficialDocument(source.isQuarantineOrderedOfficialDocument());
    target.setQuarantineOrderedVerballyDate(source.getQuarantineOrderedVerballyDate());
    target.setQuarantineOrderedOfficialDocumentDate(source.getQuarantineOrderedOfficialDocumentDate());
    target.setQuarantineExtended(source.isQuarantineExtended());
    target.setQuarantineReduced(source.isQuarantineReduced());
    target.setQuarantineHomePossible(source.getQuarantineHomePossible());
    target.setQuarantineHomePossibleComment(source.getQuarantineHomePossibleComment());
    target.setQuarantineHomeSupplyEnsured(source.getQuarantineHomeSupplyEnsured());
    target.setQuarantineHomeSupplyEnsuredComment(source.getQuarantineHomeSupplyEnsuredComment());
    target.setQuarantineOfficialOrderSent(source.isQuarantineOfficialOrderSent());
    target.setQuarantineOfficialOrderSentDate(source.getQuarantineOfficialOrderSentDate());
    target.setAdditionalDetails(source.getAdditionalDetails());
    if (source.getEpiData() != null) {
        EpiData epiData = DatabaseHelper.getEpiDataDao().queryForId(source.getEpiData().getId());
        target.setEpiData(epiDataDtoHelper.adoToDto(epiData));
    } else {
        target.setEpiData(null);
    }
    if (source.getHealthConditions() != null) {
        HealthConditions healthConditions = DatabaseHelper.getHealthConditionsDao().queryForId(source.getHealthConditions().getId());
        target.setHealthConditions(healthConditionsDtoHelper.adoToDto(healthConditions));
    } else {
        target.setHealthConditions(null);
    }
    if (source.getSormasToSormasOriginInfo() != null) {
        target.setSormasToSormasOriginInfo(sormasToSormasOriginInfoDtoHelper.adoToDto(source.getSormasToSormasOriginInfo()));
    }
    target.setEndOfQuarantineReason(source.getEndOfQuarantineReason());
    target.setEndOfQuarantineReasonDetails(source.getEndOfQuarantineReasonDetails());
    target.setPseudonymized(source.isPseudonymized());
    target.setReturningTraveler(source.getReturningTraveler());
    target.setProhibitionToWork(source.getProhibitionToWork());
    target.setProhibitionToWorkFrom(source.getProhibitionToWorkFrom());
    target.setProhibitionToWorkUntil(source.getProhibitionToWorkUntil());
    if (source.getReportingDistrict() != null) {
        District district = DatabaseHelper.getDistrictDao().queryForId(source.getReportingDistrict().getId());
        target.setReportingDistrict(DistrictDtoHelper.toReferenceDto(district));
    } else {
        target.setReportingDistrict(null);
    }
    target.setFollowUpStatusChangeDate(source.getFollowUpStatusChangeDate());
    target.setFollowUpStatusChangeUser(UserDtoHelper.toReferenceDto(source.getFollowUpStatusChangeUser()));
    target.setVaccinationStatus(source.getVaccinationStatus());
}
Also used : HealthConditions(de.symeda.sormas.app.backend.clinicalcourse.HealthConditions) User(de.symeda.sormas.app.backend.user.User) Region(de.symeda.sormas.app.backend.region.Region) EpiData(de.symeda.sormas.app.backend.epidata.EpiData) Person(de.symeda.sormas.app.backend.person.Person) District(de.symeda.sormas.app.backend.region.District) Community(de.symeda.sormas.app.backend.region.Community) CaseReferenceDto(de.symeda.sormas.api.caze.CaseReferenceDto)

Example 2 with Person

use of de.symeda.sormas.app.backend.person.Person in project SORMAS-Project by hzi-braunschweig.

the class DatabaseHelper method migratePersonContactDetails.

private void migratePersonContactDetails() throws SQLException {
    GenericRawResults<Object[]> newPersons = getDao(Person.class).queryRaw("SELECT id, phone, phoneOwner, emailAddress, generalPractitionerDetails FROM person WHERE changeDate = 0 AND snapshot = 0;", new DataType[] { DataType.BIG_INTEGER, DataType.STRING, DataType.STRING, DataType.STRING, DataType.STRING });
    for (Object[] pcd : newPersons) {
        final String insertQuery = "INSERT INTO personContactDetail " + "(" + "		uuid, changeDate, localChangeDate, creationDate, person_id, primaryContact, " + "		personContactDetailType, phoneNumberType, contactInformation, additionalInformation, " + "		thirdParty, thirdPartyRole, thirdPartyName, snapshot" + ") " + "VALUES (?, ?, " + generateDateNowSQL() + ", " + generateDateNowSQL() + ", ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
        BigInteger personId = (BigInteger) pcd[0];
        String phone = (String) pcd[1];
        String phoneOwner = (String) pcd[2];
        String emailAddress = (String) pcd[3];
        String generalPractitionerDetails = (String) pcd[4];
        if (StringUtils.isNotEmpty(phone)) {
            boolean phoneOwnerEmpty = StringUtils.isEmpty(phoneOwner);
            executeRaw(PersonContactDetail.class, insertQuery, DataHelper.createUuid(), 0, personId, (phoneOwnerEmpty ? 1 : 0), PersonContactDetailType.PHONE.name(), null, phone, null, (phoneOwnerEmpty ? 0 : 1), null, (phoneOwnerEmpty ? null : phoneOwner), 0);
        }
        if (StringUtils.isNotEmpty(emailAddress)) {
            executeRaw(PersonContactDetail.class, insertQuery, DataHelper.createUuid(), 0, personId, 1, PersonContactDetailType.EMAIL.name(), null, emailAddress, null, 0, null, null, 0);
        }
        if (StringUtils.isNotEmpty(generalPractitionerDetails)) {
            executeRaw(PersonContactDetail.class, insertQuery, DataHelper.createUuid(), 0, personId, 0, PersonContactDetailType.OTHER.name(), null, null, generalPractitionerDetails, 1, "General practitioner", generalPractitionerDetails, 0);
        }
    }
}
Also used : BigInteger(java.math.BigInteger) Person(de.symeda.sormas.app.backend.person.Person)

Example 3 with Person

use of de.symeda.sormas.app.backend.person.Person in project SORMAS-Project by hzi-braunschweig.

the class EventParticipantNewActivity method saveData.

@Override
public void saveData() {
    if (saveTask != null) {
        NotificationHelper.showNotification(this, WARNING, getString(R.string.message_already_saving));
        // don't save multiple times
        return;
    }
    final EventParticipant eventParticipantToSave = (EventParticipant) getActiveFragment().getPrimaryData();
    EventParticipantNewFragment fragment = (EventParticipantNewFragment) getActiveFragment();
    fragment.setLiveValidationDisabled(false);
    try {
        FragmentValidator.validate(getContext(), fragment.getContentBinding());
    } catch (ValidationException e) {
        NotificationHelper.showNotification(this, ERROR, e.getMessage());
        return;
    }
    SelectOrCreatePersonDialog.selectOrCreatePerson(eventParticipantToSave.getPerson(), new Consumer<Person>() {

        @Override
        public void accept(Person person) {
            eventParticipantToSave.setPerson(person);
            saveTask = new SavingAsyncTask(getRootView(), eventParticipantToSave) {

                @Override
                protected void onPreExecute() {
                    showPreloader();
                }

                @Override
                protected void doInBackground(TaskResultHolder resultHolder) throws Exception {
                    DatabaseHelper.getPersonDao().saveAndSnapshot(eventParticipantToSave.getPerson());
                    final Event event = DatabaseHelper.getEventDao().queryUuid(eventUuid);
                    eventParticipantToSave.setEvent(event);
                    DatabaseHelper.getEventParticipantDao().saveAndSnapshot(eventParticipantToSave);
                }

                @Override
                protected void onPostExecute(AsyncTaskResult<TaskResultHolder> taskResult) {
                    hidePreloader();
                    super.onPostExecute(taskResult);
                    if (taskResult.getResultStatus().isSuccess()) {
                        EventParticipantEditActivity.startActivity(getContext(), getRootUuid(), eventUuid, EventParticipantSection.EVENT_PARTICIPANT_INFO);
                    }
                    saveTask = null;
                }
            }.executeOnThreadPool();
        }
    });
}
Also used : ValidationException(de.symeda.sormas.api.utils.ValidationException) TaskResultHolder(de.symeda.sormas.app.core.async.TaskResultHolder) Event(de.symeda.sormas.app.backend.event.Event) Person(de.symeda.sormas.app.backend.person.Person) EventParticipant(de.symeda.sormas.app.backend.event.EventParticipant) SavingAsyncTask(de.symeda.sormas.app.core.async.SavingAsyncTask) ValidationException(de.symeda.sormas.api.utils.ValidationException)

Example 4 with Person

use of de.symeda.sormas.app.backend.person.Person in project SORMAS-Project by hzi-braunschweig.

the class CaseDtoHelper method fillInnerFromAdo.

@Override
public void fillInnerFromAdo(CaseDataDto target, Case source) {
    target.setClinicalConfirmation(source.getClinicalConfirmation());
    target.setEpidemiologicalConfirmation(source.getEpidemiologicalConfirmation());
    target.setLaboratoryDiagnosticConfirmation(source.getLaboratoryDiagnosticConfirmation());
    target.setCaseClassification(source.getCaseClassification());
    target.setCaseIdentificationSource(source.getCaseIdentificationSource());
    target.setScreeningType(source.getScreeningType());
    if (source.getClassificationUser() != null) {
        User user = DatabaseHelper.getUserDao().queryForId(source.getClassificationUser().getId());
        target.setClassificationUser(UserDtoHelper.toReferenceDto(user));
    } else {
        target.setClassificationUser(null);
    }
    target.setClassificationDate(source.getClassificationDate());
    target.setClassificationComment(source.getClassificationComment());
    target.setInvestigationStatus(source.getInvestigationStatus());
    target.setDisease(source.getDisease());
    target.setDiseaseVariant(source.getDiseaseVariant());
    target.setDiseaseDetails(source.getDiseaseDetails());
    target.setDiseaseVariantDetails(source.getDiseaseVariantDetails());
    target.setPlagueType(source.getPlagueType());
    target.setDengueFeverType(source.getDengueFeverType());
    if (source.getHealthFacility() != null) {
        Facility facility = DatabaseHelper.getFacilityDao().queryForId(source.getHealthFacility().getId());
        target.setHealthFacility(FacilityDtoHelper.toReferenceDto(facility));
    } else {
        target.setHealthFacility(null);
    }
    target.setHealthFacilityDetails(source.getHealthFacilityDetails());
    if (source.getPerson() != null) {
        Person person = DatabaseHelper.getPersonDao().queryForId(source.getPerson().getId());
        target.setPerson(PersonDtoHelper.toReferenceDto(person));
    }
    target.setInvestigatedDate(source.getInvestigatedDate());
    target.setReportDate(source.getReportDate());
    target.setDistrictLevelDate(source.getDistrictLevelDate());
    if (source.getReportingUser() != null) {
        User user = DatabaseHelper.getUserDao().queryForId(source.getReportingUser().getId());
        target.setReportingUser(UserDtoHelper.toReferenceDto(user));
    } else {
        target.setReportingUser(null);
    }
    if (source.getSymptoms() != null) {
        Symptoms symptoms = DatabaseHelper.getSymptomsDao().queryForId(source.getSymptoms().getId());
        SymptomsDto symptomsDto = symptomsDtoHelper.adoToDto(symptoms);
        target.setSymptoms(symptomsDto);
    } else {
        target.setSymptoms(null);
    }
    if (source.getResponsibleRegion() != null) {
        Region region = DatabaseHelper.getRegionDao().queryForId(source.getResponsibleRegion().getId());
        target.setResponsibleRegion(RegionDtoHelper.toReferenceDto(region));
    } else {
        target.setResponsibleRegion(null);
    }
    if (source.getResponsibleDistrict() != null) {
        District district = DatabaseHelper.getDistrictDao().queryForId(source.getResponsibleDistrict().getId());
        target.setResponsibleDistrict(DistrictDtoHelper.toReferenceDto(district));
    } else {
        target.setResponsibleDistrict(null);
    }
    if (source.getResponsibleCommunity() != null) {
        Community community = DatabaseHelper.getCommunityDao().queryForId(source.getResponsibleCommunity().getId());
        target.setResponsibleCommunity(CommunityDtoHelper.toReferenceDto(community));
    } else {
        target.setResponsibleCommunity(null);
    }
    if (source.getRegion() != null) {
        Region region = DatabaseHelper.getRegionDao().queryForId(source.getRegion().getId());
        target.setRegion(RegionDtoHelper.toReferenceDto(region));
    } else {
        target.setRegion(null);
    }
    if (source.getDistrict() != null) {
        District district = DatabaseHelper.getDistrictDao().queryForId(source.getDistrict().getId());
        target.setDistrict(DistrictDtoHelper.toReferenceDto(district));
    } else {
        target.setDistrict(null);
    }
    if (source.getCommunity() != null) {
        Community community = DatabaseHelper.getCommunityDao().queryForId(source.getCommunity().getId());
        target.setCommunity(CommunityDtoHelper.toReferenceDto(community));
    } else {
        target.setCommunity(null);
    }
    if (source.getPointOfEntry() != null) {
        PointOfEntry pointOfEntry = DatabaseHelper.getPointOfEntryDao().queryForId(source.getPointOfEntry().getId());
        target.setPointOfEntry(PointOfEntryDtoHelper.toReferenceDto(pointOfEntry));
    } else {
        target.setPointOfEntry(null);
    }
    target.setPointOfEntryDetails(source.getPointOfEntryDetails());
    if (source.getSurveillanceOfficer() != null) {
        User user = DatabaseHelper.getUserDao().queryForId(source.getSurveillanceOfficer().getId());
        target.setSurveillanceOfficer(UserDtoHelper.toReferenceDto(user));
    } else {
        target.setSurveillanceOfficer(null);
    }
    if (source.getHospitalization() != null) {
        Hospitalization hospitalization = DatabaseHelper.getHospitalizationDao().queryForId(source.getHospitalization().getId());
        target.setHospitalization(hospitalizationDtoHelper.adoToDto(hospitalization));
    } else {
        target.setHospitalization(null);
    }
    if (source.getEpiData() != null) {
        EpiData epiData = DatabaseHelper.getEpiDataDao().queryForId(source.getEpiData().getId());
        target.setEpiData(epiDataDtoHelper.adoToDto(epiData));
    } else {
        target.setEpiData(null);
    }
    if (source.getTherapy() != null) {
        Therapy therapy = DatabaseHelper.getTherapyDao().queryForId(source.getTherapy().getId());
        target.setTherapy(therapyDtoHelper.adoToDto(therapy));
    } else {
        target.setTherapy(null);
    }
    if (source.getClinicalCourse() != null) {
        ClinicalCourse clinicalCourse = DatabaseHelper.getClinicalCourseDao().queryForId(source.getClinicalCourse().getId());
        target.setClinicalCourse(clinicalCourseDtoHelper.adoToDto(clinicalCourse));
    } else {
        target.setClinicalCourse(null);
    }
    if (source.getMaternalHistory() != null) {
        target.setMaternalHistory(maternalHistoryDtoHelper.adoToDto(DatabaseHelper.getMaternalHistoryDao().queryForId(source.getMaternalHistory().getId())));
    } else {
        target.setMaternalHistory(null);
    }
    if (source.getPortHealthInfo() != null) {
        target.setPortHealthInfo(portHealthInfoDtoHelper.adoToDto(DatabaseHelper.getPortHealthInfoDao().queryForId(source.getPortHealthInfo().getId())));
    } else {
        target.setPortHealthInfo(null);
    }
    target.setClinicianName(source.getClinicianName());
    target.setClinicianPhone(source.getClinicianPhone());
    target.setClinicianEmail(source.getClinicianEmail());
    target.setPregnant(source.getPregnant());
    target.setVaccinationStatus(source.getVaccinationStatus());
    target.setSmallpoxVaccinationScar(source.getSmallpoxVaccinationScar());
    target.setSmallpoxVaccinationReceived(source.getSmallpoxVaccinationReceived());
    target.setSmallpoxLastVaccinationDate(source.getSmallpoxLastVaccinationDate());
    target.setEpidNumber(source.getEpidNumber());
    target.setCaseOrigin(source.getCaseOrigin());
    target.setReportLat(source.getReportLat());
    target.setReportLon(source.getReportLon());
    target.setReportLatLonAccuracy(source.getReportLatLonAccuracy());
    target.setOutcome(source.getOutcome());
    target.setOutcomeDate(source.getOutcomeDate());
    target.setSequelae(source.getSequelae());
    target.setSequelaeDetails(source.getSequelaeDetails());
    target.setNotifyingClinic(source.getNotifyingClinic());
    target.setNotifyingClinicDetails(source.getNotifyingClinicDetails());
    target.setRabiesType(source.getRabiesType());
    target.setCreationVersion(source.getCreationVersion());
    target.setAdditionalDetails(source.getAdditionalDetails());
    target.setExternalID(source.getExternalID());
    target.setExternalToken(source.getExternalToken());
    target.setInternalToken(source.getInternalToken());
    target.setQuarantine(source.getQuarantine());
    target.setQuarantineTypeDetails(source.getQuarantineTypeDetails());
    target.setQuarantineFrom(source.getQuarantineFrom());
    target.setQuarantineTo(source.getQuarantineTo());
    target.setQuarantineHelpNeeded(source.getQuarantineHelpNeeded());
    target.setQuarantineOrderedVerbally(source.isQuarantineOrderedVerbally());
    target.setQuarantineOrderedOfficialDocument(source.isQuarantineOrderedOfficialDocument());
    target.setQuarantineOrderedVerballyDate(source.getQuarantineOrderedVerballyDate());
    target.setQuarantineOrderedOfficialDocumentDate(source.getQuarantineOrderedOfficialDocumentDate());
    target.setQuarantineExtended(source.isQuarantineExtended());
    target.setQuarantineReduced(source.isQuarantineReduced());
    target.setQuarantineHomePossible(source.getQuarantineHomePossible());
    target.setQuarantineHomePossibleComment(source.getQuarantineHomePossibleComment());
    target.setQuarantineHomeSupplyEnsured(source.getQuarantineHomeSupplyEnsured());
    target.setQuarantineHomeSupplyEnsuredComment(source.getQuarantineHomeSupplyEnsuredComment());
    target.setQuarantineOfficialOrderSent(source.isQuarantineOfficialOrderSent());
    target.setQuarantineOfficialOrderSentDate(source.getQuarantineOfficialOrderSentDate());
    target.setPostpartum(source.getPostpartum());
    target.setTrimester(source.getTrimester());
    target.setPseudonymized(source.isPseudonymized());
    target.setFacilityType(source.getFacilityType());
    target.setCaseIdIsm(source.getCaseIdIsm());
    target.setContactTracingFirstContactType(source.getContactTracingFirstContactType());
    target.setContactTracingFirstContactDate(source.getContactTracingFirstContactDate());
    target.setWasInQuarantineBeforeIsolation(source.getWasInQuarantineBeforeIsolation());
    target.setQuarantineReasonBeforeIsolation(source.getQuarantineReasonBeforeIsolation());
    target.setQuarantineReasonBeforeIsolationDetails(source.getQuarantineReasonBeforeIsolationDetails());
    target.setEndOfIsolationReason(source.getEndOfIsolationReason());
    target.setEndOfIsolationReasonDetails(source.getEndOfIsolationReasonDetails());
    target.setNosocomialOutbreak(source.isNosocomialOutbreak());
    target.setInfectionSetting(source.getInfectionSetting());
    target.setProhibitionToWork(source.getProhibitionToWork());
    target.setProhibitionToWorkFrom(source.getProhibitionToWorkFrom());
    target.setProhibitionToWorkUntil(source.getProhibitionToWorkUntil());
    target.setReInfection(source.getReInfection());
    target.setPreviousInfectionDate(source.getPreviousInfectionDate());
    target.setBloodOrganOrTissueDonated(source.getBloodOrganOrTissueDonated());
    if (source.getSormasToSormasOriginInfo() != null) {
        target.setSormasToSormasOriginInfo(sormasToSormasOriginInfoDtoHelper.adoToDto(source.getSormasToSormasOriginInfo()));
    }
    target.setOwnershipHandedOver(source.isOwnershipHandedOver());
    target.setNotACaseReasonNegativeTest(source.isNotACaseReasonNegativeTest());
    target.setNotACaseReasonPhysicianInformation(source.isNotACaseReasonPhysicianInformation());
    target.setNotACaseReasonDifferentPathogen(source.isNotACaseReasonDifferentPathogen());
    target.setNotACaseReasonOther(source.isNotACaseReasonOther());
    target.setNotACaseReasonDetails(source.getNotACaseReasonDetails());
    target.setFollowUpStatusChangeDate(source.getFollowUpStatusChangeDate());
    target.setFollowUpStatusChangeUser(UserDtoHelper.toReferenceDto(source.getFollowUpStatusChangeUser()));
    if (source.getHealthConditions() != null) {
        HealthConditions healthConditions = DatabaseHelper.getHealthConditionsDao().queryForId(source.getHealthConditions().getId());
        target.setHealthConditions(healthConditionsDtoHelper.adoToDto(healthConditions));
    } else {
        target.setHealthConditions(null);
    }
}
Also used : SymptomsDto(de.symeda.sormas.api.symptoms.SymptomsDto) Therapy(de.symeda.sormas.app.backend.therapy.Therapy) User(de.symeda.sormas.app.backend.user.User) Hospitalization(de.symeda.sormas.app.backend.hospitalization.Hospitalization) ClinicalCourse(de.symeda.sormas.app.backend.clinicalcourse.ClinicalCourse) HealthConditions(de.symeda.sormas.app.backend.clinicalcourse.HealthConditions) Region(de.symeda.sormas.app.backend.region.Region) Facility(de.symeda.sormas.app.backend.facility.Facility) PointOfEntry(de.symeda.sormas.app.backend.infrastructure.PointOfEntry) EpiData(de.symeda.sormas.app.backend.epidata.EpiData) Person(de.symeda.sormas.app.backend.person.Person) District(de.symeda.sormas.app.backend.region.District) Symptoms(de.symeda.sormas.app.backend.symptoms.Symptoms) Community(de.symeda.sormas.app.backend.region.Community)

Example 5 with Person

use of de.symeda.sormas.app.backend.person.Person in project SORMAS-Project by hzi-braunschweig.

the class SettingsFragment method showRepullDataConfirmationDialog.

private void showRepullDataConfirmationDialog() {
    final ConfirmationDialog confirmationDialog = new ConfirmationDialog(getActivity(), R.string.heading_confirmation_dialog, R.string.info_resync_duration);
    confirmationDialog.setPositiveCallback(() -> {
        // Collect unsynchronized changes
        final List<Case> modifiedCases = DatabaseHelper.getCaseDao().getModifiedEntities();
        final List<Contact> modifiedContacts = DatabaseHelper.getContactDao().getModifiedEntities();
        final List<Person> modifiedPersons = DatabaseHelper.getPersonDao().getModifiedEntities();
        final List<Event> modifiedEvents = DatabaseHelper.getEventDao().getModifiedEntities();
        final List<EventParticipant> modifiedEventParticipants = DatabaseHelper.getEventParticipantDao().getModifiedEntities();
        final List<Sample> modifiedSamples = DatabaseHelper.getSampleDao().getModifiedEntities();
        final List<Visit> modifiedVisits = DatabaseHelper.getVisitDao().getModifiedEntities();
        getBaseActivity().synchronizeData(SynchronizeDataAsync.SyncMode.CompleteAndRepull, true, true, null, new Callback() {

            @Override
            public void call() {
                // Add deleted entities that had unsynchronized changes to sync log
                for (Case caze : modifiedCases) {
                    if (DatabaseHelper.getCaseDao().queryUuidReference(caze.getUuid()) == null) {
                        DatabaseHelper.getSyncLogDao().createWithParentStack(caze.toString(), getResources().getString(R.string.caption_changed_data_lost));
                    }
                }
                for (Contact contact : modifiedContacts) {
                    if (DatabaseHelper.getContactDao().queryUuidReference(contact.getUuid()) == null) {
                        DatabaseHelper.getSyncLogDao().createWithParentStack(contact.toString(), getResources().getString(R.string.caption_changed_data_lost));
                    }
                }
                for (Person person : modifiedPersons) {
                    if (DatabaseHelper.getPersonDao().queryUuidReference(person.getUuid()) == null) {
                        DatabaseHelper.getSyncLogDao().createWithParentStack(person.toString(), getResources().getString(R.string.caption_changed_data_lost));
                    }
                }
                for (Event event : modifiedEvents) {
                    if (DatabaseHelper.getEventDao().queryUuidReference(event.getUuid()) == null) {
                        DatabaseHelper.getSyncLogDao().createWithParentStack(event.toString(), getResources().getString(R.string.caption_changed_data_lost));
                    }
                }
                for (EventParticipant eventParticipant : modifiedEventParticipants) {
                    if (DatabaseHelper.getEventParticipantDao().queryUuidReference(eventParticipant.getUuid()) == null) {
                        DatabaseHelper.getSyncLogDao().createWithParentStack(eventParticipant.toString(), getResources().getString(R.string.caption_changed_data_lost));
                    }
                }
                for (Sample sample : modifiedSamples) {
                    if (DatabaseHelper.getSampleDao().queryUuidReference(sample.getUuid()) == null) {
                        DatabaseHelper.getSyncLogDao().createWithParentStack(sample.toString(), getResources().getString(R.string.caption_changed_data_lost));
                    }
                }
                for (Visit visit : modifiedVisits) {
                    if (DatabaseHelper.getVisitDao().queryUuidReference(visit.getUuid()) == null) {
                        DatabaseHelper.getSyncLogDao().createWithParentStack(visit.toString(), getResources().getString(R.string.caption_changed_data_lost));
                    }
                }
            }
        }, new Callback() {

            @Override
            public void call() {
                DatabaseHelper.clearTables(false);
            }
        });
    });
    confirmationDialog.show();
}
Also used : Sample(de.symeda.sormas.app.backend.sample.Sample) Visit(de.symeda.sormas.app.backend.visit.Visit) ConfirmationDialog(de.symeda.sormas.app.component.dialog.ConfirmationDialog) Case(de.symeda.sormas.app.backend.caze.Case) Contact(de.symeda.sormas.app.backend.contact.Contact) Callback(de.symeda.sormas.app.util.Callback) Event(de.symeda.sormas.app.backend.event.Event) Person(de.symeda.sormas.app.backend.person.Person) EventParticipant(de.symeda.sormas.app.backend.event.EventParticipant)

Aggregations

Person (de.symeda.sormas.app.backend.person.Person)27 Case (de.symeda.sormas.app.backend.caze.Case)15 Contact (de.symeda.sormas.app.backend.contact.Contact)10 EventParticipant (de.symeda.sormas.app.backend.event.EventParticipant)10 District (de.symeda.sormas.app.backend.region.District)9 Region (de.symeda.sormas.app.backend.region.Region)9 User (de.symeda.sormas.app.backend.user.User)7 Event (de.symeda.sormas.app.backend.event.Event)6 Immunization (de.symeda.sormas.app.backend.immunization.Immunization)6 Community (de.symeda.sormas.app.backend.region.Community)6 MeansOfImmunization (de.symeda.sormas.api.immunization.MeansOfImmunization)5 HealthConditions (de.symeda.sormas.app.backend.clinicalcourse.HealthConditions)5 EpiData (de.symeda.sormas.app.backend.epidata.EpiData)5 Facility (de.symeda.sormas.app.backend.facility.Facility)5 Disease (de.symeda.sormas.api.Disease)4 ClinicalCourse (de.symeda.sormas.app.backend.clinicalcourse.ClinicalCourse)4 ClinicalVisit (de.symeda.sormas.app.backend.clinicalcourse.ClinicalVisit)4 Hospitalization (de.symeda.sormas.app.backend.hospitalization.Hospitalization)4 PointOfEntry (de.symeda.sormas.app.backend.infrastructure.PointOfEntry)4 Country (de.symeda.sormas.app.backend.region.Country)4