Search in sources :

Example 1 with TaskDtoHelper

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

the class TestEntityCreator method createCaseTask.

public static Task createCaseTask(Case caze, TaskStatus taskStatus, User user) {
    TaskDto taskDto = new TaskDto();
    Task task = new TaskDtoHelper().fillOrCreateFromDto(null, taskDto);
    task.setUuid(DataHelper.createUuid());
    task.setCreationDate(new Date());
    task.setChangeDate(new Date());
    task.setTaskContext(TaskContext.CASE);
    task.setTaskType(TaskType.CASE_INVESTIGATION);
    task.setTaskStatus(taskStatus);
    task.setCaze(caze);
    task.setAssigneeUser(user);
    try {
        DatabaseHelper.getTaskDao().saveAndSnapshot(task);
        DatabaseHelper.getTaskDao().accept(task);
    } catch (DaoException e) {
        throw new RuntimeException(e);
    }
    return DatabaseHelper.getTaskDao().queryForIdWithEmbedded(task.getId());
}
Also used : Task(de.symeda.sormas.app.backend.task.Task) TaskDtoHelper(de.symeda.sormas.app.backend.task.TaskDtoHelper) DaoException(de.symeda.sormas.app.backend.common.DaoException) TaskDto(de.symeda.sormas.api.task.TaskDto) Date(java.util.Date)

Example 2 with TaskDtoHelper

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

the class SynchronizeDataAsync method repullData.

@AddTrace(name = "repullDataTrace")
private void repullData() throws DaoException, NoConnectionException, ServerConnectionException, ServerCommunicationException {
    PersonDtoHelper personDtoHelper = new PersonDtoHelper();
    CaseDtoHelper caseDtoHelper = new CaseDtoHelper();
    ImmunizationDtoHelper immunizationDtoHelper = new ImmunizationDtoHelper();
    EventDtoHelper eventDtoHelper = new EventDtoHelper();
    EventParticipantDtoHelper eventParticipantDtoHelper = new EventParticipantDtoHelper();
    SampleDtoHelper sampleDtoHelper = new SampleDtoHelper();
    PathogenTestDtoHelper pathogenTestDtoHelper = new PathogenTestDtoHelper();
    AdditionalTestDtoHelper additionalTestDtoHelper = new AdditionalTestDtoHelper();
    ContactDtoHelper contactDtoHelper = new ContactDtoHelper();
    VisitDtoHelper visitDtoHelper = new VisitDtoHelper();
    TaskDtoHelper taskDtoHelper = new TaskDtoHelper();
    WeeklyReportDtoHelper weeklyReportDtoHelper = new WeeklyReportDtoHelper();
    AggregateReportDtoHelper aggregateReportDtoHelper = new AggregateReportDtoHelper();
    PrescriptionDtoHelper prescriptionDtoHelper = new PrescriptionDtoHelper();
    TreatmentDtoHelper treatmentDtoHelper = new TreatmentDtoHelper();
    ClinicalVisitDtoHelper clinicalVisitDtoHelper = new ClinicalVisitDtoHelper();
    // order is important, due to dependencies (e.g. case & person)
    new UserRoleConfigDtoHelper().repullEntities(context);
    new DiseaseClassificationDtoHelper().repullEntities(context);
    new UserDtoHelper().repullEntities(context);
    new OutbreakDtoHelper().repullEntities(context);
    new DiseaseConfigurationDtoHelper().repullEntities(context);
    new CustomizableEnumValueDtoHelper().repullEntities(context);
    new FeatureConfigurationDtoHelper().repullEntities(context);
    personDtoHelper.repullEntities(context);
    caseDtoHelper.repullEntities(context);
    immunizationDtoHelper.repullEntities(context);
    eventDtoHelper.repullEntities(context);
    eventParticipantDtoHelper.repullEntities(context);
    sampleDtoHelper.repullEntities(context);
    pathogenTestDtoHelper.repullEntities(context);
    additionalTestDtoHelper.repullEntities(context);
    contactDtoHelper.repullEntities(context);
    visitDtoHelper.repullEntities(context);
    taskDtoHelper.repullEntities(context);
    weeklyReportDtoHelper.repullEntities(context);
    aggregateReportDtoHelper.repullEntities(context);
    prescriptionDtoHelper.repullEntities(context);
    treatmentDtoHelper.repullEntities(context);
    clinicalVisitDtoHelper.repullEntities(context);
    // Campaigns
    if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.CAMPAIGNS)) {
        final CampaignFormDataDtoHelper campaignFormDataDtoHelper = new CampaignFormDataDtoHelper();
        campaignFormDataDtoHelper.repullEntities(context);
    }
}
Also used : PersonDtoHelper(de.symeda.sormas.app.backend.person.PersonDtoHelper) ContactDtoHelper(de.symeda.sormas.app.backend.contact.ContactDtoHelper) EventDtoHelper(de.symeda.sormas.app.backend.event.EventDtoHelper) CaseDtoHelper(de.symeda.sormas.app.backend.caze.CaseDtoHelper) OutbreakDtoHelper(de.symeda.sormas.app.backend.outbreak.OutbreakDtoHelper) UserRoleConfigDtoHelper(de.symeda.sormas.app.backend.user.UserRoleConfigDtoHelper) UserDtoHelper(de.symeda.sormas.app.backend.user.UserDtoHelper) FeatureConfigurationDtoHelper(de.symeda.sormas.app.backend.feature.FeatureConfigurationDtoHelper) ClinicalVisitDtoHelper(de.symeda.sormas.app.backend.clinicalcourse.ClinicalVisitDtoHelper) VisitDtoHelper(de.symeda.sormas.app.backend.visit.VisitDtoHelper) TaskDtoHelper(de.symeda.sormas.app.backend.task.TaskDtoHelper) ImmunizationDtoHelper(de.symeda.sormas.app.backend.immunization.ImmunizationDtoHelper) SampleDtoHelper(de.symeda.sormas.app.backend.sample.SampleDtoHelper) ClinicalVisitDtoHelper(de.symeda.sormas.app.backend.clinicalcourse.ClinicalVisitDtoHelper) CustomizableEnumValueDtoHelper(de.symeda.sormas.app.backend.customizableenum.CustomizableEnumValueDtoHelper) CampaignFormDataDtoHelper(de.symeda.sormas.app.backend.campaign.data.CampaignFormDataDtoHelper) DiseaseConfigurationDtoHelper(de.symeda.sormas.app.backend.disease.DiseaseConfigurationDtoHelper) TreatmentDtoHelper(de.symeda.sormas.app.backend.therapy.TreatmentDtoHelper) WeeklyReportDtoHelper(de.symeda.sormas.app.backend.report.WeeklyReportDtoHelper) EventParticipantDtoHelper(de.symeda.sormas.app.backend.event.EventParticipantDtoHelper) DiseaseClassificationDtoHelper(de.symeda.sormas.app.backend.classification.DiseaseClassificationDtoHelper) PathogenTestDtoHelper(de.symeda.sormas.app.backend.sample.PathogenTestDtoHelper) AggregateReportDtoHelper(de.symeda.sormas.app.backend.report.AggregateReportDtoHelper) PrescriptionDtoHelper(de.symeda.sormas.app.backend.therapy.PrescriptionDtoHelper) AdditionalTestDtoHelper(de.symeda.sormas.app.backend.sample.AdditionalTestDtoHelper) AddTrace(com.google.firebase.perf.metrics.AddTrace)

Example 3 with TaskDtoHelper

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

the class SynchronizeDataAsync method pushNewPullMissingAndDeleteInvalidData.

@AddTrace(name = "pushNewPullMissingAndDeleteInvalidDataTrace")
private void pushNewPullMissingAndDeleteInvalidData() throws NoConnectionException, ServerConnectionException, ServerCommunicationException, DaoException {
    // ATTENTION: Since we are working with UUID lists we have no type safety. Look for typos!
    Log.d(SynchronizeDataAsync.class.getSimpleName(), "pushNewPullMissingAndDeleteInvalidData");
    // order is important, due to dependencies (e.g. case & person)
    // first push everything that has been CREATED by the user - otherwise this data my lose it's references to other entities.
    // Example: Case is created using an existing person, meanwhile user loses access to the person
    pushNewData();
    // weekly reports and entries
    List<String> weeklyReportUuids = executeUuidCall(RetroProvider.getWeeklyReportFacade().pullUuids());
    DatabaseHelper.getWeeklyReportDao().deleteInvalid(weeklyReportUuids);
    // aggregate reports
    List<String> aggregateReportUuids = executeUuidCall(RetroProvider.getAggregateReportFacade().pullUuids());
    DatabaseHelper.getAggregateReportDao().deleteInvalid(aggregateReportUuids);
    // tasks
    List<String> taskUuids = executeUuidCall(RetroProvider.getTaskFacade().pullUuids());
    DatabaseHelper.getTaskDao().deleteInvalid(taskUuids);
    // visits
    List<String> visitUuids = executeUuidCall(RetroProvider.getVisitFacade().pullUuids());
    DatabaseHelper.getVisitDao().deleteInvalid(visitUuids);
    // contacts
    List<String> contactUuids = executeUuidCall(RetroProvider.getContactFacade().pullUuids());
    DatabaseHelper.getContactDao().deleteInvalid(contactUuids);
    // sample tests
    List<String> sampleTestUuids = executeUuidCall(RetroProvider.getSampleTestFacade().pullUuids());
    DatabaseHelper.getSampleTestDao().deleteInvalid(sampleTestUuids);
    // additional tests
    List<String> additionalTestUuids = executeUuidCall(RetroProvider.getAdditionalTestFacade().pullUuids());
    DatabaseHelper.getAdditionalTestDao().deleteInvalid(additionalTestUuids);
    // samples
    List<String> sampleUuids = executeUuidCall(RetroProvider.getSampleFacade().pullUuids());
    DatabaseHelper.getSampleDao().deleteInvalid(sampleUuids);
    // event participants
    List<String> eventParticipantUuids = executeUuidCall(RetroProvider.getEventParticipantFacade().pullUuids());
    DatabaseHelper.getEventParticipantDao().deleteInvalid(eventParticipantUuids);
    // events
    List<String> eventUuids = executeUuidCall(RetroProvider.getEventFacade().pullUuids());
    DatabaseHelper.getEventDao().deleteInvalid(eventUuids);
    // treatments
    List<String> treatmentUuids = executeUuidCall(RetroProvider.getTreatmentFacade().pullUuids());
    DatabaseHelper.getTreatmentDao().deleteInvalid(treatmentUuids);
    // prescriptions
    List<String> prescriptionUuids = executeUuidCall(RetroProvider.getPrescriptionFacade().pullUuids());
    DatabaseHelper.getPrescriptionDao().deleteInvalid(prescriptionUuids);
    // clinical visits
    List<String> clinicalVisitUuids = executeUuidCall(RetroProvider.getClinicalVisitFacade().pullUuids());
    DatabaseHelper.getClinicalVisitDao().deleteInvalid(clinicalVisitUuids);
    // immunizations
    List<String> immunizationUuids = executeUuidCall(RetroProvider.getImmunizationFacade().pullUuids());
    DatabaseHelper.getImmunizationDao().deleteInvalid(immunizationUuids);
    // cases
    List<String> caseUuids = executeUuidCall(RetroProvider.getCaseFacade().pullUuids());
    DatabaseHelper.getCaseDao().deleteInvalid(caseUuids);
    // persons
    List<String> personUuids = executeUuidCall(RetroProvider.getPersonFacade().pullUuids());
    DatabaseHelper.getPersonDao().deleteInvalid(personUuids);
    // outbreak
    List<String> outbreakUuids = executeUuidCall(RetroProvider.getOutbreakFacade().pullActiveUuids());
    DatabaseHelper.getOutbreakDao().deleteInvalid(outbreakUuids);
    // order is important, due to dependencies (e.g. case & person)
    new PersonDtoHelper().pullMissing(personUuids);
    new CaseDtoHelper().pullMissing(caseUuids);
    new ImmunizationDtoHelper().pullMissing(caseUuids);
    new PrescriptionDtoHelper().pullMissing(prescriptionUuids);
    new TreatmentDtoHelper().pullMissing(treatmentUuids);
    new EventDtoHelper().pullMissing(eventUuids);
    new EventParticipantDtoHelper().pullMissing(eventParticipantUuids);
    new SampleDtoHelper().pullMissing(sampleUuids);
    new AdditionalTestDtoHelper().pullMissing(additionalTestUuids);
    new PathogenTestDtoHelper().pullMissing(sampleTestUuids);
    new ContactDtoHelper().pullMissing(contactUuids);
    new VisitDtoHelper().pullMissing(visitUuids);
    new TaskDtoHelper().pullMissing(taskUuids);
    new WeeklyReportDtoHelper().pullMissing(weeklyReportUuids);
    new AggregateReportDtoHelper().pullMissing(aggregateReportUuids);
    new PrescriptionDtoHelper().pullMissing(prescriptionUuids);
    new TreatmentDtoHelper().pullMissing(treatmentUuids);
    new ClinicalVisitDtoHelper().pullMissing(clinicalVisitUuids);
    // CampaignData
    if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.CAMPAIGNS)) {
        final CampaignFormDataDtoHelper campaignFormDataDtoHelper = new CampaignFormDataDtoHelper();
        campaignFormDataDtoHelper.pushEntities(true);
        final List<String> campaignFormDataUuids = executeUuidCall(RetroProvider.getCampaignFormDataFacade().pullUuids());
        DatabaseHelper.getCampaignFormDataDao().deleteInvalid(campaignFormDataUuids);
        campaignFormDataDtoHelper.pullMissing(campaignFormDataUuids);
    }
}
Also used : PersonDtoHelper(de.symeda.sormas.app.backend.person.PersonDtoHelper) ContactDtoHelper(de.symeda.sormas.app.backend.contact.ContactDtoHelper) EventDtoHelper(de.symeda.sormas.app.backend.event.EventDtoHelper) CaseDtoHelper(de.symeda.sormas.app.backend.caze.CaseDtoHelper) ClinicalVisitDtoHelper(de.symeda.sormas.app.backend.clinicalcourse.ClinicalVisitDtoHelper) VisitDtoHelper(de.symeda.sormas.app.backend.visit.VisitDtoHelper) TaskDtoHelper(de.symeda.sormas.app.backend.task.TaskDtoHelper) ImmunizationDtoHelper(de.symeda.sormas.app.backend.immunization.ImmunizationDtoHelper) SampleDtoHelper(de.symeda.sormas.app.backend.sample.SampleDtoHelper) ClinicalVisitDtoHelper(de.symeda.sormas.app.backend.clinicalcourse.ClinicalVisitDtoHelper) CampaignFormDataDtoHelper(de.symeda.sormas.app.backend.campaign.data.CampaignFormDataDtoHelper) TreatmentDtoHelper(de.symeda.sormas.app.backend.therapy.TreatmentDtoHelper) WeeklyReportDtoHelper(de.symeda.sormas.app.backend.report.WeeklyReportDtoHelper) EventParticipantDtoHelper(de.symeda.sormas.app.backend.event.EventParticipantDtoHelper) PathogenTestDtoHelper(de.symeda.sormas.app.backend.sample.PathogenTestDtoHelper) PrescriptionDtoHelper(de.symeda.sormas.app.backend.therapy.PrescriptionDtoHelper) AggregateReportDtoHelper(de.symeda.sormas.app.backend.report.AggregateReportDtoHelper) AdditionalTestDtoHelper(de.symeda.sormas.app.backend.sample.AdditionalTestDtoHelper) AddTrace(com.google.firebase.perf.metrics.AddTrace)

Example 4 with TaskDtoHelper

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

the class SynchronizeDataAsync method pushNewData.

@AddTrace(name = "pushNewDataTrace")
private void pushNewData() throws ServerCommunicationException, ServerConnectionException, DaoException, NoConnectionException {
    new PersonDtoHelper().pushEntities(true);
    new CaseDtoHelper().pushEntities(true);
    new ImmunizationDtoHelper().pushEntities(true);
    new EventDtoHelper().pushEntities(true);
    new EventParticipantDtoHelper().pushEntities(true);
    new SampleDtoHelper().pushEntities(true);
    new PathogenTestDtoHelper().pushEntities(true);
    new AdditionalTestDtoHelper().pushEntities(true);
    new ContactDtoHelper().pushEntities(true);
    new VisitDtoHelper().pushEntities(true);
    new TaskDtoHelper().pushEntities(true);
    new WeeklyReportDtoHelper().pushEntities(true);
    new AggregateReportDtoHelper().pushEntities(true);
    new PrescriptionDtoHelper().pushEntities(true);
    new TreatmentDtoHelper().pushEntities(true);
    new ClinicalVisitDtoHelper().pushEntities(true);
}
Also used : PersonDtoHelper(de.symeda.sormas.app.backend.person.PersonDtoHelper) ContactDtoHelper(de.symeda.sormas.app.backend.contact.ContactDtoHelper) EventDtoHelper(de.symeda.sormas.app.backend.event.EventDtoHelper) CaseDtoHelper(de.symeda.sormas.app.backend.caze.CaseDtoHelper) ClinicalVisitDtoHelper(de.symeda.sormas.app.backend.clinicalcourse.ClinicalVisitDtoHelper) VisitDtoHelper(de.symeda.sormas.app.backend.visit.VisitDtoHelper) TaskDtoHelper(de.symeda.sormas.app.backend.task.TaskDtoHelper) ImmunizationDtoHelper(de.symeda.sormas.app.backend.immunization.ImmunizationDtoHelper) SampleDtoHelper(de.symeda.sormas.app.backend.sample.SampleDtoHelper) ClinicalVisitDtoHelper(de.symeda.sormas.app.backend.clinicalcourse.ClinicalVisitDtoHelper) TreatmentDtoHelper(de.symeda.sormas.app.backend.therapy.TreatmentDtoHelper) WeeklyReportDtoHelper(de.symeda.sormas.app.backend.report.WeeklyReportDtoHelper) EventParticipantDtoHelper(de.symeda.sormas.app.backend.event.EventParticipantDtoHelper) PathogenTestDtoHelper(de.symeda.sormas.app.backend.sample.PathogenTestDtoHelper) AggregateReportDtoHelper(de.symeda.sormas.app.backend.report.AggregateReportDtoHelper) PrescriptionDtoHelper(de.symeda.sormas.app.backend.therapy.PrescriptionDtoHelper) AdditionalTestDtoHelper(de.symeda.sormas.app.backend.sample.AdditionalTestDtoHelper) AddTrace(com.google.firebase.perf.metrics.AddTrace)

Example 5 with TaskDtoHelper

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

the class TestEntityCreator method createEventTask.

public static Task createEventTask(Event event, TaskStatus taskStatus, User user) {
    TaskDto taskDto = new TaskDto();
    Task task = new TaskDtoHelper().fillOrCreateFromDto(null, taskDto);
    task.setUuid(DataHelper.createUuid());
    task.setCreationDate(new Date());
    task.setChangeDate(new Date());
    task.setTaskContext(TaskContext.CASE);
    task.setTaskType(TaskType.CASE_INVESTIGATION);
    task.setTaskStatus(taskStatus);
    task.setEvent(event);
    task.setAssigneeUser(user);
    try {
        DatabaseHelper.getTaskDao().saveAndSnapshot(task);
        DatabaseHelper.getTaskDao().accept(task);
    } catch (DaoException e) {
        throw new RuntimeException(e);
    }
    return DatabaseHelper.getTaskDao().queryForIdWithEmbedded(task.getId());
}
Also used : Task(de.symeda.sormas.app.backend.task.Task) TaskDtoHelper(de.symeda.sormas.app.backend.task.TaskDtoHelper) DaoException(de.symeda.sormas.app.backend.common.DaoException) TaskDto(de.symeda.sormas.api.task.TaskDto) Date(java.util.Date)

Aggregations

TaskDtoHelper (de.symeda.sormas.app.backend.task.TaskDtoHelper)6 AddTrace (com.google.firebase.perf.metrics.AddTrace)4 CaseDtoHelper (de.symeda.sormas.app.backend.caze.CaseDtoHelper)4 ClinicalVisitDtoHelper (de.symeda.sormas.app.backend.clinicalcourse.ClinicalVisitDtoHelper)4 ContactDtoHelper (de.symeda.sormas.app.backend.contact.ContactDtoHelper)4 EventDtoHelper (de.symeda.sormas.app.backend.event.EventDtoHelper)4 EventParticipantDtoHelper (de.symeda.sormas.app.backend.event.EventParticipantDtoHelper)4 ImmunizationDtoHelper (de.symeda.sormas.app.backend.immunization.ImmunizationDtoHelper)4 PersonDtoHelper (de.symeda.sormas.app.backend.person.PersonDtoHelper)4 AggregateReportDtoHelper (de.symeda.sormas.app.backend.report.AggregateReportDtoHelper)4 WeeklyReportDtoHelper (de.symeda.sormas.app.backend.report.WeeklyReportDtoHelper)4 AdditionalTestDtoHelper (de.symeda.sormas.app.backend.sample.AdditionalTestDtoHelper)4 PathogenTestDtoHelper (de.symeda.sormas.app.backend.sample.PathogenTestDtoHelper)4 SampleDtoHelper (de.symeda.sormas.app.backend.sample.SampleDtoHelper)4 PrescriptionDtoHelper (de.symeda.sormas.app.backend.therapy.PrescriptionDtoHelper)4 TreatmentDtoHelper (de.symeda.sormas.app.backend.therapy.TreatmentDtoHelper)4 VisitDtoHelper (de.symeda.sormas.app.backend.visit.VisitDtoHelper)4 CampaignFormDataDtoHelper (de.symeda.sormas.app.backend.campaign.data.CampaignFormDataDtoHelper)3 TaskDto (de.symeda.sormas.api.task.TaskDto)2 DaoException (de.symeda.sormas.app.backend.common.DaoException)2