From 9ff0427af9088a2eb050167972c7813d3dfcbd7b Mon Sep 17 00:00:00 2001 From: himeshr Date: Mon, 17 Oct 2022 12:27:10 +0530 Subject: [PATCH] #47 | Fix compilation error due to missing import and remove unused isGoonjEncounterInAvni() --- .../goonj/GoonjMappingGroup.java | 7 ------- .../goonj/worker/avni/ActivityWorker.java | 3 +-- .../goonj/worker/avni/DispatchReceiptWorker.java | 3 +-- .../goonj/worker/avni/DistributionWorker.java | 3 +-- .../goonj/worker/avni/GeneralEncounterWorker.java | 11 +---------- 5 files changed, 4 insertions(+), 23 deletions(-) diff --git a/goonj/src/main/java/org/avni_integration_service/goonj/GoonjMappingGroup.java b/goonj/src/main/java/org/avni_integration_service/goonj/GoonjMappingGroup.java index 5f1724c2..998f4b6c 100644 --- a/goonj/src/main/java/org/avni_integration_service/goonj/GoonjMappingGroup.java +++ b/goonj/src/main/java/org/avni_integration_service/goonj/GoonjMappingGroup.java @@ -7,8 +7,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Arrays; - @Service public class GoonjMappingGroup { private static final Logger logger = Logger.getLogger(GoonjMappingGroup.class); @@ -18,7 +16,6 @@ public class GoonjMappingGroup { public final MappingGroup dispatchReceipt; public final MappingGroup distribution; public final MappingGroup activity; - private final MappingGroup[] goonjEncounterMappingGroups; @Autowired public GoonjMappingGroup(MappingGroupRepository mappingGroupRepository) { @@ -28,9 +25,5 @@ public GoonjMappingGroup(MappingGroupRepository mappingGroupRepository) { this.dispatchReceipt = mappingGroupRepository.findByName(GoonjMappingDbConstants.MappingGroup_DispatchReceipt); this.distribution = mappingGroupRepository.findByName(GoonjMappingDbConstants.MappingGroup_Distribution); this.activity = mappingGroupRepository.findByName(GoonjMappingDbConstants.MappingGroup_Activity); - this.goonjEncounterMappingGroups = new MappingGroup[]{dispatch}; - } - public boolean isGoonjEncounterInAvni(String encounterType) { - return Arrays.asList(goonjEncounterMappingGroups).contains(encounterType); } } diff --git a/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/ActivityWorker.java b/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/ActivityWorker.java index a9b19f28..a31887b0 100644 --- a/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/ActivityWorker.java +++ b/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/ActivityWorker.java @@ -27,11 +27,10 @@ public ActivityWorker(AvniEncounterRepository avniEncounterRepository, AvniIgnoredConceptsRepository avniIgnoredConceptsRepository, AvniGoonjErrorService avniGoonjErrorService, IntegratingEntityStatusRepository integrationEntityStatusRepository, - GoonjMappingGroup goonjMappingGroup, ActivityRepository activityRepository, ErrorClassifier errorClassifier, @Qualifier("GoonjIntegrationSystem") IntegrationSystem integrationSystem) { super(avniEncounterRepository, avniSubjectRepository, avniIgnoredConceptsRepository, - avniGoonjErrorService, goonjMappingGroup, integrationEntityStatusRepository, + avniGoonjErrorService, integrationEntityStatusRepository, GoonjErrorType.ActivityAttributesMismatch, GoonjEntityType.Activity, Logger.getLogger(ActivityWorker.class), errorClassifier, integrationSystem); this.activityRepository = activityRepository; diff --git a/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/DispatchReceiptWorker.java b/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/DispatchReceiptWorker.java index 209b6994..0d9fc943 100644 --- a/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/DispatchReceiptWorker.java +++ b/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/DispatchReceiptWorker.java @@ -27,11 +27,10 @@ public DispatchReceiptWorker(AvniEncounterRepository avniEncounterRepository, AvniIgnoredConceptsRepository avniIgnoredConceptsRepository, AvniGoonjErrorService avniGoonjErrorService, IntegratingEntityStatusRepository integrationEntityStatusRepository, - GoonjMappingGroup goonjMappingGroup, DispatchReceiptRepository dispatchReceiptRepository, ErrorClassifier errorClassifier, @Qualifier("GoonjIntegrationSystem") IntegrationSystem integrationSystem) { super(avniEncounterRepository, avniSubjectRepository, avniIgnoredConceptsRepository, - avniGoonjErrorService, goonjMappingGroup, integrationEntityStatusRepository, + avniGoonjErrorService, integrationEntityStatusRepository, GoonjErrorType.DispatchReceiptAttributesMismatch, GoonjEntityType.DispatchReceipt, Logger.getLogger(DispatchReceiptWorker.class), errorClassifier, integrationSystem); this.dispatchReceiptRepository = dispatchReceiptRepository; diff --git a/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/DistributionWorker.java b/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/DistributionWorker.java index 3c73a242..1c2ebc77 100644 --- a/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/DistributionWorker.java +++ b/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/DistributionWorker.java @@ -27,11 +27,10 @@ public DistributionWorker(AvniEncounterRepository avniEncounterRepository, AvniIgnoredConceptsRepository avniIgnoredConceptsRepository, AvniGoonjErrorService avniGoonjErrorService, IntegratingEntityStatusRepository integrationEntityStatusRepository, - GoonjMappingGroup goonjMappingGroup, DistributionRepository distributionRepository, ErrorClassifier errorClassifier, @Qualifier("GoonjIntegrationSystem") IntegrationSystem integrationSystem) { super(avniEncounterRepository, avniSubjectRepository, avniIgnoredConceptsRepository, - avniGoonjErrorService, goonjMappingGroup, integrationEntityStatusRepository, + avniGoonjErrorService, integrationEntityStatusRepository, GoonjErrorType.DistributionAttributesMismatch, GoonjEntityType.Distribution, Logger.getLogger(DistributionWorker.class), errorClassifier, integrationSystem); this.distributionRepository = distributionRepository; diff --git a/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/GeneralEncounterWorker.java b/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/GeneralEncounterWorker.java index ad176b1f..7c4941e7 100644 --- a/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/GeneralEncounterWorker.java +++ b/goonj/src/main/java/org/avni_integration_service/goonj/worker/avni/GeneralEncounterWorker.java @@ -10,7 +10,6 @@ import org.avni_integration_service.avni.worker.ErrorRecordWorker; import org.avni_integration_service.goonj.GoonjEntityType; import org.avni_integration_service.goonj.GoonjErrorType; -import org.avni_integration_service.goonj.GoonjMappingGroup; import org.avni_integration_service.goonj.repository.GoonjBaseRepository; import org.avni_integration_service.goonj.service.AvniGoonjErrorService; import org.avni_integration_service.goonj.util.DateTimeUtil; @@ -31,7 +30,6 @@ public abstract class GeneralEncounterWorker implements ErrorRecordWorker { private final AvniSubjectRepository avniSubjectRepository; private final AvniIgnoredConceptsRepository avniIgnoredConceptsRepository; private final AvniGoonjErrorService avniGoonjErrorService; - private final GoonjMappingGroup goonjMappingGroup; private final IntegratingEntityStatusRepository integrationEntityStatusRepository; private final GoonjErrorType goonjErrorType; @@ -44,14 +42,13 @@ public abstract class GeneralEncounterWorker implements ErrorRecordWorker { public GeneralEncounterWorker(AvniEncounterRepository avniEncounterRepository, AvniSubjectRepository avniSubjectRepository, AvniIgnoredConceptsRepository avniIgnoredConceptsRepository, AvniGoonjErrorService avniGoonjErrorService, - GoonjMappingGroup goonjMappingGroup, IntegratingEntityStatusRepository integrationEntityStatusRepository, + IntegratingEntityStatusRepository integrationEntityStatusRepository, GoonjErrorType goonjErrorType, GoonjEntityType entityType, Logger logger, ErrorClassifier errorClassifier, IntegrationSystem integrationSystem) { this.avniEncounterRepository = avniEncounterRepository; this.avniSubjectRepository = avniSubjectRepository; this.avniIgnoredConceptsRepository = avniIgnoredConceptsRepository; this.avniGoonjErrorService = avniGoonjErrorService; - this.goonjMappingGroup = goonjMappingGroup; this.integrationEntityStatusRepository = integrationEntityStatusRepository; this.goonjErrorType = goonjErrorType; this.entityType = entityType; @@ -104,12 +101,6 @@ public void processError(String entityUuid) throws Exception { } public void processGeneralEncounter(GeneralEncounter generalEncounter, boolean updateSyncStatus, GoonjErrorType goonjErrorType) throws Exception { - if (goonjMappingGroup.isGoonjEncounterInAvni(generalEncounter.getEncounterType())) { - logger.debug(String.format("Skipping Avni general encounter %s because it was created from Goonj. ", generalEncounter.getEncounterType())); - updateErrorRecordAndSyncStatus(generalEncounter, updateSyncStatus, generalEncounter.getUuid()); - return; - } - removeIgnoredObservations(generalEncounter); logger.debug(String.format("Processing avni general encounter %s", generalEncounter.getUuid()));