@Test public void nullPatient() { Assert.assertNull( utils.getBirthPlaceAddress( null ) ); }
@Nullable @Override public ICompositeType getBirthPlaceAddress( @Nullable IDomainResource patient ) { if ( patient == null ) { return null; } final Patient p = (Patient) patient; final List<Extension> birthPlaceExtensions = p.getExtensionsByUrl( BIRTH_PLACE_URI ); if ( birthPlaceExtensions.isEmpty() ) { return null; } if ( birthPlaceExtensions.size() > 1 ) { throw new TransformerMappingException( "Patient contains " + birthPlaceExtensions.size() + " birth places." ); } final Type value = birthPlaceExtensions.get( 0 ).getValue(); if ( (value == null) || value.isEmpty() ) { return null; } if ( !(value instanceof Address) ) { throw new TransformerMappingException( "Patient contains birth place that is no address: " + value.fhirType() ); } return (Address) value; }
Dstu3PatientFhirToDhisTransformerUtils extends AbstractPatientFhirToDhisTransformerUtils { @Nullable @Override public ICompositeType getBirthPlaceAddress( @Nullable IDomainResource patient ) { if ( patient == null ) { return null; } final Patient p = (Patient) patient; final List<Extension> birthPlaceExtensions = p.getExtensionsByUrl( BIRTH_PLACE_URI ); if ( birthPlaceExtensions.isEmpty() ) { return null; } if ( birthPlaceExtensions.size() > 1 ) { throw new TransformerMappingException( "Patient contains " + birthPlaceExtensions.size() + " birth places." ); } final Type value = birthPlaceExtensions.get( 0 ).getValue(); if ( (value == null) || value.isEmpty() ) { return null; } if ( !(value instanceof Address) ) { throw new TransformerMappingException( "Patient contains birth place that is no address: " + value.fhirType() ); } return (Address) value; } }
Dstu3PatientFhirToDhisTransformerUtils extends AbstractPatientFhirToDhisTransformerUtils { @Nullable @Override public ICompositeType getBirthPlaceAddress( @Nullable IDomainResource patient ) { if ( patient == null ) { return null; } final Patient p = (Patient) patient; final List<Extension> birthPlaceExtensions = p.getExtensionsByUrl( BIRTH_PLACE_URI ); if ( birthPlaceExtensions.isEmpty() ) { return null; } if ( birthPlaceExtensions.size() > 1 ) { throw new TransformerMappingException( "Patient contains " + birthPlaceExtensions.size() + " birth places." ); } final Type value = birthPlaceExtensions.get( 0 ).getValue(); if ( (value == null) || value.isEmpty() ) { return null; } if ( !(value instanceof Address) ) { throw new TransformerMappingException( "Patient contains birth place that is no address: " + value.fhirType() ); } return (Address) value; } Dstu3PatientFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext ); }
Dstu3PatientFhirToDhisTransformerUtils extends AbstractPatientFhirToDhisTransformerUtils { @Nullable @Override public ICompositeType getBirthPlaceAddress( @Nullable IDomainResource patient ) { if ( patient == null ) { return null; } final Patient p = (Patient) patient; final List<Extension> birthPlaceExtensions = p.getExtensionsByUrl( BIRTH_PLACE_URI ); if ( birthPlaceExtensions.isEmpty() ) { return null; } if ( birthPlaceExtensions.size() > 1 ) { throw new TransformerMappingException( "Patient contains " + birthPlaceExtensions.size() + " birth places." ); } final Type value = birthPlaceExtensions.get( 0 ).getValue(); if ( (value == null) || value.isEmpty() ) { return null; } if ( !(value instanceof Address) ) { throw new TransformerMappingException( "Patient contains birth place that is no address: " + value.fhirType() ); } return (Address) value; } Dstu3PatientFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nullable @Override ICompositeType getBirthPlaceAddress( @Nullable IDomainResource patient ); }
Dstu3PatientFhirToDhisTransformerUtils extends AbstractPatientFhirToDhisTransformerUtils { @Nullable @Override public ICompositeType getBirthPlaceAddress( @Nullable IDomainResource patient ) { if ( patient == null ) { return null; } final Patient p = (Patient) patient; final List<Extension> birthPlaceExtensions = p.getExtensionsByUrl( BIRTH_PLACE_URI ); if ( birthPlaceExtensions.isEmpty() ) { return null; } if ( birthPlaceExtensions.size() > 1 ) { throw new TransformerMappingException( "Patient contains " + birthPlaceExtensions.size() + " birth places." ); } final Type value = birthPlaceExtensions.get( 0 ).getValue(); if ( (value == null) || value.isEmpty() ) { return null; } if ( !(value instanceof Address) ) { throw new TransformerMappingException( "Patient contains birth place that is no address: " + value.fhirType() ); } return (Address) value; } Dstu3PatientFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nullable @Override ICompositeType getBirthPlaceAddress( @Nullable IDomainResource patient );  }