Search in sources :

Example 6 with ResourceStoreImpl

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

the class DataSetEndpointCallRealIntegrationShould method createCall.

private DataSetEndpointCall createCall() {
    ResourceHandler resourceHandler = new ResourceHandler(new ResourceStoreImpl(databaseAdapter()));
    GenericCallData data = GenericCallData.create(databaseAdapter(), resourceHandler, d2.retrofit());
    Set<String> uids = new HashSet<>();
    uids.add("BfMAe6Itzgt");
    uids.add("Lpw6GcnTrmS");
    uids.add("TuL8IOPzpHh");
    return DataSetEndpointCall.FACTORY.create(data, uids);
}
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) HashSet(java.util.HashSet)

Example 7 with ResourceStoreImpl

use of org.hisp.dhis.android.core.resource.ResourceStoreImpl 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 8 with ResourceStoreImpl

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

the class TrackerDataCallMockIntegrationShould method setUp.

@Override
@Before
public void setUp() throws IOException {
    super.setUp();
    dhis2MockServer = new Dhis2MockServer(new AssetsFileReader());
    d2 = D2Factory.create(dhis2MockServer.getBaseEndpoint(), databaseAdapter());
    trackedEntityInstanceStore = new TrackedEntityInstanceStoreImpl(databaseAdapter());
    resourceStore = new ResourceStoreImpl(databaseAdapter());
    enrollmentStore = new EnrollmentStoreImpl(databaseAdapter());
}
Also used : Dhis2MockServer(org.hisp.dhis.android.core.data.server.Dhis2MockServer) TrackedEntityInstanceStoreImpl(org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl) EnrollmentStoreImpl(org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl) ResourceStoreImpl(org.hisp.dhis.android.core.resource.ResourceStoreImpl) AssetsFileReader(org.hisp.dhis.android.core.data.file.AssetsFileReader) Before(org.junit.Before)

Example 9 with ResourceStoreImpl

use of org.hisp.dhis.android.core.resource.ResourceStoreImpl 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)

Example 10 with ResourceStoreImpl

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

the class CategoryEndpointCallShould method provideCategoryEndpointCall.

private CategoryEndpointCall provideCategoryEndpointCall() {
    CategoryQuery query = CategoryQuery.builder().paging(true).pageSize(CategoryQuery.DEFAULT_PAGE_SIZE).page(1).build();
    ResponseValidator<Category> validator = new ResponseValidator<>();
    CategoryStore store = new CategoryStoreImpl(databaseAdapter());
    CategoryOptionStore categoryOptionStore = new CategoryOptionStoreImpl(databaseAdapter());
    CategoryOptionHandler categoryOptionHandler = new CategoryOptionHandler(categoryOptionStore);
    CategoryCategoryOptionLinkStore categoryCategoryOptionLinkStore = new CategoryCategoryOptionLinkStoreImpl(databaseAdapter());
    CategoryHandler handler = new CategoryHandler(store, categoryOptionHandler, categoryCategoryOptionLinkStore);
    ResourceStore resourceStore = new ResourceStoreImpl(databaseAdapter());
    ResourceHandler resourceHandler = new ResourceHandler(resourceStore);
    Date serverDate = new Date();
    return new CategoryEndpointCall(query, categoryService, validator, handler, resourceHandler, databaseAdapter(), serverDate);
}
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) Date(java.util.Date)

Aggregations

ResourceStoreImpl (org.hisp.dhis.android.core.resource.ResourceStoreImpl)13 ResourceHandler (org.hisp.dhis.android.core.resource.ResourceHandler)8 ResourceStore (org.hisp.dhis.android.core.resource.ResourceStore)7 GenericCallData (org.hisp.dhis.android.core.common.GenericCallData)6 Before (org.junit.Before)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 HashSet (java.util.HashSet)5 Date (java.util.Date)4 MockResponse (okhttp3.mockwebserver.MockResponse)4 MockWebServer (okhttp3.mockwebserver.MockWebServer)4 Retrofit (retrofit2.Retrofit)4 ContentValues (android.content.ContentValues)2 AssetsFileReader (org.hisp.dhis.android.core.data.file.AssetsFileReader)2 Dhis2MockServer (org.hisp.dhis.android.core.data.server.Dhis2MockServer)2 D2 (org.hisp.dhis.android.core.D2)1 ObjectStyle (org.hisp.dhis.android.core.common.ObjectStyle)1 ObjectStyleModel (org.hisp.dhis.android.core.common.ObjectStyleModel)1 ValueTypeRendering (org.hisp.dhis.android.core.common.ValueTypeRendering)1 EnrollmentStoreImpl (org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl)1 RelationshipTypeStore (org.hisp.dhis.android.core.relationship.RelationshipTypeStore)1