@Test public void getRequestMethodCreate() { final FhirRepositoryOperation operation = new FhirRepositoryOperation( FhirRepositoryOperationType.CREATE ); Assert.assertEquals( FhirRequestMethod.CREATE, repository.getRequestMethod( operation ) ); }
@Nonnull protected FhirRequestMethod getRequestMethod( @Nonnull FhirRepositoryOperation fhirRepositoryOperation ) { switch ( fhirRepositoryOperation.getOperationType() ) { case CREATE: return FhirRequestMethod.CREATE; case UPDATE: return FhirRequestMethod.UPDATE; case CREATE_OR_UPDATE: return FhirRequestMethod.CREATE_OR_UPDATE; default: throw new AssertionError( "Unhandled operation type: " + fhirRepositoryOperation.getOperationType() ); } }
FhirRepositoryImpl implements FhirRepository { @Nonnull protected FhirRequestMethod getRequestMethod( @Nonnull FhirRepositoryOperation fhirRepositoryOperation ) { switch ( fhirRepositoryOperation.getOperationType() ) { case CREATE: return FhirRequestMethod.CREATE; case UPDATE: return FhirRequestMethod.UPDATE; case CREATE_OR_UPDATE: return FhirRequestMethod.CREATE_OR_UPDATE; default: throw new AssertionError( "Unhandled operation type: " + fhirRepositoryOperation.getOperationType() ); } } }
FhirRepositoryImpl implements FhirRepository { @Nonnull protected FhirRequestMethod getRequestMethod( @Nonnull FhirRepositoryOperation fhirRepositoryOperation ) { switch ( fhirRepositoryOperation.getOperationType() ) { case CREATE: return FhirRequestMethod.CREATE; case UPDATE: return FhirRequestMethod.UPDATE; case CREATE_OR_UPDATE: return FhirRequestMethod.CREATE_OR_UPDATE; default: throw new AssertionError( "Unhandled operation type: " + fhirRepositoryOperation.getOperationType() ); } } FhirRepositoryImpl( @Nonnull AuthorizationContext authorizationContext,
        @Nonnull LockManager lockManager, @Nonnull RequestCacheService requestCacheService,
        @Nonnull FhirClientSystemRepository fhirClientSystemRepository,
        @Nonnull FhirClientResourceRepository fhirClientResourceRepository,
        @Nonnull SubscriptionFhirResourceRepository subscriptionFhirResourceRepository,
        @Nonnull StoredFhirResourceService storedItemService,
        @Nonnull FhirResourceRepository fhirResourceRepository,
        @Nonnull FhirToDhisTransformerService fhirToDhisTransformerService,
        @Nonnull DhisResourceRepository dhisResourceRepository,
        @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository ); }
FhirRepositoryImpl implements FhirRepository { @Nonnull protected FhirRequestMethod getRequestMethod( @Nonnull FhirRepositoryOperation fhirRepositoryOperation ) { switch ( fhirRepositoryOperation.getOperationType() ) { case CREATE: return FhirRequestMethod.CREATE; case UPDATE: return FhirRequestMethod.UPDATE; case CREATE_OR_UPDATE: return FhirRequestMethod.CREATE_OR_UPDATE; default: throw new AssertionError( "Unhandled operation type: " + fhirRepositoryOperation.getOperationType() ); } } FhirRepositoryImpl( @Nonnull AuthorizationContext authorizationContext,
        @Nonnull LockManager lockManager, @Nonnull RequestCacheService requestCacheService,
        @Nonnull FhirClientSystemRepository fhirClientSystemRepository,
        @Nonnull FhirClientResourceRepository fhirClientResourceRepository,
        @Nonnull SubscriptionFhirResourceRepository subscriptionFhirResourceRepository,
        @Nonnull StoredFhirResourceService storedItemService,
        @Nonnull FhirResourceRepository fhirResourceRepository,
        @Nonnull FhirToDhisTransformerService fhirToDhisTransformerService,
        @Nonnull DhisResourceRepository dhisResourceRepository,
        @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository ); @Override @Nullable @HystrixCommand( ignoreExceptions = { DhisConflictException.class, TransformerDataException.class, TransformerMappingException.class, TrackedEntityInstanceNotFoundException.class, DhisDataExistsException.class, UnauthorizedException.class } ) @Transactional( propagation = Propagation.NOT_SUPPORTED ) FhirRepositoryOperationOutcome save( @Nonnull FhirClientResource fhirClientResource, @Nonnull IBaseResource resource, @Nullable FhirRepositoryOperation fhirRepositoryOperation ); @Override @HystrixCommand( ignoreExceptions = { DhisConflictException.class, TransformerDataException.class, TransformerMappingException.class, TrackedEntityInstanceNotFoundException.class, DhisDataExistsException.class, UnauthorizedException.class } ) @Transactional( propagation = Propagation.NOT_SUPPORTED ) boolean delete( @Nonnull FhirClientResource fhirClientResource, @Nonnull DhisFhirResourceId dhisFhirResourceId ); }
FhirRepositoryImpl implements FhirRepository { @Nonnull protected FhirRequestMethod getRequestMethod( @Nonnull FhirRepositoryOperation fhirRepositoryOperation ) { switch ( fhirRepositoryOperation.getOperationType() ) { case CREATE: return FhirRequestMethod.CREATE; case UPDATE: return FhirRequestMethod.UPDATE; case CREATE_OR_UPDATE: return FhirRequestMethod.CREATE_OR_UPDATE; default: throw new AssertionError( "Unhandled operation type: " + fhirRepositoryOperation.getOperationType() ); } } FhirRepositoryImpl( @Nonnull AuthorizationContext authorizationContext,
        @Nonnull LockManager lockManager, @Nonnull RequestCacheService requestCacheService,
        @Nonnull FhirClientSystemRepository fhirClientSystemRepository,
        @Nonnull FhirClientResourceRepository fhirClientResourceRepository,
        @Nonnull SubscriptionFhirResourceRepository subscriptionFhirResourceRepository,
        @Nonnull StoredFhirResourceService storedItemService,
        @Nonnull FhirResourceRepository fhirResourceRepository,
        @Nonnull FhirToDhisTransformerService fhirToDhisTransformerService,
        @Nonnull DhisResourceRepository dhisResourceRepository,
        @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository ); @Override @Nullable @HystrixCommand( ignoreExceptions = { DhisConflictException.class, TransformerDataException.class, TransformerMappingException.class, TrackedEntityInstanceNotFoundException.class, DhisDataExistsException.class, UnauthorizedException.class } ) @Transactional( propagation = Propagation.NOT_SUPPORTED ) FhirRepositoryOperationOutcome save( @Nonnull FhirClientResource fhirClientResource, @Nonnull IBaseResource resource, @Nullable FhirRepositoryOperation fhirRepositoryOperation ); @Override @HystrixCommand( ignoreExceptions = { DhisConflictException.class, TransformerDataException.class, TransformerMappingException.class, TrackedEntityInstanceNotFoundException.class, DhisDataExistsException.class, UnauthorizedException.class } ) @Transactional( propagation = Propagation.NOT_SUPPORTED ) boolean delete( @Nonnull FhirClientResource fhirClientResource, @Nonnull DhisFhirResourceId dhisFhirResourceId ); static final int MAX_CONFLICT_RETRIES; }