openmrs-android-sdk/src/main/java/com/openmrs/android_sdk/library/api/repository/PatientRepository.java
/**
     * Download patient by uuid.
     *
     * @param uuid             the uuid
     * @param callbackListener the callback listener
     */
Download patient by uuid.
@param uuid             the uuid
@param callbackListener the callback listener
Download patient by uuid . @param uuid the uuid @param callbackListener the callback listener
public void downloadPatientByUuid(@NonNull final String uuid, @NonNull final DownloadPatientCallback callbackListener) {
        Call<PatientDto> call = restApi.getPatientByUUID(uuid, "full");
        call.enqueue(new Callback<PatientDto>() {
            @Override
            public void onResponse(@NonNull Call<PatientDto> call, @NonNull Response<PatientDto> response) {
                if (response.isSuccessful()) {
                    final PatientDto newPatientDto = response.body();
                    AndroidDeferredManager dm = new AndroidDeferredManager();
                    dm.when(downloadPatientPhotoByUuid(newPatientDto.getUuid())).done(result -> {
                        if (result != null) {
                            newPatientDto.getPerson().setPhoto(result);
                            callbackListener.onPatientPhotoDownloaded(newPatientDto.getPatient());
                        }
                    });
                    callbackListener.onPatientDownloaded(newPatientDto.getPatient());
                } else {
                    callbackListener.onErrorResponse(response.message());
                }
            }
            @Override
            public void onFailure(@NonNull Call<PatientDto> call, @NonNull Throwable t) {
                callbackListener.onErrorResponse(t.getMessage());
            }
        });
    }
public void downloadPatientByUuid ( @ NonNull final String uuid , @ NonNull final DownloadPatientCallback callbackListener ) { Call < PatientDto > call = restApi . getPatientByUUID ( uuid , "full" ) ; call . enqueue ( new Callback < PatientDto > ( ) { @ Override public void onResponse ( @ NonNull Call < PatientDto > call , @ NonNull Response < PatientDto > response ) { if ( response . isSuccessful ( ) ) { final PatientDto newPatientDto = response . body ( ) ; AndroidDeferredManager dm = new AndroidDeferredManager ( ) ; dm . when ( downloadPatientPhotoByUuid ( newPatientDto . getUuid ( ) ) ) . done ( result -> { if ( result != null ) { newPatientDto . getPerson ( ) . setPhoto ( result ) ; callbackListener . onPatientPhotoDownloaded ( newPatientDto . getPatient ( ) ) ; } } ) ; callbackListener . onPatientDownloaded ( newPatientDto . getPatient ( ) ) ; } else { callbackListener . onErrorResponse ( response . message ( ) ) ; } } @ Override public void onFailure ( @ NonNull Call < PatientDto > call , @ NonNull Throwable t ) { callbackListener . onErrorResponse ( t . getMessage ( ) ) ; } } ) ; }
Download patient by uuid.
Download patient by uuid .