@Test public void extractDhisIdNull() { Assert.assertNull( context.extractDhisId( null ) ); }
@Nullable @Override public String extractDhisId( @Nullable Object idElement ) { if ( idElement == null ) { return null; } final String id; if ( idElement instanceof IIdType ) { final IIdType idType = (IIdType) idElement; if ( idType.isLocal() ) { return null; } id = idType.getIdPart(); } else { id = idElement.toString(); } if ( id == null ) { return null; } if ( DhisResourceId.isValidId( id ) ) { return id; } try { return DhisFhirResourceId.parse( id ).getId(); } catch ( IllegalArgumentException e ) { throw new TransformerDataException( "Not a valid DHIS2 FHIR ID: " + id, e ); } }
FhirToDhisTransformerContextImpl implements FhirToDhisTransformerContext { @Nullable @Override public String extractDhisId( @Nullable Object idElement ) { if ( idElement == null ) { return null; } final String id; if ( idElement instanceof IIdType ) { final IIdType idType = (IIdType) idElement; if ( idType.isLocal() ) { return null; } id = idType.getIdPart(); } else { id = idElement.toString(); } if ( id == null ) { return null; } if ( DhisResourceId.isValidId( id ) ) { return id; } try { return DhisFhirResourceId.parse( id ).getId(); } catch ( IllegalArgumentException e ) { throw new TransformerDataException( "Not a valid DHIS2 FHIR ID: " + id, e ); } } }
FhirToDhisTransformerContextImpl implements FhirToDhisTransformerContext { @Nullable @Override public String extractDhisId( @Nullable Object idElement ) { if ( idElement == null ) { return null; } final String id; if ( idElement instanceof IIdType ) { final IIdType idType = (IIdType) idElement; if ( idType.isLocal() ) { return null; } id = idType.getIdPart(); } else { id = idElement.toString(); } if ( id == null ) { return null; } if ( DhisResourceId.isValidId( id ) ) { return id; } try { return DhisFhirResourceId.parse( id ).getId(); } catch ( IllegalArgumentException e ) { throw new TransformerDataException( "Not a valid DHIS2 FHIR ID: " + id, e ); } } FhirToDhisTransformerContextImpl( @Nonnull FhirRequest fhirRequest, boolean creationDisabled ); }
FhirToDhisTransformerContextImpl implements FhirToDhisTransformerContext { @Nullable @Override public String extractDhisId( @Nullable Object idElement ) { if ( idElement == null ) { return null; } final String id; if ( idElement instanceof IIdType ) { final IIdType idType = (IIdType) idElement; if ( idType.isLocal() ) { return null; } id = idType.getIdPart(); } else { id = idElement.toString(); } if ( id == null ) { return null; } if ( DhisResourceId.isValidId( id ) ) { return id; } try { return DhisFhirResourceId.parse( id ).getId(); } catch ( IllegalArgumentException e ) { throw new TransformerDataException( "Not a valid DHIS2 FHIR ID: " + id, e ); } } FhirToDhisTransformerContextImpl( @Nonnull FhirRequest fhirRequest, boolean creationDisabled ); @Nonnull @Override FhirRequest getFhirRequest(); @Nullable @Override Reference createReference( @Nullable String value, @Nonnull Object referenceType ); @Nullable @Override String extractDhisId( @Nullable Object idElement ); @Nonnull @Override ZonedDateTime now(); @Override boolean isCreationDisabled(); @Override void fail( @Nonnull String message ); @Nullable @Override String getDhisUsername(); @Nonnull @Override FhirVersion getFhirVersion(); @Override void setAttribute( @Nonnull String name, @Nullable Object value ); @Nullable @Override Object getAttribute( @Nonnull String name ); }
FhirToDhisTransformerContextImpl implements FhirToDhisTransformerContext { @Nullable @Override public String extractDhisId( @Nullable Object idElement ) { if ( idElement == null ) { return null; } final String id; if ( idElement instanceof IIdType ) { final IIdType idType = (IIdType) idElement; if ( idType.isLocal() ) { return null; } id = idType.getIdPart(); } else { id = idElement.toString(); } if ( id == null ) { return null; } if ( DhisResourceId.isValidId( id ) ) { return id; } try { return DhisFhirResourceId.parse( id ).getId(); } catch ( IllegalArgumentException e ) { throw new TransformerDataException( "Not a valid DHIS2 FHIR ID: " + id, e ); } } FhirToDhisTransformerContextImpl( @Nonnull FhirRequest fhirRequest, boolean creationDisabled ); @Nonnull @Override FhirRequest getFhirRequest(); @Nullable @Override Reference createReference( @Nullable String value, @Nonnull Object referenceType ); @Nullable @Override String extractDhisId( @Nullable Object idElement ); @Nonnull @Override ZonedDateTime now(); @Override boolean isCreationDisabled(); @Override void fail( @Nonnull String message ); @Nullable @Override String getDhisUsername(); @Nonnull @Override FhirVersion getFhirVersion(); @Override void setAttribute( @Nonnull String name, @Nullable Object value ); @Nullable @Override Object getAttribute( @Nonnull String name );  }