Fix for bean scope inconsistenices

This commit is contained in:
Nick Goupinets 2020-11-25 17:37:37 -05:00
parent 5f97428d38
commit 03643a7b3c
3 changed files with 15 additions and 1 deletions

View File

@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.mdm.config;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.mdm.api.IMdmChannelSubmitterSvc;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.api.IMdmSubmitSvc;
import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator;
import ca.uhn.fhir.jpa.dao.mdm.MdmLinkDeleteSvc;
@ -31,6 +32,7 @@ import ca.uhn.fhir.jpa.mdm.svc.MdmGoldenResourceDeletingSvc;
import ca.uhn.fhir.jpa.mdm.svc.MdmSearchParamSvc;
import ca.uhn.fhir.jpa.mdm.svc.MdmSubmitSvcImpl;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelFactory;
import ca.uhn.fhir.mdm.util.MessageHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
@ -70,7 +72,7 @@ public class MdmSubmitterConfig {
}
@Bean
IMdmSubmitSvc mdmBatchService() {
IMdmSubmitSvc mdmBatchService(IMdmSettings theMdmSetting) {
return new MdmSubmitSvcImpl();
}
}

View File

@ -50,6 +50,7 @@ import java.util.List;
import java.util.UUID;
public class MdmSubmitSvcImpl implements IMdmSubmitSvc {
private static final Logger ourLog = Logs.getMdmTroubleshootingLog();
@Autowired
@ -148,6 +149,11 @@ public class MdmSubmitSvcImpl implements IMdmSubmitSvc {
return 1;
}
@Override
public void setMdmSettings(IMdmSettings theMdmSettings) {
myMdmSettings = theMdmSettings;
}
private void validateTargetType(String theResourceType) {
if(!myMdmSettings.getMdmRules().getMdmTypes().contains(theResourceType)) {
throw new InvalidRequestException(ProviderConstants.OPERATION_MDM_SUBMIT + " does not support resource type: " + theResourceType);

View File

@ -70,4 +70,10 @@ public interface IMdmSubmitSvc {
*/
long submitTargetToMdm(IIdType theId);
/**
* This setter exists to allow imported modules to override settings.
*
* @param theMdmSettings Settings to set
*/
void setMdmSettings(IMdmSettings theMdmSettings);
}