@Test public void getBackboneElement() { final Observation observation = new Observation(); observation.addComponent().setCode( createCodeableConcept( "testUri2", "4711" ) ); final BackboneElement be = observation.addComponent().setCode( createCodeableConcept( "testUri", "4711" ) ); observation.addComponent().setCode( createCodeableConcept( "testUri3", "4711" ) ); Assert.assertEquals( be, utils.getBackboneElement( observation.getComponent(), "testUri", "4711" ) ); }
@Override @Nullable public IBaseBackboneElement getBackboneElement( @Nullable List<? extends IBaseBackboneElement> backboneElements, @Nonnull String system, @Nonnull String code ) { if ( backboneElements == null ) { return null; } return backboneElements.stream().map( ObservationComponentComponent.class::cast ) .filter( c -> getCodeTransformerUtils().containsCode( c.getCode(), system, code ) ) .findFirst().orElse( new ObservationComponentComponent() ); }
R4ObservationFhirToDhisTransformerUtils extends AbstractObservationFhirToDhisTransformerUtils { @Override @Nullable public IBaseBackboneElement getBackboneElement( @Nullable List<? extends IBaseBackboneElement> backboneElements, @Nonnull String system, @Nonnull String code ) { if ( backboneElements == null ) { return null; } return backboneElements.stream().map( ObservationComponentComponent.class::cast ) .filter( c -> getCodeTransformerUtils().containsCode( c.getCode(), system, code ) ) .findFirst().orElse( new ObservationComponentComponent() ); } }
R4ObservationFhirToDhisTransformerUtils extends AbstractObservationFhirToDhisTransformerUtils { @Override @Nullable public IBaseBackboneElement getBackboneElement( @Nullable List<? extends IBaseBackboneElement> backboneElements, @Nonnull String system, @Nonnull String code ) { if ( backboneElements == null ) { return null; } return backboneElements.stream().map( ObservationComponentComponent.class::cast ) .filter( c -> getCodeTransformerUtils().containsCode( c.getCode(), system, code ) ) .findFirst().orElse( new ObservationComponentComponent() ); } R4ObservationFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull R4FhirClientFhirToDhisTransformerUtils clientTransformUtils,
        @Nonnull R4CodeFhirToDhisTransformerUtils codeTransformerUtils ); }
R4ObservationFhirToDhisTransformerUtils extends AbstractObservationFhirToDhisTransformerUtils { @Override @Nullable public IBaseBackboneElement getBackboneElement( @Nullable List<? extends IBaseBackboneElement> backboneElements, @Nonnull String system, @Nonnull String code ) { if ( backboneElements == null ) { return null; } return backboneElements.stream().map( ObservationComponentComponent.class::cast ) .filter( c -> getCodeTransformerUtils().containsCode( c.getCode(), system, code ) ) .findFirst().orElse( new ObservationComponentComponent() ); } R4ObservationFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull R4FhirClientFhirToDhisTransformerUtils clientTransformUtils,
        @Nonnull R4CodeFhirToDhisTransformerUtils codeTransformerUtils ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nonnull @Override String getResourceName(); @Nullable @Override ICompositeType getCodes( @Nullable IBaseResource resource ); @Nullable @Override String getComponentText( @Nullable IBaseResource resource ); @Override @Nullable IBaseBackboneElement getBackboneElement( @Nullable List<? extends IBaseBackboneElement> backboneElements, @Nonnull String system, @Nonnull String code ); }
R4ObservationFhirToDhisTransformerUtils extends AbstractObservationFhirToDhisTransformerUtils { @Override @Nullable public IBaseBackboneElement getBackboneElement( @Nullable List<? extends IBaseBackboneElement> backboneElements, @Nonnull String system, @Nonnull String code ) { if ( backboneElements == null ) { return null; } return backboneElements.stream().map( ObservationComponentComponent.class::cast ) .filter( c -> getCodeTransformerUtils().containsCode( c.getCode(), system, code ) ) .findFirst().orElse( new ObservationComponentComponent() ); } R4ObservationFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull R4FhirClientFhirToDhisTransformerUtils clientTransformUtils,
        @Nonnull R4CodeFhirToDhisTransformerUtils codeTransformerUtils ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nonnull @Override String getResourceName(); @Nullable @Override ICompositeType getCodes( @Nullable IBaseResource resource ); @Nullable @Override String getComponentText( @Nullable IBaseResource resource ); @Override @Nullable IBaseBackboneElement getBackboneElement( @Nullable List<? extends IBaseBackboneElement> backboneElements, @Nonnull String system, @Nonnull String code );  }