Search in sources :

Example 6 with ResourceHandler

use of org.hisp.dhis.android.core.resource.ResourceHandler in project dhis2-android-sdk by dhis2.

the class ProgramAccessEndpointCallRealIntegrationShould method createCall.

private ProgramAccessEndpointCall createCall() {
    ResourceHandler resourceHandler = new ResourceHandler(new ResourceStoreImpl(databaseAdapter()));
    GenericCallData data = GenericCallData.create(databaseAdapter(), resourceHandler, d2.retrofit());
    ProgramService service = d2.retrofit().create(ProgramService.class);
    return ProgramAccessEndpointCall.FACTORY.create(data, service);
}
Also used : ResourceHandler(org.hisp.dhis.android.core.resource.ResourceHandler) GenericCallData(org.hisp.dhis.android.core.common.GenericCallData) ResourceStoreImpl(org.hisp.dhis.android.core.resource.ResourceStoreImpl)

Example 7 with ResourceHandler

use of org.hisp.dhis.android.core.resource.ResourceHandler in project dhis2-android-sdk by dhis2.

the class EventCallFactory method create.

public static EventEndPointCall create(Retrofit retrofit, DatabaseAdapter databaseAdapter, String orgUnit, int pageLimit, String categoryComboUID, String categoryOptionUID) {
    EventService eventService = retrofit.create(EventService.class);
    EventHandler eventHandler = HandlerFactory.createEventHandler(databaseAdapter);
    ResourceHandler resourceHandler = HandlerFactory.createResourceHandler(databaseAdapter);
    CategoryCombo categoryCombo = CategoryCombo.builder().uid(categoryComboUID).build();
    CategoryOption categoryOption = CategoryOption.builder().uid(categoryOptionUID).build();
    EventQuery eventQuery = EventQuery.Builder.create().withOrgUnit(orgUnit).withPageLimit(pageLimit).withCategoryComboAndCategoryOption(categoryCombo, categoryOption).build();
    EventEndPointCall eventEndPointCall = new EventEndPointCall(eventService, databaseAdapter, resourceHandler, eventHandler, new Date(), eventQuery);
    return eventEndPointCall;
}
Also used : CategoryCombo(org.hisp.dhis.android.core.category.CategoryCombo) EventQuery(org.hisp.dhis.android.core.event.EventQuery) EventHandler(org.hisp.dhis.android.core.event.EventHandler) CategoryOption(org.hisp.dhis.android.core.category.CategoryOption) EventService(org.hisp.dhis.android.core.event.EventService) ResourceHandler(org.hisp.dhis.android.core.resource.ResourceHandler) EventEndPointCall(org.hisp.dhis.android.core.event.EventEndPointCall) Date(java.util.Date)

Example 8 with ResourceHandler

use of org.hisp.dhis.android.core.resource.ResourceHandler in project dhis2-android-sdk by dhis2.

the class CategoryCallFactory method create.

@NonNull
public static CategoryEndpointCall create(Retrofit retrofit, DatabaseAdapter databaseAdapter) {
    CategoryService categoryService = retrofit.create(CategoryService.class);
    ResponseValidator<Category> categoryResponseValidator = new ResponseValidator<>();
    CategoryHandler categoryHandler = HandlerFactory.createCategoryHandler(databaseAdapter);
    ResourceHandler resourceHandler = HandlerFactory.createResourceHandler(databaseAdapter);
    CategoryQuery categoryQuery = CategoryQuery.defaultQuery();
    CategoryEndpointCall categoryEndpointCall = new CategoryEndpointCall(categoryQuery, categoryService, categoryResponseValidator, categoryHandler, resourceHandler, databaseAdapter, new Date());
    return categoryEndpointCall;
}
Also used : Category(org.hisp.dhis.android.core.category.Category) ResponseValidator(org.hisp.dhis.android.core.category.ResponseValidator) CategoryQuery(org.hisp.dhis.android.core.category.CategoryQuery) ResourceHandler(org.hisp.dhis.android.core.resource.ResourceHandler) CategoryService(org.hisp.dhis.android.core.category.CategoryService) CategoryEndpointCall(org.hisp.dhis.android.core.category.CategoryEndpointCall) CategoryHandler(org.hisp.dhis.android.core.category.CategoryHandler) Date(java.util.Date) NonNull(android.support.annotation.NonNull)

Example 9 with ResourceHandler

use of org.hisp.dhis.android.core.resource.ResourceHandler in project dhis2-android-sdk by dhis2.

the class CategoryComboCallFactory method create.

@NonNull
public static CategoryComboEndpointCall create(Retrofit retrofit, DatabaseAdapter databaseAdapter) {
    CategoryComboService categoryComboService = retrofit.create(CategoryComboService.class);
    ResponseValidator<CategoryCombo> categoryComboResponseValidator = new ResponseValidator<>();
    CategoryComboHandler categoryComboHandler = HandlerFactory.createCategoryComboHandler(databaseAdapter);
    ResourceHandler resourceHandler = HandlerFactory.createResourceHandler(databaseAdapter);
    CategoryComboQuery categoryComboQuery = CategoryComboQuery.defaultQuery();
    CategoryComboEndpointCall categoryComboEndpointCall = new CategoryComboEndpointCall(categoryComboQuery, categoryComboService, categoryComboResponseValidator, categoryComboHandler, resourceHandler, databaseAdapter, new Date());
    return categoryComboEndpointCall;
}
Also used : ResponseValidator(org.hisp.dhis.android.core.category.ResponseValidator) CategoryCombo(org.hisp.dhis.android.core.category.CategoryCombo) CategoryComboService(org.hisp.dhis.android.core.category.CategoryComboService) ResourceHandler(org.hisp.dhis.android.core.resource.ResourceHandler) CategoryComboQuery(org.hisp.dhis.android.core.category.CategoryComboQuery) CategoryComboEndpointCall(org.hisp.dhis.android.core.category.CategoryComboEndpointCall) CategoryComboHandler(org.hisp.dhis.android.core.category.CategoryComboHandler) Date(java.util.Date) NonNull(android.support.annotation.NonNull)

Example 10 with ResourceHandler

use of org.hisp.dhis.android.core.resource.ResourceHandler in project dhis2-android-sdk by dhis2.

the class HandlerFactory method createResourceHandler.

public static ResourceHandler createResourceHandler(DatabaseAdapter databaseAdapter) {
    ResourceStore resourceStore = new ResourceStoreImpl(databaseAdapter);
    ResourceHandler resourceHandler = new ResourceHandler(resourceStore);
    return resourceHandler;
}
Also used : ResourceStore(org.hisp.dhis.android.core.resource.ResourceStore) ResourceHandler(org.hisp.dhis.android.core.resource.ResourceHandler) ResourceStoreImpl(org.hisp.dhis.android.core.resource.ResourceStoreImpl)

Aggregations

ResourceHandler (org.hisp.dhis.android.core.resource.ResourceHandler)17 ResourceStoreImpl (org.hisp.dhis.android.core.resource.ResourceStoreImpl)8 GenericCallData (org.hisp.dhis.android.core.common.GenericCallData)7 Date (java.util.Date)5 Transaction (org.hisp.dhis.android.core.data.database.Transaction)5 HashSet (java.util.HashSet)3 Payload (org.hisp.dhis.android.core.common.Payload)3 ResourceStore (org.hisp.dhis.android.core.resource.ResourceStore)3 NonNull (android.support.annotation.NonNull)2 CategoryCombo (org.hisp.dhis.android.core.category.CategoryCombo)2 ResponseValidator (org.hisp.dhis.android.core.category.ResponseValidator)2 SQLiteConstraintException (android.database.sqlite.SQLiteConstraintException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 MockResponse (okhttp3.mockwebserver.MockResponse)1 MockWebServer (okhttp3.mockwebserver.MockWebServer)1 Category (org.hisp.dhis.android.core.category.Category)1 CategoryComboEndpointCall (org.hisp.dhis.android.core.category.CategoryComboEndpointCall)1 CategoryComboHandler (org.hisp.dhis.android.core.category.CategoryComboHandler)1 CategoryComboQuery (org.hisp.dhis.android.core.category.CategoryComboQuery)1 CategoryComboService (org.hisp.dhis.android.core.category.CategoryComboService)1