@Test public void createBatchRequestIfNoneExist() { final Bundle bundle = new Bundle(); bundle.setType( Bundle.BundleType.BATCH ); bundle.addEntry().setResource( new Patient() ).getRequest().setMethod( Bundle.HTTPVerb.POST ).setIfNoneExist( "xyz" ); final FhirBatchRequest batchRequest = provider.createBatchRequest( bundle ); Assert.assertFalse( batchRequest.isTransactional() ); Assert.assertEquals( 1, batchRequest.getOperations().size() ); Assert.assertTrue( batchRequest.getOperations().get( 0 ).isProcessed() ); Assert.assertNotNull( batchRequest.getOperations().get( 0 ).getResult().getIssue() ); }
@Nonnull @Override protected FhirBatchRequest createBatchRequest( @Nonnull Bundle bundle ) { if ( bundle.getType() != Bundle.BundleType.BATCH ) { throw new InvalidRequestException( "Only batch bundles are supported currently." ); } final List<FhirOperation> operations = new ArrayList<>(); bundle.getEntry().forEach( entry -> { final FhirOperation operation = createOperation( entry.getFullUrl(), entry.getResource(), entry.getRequest().getMethodElement().getValueAsString(), entry.getRequest().getUrl() ); if ( !operation.isProcessed() && ( entry.getRequest().hasIfMatch() || entry.getRequest().hasIfModifiedSince() || entry.getRequest().hasIfNoneExist() || entry.getRequest().hasIfNoneMatch() ) ) { operation.getResult().badRequest( "If conditions on request are not supported." ); } operations.add( operation ); } ); return new FhirBatchRequest( operations, false ); }
R4BundleResourceProvider extends AbstractBundleResourceProvider<Bundle> { @Nonnull @Override protected FhirBatchRequest createBatchRequest( @Nonnull Bundle bundle ) { if ( bundle.getType() != Bundle.BundleType.BATCH ) { throw new InvalidRequestException( "Only batch bundles are supported currently." ); } final List<FhirOperation> operations = new ArrayList<>(); bundle.getEntry().forEach( entry -> { final FhirOperation operation = createOperation( entry.getFullUrl(), entry.getResource(), entry.getRequest().getMethodElement().getValueAsString(), entry.getRequest().getUrl() ); if ( !operation.isProcessed() && ( entry.getRequest().hasIfMatch() || entry.getRequest().hasIfModifiedSince() || entry.getRequest().hasIfNoneExist() || entry.getRequest().hasIfNoneMatch() ) ) { operation.getResult().badRequest( "If conditions on request are not supported." ); } operations.add( operation ); } ); return new FhirBatchRequest( operations, false ); } }
R4BundleResourceProvider extends AbstractBundleResourceProvider<Bundle> { @Nonnull @Override protected FhirBatchRequest createBatchRequest( @Nonnull Bundle bundle ) { if ( bundle.getType() != Bundle.BundleType.BATCH ) { throw new InvalidRequestException( "Only batch bundles are supported currently." ); } final List<FhirOperation> operations = new ArrayList<>(); bundle.getEntry().forEach( entry -> { final FhirOperation operation = createOperation( entry.getFullUrl(), entry.getResource(), entry.getRequest().getMethodElement().getValueAsString(), entry.getRequest().getUrl() ); if ( !operation.isProcessed() && ( entry.getRequest().hasIfMatch() || entry.getRequest().hasIfModifiedSince() || entry.getRequest().hasIfNoneExist() || entry.getRequest().hasIfNoneMatch() ) ) { operation.getResult().badRequest( "If conditions on request are not supported." ); } operations.add( operation ); } ); return new FhirBatchRequest( operations, false ); } R4BundleResourceProvider( @Nonnull FhirClientResourceRepository fhirClientResourceRepository, @Nonnull FhirClientSystemRepository fhirClientSystemRepository,
        @Nonnull FhirRepository fhirRepository, @Nonnull DhisRepository dhisRepository, @Nonnull RequestCacheService requestCacheService ); }
R4BundleResourceProvider extends AbstractBundleResourceProvider<Bundle> { @Nonnull @Override protected FhirBatchRequest createBatchRequest( @Nonnull Bundle bundle ) { if ( bundle.getType() != Bundle.BundleType.BATCH ) { throw new InvalidRequestException( "Only batch bundles are supported currently." ); } final List<FhirOperation> operations = new ArrayList<>(); bundle.getEntry().forEach( entry -> { final FhirOperation operation = createOperation( entry.getFullUrl(), entry.getResource(), entry.getRequest().getMethodElement().getValueAsString(), entry.getRequest().getUrl() ); if ( !operation.isProcessed() && ( entry.getRequest().hasIfMatch() || entry.getRequest().hasIfModifiedSince() || entry.getRequest().hasIfNoneExist() || entry.getRequest().hasIfNoneMatch() ) ) { operation.getResult().badRequest( "If conditions on request are not supported." ); } operations.add( operation ); } ); return new FhirBatchRequest( operations, false ); } R4BundleResourceProvider( @Nonnull FhirClientResourceRepository fhirClientResourceRepository, @Nonnull FhirClientSystemRepository fhirClientSystemRepository,
        @Nonnull FhirRepository fhirRepository, @Nonnull DhisRepository dhisRepository, @Nonnull RequestCacheService requestCacheService ); @Nonnull @Override FhirVersion getFhirVersion(); @Nonnull @Transaction Bundle process( @Nonnull RequestDetails requestDetails, @TransactionParam Bundle bundle ); }
R4BundleResourceProvider extends AbstractBundleResourceProvider<Bundle> { @Nonnull @Override protected FhirBatchRequest createBatchRequest( @Nonnull Bundle bundle ) { if ( bundle.getType() != Bundle.BundleType.BATCH ) { throw new InvalidRequestException( "Only batch bundles are supported currently." ); } final List<FhirOperation> operations = new ArrayList<>(); bundle.getEntry().forEach( entry -> { final FhirOperation operation = createOperation( entry.getFullUrl(), entry.getResource(), entry.getRequest().getMethodElement().getValueAsString(), entry.getRequest().getUrl() ); if ( !operation.isProcessed() && ( entry.getRequest().hasIfMatch() || entry.getRequest().hasIfModifiedSince() || entry.getRequest().hasIfNoneExist() || entry.getRequest().hasIfNoneMatch() ) ) { operation.getResult().badRequest( "If conditions on request are not supported." ); } operations.add( operation ); } ); return new FhirBatchRequest( operations, false ); } R4BundleResourceProvider( @Nonnull FhirClientResourceRepository fhirClientResourceRepository, @Nonnull FhirClientSystemRepository fhirClientSystemRepository,
        @Nonnull FhirRepository fhirRepository, @Nonnull DhisRepository dhisRepository, @Nonnull RequestCacheService requestCacheService ); @Nonnull @Override FhirVersion getFhirVersion(); @Nonnull @Transaction Bundle process( @Nonnull RequestDetails requestDetails, @TransactionParam Bundle bundle );  }