use of org.hisp.dhis.android.core.systeminfo.SystemInfo in project dhis2-android-sdk by dhis2.
the class SingleDataCall method call.
@Override
public Response call() throws Exception {
synchronized (this) {
if (isExecuted) {
throw new IllegalStateException("Already executed");
}
isExecuted = true;
}
Response response = null;
Transaction transaction = databaseAdapter.beginNewTransaction();
try {
response = new SystemInfoCall(databaseAdapter, systemInfoStore, systemInfoService, resourceStore).call();
if (!response.isSuccessful()) {
return response;
}
SystemInfo systemInfo = (SystemInfo) response.body();
Date serverDate = systemInfo.serverDate();
response = eventCall(serverDate);
if (response == null || !response.isSuccessful()) {
return response;
}
transaction.setSuccessful();
return response;
} finally {
transaction.end();
}
}
use of org.hisp.dhis.android.core.systeminfo.SystemInfo in project dhis2-android-sdk by dhis2.
the class TrackerDataCall method call.
@Override
public Response call() throws Exception {
synchronized (this) {
if (isExecuted) {
throw new IllegalStateException("Already executed");
}
isExecuted = true;
}
Response response = null;
Map<String, TrackedEntityInstance> trackedEntityInstances = trackedEntityInstanceStore.querySynced();
if (!trackedEntityInstances.isEmpty()) {
Transaction transaction = databaseAdapter.beginNewTransaction();
try {
response = new SystemInfoCall(databaseAdapter, systemInfoStore, systemInfoService, resourceStore).call();
if (!response.isSuccessful()) {
return response;
}
SystemInfo systemInfo = (SystemInfo) response.body();
Date serverDate = systemInfo.serverDate();
response = trackedEntityInstanceCall(serverDate, trackedEntityInstances);
transaction.setSuccessful();
} finally {
transaction.end();
}
}
return response;
}
use of org.hisp.dhis.android.core.systeminfo.SystemInfo in project dhis2-android-sdk by dhis2.
the class TrackerEntitiesDataCall method call.
@Override
public Response call() throws Exception {
synchronized (this) {
if (isExecuted) {
throw new IllegalStateException("Already executed");
}
isExecuted = true;
}
Response response = null;
Transaction transaction = databaseAdapter.beginNewTransaction();
try {
response = new SystemInfoCall(databaseAdapter, systemInfoStore, systemInfoService, resourceStore).call();
if (!response.isSuccessful()) {
return response;
}
SystemInfo systemInfo = (SystemInfo) response.body();
Date serverDate = systemInfo.serverDate();
response = trackerCall(serverDate);
if (response == null || !response.isSuccessful()) {
return response;
}
transaction.setSuccessful();
return response;
} finally {
transaction.end();
}
}
Aggregations