use of de.symeda.sormas.app.backend.disease.DiseaseConfigurationDtoHelper 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);
}
}
use of de.symeda.sormas.app.backend.disease.DiseaseConfigurationDtoHelper in project SORMAS-Project by hzi-braunschweig.
the class SynchronizeDataAsync method pullMissingAndDeleteInvalidInfrastructure.
@AddTrace(name = "pullMissingAndDeleteInvalidInfrastructureTrace")
private void pullMissingAndDeleteInvalidInfrastructure() 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(), "pullMissingAndDeleteInvalidInfrastructure");
// TODO get a count first and only retrieve all uuids when count is different?
// users
List<String> userUuids = executeUuidCall(RetroProvider.getUserFacade().pullUuids());
DatabaseHelper.getUserDao().deleteInvalid(userUuids);
// disease configurations
List<String> diseaseConfigurationUuids = executeUuidCall(RetroProvider.getDiseaseConfigurationFacade().pullUuids());
DatabaseHelper.getDiseaseConfigurationDao().deleteInvalid(diseaseConfigurationUuids);
// Disease variants
List<String> customizableEnumValueUuids = executeUuidCall(RetroProvider.getCustomizableEnumValueFacade().pullUuids());
DatabaseHelper.getCustomizableEnumValueDao().deleteInvalid(customizableEnumValueUuids);
// feature configurations
List<String> featureConfigurationUuids = executeUuidCall(RetroProvider.getFeatureConfigurationFacade().pullUuids());
DatabaseHelper.getFeatureConfigurationDao().deleteInvalid(featureConfigurationUuids);
// user role config
List<String> userRoleConfigUuids = executeUuidCall(RetroProvider.getUserRoleConfigFacade().pullUuids());
DatabaseHelper.getUserRoleConfigDao().deleteInvalid(userRoleConfigUuids);
// points of entry
List<String> pointOfEntryUuids = executeUuidCall(RetroProvider.getPointOfEntryFacade().pullUuids());
DatabaseHelper.getPointOfEntryDao().deleteInvalid(pointOfEntryUuids);
// facilities
List<String> facilityUuids = executeUuidCall(RetroProvider.getFacilityFacade().pullUuids());
DatabaseHelper.getFacilityDao().deleteInvalid(facilityUuids);
// communities
List<String> communityUuids = executeUuidCall(RetroProvider.getCommunityFacade().pullUuids());
DatabaseHelper.getCommunityDao().deleteInvalid(communityUuids);
// districts
List<String> districtUuids = executeUuidCall(RetroProvider.getDistrictFacade().pullUuids());
DatabaseHelper.getDistrictDao().deleteInvalid(districtUuids);
// regions
List<String> regionUuids = executeUuidCall(RetroProvider.getRegionFacade().pullUuids());
DatabaseHelper.getRegionDao().deleteInvalid(regionUuids);
// areas
List<String> areaUuids = executeUuidCall(RetroProvider.getAreaFacade().pullUuids());
DatabaseHelper.getAreaDao().deleteInvalid(areaUuids);
// countries
List<String> countryUuids = executeUuidCall(RetroProvider.getCountryFacade().pullUuids());
DatabaseHelper.getCountryDao().deleteInvalid(countryUuids);
// subcontinents
List<String> subcontinentUuids = executeUuidCall(RetroProvider.getSubcontinentFacade().pullUuids());
DatabaseHelper.getSubcontinentDao().deleteInvalid(subcontinentUuids);
// continents
List<String> continentUuids = executeUuidCall(RetroProvider.getContinentFacade().pullUuids());
DatabaseHelper.getContinentDao().deleteInvalid(continentUuids);
// order is important, due to dependencies
new ContinentDtoHelper().pullMissing(continentUuids);
new SubcontinentDtoHelper().pullMissing(subcontinentUuids);
new CountryDtoHelper().pullMissing(countryUuids);
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.INFRASTRUCTURE_TYPE_AREA)) {
new AreaDtoHelper().pullMissing(areaUuids);
}
new RegionDtoHelper().pullMissing(regionUuids);
new DistrictDtoHelper().pullMissing(districtUuids);
new CommunityDtoHelper().pullMissing(communityUuids);
new FacilityDtoHelper().pullMissing(facilityUuids);
new PointOfEntryDtoHelper().pullMissing(pointOfEntryUuids);
new UserRoleConfigDtoHelper().pullMissing(userRoleConfigUuids);
new UserDtoHelper().pullMissing(userUuids);
new DiseaseConfigurationDtoHelper().pullMissing(diseaseConfigurationUuids);
new CustomizableEnumValueDtoHelper().pullMissing(customizableEnumValueUuids);
new FeatureConfigurationDtoHelper().pullMissing(featureConfigurationUuids);
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.CAMPAIGNS)) {
// campaigns
List<String> campaignUuids = executeUuidCall(RetroProvider.getCampaignFacade().pullUuids());
DatabaseHelper.getCampaignDao().deleteInvalid(campaignUuids);
// campaignFormMetas
List<String> campaignFormMetaUuids = executeUuidCall(RetroProvider.getCampaignFormMetaFacade().pullUuids());
DatabaseHelper.getCampaignFormMetaDao().deleteInvalid(campaignFormMetaUuids);
new CampaignFormMetaDtoHelper().pullMissing(campaignFormMetaUuids);
new CampaignDtoHelper().pullMissing(campaignUuids);
}
}
use of de.symeda.sormas.app.backend.disease.DiseaseConfigurationDtoHelper in project SORMAS-Project by hzi-braunschweig.
the class SynchronizeDataAsync method pullInitialInfrastructure.
@AddTrace(name = "pullInitialInfrastructureTrace")
private void pullInitialInfrastructure() throws DaoException, ServerCommunicationException, ServerConnectionException, NoConnectionException {
new ContinentDtoHelper().pullEntities(false, context);
new SubcontinentDtoHelper().pullEntities(false, context);
new CountryDtoHelper().pullEntities(false, context);
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.INFRASTRUCTURE_TYPE_AREA)) {
new AreaDtoHelper().pullEntities(false, context);
}
new RegionDtoHelper().pullEntities(false, context);
new DistrictDtoHelper().pullEntities(false, context);
new CommunityDtoHelper().pullEntities(false, context);
new FacilityDtoHelper().pullEntities(false, context);
new PointOfEntryDtoHelper().pullEntities(false, context);
new UserDtoHelper().pullEntities(false, context);
new DiseaseClassificationDtoHelper().pullEntities(false, context);
new DiseaseConfigurationDtoHelper().pullEntities(false, context);
new CustomizableEnumValueDtoHelper().pullEntities(false, context);
// user role configurations may be removed, so have to pull the deleted uuids
// this may be applied to other entities later as well
Date latestChangeDate = DatabaseHelper.getUserRoleConfigDao().getLatestChangeDate();
List<String> userRoleConfigUuids = executeUuidCall(RetroProvider.getUserRoleConfigFacade().pullDeletedUuidsSince(latestChangeDate != null ? latestChangeDate.getTime() : 0));
DatabaseHelper.getUserRoleConfigDao().delete(userRoleConfigUuids);
new UserRoleConfigDtoHelper().pullEntities(false, context);
Date featureConfigurationChangeDate = DatabaseHelper.getFeatureConfigurationDao().getLatestChangeDate();
List<String> featureConfigurationConfigUuids = executeUuidCall(RetroProvider.getFeatureConfigurationFacade().pullDeletedUuidsSince(featureConfigurationChangeDate != null ? featureConfigurationChangeDate.getTime() : 0));
DatabaseHelper.getFeatureConfigurationDao().delete(featureConfigurationConfigUuids);
new FeatureConfigurationDtoHelper().pullEntities(false, context);
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.CAMPAIGNS)) {
new CampaignFormMetaDtoHelper().pullEntities(false, context);
new CampaignDtoHelper().pullEntities(false, context);
}
ConfigProvider.setInitialSyncRequired(false);
}
use of de.symeda.sormas.app.backend.disease.DiseaseConfigurationDtoHelper in project SORMAS-Project by hzi-braunschweig.
the class SynchronizeDataAsync method synchronizeChangedData.
@AddTrace(name = "synchronizeChangedDataTrace")
private void synchronizeChangedData() 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 OutbreakDtoHelper().pullEntities(false, context);
new DiseaseConfigurationDtoHelper().pullEntities(false, context);
new CustomizableEnumValueDtoHelper().pullEntities(false, context);
boolean personsNeedPull = personDtoHelper.pullAndPushEntities(context);
boolean casesNeedPull = caseDtoHelper.pullAndPushEntities(context);
boolean immunizationsNeedPull = immunizationDtoHelper.pullAndPushEntities(context);
boolean eventsNeedPull = eventDtoHelper.pullAndPushEntities(context);
boolean eventParticipantsNeedPull = eventParticipantDtoHelper.pullAndPushEntities(context);
boolean samplesNeedPull = sampleDtoHelper.pullAndPushEntities(context);
boolean sampleTestsNeedPull = pathogenTestDtoHelper.pullAndPushEntities(context);
boolean additionalTestsNeedPull = additionalTestDtoHelper.pullAndPushEntities(context);
boolean contactsNeedPull = contactDtoHelper.pullAndPushEntities(context);
boolean visitsNeedPull = visitDtoHelper.pullAndPushEntities(context);
boolean tasksNeedPull = taskDtoHelper.pullAndPushEntities(context);
boolean weeklyReportsNeedPull = weeklyReportDtoHelper.pullAndPushEntities(context);
boolean aggregateReportsNeedPull = aggregateReportDtoHelper.pullAndPushEntities(context);
boolean prescriptionsNeedPull = prescriptionDtoHelper.pullAndPushEntities(context);
boolean treatmentsNeedPull = treatmentDtoHelper.pullAndPushEntities(context);
boolean clinicalVisitsNeedPull = clinicalVisitDtoHelper.pullAndPushEntities(context);
casesNeedPull |= clinicalVisitsNeedPull;
if (personsNeedPull)
personDtoHelper.pullEntities(true, context);
if (casesNeedPull)
caseDtoHelper.pullEntities(true, context);
if (immunizationsNeedPull)
immunizationDtoHelper.pullEntities(true, context);
if (eventsNeedPull)
eventDtoHelper.pullEntities(true, context);
if (eventParticipantsNeedPull)
eventParticipantDtoHelper.pullEntities(true, context);
if (samplesNeedPull)
sampleDtoHelper.pullEntities(true, context);
if (sampleTestsNeedPull)
pathogenTestDtoHelper.pullEntities(true, context);
if (additionalTestsNeedPull)
additionalTestDtoHelper.pullEntities(true, context);
if (contactsNeedPull)
contactDtoHelper.pullEntities(true, context);
if (visitsNeedPull)
visitDtoHelper.pullEntities(true, context);
if (tasksNeedPull)
taskDtoHelper.pullEntities(true, context);
if (weeklyReportsNeedPull)
weeklyReportDtoHelper.pullEntities(true, context);
if (aggregateReportsNeedPull)
aggregateReportDtoHelper.pullEntities(true, context);
if (prescriptionsNeedPull)
prescriptionDtoHelper.pullEntities(true, context);
if (treatmentsNeedPull)
treatmentDtoHelper.pullEntities(true, context);
if (clinicalVisitsNeedPull)
clinicalVisitDtoHelper.pullEntities(true, context);
// Campaigns
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.CAMPAIGNS)) {
final CampaignFormDataDtoHelper campaignFormDataDtoHelper = new CampaignFormDataDtoHelper();
if (campaignFormDataDtoHelper.pullAndPushEntities(context))
campaignFormDataDtoHelper.pullEntities(true, context);
}
}
use of de.symeda.sormas.app.backend.disease.DiseaseConfigurationDtoHelper in project SORMAS-Project by hzi-braunschweig.
the class InfrastructureHelper method handlePulledInfrastructureData.
public static void handlePulledInfrastructureData(InfrastructureSyncDto infrastructureData) throws DaoException, NoConnectionException, ServerConnectionException, ServerCommunicationException {
new ContinentDtoHelper().handlePulledList(DatabaseHelper.getContinentDao(), infrastructureData.getContinents());
new SubcontinentDtoHelper().handlePulledList(DatabaseHelper.getSubcontinentDao(), infrastructureData.getSubcontinents());
new CountryDtoHelper().handlePulledList(DatabaseHelper.getCountryDao(), infrastructureData.getCountries());
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.INFRASTRUCTURE_TYPE_AREA)) {
new AreaDtoHelper().handlePulledList(DatabaseHelper.getAreaDao(), infrastructureData.getAreas());
}
new RegionDtoHelper().handlePulledList(DatabaseHelper.getRegionDao(), infrastructureData.getRegions());
new DistrictDtoHelper().handlePulledList(DatabaseHelper.getDistrictDao(), infrastructureData.getDistricts());
new CommunityDtoHelper().handlePulledList(DatabaseHelper.getCommunityDao(), infrastructureData.getCommunities());
new FacilityDtoHelper().handlePulledList(DatabaseHelper.getFacilityDao(), infrastructureData.getFacilities());
new PointOfEntryDtoHelper().handlePulledList(DatabaseHelper.getPointOfEntryDao(), infrastructureData.getPointsOfEntry());
new UserDtoHelper().handlePulledList(DatabaseHelper.getUserDao(), infrastructureData.getUsers());
new DiseaseClassificationDtoHelper().handlePulledList(DatabaseHelper.getDiseaseClassificationCriteriaDao(), infrastructureData.getDiseaseClassifications());
new DiseaseConfigurationDtoHelper().handlePulledList(DatabaseHelper.getDiseaseConfigurationDao(), infrastructureData.getDiseaseConfigurations());
DatabaseHelper.getUserRoleConfigDao().delete(infrastructureData.getDeletedUserRoleConfigurationUuids());
new UserRoleConfigDtoHelper().handlePulledList(DatabaseHelper.getUserRoleConfigDao(), infrastructureData.getUserRoleConfigurations());
DatabaseHelper.getFeatureConfigurationDao().delete(infrastructureData.getDeletedFeatureConfigurationUuids());
new FeatureConfigurationDtoHelper().handlePulledList(DatabaseHelper.getFeatureConfigurationDao(), infrastructureData.getFeatureConfigurations());
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.CAMPAIGNS)) {
new CampaignDtoHelper().handlePulledList(DatabaseHelper.getCampaignDao(), infrastructureData.getCampaigns());
new CampaignFormMetaDtoHelper().handlePulledList(DatabaseHelper.getCampaignFormMetaDao(), infrastructureData.getCampaignFormMetas());
}
}
Aggregations