use of org.hisp.dhis.android.core.indicator.IndicatorEndpointCall in project dhis2-android-sdk by dhis2.
the class DataSetParentCall method callBody.
@Override
public Response callBody() throws Exception {
DataSetAccessEndpointCall dataSetAccessEndpointCall = dataSetAccessCallFactory.create(data);
Response<Payload<DataSet>> dataSetAccessResponse = dataSetAccessEndpointCall.call();
List<DataSet> dataSetsWithAccess = dataSetAccessResponse.body().items();
Set<String> dataSetUids = DataSetParentUidsHelper.getAssignedDataSetUids(dataSetsWithAccess);
DataSetEndpointCall dataSetEndpointCall = dataSetCallFactory.create(data, dataSetUids);
Response<Payload<DataSet>> dataSetResponse = dataSetEndpointCall.call();
List<DataSet> dataSets = dataSetResponse.body().items();
DataElementEndpointCall dataElementEndpointCall = dataElementCallFactory.create(data, DataSetParentUidsHelper.getDataElementUids(dataSets));
Response<Payload<DataElement>> dataElementResponse = dataElementEndpointCall.call();
IndicatorEndpointCall indicatorEndpointCall = indicatorCallFactory.create(data, DataSetParentUidsHelper.getIndicatorUids(dataSets));
Response<Payload<Indicator>> indicatorResponse = indicatorEndpointCall.call();
List<Indicator> indicators = indicatorResponse.body().items();
IndicatorTypeEndpointCall indicatorTypeEndpointCall = indicatorTypeCallFactory.create(data, DataSetParentUidsHelper.getIndicatorTypeUids(indicators));
indicatorTypeEndpointCall.call();
periodHandler.generateAndPersist();
linkManager.saveDataSetDataElementAndIndicatorLinks(dataSets);
linkManager.saveDataSetOrganisationUnitLinks(organisationUnits, dataSetUids);
return dataElementResponse;
}
Aggregations