use of org.hisp.dhis.android.core.imports.WebResponse in project dhis2-android-sdk by dhis2.
the class TrackedEntityInstancePostCall method call.
@Override
public Response<WebResponse> call() throws Exception {
synchronized (this) {
if (isExecuted) {
throw new IllegalStateException("Call is already executed");
}
isExecuted = true;
}
List<TrackedEntityInstance> trackedEntityInstancesToPost = queryDataToSync();
// if size is 0, then no need to do network request
if (trackedEntityInstancesToPost.isEmpty()) {
return null;
}
TrackedEntityInstancePayload trackedEntityInstancePayload = new TrackedEntityInstancePayload();
trackedEntityInstancePayload.trackedEntityInstances = trackedEntityInstancesToPost;
Response<WebResponse> response = trackedEntityInstanceService.postTrackedEntityInstances(trackedEntityInstancePayload).execute();
if (response.isSuccessful()) {
handleWebResponse(response);
}
return response;
}
use of org.hisp.dhis.android.core.imports.WebResponse in project dhis2-android-sdk by dhis2.
the class TrackedEntityInstancePostCallRealIntegrationShould method postTrackedEntityInstances.
private void postTrackedEntityInstances() throws Exception {
Response response;
Call<Response<WebResponse>> call = d2.syncTrackedEntityInstances();
response = call.call();
assertThat(response.isSuccessful()).isTrue();
}
Aggregations