use of org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl in project dhis2-android-sdk by dhis2.
the class TrackedEntityInstanceCallMockIntegrationShould method getDownloadedTei.
private TrackedEntityInstance getDownloadedTei(String teiUid) {
TrackedEntityInstance downloadedTei;
TrackedEntityAttributeValueStore teiAttributeValuesStore = new TrackedEntityAttributeValueStoreImpl(databaseAdapter());
Map<String, List<TrackedEntityAttributeValue>> attValues = teiAttributeValuesStore.queryAll();
TrackedEntityInstanceStoreImpl teiStore = new TrackedEntityInstanceStoreImpl(databaseAdapter());
downloadedTei = teiStore.queryAll().get(teiUid);
EnrollmentStoreImpl enrollmentStore = new EnrollmentStoreImpl(databaseAdapter());
Map<String, List<Enrollment>> downloadedEnrollments = enrollmentStore.queryAll();
EventStoreImpl eventStore = new EventStoreImpl(databaseAdapter());
List<Event> downloadedEventsWithoutValues = eventStore.queryAll();
TrackedEntityDataValueStoreImpl trackedEntityDataValue = new TrackedEntityDataValueStoreImpl(databaseAdapter());
Map<String, List<TrackedEntityDataValue>> downloadedValues = trackedEntityDataValue.queryTrackedEntityDataValues();
return createTei(downloadedTei, attValues, downloadedEnrollments.get(teiUid), downloadedEventsWithoutValues, downloadedValues);
}
use of org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl in project dhis2-android-sdk by dhis2.
the class TrackedEntityInstancePostCallRealIntegrationShould method getEnrollmentsByTrackedEntityInstanceFromDb.
private Enrollment getEnrollmentsByTrackedEntityInstanceFromDb(String trackedEntityInstanceUid) {
EnrollmentStoreImpl enrollmentStore = new EnrollmentStoreImpl(databaseAdapter());
Enrollment enrollment = null;
Map<String, List<Enrollment>> storedEnrollmentsByTrackedEntityInstance = enrollmentStore.queryAll();
for (Enrollment storedEnrollment : storedEnrollmentsByTrackedEntityInstance.get(trackedEntityInstanceUid)) {
if (storedEnrollment.uid().equals(enrollmentUid)) {
enrollment = storedEnrollment;
}
}
return enrollment;
}
use of org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl in project dhis2-android-sdk by dhis2.
the class TrackedEntityInstancePostCallRealIntegrationShould method setUp.
@Before
@Override
public void setUp() throws IOException {
super.setUp();
d2 = D2Factory.create("https://play.dhis2.org/android-current/api/", databaseAdapter());
trackedEntityInstanceStore = new TrackedEntityInstanceStoreImpl(databaseAdapter());
enrollmentStore = new EnrollmentStoreImpl(databaseAdapter());
eventStore = new EventStoreImpl(databaseAdapter());
trackedEntityAttributeValueStore = new TrackedEntityAttributeValueStoreImpl(databaseAdapter());
trackedEntityDataValueStore = new TrackedEntityDataValueStoreImpl(databaseAdapter());
codeGenerator = new CodeGeneratorImpl();
orgUnitUid = "DiszpKrYNg8";
programUid = "IpHINAT79UW";
programStageUid = "A03MvHHogjR";
dataElementUid = "a3kGcGDCuk6";
trackedEntityUid = "nEenWmSyUEp";
trackedEntityAttributeUid = "w75KJ2mc4zz";
coordinates = "[9,9]";
featureType = FeatureType.POINT;
categoryOptionUid = "CW81uF03hvV";
categoryComboOptionUid = "l5QR5hJ4u44";
eventUid = codeGenerator.generate();
enrollmentUid = codeGenerator.generate();
trackedEntityInstanceUid = codeGenerator.generate();
event1Uid = codeGenerator.generate();
enrollment1Uid = codeGenerator.generate();
trackedEntityInstance1Uid = codeGenerator.generate();
}
use of org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl in project dhis2-android-sdk by dhis2.
the class HandlerFactory method createEnrollmentHandler.
public static EnrollmentHandler createEnrollmentHandler(DatabaseAdapter databaseAdapter) {
EnrollmentStore enrollmentStore = new EnrollmentStoreImpl(databaseAdapter);
EventHandler eventHandler = createEventHandler(databaseAdapter);
EnrollmentHandler enrollmentHandler = new EnrollmentHandler(databaseAdapter, enrollmentStore, eventHandler);
return enrollmentHandler;
}
use of org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl 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());
}
Aggregations