Skip to content

Commit

Permalink
#47 | Fix compilation error due to missing import and remove unused i…
Browse files Browse the repository at this point in the history
…sGoonjEncounterInAvni()
  • Loading branch information
himeshr committed Oct 17, 2022
1 parent 96e604c commit 9ff0427
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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()));

Expand Down

0 comments on commit 9ff0427

Please sign in to comment.