@Test public void addSubjectResourceTypeWithoutTrackedEntityType() { final WritableProgram program = new WritableProgram(); program.setName( "Test Program" ); program.setDescription( "Test Description" ); program.setWithoutRegistration( false ); program.setStages( new ArrayList<>() ); final PlanDefinition planDefinition = new PlanDefinition(); Assert.assertTrue( transformer.addSubjectResourceType( program, planDefinition ) ); Assert.assertEquals( 0, planDefinition.getExtension().size() ); }
protected boolean addSubjectResourceType( @Nonnull Program program, @Nonnull IBaseHasExtensions resource ) { final FhirResourceType fhirResourceType = ProgramTrackedEntityTypeUtils.getTrackedEntityFhirResourceType( trackedEntityMetadataService, trackedEntityRuleRepository, program ); ResourceTypeExtensionUtils.setValue( resource, fhirResourceType, getTypeFactory() ); return program.getTrackedEntityTypeId() == null || fhirResourceType != null; }
AbstractProgramMetadataToFhirPlanDefinitionTransformer extends AbstractReadOnlyDhisMetadataToTypedFhirTransformer<AccessibleScriptedDhisMetadata, F, ProgramMetadataRule> { protected boolean addSubjectResourceType( @Nonnull Program program, @Nonnull IBaseHasExtensions resource ) { final FhirResourceType fhirResourceType = ProgramTrackedEntityTypeUtils.getTrackedEntityFhirResourceType( trackedEntityMetadataService, trackedEntityRuleRepository, program ); ResourceTypeExtensionUtils.setValue( resource, fhirResourceType, getTypeFactory() ); return program.getTrackedEntityTypeId() == null || fhirResourceType != null; } }
AbstractProgramMetadataToFhirPlanDefinitionTransformer extends AbstractReadOnlyDhisMetadataToTypedFhirTransformer<AccessibleScriptedDhisMetadata, F, ProgramMetadataRule> { protected boolean addSubjectResourceType( @Nonnull Program program, @Nonnull IBaseHasExtensions resource ) { final FhirResourceType fhirResourceType = ProgramTrackedEntityTypeUtils.getTrackedEntityFhirResourceType( trackedEntityMetadataService, trackedEntityRuleRepository, program ); ResourceTypeExtensionUtils.setValue( resource, fhirResourceType, getTypeFactory() ); return program.getTrackedEntityTypeId() == null || fhirResourceType != null; } AbstractProgramMetadataToFhirPlanDefinitionTransformer( @Nonnull ScriptExecutor scriptExecutor, @Nonnull LockManager lockManager, @Nonnull SystemRepository systemRepository, @Nonnull FhirResourceRepository fhirResourceRepository,
        @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository, @Nonnull OrganizationUnitService organizationUnitService,
        @Nonnull TrackedEntityMetadataService trackedEntityMetadataService, @Nonnull TrackedEntityRuleRepository trackedEntityRuleRepository ); }
AbstractProgramMetadataToFhirPlanDefinitionTransformer extends AbstractReadOnlyDhisMetadataToTypedFhirTransformer<AccessibleScriptedDhisMetadata, F, ProgramMetadataRule> { protected boolean addSubjectResourceType( @Nonnull Program program, @Nonnull IBaseHasExtensions resource ) { final FhirResourceType fhirResourceType = ProgramTrackedEntityTypeUtils.getTrackedEntityFhirResourceType( trackedEntityMetadataService, trackedEntityRuleRepository, program ); ResourceTypeExtensionUtils.setValue( resource, fhirResourceType, getTypeFactory() ); return program.getTrackedEntityTypeId() == null || fhirResourceType != null; } AbstractProgramMetadataToFhirPlanDefinitionTransformer( @Nonnull ScriptExecutor scriptExecutor, @Nonnull LockManager lockManager, @Nonnull SystemRepository systemRepository, @Nonnull FhirResourceRepository fhirResourceRepository,
        @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository, @Nonnull OrganizationUnitService organizationUnitService,
        @Nonnull TrackedEntityMetadataService trackedEntityMetadataService, @Nonnull TrackedEntityRuleRepository trackedEntityRuleRepository ); @Nonnull @Override DhisResourceType getDhisResourceType(); @Nonnull @Override Class<AccessibleScriptedDhisMetadata> getDhisResourceClass(); @Nonnull @Override Class<ProgramMetadataRule> getRuleClass(); }
AbstractProgramMetadataToFhirPlanDefinitionTransformer extends AbstractReadOnlyDhisMetadataToTypedFhirTransformer<AccessibleScriptedDhisMetadata, F, ProgramMetadataRule> { protected boolean addSubjectResourceType( @Nonnull Program program, @Nonnull IBaseHasExtensions resource ) { final FhirResourceType fhirResourceType = ProgramTrackedEntityTypeUtils.getTrackedEntityFhirResourceType( trackedEntityMetadataService, trackedEntityRuleRepository, program ); ResourceTypeExtensionUtils.setValue( resource, fhirResourceType, getTypeFactory() ); return program.getTrackedEntityTypeId() == null || fhirResourceType != null; } AbstractProgramMetadataToFhirPlanDefinitionTransformer( @Nonnull ScriptExecutor scriptExecutor, @Nonnull LockManager lockManager, @Nonnull SystemRepository systemRepository, @Nonnull FhirResourceRepository fhirResourceRepository,
        @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository, @Nonnull OrganizationUnitService organizationUnitService,
        @Nonnull TrackedEntityMetadataService trackedEntityMetadataService, @Nonnull TrackedEntityRuleRepository trackedEntityRuleRepository ); @Nonnull @Override DhisResourceType getDhisResourceType(); @Nonnull @Override Class<AccessibleScriptedDhisMetadata> getDhisResourceClass(); @Nonnull @Override Class<ProgramMetadataRule> getRuleClass(); static final FhirResourceType DEFAULT_SUBJECT_RESOURCE_TYPE; }