@Test public void getResourceAdapterReferenceDhisFhirIdentifier() { Mockito.doReturn( request ).when( context ).getFhirRequest(); Mockito.doReturn( true ).when( request ).isDhisFhirId(); Mockito.doReturn( new ResourceSystem( FhirResourceType.PATIENT, "National ID" ) ).when( request ).getResourceSystem( Mockito.eq( FhirResourceType.PATIENT ) ); Mockito.doReturn( scriptExecution ).when( scriptExecutionContext ).getScriptExecution(); Mockito.doReturn( Collections.singletonMap( ScriptVariable.CONTEXT.getVariableName(), context ) ).when( scriptExecution ).getVariables(); Mockito.doReturn( "abcdef123456" ).when( context ).extractDhisId( "l2C0N9u2e5q" ); final Patient patient = new Patient(); patient.addIdentifier( new Identifier().setSystem( System.DHIS2_FHIR_IDENTIFIER_URI ).setValue( "l2C0N9u2e5q" ) ); final org.dhis2.fhir.adapter.dhis.model.Reference adapterReference = utils.getResourceAdapterReference( patient, "Patient" ); Assert.assertNotNull( adapterReference ); Assert.assertEquals( new org.dhis2.fhir.adapter.dhis.model.Reference( "abcdef123456", ReferenceType.ID ), adapterReference ); }
@Override protected boolean addIdentifier( @Nonnull IBaseReference reference, @Nonnull SystemCodeValue identifier ) { final Reference r = (Reference) reference; r.setIdentifier( null ); r.getIdentifier().setSystem( identifier.getSystem() ).setValue( identifier.getCode() ); return true; }
R4FhirResourceFhirToDhisTransformerUtils extends AbstractFhirResourceFhirToDhisTransformerUtils { @Override protected boolean addIdentifier( @Nonnull IBaseReference reference, @Nonnull SystemCodeValue identifier ) { final Reference r = (Reference) reference; r.setIdentifier( null ); r.getIdentifier().setSystem( identifier.getSystem() ).setValue( identifier.getCode() ); return true; } }
R4FhirResourceFhirToDhisTransformerUtils extends AbstractFhirResourceFhirToDhisTransformerUtils { @Override protected boolean addIdentifier( @Nonnull IBaseReference reference, @Nonnull SystemCodeValue identifier ) { final Reference r = (Reference) reference; r.setIdentifier( null ); r.getIdentifier().setSystem( identifier.getSystem() ).setValue( identifier.getCode() ); return true; } R4FhirResourceFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull ReferenceFhirToDhisTransformerUtils referenceUtils,
        @Nonnull SystemCodeRepository systemCodeRepository, @Nonnull FhirIdentifierUtils fhirIdentifierUtils ); }
R4FhirResourceFhirToDhisTransformerUtils extends AbstractFhirResourceFhirToDhisTransformerUtils { @Override protected boolean addIdentifier( @Nonnull IBaseReference reference, @Nonnull SystemCodeValue identifier ) { final Reference r = (Reference) reference; r.setIdentifier( null ); r.getIdentifier().setSystem( identifier.getSystem() ).setValue( identifier.getCode() ); return true; } R4FhirResourceFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull ReferenceFhirToDhisTransformerUtils referenceUtils,
        @Nonnull SystemCodeRepository systemCodeRepository, @Nonnull FhirIdentifierUtils fhirIdentifierUtils ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nonnull @Override IBaseResource createResource( @Nonnull Object resourceType ); }
R4FhirResourceFhirToDhisTransformerUtils extends AbstractFhirResourceFhirToDhisTransformerUtils { @Override protected boolean addIdentifier( @Nonnull IBaseReference reference, @Nonnull SystemCodeValue identifier ) { final Reference r = (Reference) reference; r.setIdentifier( null ); r.getIdentifier().setSystem( identifier.getSystem() ).setValue( identifier.getCode() ); return true; } R4FhirResourceFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull ReferenceFhirToDhisTransformerUtils referenceUtils,
        @Nonnull SystemCodeRepository systemCodeRepository, @Nonnull FhirIdentifierUtils fhirIdentifierUtils ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nonnull @Override IBaseResource createResource( @Nonnull Object resourceType );  }