@Test public void searchFilterBasedOn() throws URISyntaxException { final SearchFilterCollector searchFilterCollector = new SearchFilterCollector( Collections.singletonMap( "based-on", Collections.singletonList( "CarePlan/hyusiofh7s8" ) ) ); final SearchFilter searchFilter = new SearchFilter( searchFilterCollector, false ); provider.initSearchFilter( FhirVersion.R4, new RuleInfo<>( questionnaireResponseRule, Collections.emptyList() ), searchFilter ); final List<String> variables = new ArrayList<>(); UriBuilder uriBuilder = new DefaultUriBuilderFactory().builder(); uriBuilder = searchFilterCollector.add( uriBuilder, variables ); Assert.assertEquals( new URI( "?enrollment=hyusiofh7s8" ), uriBuilder.build( variables ) ); }
@Override protected void initSearchFilter( @Nonnull FhirVersion fhirVersion, @Nonnull RuleInfo<ProgramStageRule> ruleInfo, @Nonnull SearchFilter searchFilter ) { super.initSearchFilter( fhirVersion, ruleInfo, searchFilter ); if ( ruleInfo.getRule().getFhirResourceType() == FhirResourceType.QUESTIONNAIRE_RESPONSE ) { searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_CANONICAL, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_URI, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_QUESTIONNAIRE, FhirResourceType.QUESTIONNAIRE, DhisResourceType.PROGRAM_STAGE_METADATA, "programStage" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON, FhirResourceType.CARE_PLAN, DhisResourceType.ENROLLMENT, "enrollment" ); searchFilter.addReference( QuestionnaireResponse.SP_PATIENT, FhirResourceType.PATIENT, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( QuestionnaireResponse.SP_SUBJECT, null, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( LocationExtensionUtils.LOCATION_SEARCH_PARAM, FhirResourceType.LOCATION, DhisResourceType.ORGANIZATION_UNIT, "orgUnit" ); } }
R4ProgramStageToFhirDataProvider extends AbstractProgramStageToFhirDataProvider { @Override protected void initSearchFilter( @Nonnull FhirVersion fhirVersion, @Nonnull RuleInfo<ProgramStageRule> ruleInfo, @Nonnull SearchFilter searchFilter ) { super.initSearchFilter( fhirVersion, ruleInfo, searchFilter ); if ( ruleInfo.getRule().getFhirResourceType() == FhirResourceType.QUESTIONNAIRE_RESPONSE ) { searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_CANONICAL, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_URI, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_QUESTIONNAIRE, FhirResourceType.QUESTIONNAIRE, DhisResourceType.PROGRAM_STAGE_METADATA, "programStage" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON, FhirResourceType.CARE_PLAN, DhisResourceType.ENROLLMENT, "enrollment" ); searchFilter.addReference( QuestionnaireResponse.SP_PATIENT, FhirResourceType.PATIENT, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( QuestionnaireResponse.SP_SUBJECT, null, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( LocationExtensionUtils.LOCATION_SEARCH_PARAM, FhirResourceType.LOCATION, DhisResourceType.ORGANIZATION_UNIT, "orgUnit" ); } } }
R4ProgramStageToFhirDataProvider extends AbstractProgramStageToFhirDataProvider { @Override protected void initSearchFilter( @Nonnull FhirVersion fhirVersion, @Nonnull RuleInfo<ProgramStageRule> ruleInfo, @Nonnull SearchFilter searchFilter ) { super.initSearchFilter( fhirVersion, ruleInfo, searchFilter ); if ( ruleInfo.getRule().getFhirResourceType() == FhirResourceType.QUESTIONNAIRE_RESPONSE ) { searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_CANONICAL, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_URI, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_QUESTIONNAIRE, FhirResourceType.QUESTIONNAIRE, DhisResourceType.PROGRAM_STAGE_METADATA, "programStage" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON, FhirResourceType.CARE_PLAN, DhisResourceType.ENROLLMENT, "enrollment" ); searchFilter.addReference( QuestionnaireResponse.SP_PATIENT, FhirResourceType.PATIENT, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( QuestionnaireResponse.SP_SUBJECT, null, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( LocationExtensionUtils.LOCATION_SEARCH_PARAM, FhirResourceType.LOCATION, DhisResourceType.ORGANIZATION_UNIT, "orgUnit" ); } } R4ProgramStageToFhirDataProvider( @Nonnull ScriptExecutor scriptExecutor, @Nonnull ProgramMetadataService metadataService, @Nonnull EventService eventService ); }
R4ProgramStageToFhirDataProvider extends AbstractProgramStageToFhirDataProvider { @Override protected void initSearchFilter( @Nonnull FhirVersion fhirVersion, @Nonnull RuleInfo<ProgramStageRule> ruleInfo, @Nonnull SearchFilter searchFilter ) { super.initSearchFilter( fhirVersion, ruleInfo, searchFilter ); if ( ruleInfo.getRule().getFhirResourceType() == FhirResourceType.QUESTIONNAIRE_RESPONSE ) { searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_CANONICAL, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_URI, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_QUESTIONNAIRE, FhirResourceType.QUESTIONNAIRE, DhisResourceType.PROGRAM_STAGE_METADATA, "programStage" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON, FhirResourceType.CARE_PLAN, DhisResourceType.ENROLLMENT, "enrollment" ); searchFilter.addReference( QuestionnaireResponse.SP_PATIENT, FhirResourceType.PATIENT, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( QuestionnaireResponse.SP_SUBJECT, null, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( LocationExtensionUtils.LOCATION_SEARCH_PARAM, FhirResourceType.LOCATION, DhisResourceType.ORGANIZATION_UNIT, "orgUnit" ); } } R4ProgramStageToFhirDataProvider( @Nonnull ScriptExecutor scriptExecutor, @Nonnull ProgramMetadataService metadataService, @Nonnull EventService eventService ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); }
R4ProgramStageToFhirDataProvider extends AbstractProgramStageToFhirDataProvider { @Override protected void initSearchFilter( @Nonnull FhirVersion fhirVersion, @Nonnull RuleInfo<ProgramStageRule> ruleInfo, @Nonnull SearchFilter searchFilter ) { super.initSearchFilter( fhirVersion, ruleInfo, searchFilter ); if ( ruleInfo.getRule().getFhirResourceType() == FhirResourceType.QUESTIONNAIRE_RESPONSE ) { searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_CANONICAL, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON + "." + CarePlan.SP_INSTANTIATES_URI, FhirResourceType.PLAN_DEFINITION, DhisResourceType.PROGRAM_METADATA, "program" ); searchFilter.addReference( QuestionnaireResponse.SP_QUESTIONNAIRE, FhirResourceType.QUESTIONNAIRE, DhisResourceType.PROGRAM_STAGE_METADATA, "programStage" ); searchFilter.addReference( QuestionnaireResponse.SP_BASED_ON, FhirResourceType.CARE_PLAN, DhisResourceType.ENROLLMENT, "enrollment" ); searchFilter.addReference( QuestionnaireResponse.SP_PATIENT, FhirResourceType.PATIENT, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( QuestionnaireResponse.SP_SUBJECT, null, DhisResourceType.TRACKED_ENTITY, "trackedEntityInstance" ); searchFilter.addReference( LocationExtensionUtils.LOCATION_SEARCH_PARAM, FhirResourceType.LOCATION, DhisResourceType.ORGANIZATION_UNIT, "orgUnit" ); } } R4ProgramStageToFhirDataProvider( @Nonnull ScriptExecutor scriptExecutor, @Nonnull ProgramMetadataService metadataService, @Nonnull EventService eventService ); @Nonnull @Override Set<FhirVersion> getFhirVersions();  }