@Test public void containsMappingCodeNotFound() { final System system1 = new System(); system1.setSystemUri( "http: final SystemCode systemCode1 = new SystemCode(); systemCode1.setSystemCode( "C3" ); systemCode1.setSystem( system1 ); systemCode1.setCode( new Code() ); final System system2 = new System(); system2.setSystemUri( "http: final SystemCode systemCode2 = new SystemCode(); systemCode2.setSystemCode( "C4" ); systemCode2.setSystem( system2 ); systemCode2.setCode( new Code() ); Mockito.doReturn( Arrays.asList( systemCode1, systemCode2 ) ).when( systemCodeRepository ) .findAllByCodes( Mockito.eq( Arrays.asList( "X_20", "X_21" ) ) ); Assert.assertFalse( utils.containsMappingCode( new CodeableConcept().addCoding( new Coding().setSystem( "http: .addCoding( new Coding().setSystem( "http: }
@Override public boolean containsMappingCode( @Nullable ICompositeType codeableConcept, @Nullable Object mappingCodes ) { if ( mappingCodes == null ) { throw new IllegalArgumentException( "Codes must be specified." ); } if ( (codeableConcept == null) || codeableConcept.isEmpty() ) { return false; } final List<String> convertedCodes = ScriptArgUtils.extractStringArray( mappingCodes ); if ( CollectionUtils.isEmpty( convertedCodes ) ) { return false; } final Set<String> checkedCodes = new HashSet<>(); final Collection<SystemCode> systemCodes = getSystemCodeRepository().findAllByCodes( convertedCodes ); for ( final SystemCode systemCode : systemCodes ) { if ( containsCode( codeableConcept, systemCode.getSystem().getSystemUri(), systemCode.getSystemCode() ) ) { return true; } checkedCodes.add( systemCode.getCode().getCode() ); } if ( logger.isDebugEnabled() && (checkedCodes.size() < convertedCodes.size()) ) { logger.info( "Codes have not been defined: " + Sets.difference( new HashSet<>( convertedCodes ), checkedCodes ) ); } return false; }
R4CodeFhirToDhisTransformerUtils extends AbstractCodeFhirToDhisTransformerUtils { @Override public boolean containsMappingCode( @Nullable ICompositeType codeableConcept, @Nullable Object mappingCodes ) { if ( mappingCodes == null ) { throw new IllegalArgumentException( "Codes must be specified." ); } if ( (codeableConcept == null) || codeableConcept.isEmpty() ) { return false; } final List<String> convertedCodes = ScriptArgUtils.extractStringArray( mappingCodes ); if ( CollectionUtils.isEmpty( convertedCodes ) ) { return false; } final Set<String> checkedCodes = new HashSet<>(); final Collection<SystemCode> systemCodes = getSystemCodeRepository().findAllByCodes( convertedCodes ); for ( final SystemCode systemCode : systemCodes ) { if ( containsCode( codeableConcept, systemCode.getSystem().getSystemUri(), systemCode.getSystemCode() ) ) { return true; } checkedCodes.add( systemCode.getCode().getCode() ); } if ( logger.isDebugEnabled() && (checkedCodes.size() < convertedCodes.size()) ) { logger.info( "Codes have not been defined: " + Sets.difference( new HashSet<>( convertedCodes ), checkedCodes ) ); } return false; } }
R4CodeFhirToDhisTransformerUtils extends AbstractCodeFhirToDhisTransformerUtils { @Override public boolean containsMappingCode( @Nullable ICompositeType codeableConcept, @Nullable Object mappingCodes ) { if ( mappingCodes == null ) { throw new IllegalArgumentException( "Codes must be specified." ); } if ( (codeableConcept == null) || codeableConcept.isEmpty() ) { return false; } final List<String> convertedCodes = ScriptArgUtils.extractStringArray( mappingCodes ); if ( CollectionUtils.isEmpty( convertedCodes ) ) { return false; } final Set<String> checkedCodes = new HashSet<>(); final Collection<SystemCode> systemCodes = getSystemCodeRepository().findAllByCodes( convertedCodes ); for ( final SystemCode systemCode : systemCodes ) { if ( containsCode( codeableConcept, systemCode.getSystem().getSystemUri(), systemCode.getSystemCode() ) ) { return true; } checkedCodes.add( systemCode.getCode().getCode() ); } if ( logger.isDebugEnabled() && (checkedCodes.size() < convertedCodes.size()) ) { logger.info( "Codes have not been defined: " + Sets.difference( new HashSet<>( convertedCodes ), checkedCodes ) ); } return false; } R4CodeFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext,
        @Nonnull CodeRepository codeRepository,
        @Nonnull SystemCodeRepository systemCodeRepository ); }
R4CodeFhirToDhisTransformerUtils extends AbstractCodeFhirToDhisTransformerUtils { @Override public boolean containsMappingCode( @Nullable ICompositeType codeableConcept, @Nullable Object mappingCodes ) { if ( mappingCodes == null ) { throw new IllegalArgumentException( "Codes must be specified." ); } if ( (codeableConcept == null) || codeableConcept.isEmpty() ) { return false; } final List<String> convertedCodes = ScriptArgUtils.extractStringArray( mappingCodes ); if ( CollectionUtils.isEmpty( convertedCodes ) ) { return false; } final Set<String> checkedCodes = new HashSet<>(); final Collection<SystemCode> systemCodes = getSystemCodeRepository().findAllByCodes( convertedCodes ); for ( final SystemCode systemCode : systemCodes ) { if ( containsCode( codeableConcept, systemCode.getSystem().getSystemUri(), systemCode.getSystemCode() ) ) { return true; } checkedCodes.add( systemCode.getCode().getCode() ); } if ( logger.isDebugEnabled() && (checkedCodes.size() < convertedCodes.size()) ) { logger.info( "Codes have not been defined: " + Sets.difference( new HashSet<>( convertedCodes ), checkedCodes ) ); } return false; } R4CodeFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext,
        @Nonnull CodeRepository codeRepository,
        @Nonnull SystemCodeRepository systemCodeRepository ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nonnull @Override List<SystemCodeValue> getSystemCodeValues( @Nullable ICompositeType codeableConcept ); @Override @Nullable String getCode( @Nullable ICompositeType codeableConcept, @Nullable String system ); @Override boolean containsMappingCode( @Nullable ICompositeType codeableConcept, @Nullable Object mappingCodes ); @Override boolean containsCode( @Nullable ICompositeType codeableConcept, @Nullable String system, @Nonnull String code ); }
R4CodeFhirToDhisTransformerUtils extends AbstractCodeFhirToDhisTransformerUtils { @Override public boolean containsMappingCode( @Nullable ICompositeType codeableConcept, @Nullable Object mappingCodes ) { if ( mappingCodes == null ) { throw new IllegalArgumentException( "Codes must be specified." ); } if ( (codeableConcept == null) || codeableConcept.isEmpty() ) { return false; } final List<String> convertedCodes = ScriptArgUtils.extractStringArray( mappingCodes ); if ( CollectionUtils.isEmpty( convertedCodes ) ) { return false; } final Set<String> checkedCodes = new HashSet<>(); final Collection<SystemCode> systemCodes = getSystemCodeRepository().findAllByCodes( convertedCodes ); for ( final SystemCode systemCode : systemCodes ) { if ( containsCode( codeableConcept, systemCode.getSystem().getSystemUri(), systemCode.getSystemCode() ) ) { return true; } checkedCodes.add( systemCode.getCode().getCode() ); } if ( logger.isDebugEnabled() && (checkedCodes.size() < convertedCodes.size()) ) { logger.info( "Codes have not been defined: " + Sets.difference( new HashSet<>( convertedCodes ), checkedCodes ) ); } return false; } R4CodeFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext,
        @Nonnull CodeRepository codeRepository,
        @Nonnull SystemCodeRepository systemCodeRepository ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nonnull @Override List<SystemCodeValue> getSystemCodeValues( @Nullable ICompositeType codeableConcept ); @Override @Nullable String getCode( @Nullable ICompositeType codeableConcept, @Nullable String system ); @Override boolean containsMappingCode( @Nullable ICompositeType codeableConcept, @Nullable Object mappingCodes ); @Override boolean containsCode( @Nullable ICompositeType codeableConcept, @Nullable String system, @Nonnull String code );  }