From 1ce24a70417dcec8fb7f0e24d05baeb2f47d4493 Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Wed, 26 Apr 2023 16:38:13 +1000 Subject: [PATCH 001/478] [VERSION-1.9.0-SNAPSHOT] Bump to version 1.9.0-SNAPSHOT --- core/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/gradle.properties b/core/gradle.properties index 1ec3049866..bbebc1c830 100644 --- a/core/gradle.properties +++ b/core/gradle.properties @@ -29,8 +29,8 @@ # Properties which are consumed by plugins/gradle-mvn-push.gradle plugin. # They are used for publishing artifact to snapshot repository. -VERSION_NAME=1.8.0-SNAPSHOT -VERSION_CODE=280 +VERSION_NAME=1.9.0-SNAPSHOT +VERSION_CODE=290 GROUP=org.hisp.dhis From 5c98af5330c7382449e1ad7b307b6c55ff33c368 Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Wed, 26 Apr 2023 16:38:37 +1000 Subject: [PATCH 002/478] [VERSION-1.9.0-SNAPSHOT] Accept connections to version 2.41 --- .../hisp/dhis/android/core/systeminfo/DHISPatchVersion.kt | 4 +++- .../org/hisp/dhis/android/core/systeminfo/DHISVersion.kt | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/systeminfo/DHISPatchVersion.kt b/core/src/main/java/org/hisp/dhis/android/core/systeminfo/DHISPatchVersion.kt index 7e3626a16f..c51b18e69d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/systeminfo/DHISPatchVersion.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/systeminfo/DHISPatchVersion.kt @@ -66,7 +66,9 @@ enum class DHISPatchVersion(val majorVersion: DHISVersion, val strValue: String, V2_39_0(DHISVersion.V2_39, "2.39.0", SMSVersion.V2), - V2_40_0(DHISVersion.V2_40, "2.40.0", SMSVersion.V2); + V2_40_0(DHISVersion.V2_40, "2.40.0", SMSVersion.V2), + + V2_41_0(DHISVersion.V2_41, "2.41.0", SMSVersion.V2); companion object { @JvmStatic diff --git a/core/src/main/java/org/hisp/dhis/android/core/systeminfo/DHISVersion.kt b/core/src/main/java/org/hisp/dhis/android/core/systeminfo/DHISVersion.kt index 816f3979e3..df8227126b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/systeminfo/DHISVersion.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/systeminfo/DHISVersion.kt @@ -39,7 +39,8 @@ enum class DHISVersion(internal val prefix: String) { V2_37("2.37"), V2_38("2.38"), V2_39("2.39"), - V2_40("2.40"); + V2_40("2.40"), + V2_41("2.41"); companion object { @JvmStatic @@ -54,7 +55,7 @@ enum class DHISVersion(internal val prefix: String) { @JvmStatic fun allowedVersionsAsStr(): Array { - return listOf(V2_30, V2_31, V2_32, V2_33, V2_34, V2_35, V2_36, V2_37, V2_38, V2_39, V2_40) + return listOf(V2_30, V2_31, V2_32, V2_33, V2_34, V2_35, V2_36, V2_37, V2_38, V2_39, V2_40, V2_41) .map { it.prefix } .toTypedArray() } From c4ec3da70fcbb3e805cfa9e64d34411eaa70a1fd Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Tue, 9 May 2023 15:48:50 +1000 Subject: [PATCH 003/478] [ANDROSDK-1676] Implement AggregatedDataCall using coroutines --- ...aValueEndpointCallRealIntegrationShould.kt | 37 +++-- ...AggregatedDataCallMockIntegrationShould.kt | 5 + .../api/executors/internal/APIDownloader.kt | 4 + .../executors/internal/APIDownloaderImpl.kt | 5 + .../arch/call/factories/internal/QueryCall.kt | 7 +- .../dataapproval/internal/DataApprovalCall.kt | 34 ++-- .../internal/DataApprovalQuery.kt} | 47 ++---- ...valService.java => DataApprovalService.kt} | 37 ++--- .../DataSetCompleteRegistrationCall.kt | 39 +++-- ...ataSetCompleteRegistrationCallProcessor.kt | 4 +- .../DataSetCompleteRegistrationQuery.kt} | 50 ++---- .../DataSetCompleteRegistrationService.kt | 5 +- .../core/datavalue/internal/DataValueCall.kt | 28 ++-- ...{DataValueQuery.java => DataValueQuery.kt} | 25 ++- .../datavalue/internal/DataValueService.kt | 17 +- .../data/internal/AggregatedDataCall.kt | 151 ++++++++++-------- .../internal/AggregatedDataDownloaderImpl.kt | 3 +- 17 files changed, 233 insertions(+), 265 deletions(-) rename core/src/main/java/org/hisp/dhis/android/core/{dataset/internal/DataSetCompleteRegistrationQuery.java => dataapproval/internal/DataApprovalQuery.kt} (61%) rename core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/{DataApprovalService.java => DataApprovalService.kt} (73%) rename core/src/main/java/org/hisp/dhis/android/core/{dataapproval/internal/DataApprovalQuery.java => dataset/internal/DataSetCompleteRegistrationQuery.kt} (58%) rename core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/{DataValueQuery.java => DataValueQuery.kt} (79%) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.kt index 14a7f75adc..a0222dda4a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.kt @@ -27,7 +27,7 @@ */ package org.hisp.dhis.android.core.datavalue.internal -import io.reactivex.Single +import kotlinx.coroutines.runBlocking import org.hisp.dhis.android.core.BaseRealIntegrationTest import org.hisp.dhis.android.core.arch.api.executors.internal.APIDownloader import org.hisp.dhis.android.core.arch.api.executors.internal.APIDownloaderImpl @@ -46,7 +46,24 @@ class DataValueEndpointCallRealIntegrationShould : BaseRealIntegrationTest() { * metadataSyncCall. It works against the demo server. */ - private fun download(): Single> { + // @Test + @Throws(Exception::class) + fun download_data_values() { + runBlocking { + if (!d2.userModule().isLogged().blockingGet()) { + d2.userModule().logIn(username, password, url).blockingGet() + } + + /* This test won't pass independently of the sync of metadata, as the foreign keys + constraints won't be satisfied. + To run the test, you will need to disable foreign key support in database in + DbOpenHelper.java replacing 'foreign_keys = ON' with 'foreign_keys = OFF' and + uncomment the @Test tag */ + download() + } + } + + private suspend fun download(): List { val dataValueHandler: Handler = ObjectWithoutUidHandlerImpl( DataValueStore.create(d2.databaseAdapter()) ) @@ -71,20 +88,6 @@ class DataValueEndpointCallRealIntegrationShould : BaseRealIntegrationTest() { val dataValueService = d2.retrofit().create(DataValueService::class.java) return DataValueCall(dataValueService, dataValueHandler, apiDownloader) - .download(DataValueQuery.create(bundle)) - } - - // @Test - @Throws(Exception::class) - fun download_data_values() { - if (!d2.userModule().isLogged().blockingGet()) { - d2.userModule().logIn(username, password, url).blockingGet() - } - - /* This test won't pass independently of the sync of metadata, as the foreign keys - constraints won't be satisfied. - To run the test, you will need to disable foreign key support in database in - DbOpenHelper.java replacing 'foreign_keys = ON' with 'foreign_keys = OFF' and - uncomment the @Test tag */download().blockingGet() + .download(DataValueQuery(bundle)) } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.kt index ffb6f94924..2a9f5e24dc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.kt @@ -28,14 +28,19 @@ package org.hisp.dhis.android.core.domain.aggregated.data import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataDispatcher +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.Test +import org.junit.runner.RunWith +@RunWith(D2JunitRunner::class) class AggregatedDataCallMockIntegrationShould : BaseMockIntegrationTestMetadataDispatcher() { @Test fun emit_progress() { val testObserver = d2.aggregatedModule().data().download().test() + testObserver.awaitTerminalEvent() + testObserver.assertValueCount(3) testObserver.assertValueAt(0) { v: AggregatedD2Progress -> diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIDownloader.kt b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIDownloader.kt index be42f57b5f..31eed8ab08 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIDownloader.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIDownloader.kt @@ -34,6 +34,7 @@ import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler import org.hisp.dhis.android.core.common.CoreObject import org.hisp.dhis.android.core.resource.internal.Resource +@Suppress("TooManyFunctions") internal interface APIDownloader { fun

downloadPartitioned( uids: Set, @@ -78,6 +79,9 @@ internal interface APIDownloader { fun

download(handler: Handler

, downloader: Single>): Single> fun

downloadList(handler: Handler

, downloader: Single>): Single> + + suspend fun

downloadListAsCoroutine(handler: Handler

, downloader: suspend () -> List

): List

+ fun

downloadObject(handler: Handler

, downloader: Single

): Single

fun

downloadPagedPayload( diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIDownloaderImpl.kt b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIDownloaderImpl.kt index 92cd5058d0..89d985af1d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIDownloaderImpl.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIDownloaderImpl.kt @@ -180,6 +180,11 @@ internal class APIDownloaderImpl @Inject constructor(private val resourceHandler .doOnSuccess { oCollection: List

-> handler.handleMany(oCollection) } } + override suspend fun

downloadListAsCoroutine(handler: Handler

, downloader: suspend () -> List

): List

{ + return downloader.invoke() + .also { handler.handleMany(it) } + } + override fun

downloadObject(handler: Handler

, downloader: Single

): Single

{ return downloader .doOnSuccess { o: P -> handler.handle(o) } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCall.kt b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCall.kt index 77ac540ca8..09eb40b01b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCall.kt @@ -27,9 +27,8 @@ */ package org.hisp.dhis.android.core.arch.call.factories.internal -import io.reactivex.Single -import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQueryKt -interface QueryCall { - fun download(query: Q): Single> +internal interface QueryCall { + suspend fun download(query: Q): List

} diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCall.kt index 9d4c94d113..c3180c3609 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCall.kt @@ -28,9 +28,6 @@ package org.hisp.dhis.android.core.dataapproval.internal import dagger.Reusable -import io.reactivex.Observable -import io.reactivex.Single -import java.util.ArrayList import javax.inject.Inject import org.hisp.dhis.android.core.arch.api.executors.internal.APIDownloader import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCall @@ -54,26 +51,25 @@ internal class DataApprovalCall @Inject constructor( } @Suppress("MagicNumber") - override fun download(query: DataApprovalQuery): Single> { + override suspend fun download(query: DataApprovalQuery): List { val partitions = multiDimensionalPartitioner.partitionForSize( QUERY_WITHOUT_UIDS_LENGTH, - query.workflowsUids(), - query.periodIds(), - query.organisationUnistUids(), - query.attributeOptionCombosUids() + query.workflowsUids, + query.periodIds, + query.organisationUnistUids, + query.attributeOptionCombosUids ) - return Observable.fromIterable(partitions).flatMapSingle { part -> - apiDownloader.downloadList( - handler, + return partitions.fold(emptyList()) { acc, part -> + acc + apiDownloader.downloadListAsCoroutine(handler) { service.getDataApprovals( - DataApprovalFields.allFields, - query.lastUpdatedStr(), - commaSeparatedCollectionValues(part[0]), - commaSeparatedCollectionValues(part[1]), - commaSeparatedCollectionValues(part[2]), - commaSeparatedCollectionValues(part[3]) + fields = DataApprovalFields.allFields, + lastUpdated = query.lastUpdatedStr, + workflow = commaSeparatedCollectionValues(part[0]), + periods = commaSeparatedCollectionValues(part[1]), + organisationUnit = commaSeparatedCollectionValues(part[2]), + attributeOptionCombo = commaSeparatedCollectionValues(part[3]) ) - ) - }.reduce(ArrayList(), { t1, t2 -> t1 + t2 }) + } + } } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.kt similarity index 61% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.kt index c484aa2fd2..7ee945c5fa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.kt @@ -25,35 +25,18 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -package org.hisp.dhis.android.core.dataset.internal; - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; - -import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; - -import java.util.Collection; - -@AutoValue -public abstract class DataSetCompleteRegistrationQuery extends BaseQuery { - - public abstract Collection dataSetUids(); - - public abstract Collection periodIds(); - - public abstract Collection rootOrgUnitUids(); - - @Nullable - public abstract String lastUpdatedStr(); - - public static DataSetCompleteRegistrationQuery create(Collection dataSetUids, - Collection periodIds, - Collection rootOrgUnitUids, - String lastUpdatedStr) { - - return new AutoValue_DataSetCompleteRegistrationQuery(1, BaseQuery.DEFAULT_PAGE_SIZE, - false, dataSetUids, periodIds, rootOrgUnitUids, lastUpdatedStr); - } -} +package org.hisp.dhis.android.core.dataapproval.internal + +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQueryKt + +internal data class DataApprovalQuery( + val workflowsUids: Collection, + val organisationUnistUids: Collection, + val periodIds: Collection, + val attributeOptionCombosUids: Collection, + val lastUpdatedStr: String? +) : BaseQueryKt( + page = 1, + pageSize = DEFAULT_PAGE_SIZE, + paging = false +) diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.kt similarity index 73% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.kt index 3e5c13dd21..078b76d306 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.kt @@ -25,28 +25,23 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +package org.hisp.dhis.android.core.dataapproval.internal -package org.hisp.dhis.android.core.dataapproval.internal; - -import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; -import org.hisp.dhis.android.core.arch.api.filters.internal.Which; -import org.hisp.dhis.android.core.dataapproval.DataApproval; - -import java.util.List; - -import io.reactivex.Single; -import retrofit2.http.GET; -import retrofit2.http.Query; - -interface DataApprovalService { +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields +import org.hisp.dhis.android.core.arch.api.filters.internal.Which +import org.hisp.dhis.android.core.dataapproval.DataApproval +import retrofit2.http.GET +import retrofit2.http.Query +@Suppress("LongParameterList") +internal interface DataApprovalService { @GET("dataApprovals/multiple") - Single> getDataApprovals( - @Query("fields") @Which Fields fields, - @Query("lastUpdated") String lastUpdated, - @Query("wf") String workflow, - @Query("pe") String periods, - @Query("ou") String organisationUnit, - @Query("aoc") String attributeOptionCombo - ); + suspend fun getDataApprovals( + @Query("fields") @Which fields: Fields, + @Query("lastUpdated") lastUpdated: String?, + @Query("wf") workflow: String, + @Query("pe") periods: String, + @Query("ou") organisationUnit: String, + @Query("aoc") attributeOptionCombo: String + ): List } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCall.kt index fe77ff72e9..eba26d83e4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCall.kt @@ -28,9 +28,6 @@ package org.hisp.dhis.android.core.dataset.internal import dagger.Reusable -import io.reactivex.Observable -import io.reactivex.Single -import java.util.ArrayList import javax.inject.Inject import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCall import org.hisp.dhis.android.core.arch.helpers.CollectionsHelper.commaSeparatedCollectionValues @@ -51,29 +48,29 @@ internal class DataSetCompleteRegistrationCall @Inject constructor( ).length } - override fun download(query: DataSetCompleteRegistrationQuery): Single> { - return downloadInternal(query).doOnSuccess { registrations -> processor.process(registrations, query) } + override suspend fun download(query: DataSetCompleteRegistrationQuery): List { + return downloadInternal(query) + .also { processor.process(it, query) } } - private fun downloadInternal(query: DataSetCompleteRegistrationQuery): Single> { + private suspend fun downloadInternal(query: DataSetCompleteRegistrationQuery): List { val partitions = multiDimensionalPartitioner.partitionForSize( QUERY_WITHOUT_UIDS_LENGTH, - query.dataSetUids(), - query.periodIds(), - query.rootOrgUnitUids() + query.dataSetUids, + query.periodIds, + query.rootOrgUnitUids ) - return Observable.fromIterable(partitions).flatMapSingle { part -> - service.getDataSetCompleteRegistrations( - DataSetCompleteRegistrationFields.allFields, - query.lastUpdatedStr(), - commaSeparatedCollectionValues(part[0]), - commaSeparatedCollectionValues(part[1]), - commaSeparatedCollectionValues(part[2]), - true, - false - ) - }.map { it.dataSetCompleteRegistrations } - .reduce(ArrayList(), { t1, t2 -> t1 + t2 }) + return partitions.fold(emptyList()) { acc, part -> + acc + service.getDataSetCompleteRegistrations( + fields = DataSetCompleteRegistrationFields.allFields, + lastUpdated = query.lastUpdatedStr, + dataSetUids = commaSeparatedCollectionValues(part[0]), + periodIds = commaSeparatedCollectionValues(part[1]), + organisationUnitIds = commaSeparatedCollectionValues(part[2]), + children = true, + paging = false + ).dataSetCompleteRegistrations + } } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallProcessor.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallProcessor.kt index 40dd364d4e..8dd97129e4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallProcessor.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallProcessor.kt @@ -55,9 +55,9 @@ internal class DataSetCompleteRegistrationCallProcessor @Inject internal constru linked to a particular query before storing the returned values. Only records in "SYNCED" state are removed. */ private fun removeExistingRegistersForQuery(query: DataSetCompleteRegistrationQuery) { - for (rootOrgUnitUid in query.rootOrgUnitUids()) { + for (rootOrgUnitUid in query.rootOrgUnitUids) { dataSetCompleteRegistrationStore.removeNotPresentAndSynced( - query.dataSetUids(), query.periodIds(), rootOrgUnitUid + query.dataSetUids, query.periodIds, rootOrgUnitUid ) } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.kt similarity index 58% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.kt index dac93403d3..ffe380d65d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.kt @@ -25,39 +25,17 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -package org.hisp.dhis.android.core.dataapproval.internal; - -import androidx.annotation.Nullable; - -import com.google.auto.value.AutoValue; - -import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; - -import java.util.Collection; - -@AutoValue -public abstract class DataApprovalQuery extends BaseQuery { - - public abstract Collection workflowsUids(); - - public abstract Collection organisationUnistUids(); - - public abstract Collection periodIds(); - - public abstract Collection attributeOptionCombosUids(); - - @Nullable - public abstract String lastUpdatedStr(); - - public static DataApprovalQuery create(Collection workflowsUids, - Collection organisationUnitsUids, - Collection periodIds, - Collection attributeOptionCombosUids, - String lastUpdatedStr) { - - return new AutoValue_DataApprovalQuery(1, BaseQuery.DEFAULT_PAGE_SIZE, - false, workflowsUids, organisationUnitsUids, - periodIds, attributeOptionCombosUids, lastUpdatedStr); - } -} +package org.hisp.dhis.android.core.dataset.internal + +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQueryKt + +internal data class DataSetCompleteRegistrationQuery( + val dataSetUids: Collection, + val periodIds: Collection, + val rootOrgUnitUids: Collection, + val lastUpdatedStr: String?, +) : BaseQueryKt( + page = 1, + pageSize = DEFAULT_PAGE_SIZE, + paging = false +) diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt index ad681fdb05..2fcc5506fd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt @@ -27,7 +27,6 @@ */ package org.hisp.dhis.android.core.dataset.internal -import io.reactivex.Single import org.hisp.dhis.android.core.arch.api.fields.internal.Fields import org.hisp.dhis.android.core.arch.api.filters.internal.Which import org.hisp.dhis.android.core.common.Unit @@ -41,7 +40,7 @@ import retrofit2.http.* internal interface DataSetCompleteRegistrationService { @GET("completeDataSetRegistrations") - fun getDataSetCompleteRegistrations( + suspend fun getDataSetCompleteRegistrations( @Query("fields") @Which fields: Fields, @Query("lastUpdated") lastUpdated: String?, @Query("dataSet") dataSetUids: String, @@ -49,7 +48,7 @@ internal interface DataSetCompleteRegistrationService { @Query("orgUnit") organisationUnitIds: String, @Query("children") children: Boolean, @Query("paging") paging: Boolean - ): Single + ): DataSetCompleteRegistrationPayload @POST("completeDataSetRegistrations") fun postDataSetCompleteRegistrations( diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueCall.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueCall.kt index 3cb5dab715..6b5e8a1254 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueCall.kt @@ -28,7 +28,6 @@ package org.hisp.dhis.android.core.datavalue.internal import dagger.Reusable -import io.reactivex.Single import javax.inject.Inject import org.hisp.dhis.android.core.arch.api.executors.internal.APIDownloader import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCall @@ -44,20 +43,19 @@ internal class DataValueCall @Inject constructor( private val apiDownloader: APIDownloader ) : QueryCall { - override fun download(query: DataValueQuery): Single> { - val b = query.bundle() - return apiDownloader.downloadList( - handler, + override suspend fun download(query: DataValueQuery): List { + val b = query.bundle + return apiDownloader.downloadListAsCoroutine(handler) { service.getDataValues( - DataValueFields.allFields, - b.key.lastUpdatedStr(), - commaSeparatedUids(b.dataSets), - commaSeparatedCollectionValues(b.periodIds), - commaSeparatedCollectionValues(b.rootOrganisationUnitUids), - true, - false, - true - ).map { it.dataValues } - ) + fields = DataValueFields.allFields, + lastUpdated = b.key.lastUpdatedStr(), + dataSetUids = commaSeparatedUids(b.dataSets), + periodIds = commaSeparatedCollectionValues(b.periodIds), + orgUnitUids = commaSeparatedCollectionValues(b.rootOrganisationUnitUids), + children = true, + paging = false, + includeDeleted = true + ).dataValues + } } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.kt similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.kt index daa12dc4e8..06f71f8e43 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.kt @@ -25,20 +25,15 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +package org.hisp.dhis.android.core.datavalue.internal -package org.hisp.dhis.android.core.datavalue.internal; +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQueryKt +import org.hisp.dhis.android.core.domain.aggregated.data.internal.AggregatedDataCallBundle -import com.google.auto.value.AutoValue; - -import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; -import org.hisp.dhis.android.core.domain.aggregated.data.internal.AggregatedDataCallBundle; - -@AutoValue -public abstract class DataValueQuery extends BaseQuery { - public abstract AggregatedDataCallBundle bundle(); - - public static DataValueQuery create(AggregatedDataCallBundle bundle) { - return new AutoValue_DataValueQuery(1, BaseQuery.DEFAULT_PAGE_SIZE, false, - bundle); - } -} +internal data class DataValueQuery( + val bundle: AggregatedDataCallBundle +) : BaseQueryKt( + page = 1, + pageSize = DEFAULT_PAGE_SIZE, + paging = false +) diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.kt index bc17ae7398..9679d75550 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.kt @@ -27,7 +27,6 @@ */ package org.hisp.dhis.android.core.datavalue.internal -import io.reactivex.Single import org.hisp.dhis.android.core.arch.api.fields.internal.Fields import org.hisp.dhis.android.core.arch.api.filters.internal.Which import org.hisp.dhis.android.core.datavalue.DataValue @@ -43,16 +42,16 @@ import retrofit2.http.Query internal interface DataValueService { @GET("dataValueSets") - fun getDataValues( - @Query("fields") @Which fields: Fields?, + suspend fun getDataValues( + @Query("fields") @Which fields: Fields, @Query("lastUpdated") lastUpdated: String?, - @Query("dataSet") dataSetUids: String?, - @Query("period") periodIds: String?, - @Query("orgUnit") orgUnitUids: String?, - @Query("children") children: Boolean?, - @Query("paging") paging: Boolean?, + @Query("dataSet") dataSetUids: String, + @Query("period") periodIds: String, + @Query("orgUnit") orgUnitUids: String, + @Query("children") children: Boolean, + @Query("paging") paging: Boolean, @Query("includeDeleted") includeDeleted: Boolean? - ): Single + ): DataValueSet @POST("dataValueSets") fun postDataValues(@Body dataValueSet: DataValueSet): Call diff --git a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataCall.kt b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataCall.kt index f47d9d36bf..ce6d74ed3e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataCall.kt @@ -28,10 +28,13 @@ package org.hisp.dhis.android.core.domain.aggregated.data.internal import dagger.Reusable -import io.reactivex.Observable -import io.reactivex.Single import javax.inject.Inject -import org.hisp.dhis.android.core.arch.api.executors.internal.RxAPICallExecutor +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flatMapLatest +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.rx2.asFlow +import org.hisp.dhis.android.core.arch.api.executors.internal.CoroutineAPICallExecutor import org.hisp.dhis.android.core.arch.call.D2ProgressSyncStatus import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCall import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder @@ -58,105 +61,117 @@ internal class AggregatedDataCall @Inject constructor( private val dsCompleteRegistrationCall: QueryCall, private val dataApprovalCall: QueryCall, private val categoryOptionComboStore: CategoryOptionComboStore, - private val rxCallExecutor: RxAPICallExecutor, + private val coroutineCallExecutor: CoroutineAPICallExecutor, private val aggregatedDataSyncStore: ObjectWithoutUidStore, private val aggregatedDataCallBundleFactory: AggregatedDataCallBundleFactory, private val resourceHandler: ResourceHandler, private val hashHelper: AggregatedDataSyncHashHelper ) { - fun download(): Observable { + @OptIn(ExperimentalCoroutinesApi::class) + fun download(): Flow { val progressManager = AggregatedD2ProgressManager(null) return systemInfoModuleDownloader.downloadWithProgressManager(progressManager) - .switchMap { selectDataSetsAndDownload(progressManager) } + .asFlow() + .flatMapLatest { selectDataSetsAndDownload(progressManager) } } private fun selectDataSetsAndDownload( progressManager: AggregatedD2ProgressManager - ): Observable { - val bundles = aggregatedDataCallBundleFactory.bundles - val dataSets = bundles.flatMap { it.dataSets }.mapNotNull { it.uid() } + ): Flow { + return flow { + val bundles = aggregatedDataCallBundleFactory.bundles + val dataSets = bundles.flatMap { it.dataSets }.mapNotNull { it.uid() } - progressManager.setTotalCalls(dataSets.size + 1) - progressManager.setDataSets(dataSets) + progressManager.setTotalCalls(bundles.size + 2) + progressManager.setDataSets(dataSets) + emit(progressManager.getProgress()) - return Observable.merge( - Observable.fromCallable { progressManager.setDataSets(dataSets) }, - Observable.fromIterable(bundles).flatMap { downloadInternal(it, progressManager) }, - Observable.fromCallable { progressManager.complete() } - ) + for (bundle in bundles) { + downloadBundle(bundle) + + bundle.dataSets.forEach { + progressManager.completeDataSet(it.uid(), D2ProgressSyncStatus.SUCCESS) + progressManager.increaseProgress(DataValue::class.java, false) + } + + emit(progressManager.getProgress()) + } + emit(progressManager.complete()) + } } - private fun downloadInternal( - bundle: AggregatedDataCallBundle, - progressManager: AggregatedD2ProgressManager - ): Observable { - val dataValueQuery = DataValueQuery.create(bundle) - - val completeRegistrationQuery = DataSetCompleteRegistrationQuery.create( - getUids(bundle.dataSets), - bundle.periodIds, - bundle.rootOrganisationUnitUids, - bundle.key.lastUpdatedStr() - ) + private suspend fun downloadBundle( + bundle: AggregatedDataCallBundle + ) { + return coroutineCallExecutor.wrapTransactionally(cleanForeignKeyErrors = true) { + downloadDataValues(bundle) + downloadCompleteRegistration(bundle) + downloadApproval(bundle) + updateAggregatedDataSync(bundle) + } + } - val observable = - dataValueCall.download(dataValueQuery) - .flatMap { dsCompleteRegistrationCall.download(completeRegistrationQuery) } - .flatMap { getApprovalSingle(bundle) } - .flatMap { updateAggregatedDataSync(bundle) } - .map { - bundle.dataSets.forEach { - progressManager.completeDataSet(it.uid(), D2ProgressSyncStatus.SUCCESS) - progressManager.increaseProgress(DataValue::class.java, false) - } - progressManager.getProgress() - } - .toObservable() + private suspend fun downloadDataValues( + bundle: AggregatedDataCallBundle + ): List { + val dataValueQuery = DataValueQuery(bundle) + return dataValueCall.download(dataValueQuery) + } + + private suspend fun downloadCompleteRegistration( + bundle: AggregatedDataCallBundle + ): List { + val completeRegistrationQuery = DataSetCompleteRegistrationQuery( + dataSetUids = getUids(bundle.dataSets), + periodIds = bundle.periodIds, + rootOrgUnitUids = bundle.rootOrganisationUnitUids, + lastUpdatedStr = bundle.key.lastUpdatedStr() + ) - return rxCallExecutor.wrapObservableTransactionally(observable, cleanForeignKeys = true) + return dsCompleteRegistrationCall.download(completeRegistrationQuery) } private fun updateAggregatedDataSync( bundle: AggregatedDataCallBundle - ): Single { - return Single.fromCallable { - for (dataSet in bundle.dataSets) { - aggregatedDataSyncStore.updateOrInsertWhere( - AggregatedDataSync.builder() - .dataSet(dataSet.uid()) - .periodType(dataSet.periodType()) - .pastPeriods(bundle.key.pastPeriods) - .futurePeriods(dataSet.openFuturePeriods()) - .dataElementsHash(hashHelper.getDataSetDataElementsHash(dataSet)) - .organisationUnitsHash(bundle.allOrganisationUnitUidsSet.hashCode()) - .lastUpdated(resourceHandler.serverDate) - .build() - ) - } + ) { + for (dataSet in bundle.dataSets) { + aggregatedDataSyncStore.updateOrInsertWhere( + AggregatedDataSync.builder() + .dataSet(dataSet.uid()) + .periodType(dataSet.periodType()) + .pastPeriods(bundle.key.pastPeriods) + .futurePeriods(dataSet.openFuturePeriods()) + .dataElementsHash(hashHelper.getDataSetDataElementsHash(dataSet)) + .organisationUnitsHash(bundle.allOrganisationUnitUidsSet.hashCode()) + .lastUpdated(resourceHandler.serverDate) + .build() + ) } } - private fun getApprovalSingle( + private suspend fun downloadApproval( bundle: AggregatedDataCallBundle - ): Single> { + ): List { val dataSetsWithWorkflow = bundle.dataSets.filter { it.workflow() != null } - val workflowUids = dataSetsWithWorkflow.map { it.workflow()!!.uid() } + val workflowUids = dataSetsWithWorkflow.mapNotNull { it.workflow()?.uid() } return if (workflowUids.isEmpty()) { - Single.just(emptyList()) + emptyList() } else { val attributeOptionComboUids = getAttributeOptionCombosUidsFrom(dataSetsWithWorkflow) - val dataApprovalQuery = DataApprovalQuery.create( - workflowUids, - bundle.allOrganisationUnitUidsSet, bundle.periodIds, attributeOptionComboUids, - bundle.key.lastUpdatedStr() + val dataApprovalQuery = DataApprovalQuery( + workflowsUids = workflowUids, + organisationUnistUids = bundle.allOrganisationUnitUidsSet, + periodIds = bundle.periodIds, + attributeOptionCombosUids = attributeOptionComboUids, + lastUpdatedStr = bundle.key.lastUpdatedStr() ) dataApprovalCall.download(dataApprovalQuery) } } private fun getAttributeOptionCombosUidsFrom(dataSetsWithWorkflow: Collection): Set { - val categoryComboUids = dataSetsWithWorkflow.map { it.categoryCombo()!!.uid() }.toSet() + val categoryComboUids = dataSetsWithWorkflow.mapNotNull { it.categoryCombo()?.uid() }.toSet() val whereClause = WhereClauseBuilder() .appendInKeyStringValues( @@ -166,8 +181,4 @@ internal class AggregatedDataCall @Inject constructor( return categoryOptionComboStore.selectWhere(whereClause).map { it.uid() }.toSet() } - - fun blockingDownload() { - download().blockingSubscribe() - } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataDownloaderImpl.kt b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataDownloaderImpl.kt index 74e8b039ba..76bdf49f18 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataDownloaderImpl.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataDownloaderImpl.kt @@ -31,6 +31,7 @@ package org.hisp.dhis.android.core.domain.aggregated.data.internal import dagger.Reusable import io.reactivex.Observable import javax.inject.Inject +import kotlinx.coroutines.rx2.asObservable import org.hisp.dhis.android.core.domain.aggregated.data.AggregatedD2Progress import org.hisp.dhis.android.core.domain.aggregated.data.AggregatedDataDownloader @@ -40,7 +41,7 @@ internal class AggregatedDataDownloaderImpl @Inject constructor( ) : AggregatedDataDownloader { override fun download(): Observable { - return dataCall.download() + return dataCall.download().asObservable() } override fun blockingDownload() { From 416b5296cfc07787e6fddf3c3f2a07a5bb187e53 Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Wed, 10 May 2023 11:38:42 +1000 Subject: [PATCH 004/478] [ANDROSDK-1676] Simplify partition methods --- .../android/core/dataapproval/internal/DataApprovalCall.kt | 4 ++-- .../core/dataset/internal/DataSetCompleteRegistrationCall.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCall.kt index c3180c3609..fcb9d1ab92 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCall.kt @@ -59,8 +59,8 @@ internal class DataApprovalCall @Inject constructor( query.organisationUnistUids, query.attributeOptionCombosUids ) - return partitions.fold(emptyList()) { acc, part -> - acc + apiDownloader.downloadListAsCoroutine(handler) { + return partitions.flatMap { part -> + apiDownloader.downloadListAsCoroutine(handler) { service.getDataApprovals( fields = DataApprovalFields.allFields, lastUpdated = query.lastUpdatedStr, diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCall.kt index eba26d83e4..3a527982e5 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCall.kt @@ -61,8 +61,8 @@ internal class DataSetCompleteRegistrationCall @Inject constructor( query.rootOrgUnitUids ) - return partitions.fold(emptyList()) { acc, part -> - acc + service.getDataSetCompleteRegistrations( + return partitions.flatMap { part -> + service.getDataSetCompleteRegistrations( fields = DataSetCompleteRegistrationFields.allFields, lastUpdated = query.lastUpdatedStr, dataSetUids = commaSeparatedCollectionValues(part[0]), From 3e103d322ecd9d36bde776a8595a71cb7c9cfe4d Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Fri, 12 May 2023 16:39:10 +1000 Subject: [PATCH 005/478] [ANDROSDK-1676] Add failing test for error in aggregatedDataCall --- ...dDataCallEnqueableMockIntegrationShould.kt | 66 +++++++++++++++++++ ...AggregatedDataCallMockIntegrationShould.kt | 20 ++++-- .../period/PeriodMockIntegrationShould.java | 2 +- ...ectionRepositoryMockIntegrationShould.java | 10 +-- ...llectionRepositoryMockIntegrationShould.kt | 11 ++-- ...llectionRepositoryMockIntegrationShould.kt | 14 ++-- .../DataSetModuleMockIntegrationShould.java | 4 +- ...llectionRepositoryMockIntegrationShould.kt | 14 ++-- ...ectionRepositoryMockIntegrationShould.java | 4 +- .../MaintenanceMockIntegrationShould.java | 2 +- .../core/mockwebserver/Dhis2MockServer.java | 1 + .../resources/dataset/data_sets.json | 52 +++++++++++++++ .../resources/datavalue/data_values.json | 12 ++++ .../datavalue/data_values_monthly.json | 52 +++++++++++++++ .../datavalue/data_values_weekly.json | 16 +++++ 15 files changed, 245 insertions(+), 35 deletions(-) create mode 100644 core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallEnqueableMockIntegrationShould.kt create mode 100644 core/src/sharedTest/resources/datavalue/data_values_monthly.json create mode 100644 core/src/sharedTest/resources/datavalue/data_values_weekly.json diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallEnqueableMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallEnqueableMockIntegrationShould.kt new file mode 100644 index 0000000000..f3e6c4d062 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallEnqueableMockIntegrationShould.kt @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2004-2023, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.hisp.dhis.android.core.domain.aggregated.data + +import com.google.common.truth.Truth.assertThat +import org.hisp.dhis.android.core.period.PeriodType +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class AggregatedDataCallEnqueableMockIntegrationShould : BaseMockIntegrationTestMetadataEnqueable() { + + @Test + fun should_rollback_full_bundles_on_error() { + val monthlyDataValues = "datavalue/data_values_monthly.json" + val weeklyDataValues = "datavalue/data_values_weekly.json" + val weeklyCompleteRegistrations = "dataset/data_set_complete_registrations.json" + val weeklyApprovals = "dataapproval/data_approvals_multiple.json" + + dhis2MockServer.enqueueMockResponse(monthlyDataValues) + dhis2MockServer.enqueueMockResponse(403) + dhis2MockServer.enqueueMockResponse(weeklyDataValues) + dhis2MockServer.enqueueMockResponse(weeklyCompleteRegistrations) + dhis2MockServer.enqueueMockResponse(weeklyApprovals) + + d2.aggregatedModule().data().blockingDownload() + + val monthlyValues = d2.dataSetModule().dataSetInstances() + .byPeriodType().eq(PeriodType.Monthly) + .blockingGet() + + val weeklyValues = d2.dataSetModule().dataSetInstances() + .byPeriodType().eq(PeriodType.Weekly) + .blockingGet() + + assertThat(monthlyValues).isEmpty() + assertThat(weeklyValues).isNotEmpty() + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.kt index 2a9f5e24dc..e8d3f3602a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.kt @@ -27,6 +27,7 @@ */ package org.hisp.dhis.android.core.domain.aggregated.data +import org.hisp.dhis.android.core.arch.call.D2ProgressStatus import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataDispatcher import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.Test @@ -41,18 +42,29 @@ class AggregatedDataCallMockIntegrationShould : BaseMockIntegrationTestMetadataD testObserver.awaitTerminalEvent() - testObserver.assertValueCount(3) + testObserver.assertValueCount(4) testObserver.assertValueAt(0) { v: AggregatedD2Progress -> - !v.isComplete && v.dataSets().all { (_, progress) -> !progress.isComplete } + !v.isComplete && hasNCompletedDataSets(v.dataSets(), number = 0) } testObserver.assertValueAt(1) { v: AggregatedD2Progress -> - !v.isComplete && v.dataSets().all { (_, progress) -> progress.isComplete } + !v.isComplete && hasNCompletedDataSets(v.dataSets(), number = 2) } testObserver.assertValueAt(2) { v: AggregatedD2Progress -> - v.isComplete && v.dataSets().all { (_, progress) -> progress.isComplete } + !v.isComplete && hasNCompletedDataSets(v.dataSets(), number = 3) + } + testObserver.assertValueAt(3) { v: AggregatedD2Progress -> + v.isComplete && hasAllCompletedDataSets(v.dataSets()) } testObserver.dispose() } + + private fun hasNCompletedDataSets(dataSets: Map, number: Int): Boolean { + return dataSets.filter { (_, progress) -> progress.isComplete }.size == number + } + + private fun hasAllCompletedDataSets(dataSets: Map): Boolean { + return dataSets.all { (_, progress) -> progress.isComplete } + } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodMockIntegrationShould.java index 0378f7057a..266f1184d2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodMockIntegrationShould.java @@ -73,7 +73,7 @@ public void create_period_in_database_if_not_exist() throws ParseException { @Test public void get_periods() { - assertThat(d2.periodModule().periods().blockingCount()).isEqualTo(206); + assertThat(d2.periodModule().periods().blockingCount()).isEqualTo(225); } @Test diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCollectionRepositoryMockIntegrationShould.java index fb064f70ef..9f778461a3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCollectionRepositoryMockIntegrationShould.java @@ -48,7 +48,7 @@ public class DataSetCollectionRepositoryMockIntegrationShould extends BaseMockIn public void find_all() { List dataSets = d2.dataSetModule().dataSets() .blockingGet(); - assertThat(dataSets.size()).isEqualTo(2); + assertThat(dataSets.size()).isEqualTo(3); } @Test @@ -64,7 +64,7 @@ public void filter_by_category_combo() { List dataSets = d2.dataSetModule().dataSets() .byCategoryComboUid().eq("m2jTvAj5kkm") .blockingGet(); - assertThat(dataSets.size()).isEqualTo(1); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -88,7 +88,7 @@ public void filter_by_version_bigger_1() { List dataSets = d2.dataSetModule().dataSets() .byVersion().biggerThan(21) .blockingGet(); - assertThat(dataSets.size()).isEqualTo(1); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -96,7 +96,7 @@ public void filter_by_version_bigger_0() { List dataSets = d2.dataSetModule().dataSets() .byVersion().biggerThan(22) .blockingGet(); - assertThat(dataSets.size()).isEqualTo(0); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -208,7 +208,7 @@ public void filter_by_access_data_write() { List dataSets = d2.dataSetModule().dataSets() .byAccessDataWrite().isTrue() .blockingGet(); - assertThat(dataSets.size()).isEqualTo(2); + assertThat(dataSets.size()).isEqualTo(3); } @Test diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceCollectionRepositoryMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceCollectionRepositoryMockIntegrationShould.kt index bddfceadfd..88bb79de36 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceCollectionRepositoryMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceCollectionRepositoryMockIntegrationShould.kt @@ -29,7 +29,6 @@ package org.hisp.dhis.android.testapp.dataset import com.google.common.truth.Truth.assertThat import org.hisp.dhis.android.core.arch.helpers.DateUtils -import org.hisp.dhis.android.core.common.BaseIdentifiableObject import org.hisp.dhis.android.core.period.PeriodType import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher import org.hisp.dhis.android.core.utils.runner.D2JunitRunner @@ -43,7 +42,7 @@ class DataSetInstanceCollectionRepositoryMockIntegrationShould : BaseMockIntegra val dataSetInstances = d2.dataSetModule().dataSetInstances() .blockingGet() - assertThat(dataSetInstances.size).isEqualTo(3) + assertThat(dataSetInstances.size).isEqualTo(4) } @Test @@ -79,16 +78,16 @@ class DataSetInstanceCollectionRepositoryMockIntegrationShould : BaseMockIntegra .byPeriodStartDate().after(DateUtils.SIMPLE_DATE_FORMAT.parse("2019-06-15T00:00:00.000")) .blockingGet() - assertThat(dataSetInstances.size).isEqualTo(2) + assertThat(dataSetInstances.size).isEqualTo(3) } @Test fun filter_by_period_end_date() { val dataSetInstances = d2.dataSetModule().dataSetInstances() - .byPeriodEndDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) + .byPeriodEndDate().after(DateUtils.DATE_FORMAT.parse("2018-07-15T00:00:00.000")) .blockingGet() - assertThat(dataSetInstances.size).isEqualTo(3) + assertThat(dataSetInstances.size).isEqualTo(4) } @Test @@ -97,7 +96,7 @@ class DataSetInstanceCollectionRepositoryMockIntegrationShould : BaseMockIntegra .byOrganisationUnitUid().eq("DiszpKrYNg8") .blockingGet() - assertThat(dataSetInstances.size).isEqualTo(2) + assertThat(dataSetInstances.size).isEqualTo(3) } @Test diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould.kt index 058fc7430c..3a728b60db 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould.kt @@ -43,7 +43,7 @@ class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould : BaseMock val summaries = d2.dataSetModule().dataSetInstanceSummaries() .blockingGet() - assertThat(summaries.size).isEqualTo(2) + assertThat(summaries.size).isEqualTo(3) summaries .filter { it.dataSetUid() == "lyLU2wR22tC" } .forEach { @@ -58,7 +58,7 @@ class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould : BaseMock .byDataSetUid().eq("lyLU2wR22tC") .blockingGet() - assertThat(summaries.size).isEqualTo(2) + assertThat(summaries.size).isEqualTo(3) summaries .filter { it.dataSetUid() == "lyLU2wR22tC" } .forEach { @@ -73,7 +73,7 @@ class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould : BaseMock .byPeriod().eq("2018") .blockingGet() - assertThat(summaries.size).isEqualTo(2) + assertThat(summaries.size).isEqualTo(3) summaries .filter { it.dataSetUid() == "lyLU2wR22tC" } .forEach { @@ -88,7 +88,7 @@ class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould : BaseMock .byPeriodType().eq(PeriodType.Yearly) .blockingGet() - assertThat(summaries.size).isEqualTo(2) + assertThat(summaries.size).isEqualTo(3) } @Test @@ -97,7 +97,7 @@ class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould : BaseMock .byPeriodStartDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) .blockingGet() - assertThat(summaries.size).isEqualTo(2) + assertThat(summaries.size).isEqualTo(3) } @Test @@ -106,7 +106,7 @@ class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould : BaseMock .byPeriodEndDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) .blockingGet() - assertThat(summaries.size).isEqualTo(2) + assertThat(summaries.size).isEqualTo(3) } @Test @@ -115,7 +115,7 @@ class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould : BaseMock .byOrganisationUnitUid().eq("DiszpKrYNg8") .blockingGet() - assertThat(summaries.size).isEqualTo(2) + assertThat(summaries.size).isEqualTo(3) summaries .filter { it.dataSetUid() == "lyLU2wR22tC" } .forEach { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java index 19ee2ca2f5..3bfe1929af 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java @@ -49,7 +49,7 @@ public class DataSetModuleMockIntegrationShould extends BaseMockIntegrationTestF @Test public void allow_access_to_all_data_sets_without_children() { List dataSets = d2.dataSetModule().dataSets().blockingGet(); - assertThat(dataSets.size()).isEqualTo(2); + assertThat(dataSets.size()).isEqualTo(3); for (DataSet dataSet : dataSets) { assertThat(dataSet.dataSetElements() == null).isTrue(); } @@ -64,7 +64,7 @@ public void allow_access_to_one_data_set_without_children() { @Test public void allow_access_to_all_data_sets_with_children() { List dataSets = d2.dataSetModule().dataSets().withDataSetElements().blockingGet(); - assertThat(dataSets.size()).isEqualTo(2); + assertThat(dataSets.size()).isEqualTo(3); for (DataSet dataSet : dataSets) { assertThat(dataSet.dataSetElements() == null).isFalse(); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.kt index 64032de61e..c6030817ec 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.kt @@ -43,7 +43,7 @@ class DataValueCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe val dataValues = d2.dataValueModule().dataValues() .blockingGet() - assertThat(dataValues.size).isEqualTo(7) + assertThat(dataValues.size).isEqualTo(8) } @Test @@ -53,7 +53,7 @@ class DataValueCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe .eq("g9eOBujte1U") .blockingGet() - assertThat(dataValues.size).isEqualTo(7) + assertThat(dataValues.size).isEqualTo(8) } @Test @@ -73,7 +73,7 @@ class DataValueCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe .eq("DiszpKrYNg8") .blockingGet() - assertThat(dataValues.size).isEqualTo(6) + assertThat(dataValues.size).isEqualTo(7) } @Test @@ -83,7 +83,7 @@ class DataValueCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe .eq("Gmbgme7z9BF") .blockingGet() - assertThat(dataValues.size).isEqualTo(6) + assertThat(dataValues.size).isEqualTo(7) } @Test @@ -152,7 +152,7 @@ class DataValueCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe .byFollowUp().isFalse .blockingGet() - assertThat(dataValues.size).isEqualTo(6) + assertThat(dataValues.size).isEqualTo(7) } @Test @@ -161,7 +161,7 @@ class DataValueCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe .bySyncState().eq(State.SYNCED) .blockingGet() - assertThat(dataValues.size).isEqualTo(7) + assertThat(dataValues.size).isEqualTo(8) } @Test @@ -170,7 +170,7 @@ class DataValueCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe .byDeleted().isFalse .blockingGet() - assertThat(dataValues.size).isEqualTo(7) + assertThat(dataValues.size).isEqualTo(8) } @Test diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/ForeignKeyViolationCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/ForeignKeyViolationCollectionRepositoryMockIntegrationShould.java index bfd5c0fbaa..f6aa026ba5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/ForeignKeyViolationCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/ForeignKeyViolationCollectionRepositoryMockIntegrationShould.java @@ -46,7 +46,7 @@ public class ForeignKeyViolationCollectionRepositoryMockIntegrationShould extend @Test public void find_all() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations().blockingGet(); - assertThat(foreignKeyViolations.size()).isEqualTo(3); + assertThat(foreignKeyViolations.size()).isEqualTo(4); } @Test @@ -102,6 +102,6 @@ public void filter_by_from_object_row() { public void filter_by_created() throws ParseException { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byCreated().after(DateUtils.DATE_FORMAT.parse("2019-01-15T08:14:06.767")).blockingGet(); - assertThat(foreignKeyViolations.size()).isEqualTo(3); + assertThat(foreignKeyViolations.size()).isEqualTo(4); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/MaintenanceMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/MaintenanceMockIntegrationShould.java index ea171e35e4..0159095b4f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/MaintenanceMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/MaintenanceMockIntegrationShould.java @@ -49,7 +49,7 @@ public class MaintenanceMockIntegrationShould extends BaseMockIntegrationTestFul @Test public void allow_access_to_foreign_key_violations() { List violations = d2.maintenanceModule().foreignKeyViolations().blockingGet(); - assertThat(violations.size()).isEqualTo(3); + assertThat(violations.size()).isEqualTo(4); ForeignKeyViolation optionViolation = ForeignKeyViolation.builder() .toTable(OptionSetTableInfo.TABLE_INFO.name()) diff --git a/core/src/main/java/org/hisp/dhis/android/core/mockwebserver/Dhis2MockServer.java b/core/src/main/java/org/hisp/dhis/android/core/mockwebserver/Dhis2MockServer.java index f4b3f8d81a..be408f780a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/mockwebserver/Dhis2MockServer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/mockwebserver/Dhis2MockServer.java @@ -351,6 +351,7 @@ public void enqueueMetadataResponses() { enqueueMockResponse(DATA_ELEMENTS_JSON); enqueueMockResponse(VALIDATION_RULE_UIDS_JSON); enqueueMockResponse(VALIDATION_RULE_UIDS_JSON); + enqueueMockResponse(VALIDATION_RULE_UIDS_JSON); enqueueMockResponse(VALIDATION_RULES_JSON); enqueueMockResponse(CATEGORY_COMBOS_JSON); enqueueMockResponse(CATEGORIES_JSON); diff --git a/core/src/sharedTest/resources/dataset/data_sets.json b/core/src/sharedTest/resources/dataset/data_sets.json index ebc5c3c69c..2724a8d2f1 100644 --- a/core/src/sharedTest/resources/dataset/data_sets.json +++ b/core/src/sharedTest/resources/dataset/data_sets.json @@ -186,6 +186,58 @@ ], "dataInputPeriods": [ ] + }, + { + "lastUpdated": "2014-08-09T12:35:36.743", + "id": "TaMAefItzgt", + "created": "2012-06-10T00:36:10.036", + "name": "Child Health Weekly", + "shortName": "Child Health", + "validCompleteOnly": true, + "skipOffline": true, + "version": 25, + "timelyDays": 5, + "dataElementDecoration": false, + "displayName": "Child Health", + "notifyCompletingUser": true, + "noValueRequiresComment": false, + "displayShortName": "Child Health", + "fieldCombinationRequired": true, + "renderHorizontally": true, + "renderAsTabs": false, + "mobile": true, + "periodType": "Weekly", + "openFuturePeriods": 2, + "expiryDays": 2, + "categoryCombo": { + "id": "m2jTvAj5kkm" + }, + "dataSetElements": [ + { + "dataSet": { + "id": "TaMAefItzgt" + }, + "dataElement": { + "id": "g9eOBujte1U" + }, + "categoryCombo": { + "id": "m2jTvAj5kkm" + } + } + ], + "indicators": [ + ], + "access": { + "data": { + "write": true + } + }, + "sections": [ + ], + "compulsoryDataElementOperands": [ + ], + "dataInputPeriods": [ + ] } ] } \ No newline at end of file diff --git a/core/src/sharedTest/resources/datavalue/data_values.json b/core/src/sharedTest/resources/datavalue/data_values.json index 65e096a544..2520667400 100644 --- a/core/src/sharedTest/resources/datavalue/data_values.json +++ b/core/src/sharedTest/resources/datavalue/data_values.json @@ -86,6 +86,18 @@ "created": "2012-08-11T00:00:00.000+0000", "lastUpdated": "2012-08-11T00:00:00.000+0000", "followup": false + }, + { + "dataElement": "g9eOBujte1U", + "period": "2019W43", + "orgUnit": "DiszpKrYNg8", + "categoryOptionCombo": "Gmbgme7z9BF", + "attributeOptionCombo": "Gmbgme7z9BF", + "value": "5", + "storedBy": "bodata1", + "created": "2012-08-11T00:00:00.000+0000", + "lastUpdated": "2012-08-11T00:00:00.000+0000", + "followup": false } ] } \ No newline at end of file diff --git a/core/src/sharedTest/resources/datavalue/data_values_monthly.json b/core/src/sharedTest/resources/datavalue/data_values_monthly.json new file mode 100644 index 0000000000..a25e75a8c9 --- /dev/null +++ b/core/src/sharedTest/resources/datavalue/data_values_monthly.json @@ -0,0 +1,52 @@ +{ + "dataValues": [ + { + "dataElement": "g9eOBujte1U", + "period": "201907", + "orgUnit": "DiszpKrYNg8", + "categoryOptionCombo": "Gmbgme7z9BF", + "attributeOptionCombo": "bRowv6yZOF2", + "value": "12", + "storedBy": "bodata1", + "created": "2012-08-11T00:00:00.000+0000", + "lastUpdated": "2012-08-11T00:00:00.000+0000", + "followup": false + }, + { + "dataElement": "g9eOBujte1U", + "period": "201907", + "orgUnit": "DiszpKrYNg8", + "categoryOptionCombo": "bRowv6yZOF2", + "attributeOptionCombo": "bRowv6yZOF2", + "value": "12", + "storedBy": "bodata1", + "created": "2012-08-11T00:00:00.000+0000", + "lastUpdated": "2012-08-11T00:00:00.000+0000", + "followup": false + }, + { + "dataElement": "g9eOBujte1U", + "period": "201906", + "orgUnit": "g8upMTyEZGZ", + "categoryOptionCombo": "Gmbgme7z9BF", + "attributeOptionCombo": "bRowv6yZOF2", + "value": "4", + "storedBy": "bodata1", + "created": "2012-08-11T00:00:00.000+0000", + "lastUpdated": "2012-08-11T00:00:00.000+0000", + "followup": false + }, + { + "dataElement": "g9eOBujte1U", + "period": "201908", + "orgUnit": "DiszpKrYNg8", + "categoryOptionCombo": "Gmbgme7z9BF", + "attributeOptionCombo": "Gmbgme7z9BF", + "value": "24", + "storedBy": "bodata1", + "created": "2012-08-11T00:00:00.000+0000", + "lastUpdated": "2012-08-11T00:00:00.000+0000", + "followup": false + } + ] +} \ No newline at end of file diff --git a/core/src/sharedTest/resources/datavalue/data_values_weekly.json b/core/src/sharedTest/resources/datavalue/data_values_weekly.json new file mode 100644 index 0000000000..213cec5168 --- /dev/null +++ b/core/src/sharedTest/resources/datavalue/data_values_weekly.json @@ -0,0 +1,16 @@ +{ + "dataValues": [ + { + "dataElement": "g9eOBujte1U", + "period": "2019W43", + "orgUnit": "DiszpKrYNg8", + "categoryOptionCombo": "Gmbgme7z9BF", + "attributeOptionCombo": "Gmbgme7z9BF", + "value": "5", + "storedBy": "bodata1", + "created": "2012-08-11T00:00:00.000+0000", + "lastUpdated": "2012-08-11T00:00:00.000+0000", + "followup": false + } + ] +} \ No newline at end of file From d80be094f2ca83e3ea5146ab90c54af990c37819 Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Fri, 12 May 2023 16:54:05 +1000 Subject: [PATCH 006/478] [ANDROSDK-1676] Continue on bundle error --- ...atedDataCallEnqueableMockIntegrationShould.kt | 16 ++++++++-------- .../arch/call/factories/internal/QueryCall.kt | 2 +- .../data/internal/AggregatedDataCall.kt | 14 +++++++++----- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallEnqueableMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallEnqueableMockIntegrationShould.kt index f3e6c4d062..31a6184d93 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallEnqueableMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallEnqueableMockIntegrationShould.kt @@ -42,25 +42,25 @@ class AggregatedDataCallEnqueableMockIntegrationShould : BaseMockIntegrationTest val monthlyDataValues = "datavalue/data_values_monthly.json" val weeklyDataValues = "datavalue/data_values_weekly.json" val weeklyCompleteRegistrations = "dataset/data_set_complete_registrations.json" - val weeklyApprovals = "dataapproval/data_approvals_multiple.json" + + dhis2MockServer.enqueueSystemInfoResponse() dhis2MockServer.enqueueMockResponse(monthlyDataValues) dhis2MockServer.enqueueMockResponse(403) + dhis2MockServer.enqueueMockResponse(weeklyDataValues) dhis2MockServer.enqueueMockResponse(weeklyCompleteRegistrations) - dhis2MockServer.enqueueMockResponse(weeklyApprovals) d2.aggregatedModule().data().blockingDownload() val monthlyValues = d2.dataSetModule().dataSetInstances() - .byPeriodType().eq(PeriodType.Monthly) - .blockingGet() + .byPeriodType().eq(PeriodType.Monthly) + .blockingGet() + assertThat(monthlyValues).isEmpty() val weeklyValues = d2.dataSetModule().dataSetInstances() - .byPeriodType().eq(PeriodType.Weekly) - .blockingGet() - - assertThat(monthlyValues).isEmpty() + .byPeriodType().eq(PeriodType.Weekly) + .blockingGet() assertThat(weeklyValues).isNotEmpty() } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCall.kt b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCall.kt index 09eb40b01b..9c1b5ae057 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCall.kt @@ -29,6 +29,6 @@ package org.hisp.dhis.android.core.arch.call.factories.internal import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQueryKt -internal interface QueryCall { +internal fun interface QueryCall { suspend fun download(query: Q): List

} diff --git a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataCall.kt b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataCall.kt index ce6d74ed3e..b2b2ce96c6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataCall.kt @@ -50,6 +50,7 @@ import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationQu import org.hisp.dhis.android.core.datavalue.DataValue import org.hisp.dhis.android.core.datavalue.internal.DataValueQuery import org.hisp.dhis.android.core.domain.aggregated.data.AggregatedD2Progress +import org.hisp.dhis.android.core.maintenance.D2Error import org.hisp.dhis.android.core.resource.internal.ResourceHandler import org.hisp.dhis.android.core.systeminfo.internal.SystemInfoModuleDownloader @@ -103,11 +104,14 @@ internal class AggregatedDataCall @Inject constructor( private suspend fun downloadBundle( bundle: AggregatedDataCallBundle ) { - return coroutineCallExecutor.wrapTransactionally(cleanForeignKeyErrors = true) { - downloadDataValues(bundle) - downloadCompleteRegistration(bundle) - downloadApproval(bundle) - updateAggregatedDataSync(bundle) + return try { + coroutineCallExecutor.wrapTransactionally(cleanForeignKeyErrors = true) { + downloadDataValues(bundle) + downloadCompleteRegistration(bundle) + downloadApproval(bundle) + updateAggregatedDataSync(bundle) + } + } catch (_: D2Error) { } } From 9b960bd0ab0a0da528bd03bdabcf123747b40ad7 Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 17 May 2023 15:19:10 +0200 Subject: [PATCH 007/478] [ANDROID-1678] Refactor updateDataValues function to return Flow --- .../FileResourceCallRealIntegrationShould.kt | 4 +- .../internal/DataValueFileResourcePostCall.kt | 4 +- .../datavalue/internal/DataValuePostCall.kt | 49 +++++++++---------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceCallRealIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceCallRealIntegrationShould.kt index 268784df63..946a532331 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceCallRealIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceCallRealIntegrationShould.kt @@ -191,8 +191,8 @@ class FileResourceCallRealIntegrationShould : BaseRealIntegrationTest() { d2.dataValueModule().dataValues() .value( - nextPeriod.periodId()!!, dataValue.organisationUnit(), dataValue.dataElement(), - dataValue.categoryOptionCombo(), dataValue.attributeOptionCombo() + nextPeriod.periodId()!!, dataValue.organisationUnit()!!, dataValue.dataElement()!!, + dataValue.categoryOptionCombo()!!, dataValue.attributeOptionCombo()!! ) .blockingSet(uid) diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueFileResourcePostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueFileResourcePostCall.kt index cda24fab30..41d278241b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueFileResourcePostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueFileResourcePostCall.kt @@ -40,7 +40,7 @@ internal class DataValueFileResourcePostCall @Inject constructor( private val fileResourceHelper: FileResourceHelper, private val fileResourcePostCall: FileResourcePostCall ) { - fun uploadFileResource(dataValues: List): DataValueFileResourcePostCallResult { + suspend fun uploadFileResource(dataValues: List): DataValueFileResourcePostCallResult { val fileResources = fileResourceHelper.getUploadableFileResources() return if (fileResources.isEmpty()) { @@ -62,7 +62,7 @@ internal class DataValueFileResourcePostCall @Inject constructor( } } - fun updateFileResourceStates(fileResources: List) { + suspend fun updateFileResourceStates(fileResources: List) { fileResourceHelper.updateFileResourceStates(fileResources, FileResourceDomainType.AGGREGATED) } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt index 492c944701..8e0c6d1b07 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt @@ -28,10 +28,12 @@ package org.hisp.dhis.android.core.datavalue.internal import dagger.Reusable -import io.reactivex.Observable -import io.reactivex.ObservableEmitter import java.net.HttpURLConnection import javax.inject.Inject +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.withContext import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor import org.hisp.dhis.android.core.arch.call.D2Progress import org.hisp.dhis.android.core.arch.call.internal.D2ProgressManager @@ -54,32 +56,27 @@ internal class DataValuePostCall @Inject constructor( private val dataValueStore: DataValueStore, private val versionManager: DHISVersionManager ) { - fun uploadDataValues(dataValues: List): Observable { - return Observable.defer { - if (dataValues.isEmpty()) { - return@defer Observable.empty() - } else { - val progressManager = D2ProgressManager(1) - return@defer Observable.create { emitter: ObservableEmitter -> - val result = fileResourcePostCall.uploadFileResource(dataValues) - val validDataValues = result.dataValues + fun uploadDataValues(dataValues: List): Flow = flow { + if (dataValues.isEmpty()) { + return@flow + } + + val progressManager = D2ProgressManager(1) + val result = withContext(Dispatchers.IO) { fileResourcePostCall.uploadFileResource(dataValues) } + val validDataValues = result.dataValues - markObjectsAs(validDataValues, State.UPLOADING) - try { - val dataValueSet = DataValueSet(validDataValues) - val dataValueImportSummary = executePostCall(dataValueSet) - dataValueImportHandler.handleImportSummary(dataValueSet, dataValueImportSummary) - fileResourcePostCall.updateFileResourceStates(result.fileResources) - } catch (e: D2Error) { - markObjectsAs(validDataValues, errorIfOnline(e)) - fileResourcePostCall.updateFileResourceStates(result.fileResources) - throw e - } - emitter.onNext(progressManager.increaseProgress(DataValue::class.java, true)) - emitter.onComplete() - } - } + markObjectsAs(validDataValues, State.UPLOADING) + try { + val dataValueSet = DataValueSet(validDataValues) + val dataValueImportSummary = executePostCall(dataValueSet) + dataValueImportHandler.handleImportSummary(dataValueSet, dataValueImportSummary) + fileResourcePostCall.updateFileResourceStates(result.fileResources) + } catch (e: D2Error) { + markObjectsAs(validDataValues, errorIfOnline(e)) + fileResourcePostCall.updateFileResourceStates(result.fileResources) + throw e } + emit(progressManager.increaseProgress(DataValue::class.java, true)) } private fun executePostCall(dataValueSet: DataValueSet): DataValueImportSummary? { From e2af1b894da328cc375f8df1d485600441e858f4 Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 17 May 2023 15:19:30 +0200 Subject: [PATCH 008/478] Rename .java to .kt --- ...CollectionRepository.java => DataValueCollectionRepository.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename core/src/main/java/org/hisp/dhis/android/core/datavalue/{DataValueCollectionRepository.java => DataValueCollectionRepository.kt} (100%) diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt similarity index 100% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt From aa0e1b12ac28effb8939c883a9e08da89d0cd170 Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 17 May 2023 15:19:30 +0200 Subject: [PATCH 009/478] [ANDROID-1678] Refactor DataValueCollectionRepository to kotlin --- .../DataValueCollectionRepository.kt | 191 +++++++++--------- 1 file changed, 92 insertions(+), 99 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt index 58f064a011..e3f9868f6e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt @@ -25,143 +25,136 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -package org.hisp.dhis.android.core.datavalue; - -import org.hisp.dhis.android.core.arch.call.D2Progress; -import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithUploadCollectionRepository; -import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.StringFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.datavalue.internal.DataValuePostCall; -import org.hisp.dhis.android.core.datavalue.internal.DataValueStore; - -import java.util.Map; - -import javax.inject.Inject; - -import dagger.Reusable; -import io.reactivex.Observable; - -import static org.hisp.dhis.android.core.datavalue.DataValueTableInfo.Columns; +package org.hisp.dhis.android.core.datavalue + +import dagger.Reusable +import io.reactivex.Observable +import javax.inject.Inject +import kotlinx.coroutines.flow.emitAll +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.rx2.asObservable +import org.hisp.dhis.android.core.arch.call.D2Progress +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithUploadCollectionRepository +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl +import org.hisp.dhis.android.core.arch.repositories.filters.internal.* +import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope +import org.hisp.dhis.android.core.common.State +import org.hisp.dhis.android.core.datavalue.DataValueByDataSetQueryHelper.dataValueKey +import org.hisp.dhis.android.core.datavalue.DataValueByDataSetQueryHelper.operator +import org.hisp.dhis.android.core.datavalue.DataValueByDataSetQueryHelper.whereClause +import org.hisp.dhis.android.core.datavalue.internal.DataValuePostCall +import org.hisp.dhis.android.core.datavalue.internal.DataValueStore @Reusable -public final class DataValueCollectionRepository - extends ReadOnlyCollectionRepositoryImpl - implements ReadOnlyWithUploadCollectionRepository { - - private final DataValueStore store; - private final DataValuePostCall postCall; - - @Inject - DataValueCollectionRepository(final DataValueStore store, - final Map> childrenAppenders, - final RepositoryScope scope, - final DataValuePostCall postCall) { - super(store, childrenAppenders, scope, new FilterConnectorFactory<>(scope, - s -> new DataValueCollectionRepository(store, childrenAppenders, s, postCall))); - this.store = store; - this.postCall = postCall; +class DataValueCollectionRepository @Inject internal constructor( + private val store: DataValueStore, + childrenAppenders: MutableMap>, + scope: RepositoryScope, + private val postCall: DataValuePostCall +) : ReadOnlyCollectionRepositoryImpl( + store, + childrenAppenders, + scope, + FilterConnectorFactory(scope) { s: RepositoryScope -> + DataValueCollectionRepository(store, childrenAppenders, s, postCall) } +), + ReadOnlyWithUploadCollectionRepository { - @Override - public Observable upload() { - return Observable.fromCallable(() -> - bySyncState().in(State.uploadableStatesIncludingError()).blockingGetWithoutChildren() - ).flatMap(postCall::uploadDataValues); - } + override fun upload(): Observable = flow { + val dataValues = + bySyncState().`in`(State.uploadableStatesIncludingError().toMutableList()).blockingGetWithoutChildren() + emitAll(postCall.uploadDataValues(dataValues)) + }.asObservable() - @Override - public void blockingUpload() { - upload().blockingSubscribe(); + override fun blockingUpload() { + upload().blockingSubscribe() } - public DataValueObjectRepository value(String period, - String organisationUnit, - String dataElement, - String categoryOptionCombo, - String attributeOptionCombo) { - RepositoryScope updatedScope = byPeriod().eq(period) - .byOrganisationUnitUid().eq(organisationUnit) - .byDataElementUid().eq(dataElement) - .byCategoryOptionComboUid().eq(categoryOptionCombo) - .byAttributeOptionComboUid().eq(attributeOptionCombo) - .scope; - return new DataValueObjectRepository(store, childrenAppenders, updatedScope, period, organisationUnit, - dataElement, categoryOptionCombo, attributeOptionCombo); + fun value( + period: String, + organisationUnit: String, + dataElement: String, + categoryOptionCombo: String, + attributeOptionCombo: String + ): DataValueObjectRepository { + val updatedScope = byPeriod().eq(period) + .byOrganisationUnitUid().eq(organisationUnit) + .byDataElementUid().eq(dataElement) + .byCategoryOptionComboUid().eq(categoryOptionCombo) + .byAttributeOptionComboUid().eq(attributeOptionCombo).scope + return DataValueObjectRepository( + store, childrenAppenders, updatedScope, period, organisationUnit, + dataElement, categoryOptionCombo, attributeOptionCombo + ) } - public StringFilterConnector byDataElementUid() { - return cf.string(Columns.DATA_ELEMENT); + fun byDataElementUid(): StringFilterConnector { + return cf.string(DataValueTableInfo.Columns.DATA_ELEMENT) } - public StringFilterConnector byPeriod() { - return cf.string(Columns.PERIOD); + fun byPeriod(): StringFilterConnector { + return cf.string(DataValueTableInfo.Columns.PERIOD) } - public StringFilterConnector byOrganisationUnitUid() { - return cf.string(Columns.ORGANISATION_UNIT); + fun byOrganisationUnitUid(): StringFilterConnector { + return cf.string(DataValueTableInfo.Columns.ORGANISATION_UNIT) } - public StringFilterConnector byCategoryOptionComboUid() { - return cf.string(Columns.CATEGORY_OPTION_COMBO); + fun byCategoryOptionComboUid(): StringFilterConnector { + return cf.string(DataValueTableInfo.Columns.CATEGORY_OPTION_COMBO) } - public StringFilterConnector byAttributeOptionComboUid() { - return cf.string(Columns.ATTRIBUTE_OPTION_COMBO); + fun byAttributeOptionComboUid(): StringFilterConnector { + return cf.string(DataValueTableInfo.Columns.ATTRIBUTE_OPTION_COMBO) } - public StringFilterConnector byValue() { - return cf.string(Columns.VALUE); + fun byValue(): StringFilterConnector { + return cf.string(DataValueTableInfo.Columns.VALUE) } - public DataValueCollectionRepository byDataSetUid(String dataSetUid) { - return cf.subQuery(DataValueByDataSetQueryHelper.getDataValueKey()) - .rawSubQuery(DataValueByDataSetQueryHelper.getOperator(), - DataValueByDataSetQueryHelper.whereClause(dataSetUid)); + fun byDataSetUid(dataSetUid: String?): DataValueCollectionRepository { + return cf.subQuery(dataValueKey) + .rawSubQuery( + operator, + whereClause(dataSetUid!!) + )!! } - public StringFilterConnector byStoredBy() { - return cf.string(Columns.STORED_BY); + fun byStoredBy(): StringFilterConnector { + return cf.string(DataValueTableInfo.Columns.STORED_BY) } - public DateFilterConnector byCreated() { - return cf.date(Columns.CREATED); + fun byCreated(): DateFilterConnector { + return cf.date(DataValueTableInfo.Columns.CREATED) } - public DateFilterConnector byLastUpdated() { - return cf.date(Columns.LAST_UPDATED); + fun byLastUpdated(): DateFilterConnector { + return cf.date(DataValueTableInfo.Columns.LAST_UPDATED) } - public StringFilterConnector byComment() { - return cf.string(Columns.COMMENT); + fun byComment(): StringFilterConnector { + return cf.string(DataValueTableInfo.Columns.COMMENT) } - public BooleanFilterConnector byFollowUp() { - return cf.bool(Columns.FOLLOW_UP); + fun byFollowUp(): BooleanFilterConnector { + return cf.bool(DataValueTableInfo.Columns.FOLLOW_UP) } /** - * @deprecated Use {@link #bySyncState()} instead. - * * @return */ - @Deprecated - public EnumFilterConnector byState() { - return bySyncState(); + @Deprecated("Use {@link #bySyncState()} instead.\n" + " \n" + " ") + fun byState(): EnumFilterConnector { + return bySyncState() } - public EnumFilterConnector bySyncState() { - return cf.enumC(Columns.SYNC_STATE); + fun bySyncState(): EnumFilterConnector { + return cf.enumC(DataValueTableInfo.Columns.SYNC_STATE) } - public BooleanFilterConnector byDeleted() { - return cf.bool(Columns.DELETED); + fun byDeleted(): BooleanFilterConnector { + return cf.bool(DataValueTableInfo.Columns.DELETED) } -} \ No newline at end of file +} From 22526ed95ea31b650135ace7656df75a830fd0a0 Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 17 May 2023 15:51:22 +0200 Subject: [PATCH 010/478] [ANDROID-1678] Supress TooManyfunctions warning --- .../dhis/android/core/datavalue/DataValueCollectionRepository.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt index e3f9868f6e..26929cc626 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueCollectionRepository.kt @@ -46,6 +46,7 @@ import org.hisp.dhis.android.core.datavalue.DataValueByDataSetQueryHelper.whereC import org.hisp.dhis.android.core.datavalue.internal.DataValuePostCall import org.hisp.dhis.android.core.datavalue.internal.DataValueStore +@Suppress("TooManyFunctions") @Reusable class DataValueCollectionRepository @Inject internal constructor( private val store: DataValueStore, From 8bfbce936d83ad601dcc55d77299edeead205f42 Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 18 May 2023 12:34:29 +0200 Subject: [PATCH 011/478] [ANDROID-1678] Refactor DataValueService methods to return a suspend function --- .../datavalue/internal/DataValuePostCall.kt | 42 +++++++++++-------- .../datavalue/internal/DataValueService.kt | 5 +-- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt index 8e0c6d1b07..7952bec460 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt @@ -30,13 +30,12 @@ package org.hisp.dhis.android.core.datavalue.internal import dagger.Reusable import java.net.HttpURLConnection import javax.inject.Inject -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow -import kotlinx.coroutines.withContext -import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor +import org.hisp.dhis.android.core.arch.api.executors.internal.CoroutineAPICallExecutor import org.hisp.dhis.android.core.arch.call.D2Progress import org.hisp.dhis.android.core.arch.call.internal.D2ProgressManager +import org.hisp.dhis.android.core.arch.helpers.Result import org.hisp.dhis.android.core.arch.helpers.internal.DataStateHelper.errorIfOnline import org.hisp.dhis.android.core.arch.helpers.internal.DataStateHelper.forcedOrOwn import org.hisp.dhis.android.core.common.State @@ -52,9 +51,9 @@ internal class DataValuePostCall @Inject constructor( private val dataValueService: DataValueService, private val dataValueImportHandler: DataValueImportHandler, private val fileResourcePostCall: DataValueFileResourcePostCall, - private val apiCallExecutor: APICallExecutor, private val dataValueStore: DataValueStore, - private val versionManager: DHISVersionManager + private val versionManager: DHISVersionManager, + private val coroutineAPICallExecutor: CoroutineAPICallExecutor ) { fun uploadDataValues(dataValues: List): Flow = flow { if (dataValues.isEmpty()) { @@ -62,34 +61,41 @@ internal class DataValuePostCall @Inject constructor( } val progressManager = D2ProgressManager(1) - val result = withContext(Dispatchers.IO) { fileResourcePostCall.uploadFileResource(dataValues) } + val result = fileResourcePostCall.uploadFileResource(dataValues) val validDataValues = result.dataValues markObjectsAs(validDataValues, State.UPLOADING) try { val dataValueSet = DataValueSet(validDataValues) - val dataValueImportSummary = executePostCall(dataValueSet) - dataValueImportHandler.handleImportSummary(dataValueSet, dataValueImportSummary) - fileResourcePostCall.updateFileResourceStates(result.fileResources) + executePostCall(dataValueSet).fold( + onSuccess = { + dataValueImportHandler.handleImportSummary(dataValueSet, it) + }, + onFailure = { + throw it + } + ) } catch (e: D2Error) { markObjectsAs(validDataValues, errorIfOnline(e)) - fileResourcePostCall.updateFileResourceStates(result.fileResources) throw e + } finally { + fileResourcePostCall.updateFileResourceStates(result.fileResources) } emit(progressManager.increaseProgress(DataValue::class.java, true)) } - private fun executePostCall(dataValueSet: DataValueSet): DataValueImportSummary? { + private suspend fun executePostCall(dataValueSet: DataValueSet): Result { return if (versionManager.isGreaterOrEqualThan(DHISVersion.V2_38)) { - apiCallExecutor.executeObjectCallWithAcceptedErrorCodes( - dataValueService.postDataValuesWebResponse(dataValueSet), - listOf(HttpURLConnection.HTTP_CONFLICT), - DataValueImportSummaryWebResponse::class.java - ).response() + coroutineAPICallExecutor.wrap( + acceptedErrorCodes = listOf(HttpURLConnection.HTTP_CONFLICT), + errorClass = DataValueImportSummaryWebResponse::class.java + ) { + dataValueService.postDataValuesWebResponse(dataValueSet) + }.map { it.response()!! } // TODO ("Remove !! after refactor to DataClass") } else { - apiCallExecutor.executeObjectCall( + coroutineAPICallExecutor.wrap() { dataValueService.postDataValues(dataValueSet) - ) + } } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.kt index 9679d75550..0e3ac8deba 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.kt @@ -32,7 +32,6 @@ import org.hisp.dhis.android.core.arch.api.filters.internal.Which import org.hisp.dhis.android.core.datavalue.DataValue import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary import org.hisp.dhis.android.core.imports.internal.DataValueImportSummaryWebResponse -import retrofit2.Call import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.POST @@ -54,8 +53,8 @@ internal interface DataValueService { ): DataValueSet @POST("dataValueSets") - fun postDataValues(@Body dataValueSet: DataValueSet): Call + suspend fun postDataValues(@Body dataValueSet: DataValueSet): DataValueImportSummary @POST("dataValueSets") - fun postDataValuesWebResponse(@Body dataValueSet: DataValueSet): Call + suspend fun postDataValuesWebResponse(@Body dataValueSet: DataValueSet): DataValueImportSummaryWebResponse } From b5c3ee936a443ebf7cc244eb15795687ee14968c Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 18 May 2023 13:33:45 +0200 Subject: [PATCH 012/478] [ANDROID-1678] Create CoroutineAPICallExecutorShould test --- .../datavalue/internal/DataValuePostCall.kt | 2 +- .../CoroutineAPICallExecutorShould.kt | 97 +++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 core/src/test/java/org/hisp/dhis/android/core/arch/api/executors/internal/CoroutineAPICallExecutorShould.kt diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt index 7952bec460..f41803b7a9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt @@ -93,7 +93,7 @@ internal class DataValuePostCall @Inject constructor( dataValueService.postDataValuesWebResponse(dataValueSet) }.map { it.response()!! } // TODO ("Remove !! after refactor to DataClass") } else { - coroutineAPICallExecutor.wrap() { + coroutineAPICallExecutor.wrap { dataValueService.postDataValues(dataValueSet) } } diff --git a/core/src/test/java/org/hisp/dhis/android/core/arch/api/executors/internal/CoroutineAPICallExecutorShould.kt b/core/src/test/java/org/hisp/dhis/android/core/arch/api/executors/internal/CoroutineAPICallExecutorShould.kt new file mode 100644 index 0000000000..755f0198d8 --- /dev/null +++ b/core/src/test/java/org/hisp/dhis/android/core/arch/api/executors/internal/CoroutineAPICallExecutorShould.kt @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2004-2023, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.android.core.arch.api.executors.internal + +import com.nhaarman.mockitokotlin2.mock +import kotlinx.coroutines.runBlocking +import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore +import org.hisp.dhis.android.core.arch.helpers.Result +import org.hisp.dhis.android.core.maintenance.D2Error +import org.hisp.dhis.android.core.maintenance.D2ErrorCode +import org.hisp.dhis.android.core.maintenance.internal.ForeignKeyCleaner +import org.hisp.dhis.android.core.user.internal.UserAccountDisabledErrorCatcher +import org.junit.Assert.assertEquals +import org.junit.Before +import org.junit.Test + +class CoroutineAPICallExecutorShould { + + private val errorMapper: APIErrorMapper = mock() + private val userAccountDisabledErrorCatcher: UserAccountDisabledErrorCatcher = mock() + private val errorStore: ObjectStore = mock() + private val databaseAdapter: DatabaseAdapter = mock() + private val foreignKeyCleaner: ForeignKeyCleaner = mock() + + private lateinit var coroutineAPICallExecutor: CoroutineAPICallExecutor + + @Before + fun setUp() { + coroutineAPICallExecutor = CoroutineAPICallExecutorImpl( + errorMapper = errorMapper, + userAccountDisabledErrorCatcher = userAccountDisabledErrorCatcher, + errorStore = errorStore, + databaseAdapter = databaseAdapter, + foreignKeyCleaner = foreignKeyCleaner + ) + } + + @Test + fun `should return object when object api call succeed`() = runBlocking { + // Given suspend function returns an Int + val expectedResult = Result.Success(13) + val block: suspend () -> Int = { 13 } + + // When api call is executed + val result = coroutineAPICallExecutor.wrap { + block.invoke() + } + + // Then the executor returns the expected result + assertEquals(expectedResult, result) + } + + @Test + fun `should return D2Error when object api call fails`() = runBlocking { + // Given suspend function returns an error + val d2Error = D2Error.builder() + .errorCode(D2ErrorCode.API_UNSUCCESSFUL_RESPONSE) + .errorDescription("API call failed") + .build() + val expectedResult = Result.Failure(d2Error) + + // When api call is executed + val result = coroutineAPICallExecutor.wrap { + throw d2Error + } + + // Then the executor returns the D2Error + assertEquals(expectedResult, result) + } +} From 52a76e653330fdbc235ff6aa1bbb59841e9c91f0 Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 18 May 2023 13:35:30 +0200 Subject: [PATCH 013/478] [ANDROID-1678] Deprecate BaseQuery.java --- .../android/core/arch/call/queries/internal/BaseQuery.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/BaseQuery.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/BaseQuery.java index b807ed0ff8..9c73e4d5bb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/BaseQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/BaseQuery.java @@ -28,6 +28,9 @@ package org.hisp.dhis.android.core.arch.call.queries.internal; +import kotlin.Deprecated; + +@Deprecated(message = "Use BaseQueryKt instead") public abstract class BaseQuery { public static final int DEFAULT_PAGE_SIZE = 50; From 0ade054c817dcf2d7a16003477f02e32ab996eb5 Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 18 May 2023 14:01:55 +0200 Subject: [PATCH 014/478] Rename .java to .kt --- ...mmaryWebResponse.java => DataValueImportSummaryWebResponse.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename core/src/main/java/org/hisp/dhis/android/core/imports/internal/{DataValueImportSummaryWebResponse.java => DataValueImportSummaryWebResponse.kt} (100%) diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponse.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponse.kt similarity index 100% rename from core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponse.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponse.kt From 91fb4126dcc74d8a67a62c41c645865563bfe879 Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 18 May 2023 14:01:55 +0200 Subject: [PATCH 015/478] [ANDROID-1678] Refactor DataValueImportSummaryWebResponse to data class --- .../DataSetCompleteRegistrationPostCall.kt | 2 +- .../datavalue/internal/DataValuePostCall.kt | 2 +- .../DataValueImportSummaryWebResponse.kt | 39 ++++++------------- ...DataValueImportSummaryWebResponseShould.kt | 2 +- 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt index 41afb9ef88..992726f5db 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt @@ -145,7 +145,7 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( dataSetCompleteRegistrationService.postDataSetCompleteRegistrationsWebResponse(payload), listOf(HttpURLConnection.HTTP_CONFLICT), DataValueImportSummaryWebResponse::class.java - ).response() + ).response } else { apiCallExecutor.executeObjectCall( dataSetCompleteRegistrationService.postDataSetCompleteRegistrations(payload) diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt index f41803b7a9..918fa84578 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.kt @@ -91,7 +91,7 @@ internal class DataValuePostCall @Inject constructor( errorClass = DataValueImportSummaryWebResponse::class.java ) { dataValueService.postDataValuesWebResponse(dataValueSet) - }.map { it.response()!! } // TODO ("Remove !! after refactor to DataClass") + }.map { it.response } } else { coroutineAPICallExecutor.wrap { dataValueService.postDataValues(dataValueSet) diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponse.kt b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponse.kt index 973022330a..6f3998a042 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponse.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponse.kt @@ -25,35 +25,20 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +package org.hisp.dhis.android.core.imports.internal -package org.hisp.dhis.android.core.imports.internal; +data class DataValueImportSummaryWebResponse( + val response: DataValueImportSummary, + val httpStatus: String, + val httpStatusCode: Int, + val status: String, + val message: String +) : WebResponse() { + override fun httpStatus() = httpStatus -import androidx.annotation.Nullable; + override fun httpStatusCode() = httpStatusCode -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; -import com.google.auto.value.AutoValue; + override fun status() = status -@AutoValue -@JsonDeserialize(builder = AutoValue_DataValueImportSummaryWebResponse.Builder.class) -public abstract class DataValueImportSummaryWebResponse extends WebResponse { - - private static final String RESPONSE = "response"; - - @Nullable - @JsonProperty(RESPONSE) - public abstract DataValueImportSummary response(); - - public static Builder builder() { - return new AutoValue_DataValueImportSummaryWebResponse.Builder(); - } - - @AutoValue.Builder - @JsonPOJOBuilder(withPrefix = "") - public static abstract class Builder extends WebResponse.Builder { - public abstract Builder response(DataValueImportSummary response); - - public abstract DataValueImportSummaryWebResponse build(); - } + override fun message() = message } diff --git a/core/src/test/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponseShould.kt b/core/src/test/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponseShould.kt index 075ce3df55..bf57bc5452 100644 --- a/core/src/test/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponseShould.kt +++ b/core/src/test/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummaryWebResponseShould.kt @@ -42,6 +42,6 @@ class DataValueImportSummaryWebResponseShould : @Test override fun map_from_json_string() { val webResponse = objectMapper.readValue(jsonStream, DataValueImportSummaryWebResponse::class.java) - assertThat(webResponse.response()!!.importStatus()).isEqualTo(ImportStatus.SUCCESS) + assertThat(webResponse.response.importStatus()).isEqualTo(ImportStatus.SUCCESS) } } From 4b96723a0a3b693e43a7d874c5b0dab720d401b5 Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 8 Jun 2023 13:25:57 +0200 Subject: [PATCH 016/478] [ANDROSDK-1689] Replace Observable in DataSetCompleteRegistrationPostCall to kotlin flows --- .../executors/internal/APICallExecutor.java | 3 - .../internal/APICallExecutorImpl.java | 26 +-- ...pleteRegistrationCollectionRepository.java | 154 ------------------ ...ompleteRegistrationCollectionRepository.kt | 136 ++++++++++++++++ .../DataSetCompleteRegistrationPostCall.kt | 84 ++++------ .../DataSetCompleteRegistrationService.kt | 13 +- 6 files changed, 186 insertions(+), 230 deletions(-) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.kt diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutor.java index 15c755b618..e344c1cde7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutor.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.arch.api.executors.internal; import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; -import org.hisp.dhis.android.core.common.Unit; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.List; @@ -47,6 +46,4 @@

P executeObjectCallWithAcceptedErrorCodes(Call

call, Class

errorClass) throws D2Error;

P executeObjectCallWithErrorCatcher(Call

call, APICallErrorCatcher errorCatcher) throws D2Error; - - Unit executeObjectCallWithEmptyResponse(Call call) throws D2Error; } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutorImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutorImpl.java index 08d6789edb..5a58f84ec5 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutorImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutorImpl.java @@ -32,7 +32,6 @@ import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter; import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; import org.hisp.dhis.android.core.arch.json.internal.ObjectMapperFactory; -import org.hisp.dhis.android.core.common.Unit; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.maintenance.internal.D2ErrorStore; @@ -64,40 +63,34 @@ public APICallExecutorImpl(ObjectStore errorStore, @Override public

List

executePayloadCall(Call> call) throws D2Error { - return executeObjectCallInternal(call, new ArrayList<>(), null, null, false).items(); + return executeObjectCallInternal(call, new ArrayList<>(), null, null).items(); } @Override public

P executeObjectCall(Call

call) throws D2Error { - return executeObjectCallInternal(call, new ArrayList<>(), null, null, false); + return executeObjectCallInternal(call, new ArrayList<>(), null, null); } @Override public

P executeObjectCallWithAcceptedErrorCodes(Call

call, List acceptedErrorCodes, Class

errorClass) throws D2Error { - return executeObjectCallInternal(call, acceptedErrorCodes, errorClass, null, false); + return executeObjectCallInternal(call, acceptedErrorCodes, errorClass, null); } @Override public

P executeObjectCallWithErrorCatcher(Call

call, APICallErrorCatcher errorCatcher) throws D2Error { - return executeObjectCallInternal(call, new ArrayList<>(), null, errorCatcher, false); - } - - @Override - public Unit executeObjectCallWithEmptyResponse(Call call) throws D2Error { - return executeObjectCallInternal(call, new ArrayList<>(), null, null, true); + return executeObjectCallInternal(call, new ArrayList<>(), null, errorCatcher); } private

P executeObjectCallInternal(Call

call, List acceptedErrorCodes, Class

errorClass, - APICallErrorCatcher errorCatcher, - boolean emptyBodyExpected) throws D2Error { + APICallErrorCatcher errorCatcher) throws D2Error { try { Response

response = call.execute(); if (response.isSuccessful()) { - return processSuccessfulResponse(errorBuilder(call), response, emptyBodyExpected); + return processSuccessfulResponse(errorBuilder(call), response); } else { String errorBody = errorMapper.getErrorBody(response); if (userAccountDisabledErrorCatcher.isUserAccountLocked(response, errorBody)) { @@ -131,11 +124,8 @@ private

void catchAndThrow(APICallErrorCatcher errorCatcher, D2Error.Builder } } - private

P processSuccessfulResponse(D2Error.Builder errorBuilder, Response

response, - boolean emptyBodyExpected) throws D2Error { - if (emptyBodyExpected) { - return null; - } else if (response.body() == null) { + private

P processSuccessfulResponse(D2Error.Builder errorBuilder, Response

response) throws D2Error { + if (response.body() == null) { throw storeAndReturn(errorMapper.responseException(errorBuilder, response, null)); } else { return response.body(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.java deleted file mode 100644 index 8384e08fb4..0000000000 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2004-2023, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.hisp.dhis.android.core.dataset; - -import org.hisp.dhis.android.core.arch.call.D2Progress; -import org.hisp.dhis.android.core.arch.handlers.internal.Handler; -import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithUploadCollectionRepository; -import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.internal.StringFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistrationTableInfo.Columns; -import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationPostCall; -import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationStore; -import org.hisp.dhis.android.core.user.UserCredentialsObjectRepository; - -import java.util.Map; - -import javax.inject.Inject; - -import dagger.Reusable; -import io.reactivex.Observable; - -@Reusable -public final class DataSetCompleteRegistrationCollectionRepository - extends ReadOnlyCollectionRepositoryImpl - implements ReadOnlyWithUploadCollectionRepository { - - private final DataSetCompleteRegistrationPostCall postCall; - private final DataSetCompleteRegistrationStore dataSetCompleteRegistrationStore; - private final UserCredentialsObjectRepository credentialsRepository; - - @Inject - DataSetCompleteRegistrationCollectionRepository( - final DataSetCompleteRegistrationStore store, - final Map> childrenAppenders, - final RepositoryScope scope, - final Handler handler, - final DataSetCompleteRegistrationPostCall postCall, - final UserCredentialsObjectRepository credentialsRepository) { - - super(store, childrenAppenders, scope, new FilterConnectorFactory<>(scope, - s -> new DataSetCompleteRegistrationCollectionRepository(store, childrenAppenders, - s, handler, postCall, credentialsRepository))); - - this.postCall = postCall; - this.dataSetCompleteRegistrationStore = store; - this.credentialsRepository = credentialsRepository; - } - - public DataSetCompleteRegistrationObjectRepository value(final String period, - final String organisationUnit, - final String dataSet, - final String attributeOptionCombo) { - - RepositoryScope updatedScope = byPeriod().eq(period) - .byOrganisationUnitUid().eq(organisationUnit) - .byDataSetUid().eq(dataSet) - .byAttributeOptionComboUid().eq(attributeOptionCombo) - .scope; - - return new DataSetCompleteRegistrationObjectRepository( - dataSetCompleteRegistrationStore, credentialsRepository, childrenAppenders, - updatedScope, period, organisationUnit, dataSet, attributeOptionCombo); - } - - @Override - public Observable upload() { - return Observable.fromCallable(() -> - bySyncState().in(State.uploadableStatesIncludingError()).blockingGetWithoutChildren() - ).flatMap(postCall::uploadDataSetCompleteRegistrations); - } - - @Override - public void blockingUpload() { - upload().blockingSubscribe(); - } - - - public StringFilterConnector byPeriod() { - return cf.string(Columns.PERIOD); - } - - public StringFilterConnector byDataSetUid() { - return cf.string(Columns.DATA_SET); - } - - public StringFilterConnector byOrganisationUnitUid() { - return cf.string(Columns.ORGANISATION_UNIT); - } - - public StringFilterConnector byAttributeOptionComboUid() { - return cf.string(Columns.ATTRIBUTE_OPTION_COMBO); - } - - public DateFilterConnector byDate() { - return cf.date(Columns.DATE); - } - - public StringFilterConnector byStoredBy() { - return cf.string(Columns.STORED_BY); - } - - public BooleanFilterConnector byDeleted() { - return cf.bool(Columns.DELETED); - } - - /** - * @deprecated Use {@link #bySyncState()} instead. - * - * @return - */ - @Deprecated - public EnumFilterConnector byState() { - return bySyncState(); - } - - public EnumFilterConnector bySyncState() { - return cf.enumC(Columns.SYNC_STATE); - } - -} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.kt new file mode 100644 index 0000000000..5a4e846e0b --- /dev/null +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.kt @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2004-2023, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.hisp.dhis.android.core.dataset + +import dagger.Reusable +import io.reactivex.Observable +import kotlinx.coroutines.flow.emitAll +import kotlinx.coroutines.flow.flow +import kotlinx.coroutines.rx2.asObservable +import org.hisp.dhis.android.core.arch.call.D2Progress +import org.hisp.dhis.android.core.arch.handlers.internal.Handler +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithUploadCollectionRepository +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl +import org.hisp.dhis.android.core.arch.repositories.filters.internal.BooleanFilterConnector +import org.hisp.dhis.android.core.arch.repositories.filters.internal.DateFilterConnector +import org.hisp.dhis.android.core.arch.repositories.filters.internal.EnumFilterConnector +import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory +import org.hisp.dhis.android.core.arch.repositories.filters.internal.StringFilterConnector +import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope +import org.hisp.dhis.android.core.common.State +import org.hisp.dhis.android.core.common.State.Companion.uploadableStatesIncludingError +import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationPostCall +import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationStore +import org.hisp.dhis.android.core.user.UserCredentialsObjectRepository +import javax.inject.Inject + +@Reusable +class DataSetCompleteRegistrationCollectionRepository @Inject internal constructor( + private val dataSetCompleteRegistrationStore: DataSetCompleteRegistrationStore, + childrenAppenders: MutableMap>, + scope: RepositoryScope, + handler: Handler, + private val postCall: DataSetCompleteRegistrationPostCall, + private val credentialsRepository: UserCredentialsObjectRepository +) : ReadOnlyCollectionRepositoryImpl( + dataSetCompleteRegistrationStore, childrenAppenders, scope, FilterConnectorFactory( + scope + ) { s: RepositoryScope -> + DataSetCompleteRegistrationCollectionRepository( + dataSetCompleteRegistrationStore, childrenAppenders, + s, handler, postCall, credentialsRepository + ) + }), ReadOnlyWithUploadCollectionRepository { + fun value( + period: String, + organisationUnit: String, + dataSet: String, + attributeOptionCombo: String + ): DataSetCompleteRegistrationObjectRepository { + val updatedScope = byPeriod().eq(period) + .byOrganisationUnitUid().eq(organisationUnit) + .byDataSetUid().eq(dataSet) + .byAttributeOptionComboUid().eq(attributeOptionCombo).scope + return DataSetCompleteRegistrationObjectRepository( + dataSetCompleteRegistrationStore, credentialsRepository, childrenAppenders, + updatedScope, period, organisationUnit, dataSet, attributeOptionCombo + ) + } + + override fun upload(): Observable = flow { + val dataSetCompleteRegistrations = + bySyncState().`in`(*uploadableStatesIncludingError()).blockingGetWithoutChildren() + + emitAll(postCall.uploadDataSetCompleteRegistrations(dataSetCompleteRegistrations)) + }.asObservable() + + override fun blockingUpload() { + upload().blockingSubscribe() + } + + fun byPeriod(): StringFilterConnector { + return cf.string(DataSetCompleteRegistrationTableInfo.Columns.PERIOD) + } + + fun byDataSetUid(): StringFilterConnector { + return cf.string(DataSetCompleteRegistrationTableInfo.Columns.DATA_SET) + } + + fun byOrganisationUnitUid(): StringFilterConnector { + return cf.string(DataSetCompleteRegistrationTableInfo.Columns.ORGANISATION_UNIT) + } + + fun byAttributeOptionComboUid(): StringFilterConnector { + return cf.string(DataSetCompleteRegistrationTableInfo.Columns.ATTRIBUTE_OPTION_COMBO) + } + + fun byDate(): DateFilterConnector { + return cf.date(DataSetCompleteRegistrationTableInfo.Columns.DATE) + } + + fun byStoredBy(): StringFilterConnector { + return cf.string(DataSetCompleteRegistrationTableInfo.Columns.STORED_BY) + } + + fun byDeleted(): BooleanFilterConnector { + return cf.bool(DataSetCompleteRegistrationTableInfo.Columns.DELETED) + } + + /** + * @return + */ + @Deprecated("Use {@link #bySyncState()} instead.\n" + " \n" + " ", ReplaceWith("bySyncState()")) + fun byState(): EnumFilterConnector { + return bySyncState() + } + + fun bySyncState(): EnumFilterConnector { + return cf.enumC(DataSetCompleteRegistrationTableInfo.Columns.SYNC_STATE) + } +} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt index 992726f5db..f0dda0100e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt @@ -28,14 +28,14 @@ package org.hisp.dhis.android.core.dataset.internal import dagger.Reusable -import io.reactivex.Observable -import io.reactivex.ObservableEmitter -import java.net.HttpURLConnection -import javax.inject.Inject -import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.emptyFlow +import kotlinx.coroutines.flow.flow +import org.hisp.dhis.android.core.arch.api.executors.internal.CoroutineAPICallExecutor import org.hisp.dhis.android.core.arch.call.D2Progress import org.hisp.dhis.android.core.arch.call.internal.D2ProgressManager import org.hisp.dhis.android.core.arch.helpers.CollectionsHelper +import org.hisp.dhis.android.core.arch.helpers.Result import org.hisp.dhis.android.core.arch.helpers.UidsHelper.getUids import org.hisp.dhis.android.core.arch.helpers.internal.DataStateHelper.errorIfOnline import org.hisp.dhis.android.core.arch.helpers.internal.DataStateHelper.forcedOrOwn @@ -47,52 +47,40 @@ import org.hisp.dhis.android.core.imports.internal.DataValueImportSummaryWebResp import org.hisp.dhis.android.core.maintenance.D2Error import org.hisp.dhis.android.core.systeminfo.DHISVersion import org.hisp.dhis.android.core.systeminfo.DHISVersionManager +import java.net.HttpURLConnection +import javax.inject.Inject @Reusable internal class DataSetCompleteRegistrationPostCall @Inject constructor( private val dataSetCompleteRegistrationService: DataSetCompleteRegistrationService, private val dataSetCompleteRegistrationImportHandler: DataSetCompleteRegistrationImportHandler, - private val apiCallExecutor: APICallExecutor, private val categoryOptionComboCollectionRepository: CategoryOptionComboCollectionRepository, private val dataSetCompleteRegistrationStore: DataSetCompleteRegistrationStore, - private val versionManager: DHISVersionManager + private val versionManager: DHISVersionManager, + private val coroutineAPICallExecutor: CoroutineAPICallExecutor ) { - fun uploadDataSetCompleteRegistrations( + suspend fun uploadDataSetCompleteRegistrations( dataSetCompleteRegistrations: List - ): Observable { - return Observable.defer { - if (dataSetCompleteRegistrations.isEmpty()) { - return@defer Observable.empty() - } else { - val toPostDataSetCompleteRegistrations: MutableList = ArrayList() - val toDeleteDataSetCompleteRegistrations: MutableList = ArrayList() - for (dscr in dataSetCompleteRegistrations) { - if (dscr.deleted()!!) { - toDeleteDataSetCompleteRegistrations.add(dscr) - } else { - toPostDataSetCompleteRegistrations.add(dscr) - } - } - val progressManager = D2ProgressManager(1) - return@defer Observable.create { emitter: ObservableEmitter -> - uploadInternal( - progressManager, - emitter, - toPostDataSetCompleteRegistrations, - toDeleteDataSetCompleteRegistrations - ) - } - } + ): Flow { + if (dataSetCompleteRegistrations.isEmpty()) { + return emptyFlow() } + val toPostDataSetCompleteRegistrations = dataSetCompleteRegistrations.filterNot { it.deleted() == true } + val toDeleteDataSetCompleteRegistrations = dataSetCompleteRegistrations.filter { it.deleted() == true } + val progressManager = D2ProgressManager(1) + return uploadInternal( + progressManager, + toPostDataSetCompleteRegistrations, + toDeleteDataSetCompleteRegistrations + ) } @Throws(D2Error::class) - private fun uploadInternal( + private suspend fun uploadInternal( progressManager: D2ProgressManager, - emitter: ObservableEmitter, toPostDataSetCompleteRegistrations: List, toDeleteDataSetCompleteRegistrations: List - ) { + ) = flow { val payload = DataSetCompleteRegistrationPayload(toPostDataSetCompleteRegistrations) val dataValueImportSummary: DataValueImportSummary = if (toPostDataSetCompleteRegistrations.isEmpty()) { @@ -100,7 +88,7 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( } else { markObjectsAs(toPostDataSetCompleteRegistrations, State.UPLOADING) try { - postCompleteRegistrations(payload)!! + postCompleteRegistrations(payload).getOrThrow() } catch (e: D2Error) { markObjectsAs(toPostDataSetCompleteRegistrations, errorIfOnline(e)) throw e @@ -116,7 +104,7 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( .uid(dataSetCompleteRegistration.attributeOptionCombo()) .blockingGet() markObjectsAs(toDeleteDataSetCompleteRegistrations, State.UPLOADING) - apiCallExecutor.executeObjectCallWithEmptyResponse( + coroutineAPICallExecutor.wrap { dataSetCompleteRegistrationService.deleteDataSetCompleteRegistration( dataSetCompleteRegistration.dataSet(), dataSetCompleteRegistration.period(), @@ -125,7 +113,7 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( CollectionsHelper.semicolonSeparatedCollectionValues(getUids(coc.categoryOptions()!!)), false ) - ) + } deletedDataSetCompleteRegistrations.add(dataSetCompleteRegistration) } catch (d2Error: D2Error) { withErrorDataSetCompleteRegistrations.add(dataSetCompleteRegistration) @@ -135,21 +123,21 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( payload, dataValueImportSummary, deletedDataSetCompleteRegistrations, withErrorDataSetCompleteRegistrations ) - emitter.onNext(progressManager.increaseProgress(DataSetCompleteRegistration::class.java, true)) - emitter.onComplete() + emit(progressManager.increaseProgress(DataSetCompleteRegistration::class.java, true)) } - private fun postCompleteRegistrations(payload: DataSetCompleteRegistrationPayload): DataValueImportSummary? { + private suspend fun postCompleteRegistrations(payload: DataSetCompleteRegistrationPayload): Result { return if (versionManager.isGreaterOrEqualThan(DHISVersion.V2_38)) { - apiCallExecutor.executeObjectCallWithAcceptedErrorCodes( - dataSetCompleteRegistrationService.postDataSetCompleteRegistrationsWebResponse(payload), - listOf(HttpURLConnection.HTTP_CONFLICT), - DataValueImportSummaryWebResponse::class.java - ).response + coroutineAPICallExecutor.wrap( + acceptedErrorCodes = listOf(HttpURLConnection.HTTP_CONFLICT), + errorClass = DataValueImportSummaryWebResponse::class.java + ) { + dataSetCompleteRegistrationService.postDataSetCompleteRegistrationsWebResponse(payload) + }.map { it.response } } else { - apiCallExecutor.executeObjectCall( + coroutineAPICallExecutor.wrap { dataSetCompleteRegistrationService.postDataSetCompleteRegistrations(payload) - ) + } } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt index 2fcc5506fd..477e68b9eb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt @@ -33,7 +33,6 @@ import org.hisp.dhis.android.core.common.Unit import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary import org.hisp.dhis.android.core.imports.internal.DataValueImportSummaryWebResponse -import retrofit2.Call import retrofit2.http.* @Suppress("LongParameterList") @@ -51,22 +50,22 @@ internal interface DataSetCompleteRegistrationService { ): DataSetCompleteRegistrationPayload @POST("completeDataSetRegistrations") - fun postDataSetCompleteRegistrations( + suspend fun postDataSetCompleteRegistrations( @Body dataSetCompleteRegistrationPayload: DataSetCompleteRegistrationPayload - ): Call + ): DataValueImportSummary @POST("completeDataSetRegistrations") - fun postDataSetCompleteRegistrationsWebResponse( + suspend fun postDataSetCompleteRegistrationsWebResponse( @Body dataSetCompleteRegistrationPayload: DataSetCompleteRegistrationPayload - ): Call + ): DataValueImportSummaryWebResponse @DELETE("completeDataSetRegistrations") - fun deleteDataSetCompleteRegistration( + suspend fun deleteDataSetCompleteRegistration( @Query("ds") dataSet: String, @Query("pe") periodId: String, @Query("ou") orgUnit: String, @Query("cc") categoryComboUid: String, @Query("cp") categoryOptionUids: String, @Query("multiOu") multiOrganisationUnit: Boolean - ): Call + ): Unit } From 32d79e9be37a1d22e5ea89a07d94ae238c591545 Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 8 Jun 2023 13:48:39 +0200 Subject: [PATCH 017/478] [ANDROSDK-1689] DataSetCompleteRegistrationPostCallMockIntegrationShould --- ...gistrationPostCallMockIntegrationShould.kt | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt new file mode 100644 index 0000000000..6e58d3b5d8 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2004-2023, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.android.core.dataset.internal + +import org.hisp.dhis.android.core.common.State +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration +import org.hisp.dhis.android.core.maintenance.D2Error +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.After +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith +import java.text.SimpleDateFormat + +@RunWith(D2JunitRunner::class) +class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegrationTestMetadataEnqueable() { + + @After + @Throws(D2Error::class) + fun tearDown() { + d2.wipeModule().wipeData() + } + + @Test + fun post_dataset_complete_registration_success() { + //Given a DatasetComplete registration to post + dhis2MockServer.enqueueMockResponse(200, "imports/data_value_import_summary_web_response.json") + val dataSetCompleteRegistration = provideDataSetCompleteRegistration() + d2.dataSetModule().dataSetCompleteRegistrations().value( + period = dataSetCompleteRegistration.period(), + organisationUnit = dataSetCompleteRegistration.organisationUnit(), + dataSet = dataSetCompleteRegistration.dataSet(), + attributeOptionCombo = dataSetCompleteRegistration.attributeOptionCombo() + ).blockingSet() + + val toPostRepository = d2.dataSetModule() + .dataSetCompleteRegistrations() + .bySyncState().eq(State.TO_POST) + + val syncedRepository = d2.dataSetModule() + .dataSetCompleteRegistrations() + .bySyncState().eq(State.SYNCED) + + assertEquals(toPostRepository.blockingGet().size, 1) + assertEquals(syncedRepository.blockingGet().size, 0) + + //When the object is uploaded + d2.dataSetModule().dataSetCompleteRegistrations().blockingUpload() + + //Then the status is synced + assertEquals(toPostRepository.blockingGet().size, 0) + assertEquals(syncedRepository.blockingGet().size, 1) + } + + @Test + fun post_dataset_delete_complete_registration_success() { + val toPostRepository = d2.dataSetModule() + .dataSetCompleteRegistrations() + .bySyncState().eq(State.TO_POST) + + val syncedRepository = d2.dataSetModule() + .dataSetCompleteRegistrations() + .bySyncState().eq(State.SYNCED) + + val toUpdateRepository = d2.dataSetModule() + .dataSetCompleteRegistrations() + .bySyncState().eq(State.TO_UPDATE) + + val dataSetCompleteRegistration = provideDataSetCompleteRegistration() + var dObject = d2.dataSetModule().dataSetCompleteRegistrations().value( + period = dataSetCompleteRegistration.period(), + organisationUnit = dataSetCompleteRegistration.organisationUnit(), + dataSet = dataSetCompleteRegistration.dataSet(), + attributeOptionCombo = dataSetCompleteRegistration.attributeOptionCombo() + ) + + dhis2MockServer.enqueueMockResponse(200, "imports/data_value_import_summary_web_response.json") + dObject.blockingSet() + assertEquals(toPostRepository.blockingGet().size, 1) + assertEquals(syncedRepository.blockingGet().size, 0) + + d2.dataSetModule().dataSetCompleteRegistrations().blockingUpload() + + assertEquals(toPostRepository.blockingGet().size, 0) + assertEquals(syncedRepository.blockingGet().size, 1) + + dhis2MockServer.enqueueMockResponse(200) + dObject = d2.dataSetModule().dataSetCompleteRegistrations().value( + period = dataSetCompleteRegistration.period(), + organisationUnit = dataSetCompleteRegistration.organisationUnit(), + dataSet = dataSetCompleteRegistration.dataSet(), + attributeOptionCombo = dataSetCompleteRegistration.attributeOptionCombo()) + dObject.blockingDelete() + assertEquals(toUpdateRepository.blockingGet().size, 1) + + d2.dataSetModule().dataSetCompleteRegistrations().blockingUpload() + + assertEquals(toUpdateRepository.blockingGet().size, 0) + } + + private fun provideDataSetCompleteRegistration() = DataSetCompleteRegistration.builder() + .period("2018") + .dataSet("BfMAe6Itzgt") + .attributeOptionCombo("bRowv6yZOF2") + .organisationUnit("DiszpKrYNg8") + .date(dateFormat.parse("2010-03-02")) + .storedBy("android") + .build() + + private val dateFormat = SimpleDateFormat("yyyy-MM-dd") +} \ No newline at end of file From 6a8bc07000c18da775e0566b62007e6e7727d30f Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 8 Jun 2023 14:04:08 +0200 Subject: [PATCH 018/478] [ANDROSDK-1689] ktlintCheck --- ...leteRegistrationPostCallMockIntegrationShould.kt | 13 +++++++------ ...taSetCompleteRegistrationCollectionRepository.kt | 12 ++++++++---- .../internal/DataSetCompleteRegistrationPostCall.kt | 8 +++++--- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt index 6e58d3b5d8..2ea2d2c108 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt @@ -28,6 +28,7 @@ package org.hisp.dhis.android.core.dataset.internal +import java.text.SimpleDateFormat import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration import org.hisp.dhis.android.core.maintenance.D2Error @@ -37,7 +38,6 @@ import org.junit.After import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith -import java.text.SimpleDateFormat @RunWith(D2JunitRunner::class) class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegrationTestMetadataEnqueable() { @@ -50,7 +50,7 @@ class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegra @Test fun post_dataset_complete_registration_success() { - //Given a DatasetComplete registration to post + // Given a DatasetComplete registration to post dhis2MockServer.enqueueMockResponse(200, "imports/data_value_import_summary_web_response.json") val dataSetCompleteRegistration = provideDataSetCompleteRegistration() d2.dataSetModule().dataSetCompleteRegistrations().value( @@ -71,10 +71,10 @@ class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegra assertEquals(toPostRepository.blockingGet().size, 1) assertEquals(syncedRepository.blockingGet().size, 0) - //When the object is uploaded + // When the object is uploaded d2.dataSetModule().dataSetCompleteRegistrations().blockingUpload() - //Then the status is synced + // Then the status is synced assertEquals(toPostRepository.blockingGet().size, 0) assertEquals(syncedRepository.blockingGet().size, 1) } @@ -116,7 +116,8 @@ class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegra period = dataSetCompleteRegistration.period(), organisationUnit = dataSetCompleteRegistration.organisationUnit(), dataSet = dataSetCompleteRegistration.dataSet(), - attributeOptionCombo = dataSetCompleteRegistration.attributeOptionCombo()) + attributeOptionCombo = dataSetCompleteRegistration.attributeOptionCombo() + ) dObject.blockingDelete() assertEquals(toUpdateRepository.blockingGet().size, 1) @@ -135,4 +136,4 @@ class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegra .build() private val dateFormat = SimpleDateFormat("yyyy-MM-dd") -} \ No newline at end of file +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.kt index 5a4e846e0b..2b488aad4a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCollectionRepository.kt @@ -29,6 +29,7 @@ package org.hisp.dhis.android.core.dataset import dagger.Reusable import io.reactivex.Observable +import javax.inject.Inject import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.flow import kotlinx.coroutines.rx2.asObservable @@ -48,9 +49,9 @@ import org.hisp.dhis.android.core.common.State.Companion.uploadableStatesIncludi import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationPostCall import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationStore import org.hisp.dhis.android.core.user.UserCredentialsObjectRepository -import javax.inject.Inject @Reusable +@Suppress("SpreadOperator", "TooManyFunctions") class DataSetCompleteRegistrationCollectionRepository @Inject internal constructor( private val dataSetCompleteRegistrationStore: DataSetCompleteRegistrationStore, childrenAppenders: MutableMap>, @@ -59,14 +60,17 @@ class DataSetCompleteRegistrationCollectionRepository @Inject internal construct private val postCall: DataSetCompleteRegistrationPostCall, private val credentialsRepository: UserCredentialsObjectRepository ) : ReadOnlyCollectionRepositoryImpl( - dataSetCompleteRegistrationStore, childrenAppenders, scope, FilterConnectorFactory( + dataSetCompleteRegistrationStore, childrenAppenders, scope, + FilterConnectorFactory( scope ) { s: RepositoryScope -> DataSetCompleteRegistrationCollectionRepository( dataSetCompleteRegistrationStore, childrenAppenders, s, handler, postCall, credentialsRepository ) - }), ReadOnlyWithUploadCollectionRepository { + } +), + ReadOnlyWithUploadCollectionRepository { fun value( period: String, organisationUnit: String, @@ -133,4 +137,4 @@ class DataSetCompleteRegistrationCollectionRepository @Inject internal construct fun bySyncState(): EnumFilterConnector { return cf.enumC(DataSetCompleteRegistrationTableInfo.Columns.SYNC_STATE) } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt index f0dda0100e..0ab7b8f560 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt @@ -28,6 +28,8 @@ package org.hisp.dhis.android.core.dataset.internal import dagger.Reusable +import java.net.HttpURLConnection +import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.flow @@ -47,8 +49,6 @@ import org.hisp.dhis.android.core.imports.internal.DataValueImportSummaryWebResp import org.hisp.dhis.android.core.maintenance.D2Error import org.hisp.dhis.android.core.systeminfo.DHISVersion import org.hisp.dhis.android.core.systeminfo.DHISVersionManager -import java.net.HttpURLConnection -import javax.inject.Inject @Reusable internal class DataSetCompleteRegistrationPostCall @Inject constructor( @@ -126,7 +126,9 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( emit(progressManager.increaseProgress(DataSetCompleteRegistration::class.java, true)) } - private suspend fun postCompleteRegistrations(payload: DataSetCompleteRegistrationPayload): Result { + private suspend fun postCompleteRegistrations( + payload: DataSetCompleteRegistrationPayload + ): Result { return if (versionManager.isGreaterOrEqualThan(DHISVersion.V2_38)) { coroutineAPICallExecutor.wrap( acceptedErrorCodes = listOf(HttpURLConnection.HTTP_CONFLICT), From 8a420a09cf12be29f008e8824df7602261610f4d Mon Sep 17 00:00:00 2001 From: andresmr Date: Thu, 8 Jun 2023 16:47:43 +0200 Subject: [PATCH 019/478] [ANDROSDK-1689] remove suspend when returning flows --- .../dataset/internal/DataSetCompleteRegistrationPostCall.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt index 0ab7b8f560..8aef61252c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt @@ -59,7 +59,7 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( private val versionManager: DHISVersionManager, private val coroutineAPICallExecutor: CoroutineAPICallExecutor ) { - suspend fun uploadDataSetCompleteRegistrations( + fun uploadDataSetCompleteRegistrations( dataSetCompleteRegistrations: List ): Flow { if (dataSetCompleteRegistrations.isEmpty()) { @@ -76,7 +76,7 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( } @Throws(D2Error::class) - private suspend fun uploadInternal( + private fun uploadInternal( progressManager: D2ProgressManager, toPostDataSetCompleteRegistrations: List, toDeleteDataSetCompleteRegistrations: List From a8ae773a3c0b54d572b0d4e211d030b6872434cf Mon Sep 17 00:00:00 2001 From: andresmr Date: Fri, 9 Jun 2023 07:40:39 +0200 Subject: [PATCH 020/478] [ANDROSDK-1689] Change response on deletion by 204 --- .../DataSetCompleteRegistrationPostCallMockIntegrationShould.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt index 2ea2d2c108..c37416fe93 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt @@ -111,7 +111,7 @@ class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegra assertEquals(toPostRepository.blockingGet().size, 0) assertEquals(syncedRepository.blockingGet().size, 1) - dhis2MockServer.enqueueMockResponse(200) + dhis2MockServer.enqueueMockResponse(204) dObject = d2.dataSetModule().dataSetCompleteRegistrations().value( period = dataSetCompleteRegistration.period(), organisationUnit = dataSetCompleteRegistration.organisationUnit(), From b8284cc9b3f7acb3936fba96ad0ca01e554f27fb Mon Sep 17 00:00:00 2001 From: andresmr Date: Fri, 9 Jun 2023 07:52:44 +0200 Subject: [PATCH 021/478] [ANDROSDK-1689] Use DataUtils.SIMPLE_DATE_FORMAT --- ...aSetCompleteRegistrationPostCallMockIntegrationShould.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt index c37416fe93..34ef6ecdd7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.dataset.internal -import java.text.SimpleDateFormat +import org.hisp.dhis.android.core.arch.helpers.DateUtils.SIMPLE_DATE_FORMAT import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration import org.hisp.dhis.android.core.maintenance.D2Error @@ -131,9 +131,7 @@ class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegra .dataSet("BfMAe6Itzgt") .attributeOptionCombo("bRowv6yZOF2") .organisationUnit("DiszpKrYNg8") - .date(dateFormat.parse("2010-03-02")) + .date(SIMPLE_DATE_FORMAT.parse("2010-03-02")) .storedBy("android") .build() - - private val dateFormat = SimpleDateFormat("yyyy-MM-dd") } From fb2a1577e90d1e7c7c2f0cc3eb6003f1a67f3160 Mon Sep 17 00:00:00 2001 From: andresmr Date: Tue, 13 Jun 2023 13:07:22 +0200 Subject: [PATCH 022/478] [ANDROSDK-1689] mock response with empty body --- ...gistrationPostCallMockIntegrationShould.kt | 2 +- .../core/mockwebserver/Dhis2MockServer.java | 24 ++++++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt index 34ef6ecdd7..22f1e35123 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallMockIntegrationShould.kt @@ -111,7 +111,7 @@ class DataSetCompleteRegistrationPostCallMockIntegrationShould : BaseMockIntegra assertEquals(toPostRepository.blockingGet().size, 0) assertEquals(syncedRepository.blockingGet().size, 1) - dhis2MockServer.enqueueMockResponse(204) + dhis2MockServer.enqueueMockResponseWithEmptyBody(204) dObject = d2.dataSetModule().dataSetCompleteRegistrations().value( period = dataSetCompleteRegistration.period(), organisationUnit = dataSetCompleteRegistration.organisationUnit(), diff --git a/core/src/main/java/org/hisp/dhis/android/core/mockwebserver/Dhis2MockServer.java b/core/src/main/java/org/hisp/dhis/android/core/mockwebserver/Dhis2MockServer.java index 06a709ad44..178c33f91c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/mockwebserver/Dhis2MockServer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/mockwebserver/Dhis2MockServer.java @@ -28,6 +28,8 @@ package org.hisp.dhis.android.core.mockwebserver; +import static okhttp3.internal.Util.UTC; + import android.util.Log; import androidx.annotation.NonNull; @@ -46,8 +48,6 @@ import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; -import static okhttp3.internal.Util.UTC; - @SuppressWarnings("PMD") public class Dhis2MockServer { private static final int OK_CODE = 200; @@ -117,23 +117,23 @@ public class Dhis2MockServer { private static final String SMS_METADATA = "sms/metadata_ids.json"; private static final String MOCKWEBSERVER = "Dhis2MockWebServer"; - private MockWebServer server; - private IFileReader fileReader; - private Dhis2Dispatcher dhis2Dispatcher; + private final MockWebServer server; + private final IFileReader fileReader; + private final Dhis2Dispatcher dhis2Dispatcher; - public Dhis2MockServer(IFileReader fileReader, int port) throws IOException { + public Dhis2MockServer(IFileReader fileReader, int port) { this.fileReader = fileReader; this.server = new MockWebServer(); dhis2Dispatcher = new Dhis2Dispatcher(fileReader, new ResponseController()); start(port); } - public Dhis2MockServer(int port) throws IOException { + public Dhis2MockServer(int port) { this(new ResourcesFileReader(), port); dhis2Dispatcher.configInternalResponseController(); } - private void start(int port) throws IOException { + private void start(int port) { try { this.server.start(port); } catch (IOException e) { @@ -141,7 +141,7 @@ private void start(int port) throws IOException { } } - public void shutdown() throws IOException { + public void shutdown() { try { this.server.shutdown(); } catch (IOException e) { @@ -157,6 +157,12 @@ public void enqueueMockResponse(int code) { enqueueMockResponseText(code, "{}"); } + public void enqueueMockResponseWithEmptyBody(int code) { + MockResponse mockResponse = new MockResponse(); + mockResponse.setResponseCode(code); + server.enqueue(mockResponse); + } + public void enqueueMockResponseText(int code, String response) { MockResponse mockResponse = new MockResponse(); mockResponse.setResponseCode(code); From cd54283901782dce0a31b674d053c45cc1191a02 Mon Sep 17 00:00:00 2001 From: andresmr Date: Wed, 14 Jun 2023 08:13:22 +0200 Subject: [PATCH 023/478] [ANDROSDK-1689] Change Retrofit 204 handling response from Unit to Response --- .../DataSetCompleteRegistrationPostCall.kt | 45 +++++++++++-------- .../DataSetCompleteRegistrationService.kt | 3 +- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt index 8aef61252c..b0db683b67 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.kt @@ -98,26 +98,33 @@ internal class DataSetCompleteRegistrationPostCall @Inject constructor( val deletedDataSetCompleteRegistrations: MutableList = ArrayList() val withErrorDataSetCompleteRegistrations: MutableList = ArrayList() for (dataSetCompleteRegistration in toDeleteDataSetCompleteRegistrations) { - try { - val coc = categoryOptionComboCollectionRepository - .withCategoryOptions() - .uid(dataSetCompleteRegistration.attributeOptionCombo()) - .blockingGet() - markObjectsAs(toDeleteDataSetCompleteRegistrations, State.UPLOADING) - coroutineAPICallExecutor.wrap { - dataSetCompleteRegistrationService.deleteDataSetCompleteRegistration( - dataSetCompleteRegistration.dataSet(), - dataSetCompleteRegistration.period(), - dataSetCompleteRegistration.organisationUnit(), - coc.categoryCombo()!!.uid(), - CollectionsHelper.semicolonSeparatedCollectionValues(getUids(coc.categoryOptions()!!)), - false - ) + val coc = categoryOptionComboCollectionRepository + .withCategoryOptions() + .uid(dataSetCompleteRegistration.attributeOptionCombo()) + .blockingGet() + markObjectsAs(toDeleteDataSetCompleteRegistrations, State.UPLOADING) + coroutineAPICallExecutor.wrap { + dataSetCompleteRegistrationService.deleteDataSetCompleteRegistration( + dataSetCompleteRegistration.dataSet(), + dataSetCompleteRegistration.period(), + dataSetCompleteRegistration.organisationUnit(), + coc.categoryCombo()!!.uid(), + CollectionsHelper.semicolonSeparatedCollectionValues(getUids(coc.categoryOptions()!!)), + false + ) + }.fold( + onSuccess = { result -> + if (result.isSuccessful) { + deletedDataSetCompleteRegistrations.add(dataSetCompleteRegistration) + } else { + withErrorDataSetCompleteRegistrations.add(dataSetCompleteRegistration) + } + }, + + onFailure = { + withErrorDataSetCompleteRegistrations.add(dataSetCompleteRegistration) } - deletedDataSetCompleteRegistrations.add(dataSetCompleteRegistration) - } catch (d2Error: D2Error) { - withErrorDataSetCompleteRegistrations.add(dataSetCompleteRegistration) - } + ) } dataSetCompleteRegistrationImportHandler.handleImportSummary( payload, dataValueImportSummary, deletedDataSetCompleteRegistrations, diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt index 477e68b9eb..a096d89a94 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.kt @@ -33,6 +33,7 @@ import org.hisp.dhis.android.core.common.Unit import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary import org.hisp.dhis.android.core.imports.internal.DataValueImportSummaryWebResponse +import retrofit2.Response import retrofit2.http.* @Suppress("LongParameterList") @@ -67,5 +68,5 @@ internal interface DataSetCompleteRegistrationService { @Query("cc") categoryComboUid: String, @Query("cp") categoryOptionUids: String, @Query("multiOu") multiOrganisationUnit: Boolean - ): Unit + ): Response } From 9b9c902aacd514dc02d006c26109593c66b101f3 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 23 Jun 2023 10:48:19 +0200 Subject: [PATCH 024/478] [ANDROSDK-1688] feature: added Style to indicators --- ...ectionRepositoryMockIntegrationShould.java | 16 +++++++++++ core/src/main/assets/migrations/148.sql | 4 +++ core/src/main/assets/snapshots/snapshot.sql | 2 +- .../internal/BaseDatabaseOpenHelper.java | 2 +- .../android/core/indicator/Indicator.java | 26 +++++++++++++++--- .../IndicatorCollectionRepository.java | 8 ++++++ .../core/indicator/IndicatorTableInfo.java | 5 ++-- .../indicator/internal/IndicatorFields.java | 4 ++- .../indicator/internal/IndicatorStore.java | 27 ++++++++++--------- .../core/data/indicator/IndicatorSamples.java | 4 ++- .../resources/indicators/indicator.json | 6 ++++- .../resources/indicators/indicators.json | 6 ++++- .../core/indicator/IndicatorShould.java | 2 ++ 13 files changed, 87 insertions(+), 25 deletions(-) create mode 100644 core/src/main/assets/migrations/148.sql diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java index c67eb4f4d8..97149ae53f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java @@ -116,6 +116,22 @@ public void filter_by_url() { assertThat(indicators.size()).isEqualTo(1); } + @Test + public void filter_by_color() { + List indicators = d2.indicatorModule().indicators() + .byColor().eq("#FF0000") + .blockingGet(); + assertThat(indicators.size()).isEqualTo(1); + } + + @Test + public void filter_by_icon() { + List indicators = d2.indicatorModule().indicators() + .byIcon().eq("circle") + .blockingGet(); + assertThat(indicators.size()).isEqualTo(1); + } + @Test public void filter_by_dataSetUid() { List indicators = d2.indicatorModule().indicators() diff --git a/core/src/main/assets/migrations/148.sql b/core/src/main/assets/migrations/148.sql new file mode 100644 index 0000000000..c2cacaa898 --- /dev/null +++ b/core/src/main/assets/migrations/148.sql @@ -0,0 +1,4 @@ +# Add style properties in Indicator table (ANDROSDK-1688) + +ALTER TABLE Indicator ADD COLUMN color TEXT; +ALTER TABLE Indicator ADD COLUMN icon TEXT; \ No newline at end of file diff --git a/core/src/main/assets/snapshots/snapshot.sql b/core/src/main/assets/snapshots/snapshot.sql index 46d3593e9b..85c8346ead 100644 --- a/core/src/main/assets/snapshots/snapshot.sql +++ b/core/src/main/assets/snapshots/snapshot.sql @@ -24,7 +24,7 @@ CREATE TABLE CategoryCategoryComboLink (_id INTEGER PRIMARY KEY AUTOINCREMENT, c CREATE TABLE CategoryOptionCombo (_id INTEGER PRIMARY KEY AUTOINCREMENT, uid TEXT NOT NULL UNIQUE, code TEXT, name TEXT, displayName TEXT, created TEXT, lastUpdated TEXT, categoryCombo TEXT, FOREIGN KEY (categoryCombo) REFERENCES CategoryCombo (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED); CREATE TABLE DataSet (_id INTEGER PRIMARY KEY AUTOINCREMENT, uid TEXT NOT NULL UNIQUE, code TEXT, name TEXT, displayName TEXT, created TEXT, lastUpdated TEXT, shortName TEXT, displayShortName TEXT, description TEXT, displayDescription TEXT, periodType TEXT, categoryCombo TEXT NOT NULL, mobile INTEGER, version INTEGER, expiryDays INTEGER, timelyDays INTEGER, notifyCompletingUser INTEGER, openFuturePeriods INTEGER, fieldCombinationRequired INTEGER, validCompleteOnly INTEGER, noValueRequiresComment INTEGER, skipOffline INTEGER, dataElementDecoration INTEGER, renderAsTabs INTEGER, renderHorizontally INTEGER, accessDataWrite INTEGER, workflow TEXT, color TEXT, icon TEXT, FOREIGN KEY (categoryCombo) REFERENCES CategoryCombo (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED); CREATE TABLE DataSetDataElementLink (_id INTEGER PRIMARY KEY AUTOINCREMENT, dataSet TEXT NOT NULL, dataElement TEXT NOT NULL, categoryCombo TEXT REFERENCES CategoryCombo (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY (dataSet) REFERENCES DataSet (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY (dataElement) REFERENCES DataElement (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, UNIQUE (dataSet, dataElement)); -CREATE TABLE Indicator (_id INTEGER PRIMARY KEY AUTOINCREMENT, uid TEXT NOT NULL UNIQUE, code TEXT, name TEXT, displayName TEXT, created TEXT, lastUpdated TEXT, shortName TEXT, displayShortName TEXT, description TEXT, displayDescription TEXT, annualized INTEGER, indicatorType TEXT, numerator TEXT, numeratorDescription TEXT, denominator TEXT, denominatorDescription TEXT, url TEXT, decimals INTEGER, FOREIGN KEY (indicatorType) REFERENCES IndicatorType (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED); +CREATE TABLE Indicator (_id INTEGER PRIMARY KEY AUTOINCREMENT, uid TEXT NOT NULL UNIQUE, code TEXT, name TEXT, displayName TEXT, created TEXT, lastUpdated TEXT, shortName TEXT, displayShortName TEXT, description TEXT, displayDescription TEXT, annualized INTEGER, indicatorType TEXT, numerator TEXT, numeratorDescription TEXT, denominator TEXT, denominatorDescription TEXT, url TEXT, decimals INTEGER, color TEXT, icon TEXT, FOREIGN KEY (indicatorType) REFERENCES IndicatorType (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED); CREATE TABLE DataSetIndicatorLink (_id INTEGER PRIMARY KEY AUTOINCREMENT, dataSet TEXT NOT NULL, indicator TEXT NOT NULL, FOREIGN KEY (dataSet) REFERENCES DataSet (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY (indicator) REFERENCES Indicator (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, UNIQUE (dataSet, indicator)); CREATE TABLE Period (_id INTEGER PRIMARY KEY AUTOINCREMENT, periodId TEXT, periodType TEXT, startDate TEXT, endDate TEXT, UNIQUE (periodId)); CREATE TABLE ValueTypeDeviceRendering (_id INTEGER PRIMARY KEY AUTOINCREMENT, uid TEXT, objectTable TEXT, deviceType TEXT, type TEXT, min INTEGER, max INTEGER, step INTEGER, decimalPoints INTEGER, UNIQUE (uid, deviceType)); diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.java index 45075ea0dd..7b8897890c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.java @@ -35,7 +35,7 @@ class BaseDatabaseOpenHelper { - static final int VERSION = 147; + static final int VERSION = 148; private final AssetManager assetManager; private final int targetVersion; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/Indicator.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/Indicator.java index 0a2f3644c5..915a38d8d0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/Indicator.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/Indicator.java @@ -42,13 +42,16 @@ import org.hisp.dhis.android.core.arch.db.adapters.ignore.internal.IgnoreObjectWithUidListColumnAdapter; import org.hisp.dhis.android.core.common.BaseNameableObject; import org.hisp.dhis.android.core.common.CoreObject; +import org.hisp.dhis.android.core.common.ObjectStyle; +import org.hisp.dhis.android.core.common.ObjectWithStyle; import org.hisp.dhis.android.core.common.ObjectWithUid; import java.util.List; @AutoValue @JsonDeserialize(builder = AutoValue_Indicator.Builder.class) -public abstract class Indicator extends BaseNameableObject implements CoreObject { +public abstract class Indicator extends BaseNameableObject + implements CoreObject, ObjectWithStyle { @Nullable @JsonProperty() @@ -86,7 +89,7 @@ public abstract class Indicator extends BaseNameableObject implements CoreObject @Nullable @JsonProperty() @ColumnAdapter(IgnoreObjectWithUidListColumnAdapter.class) - public abstract List legendSets(); + public abstract List legendSets(); public static Builder builder() { return new $$AutoValue_Indicator.Builder(); @@ -100,7 +103,8 @@ public static Indicator create(Cursor cursor) { @AutoValue.Builder @JsonPOJOBuilder(withPrefix = "") - public static abstract class Builder extends BaseNameableObject.Builder { + public static abstract class Builder extends BaseNameableObject.Builder + implements ObjectWithStyle.Builder { public abstract Builder id(Long id); public abstract Builder annualized(Boolean annualized); @@ -121,6 +125,20 @@ public static abstract class Builder extends BaseNameableObject.Builder public abstract Builder decimals(Integer decimals); - public abstract Indicator build(); + abstract Indicator autoBuild(); + + // Auxiliary fields + abstract ObjectStyle style(); + + public Indicator build() { + try { + style(); + } catch (IllegalStateException e) { + style(ObjectStyle.builder().build()); + } + + return autoBuild(); + } + } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorCollectionRepository.java index 0bbe658d2d..2b31c27345 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorCollectionRepository.java @@ -85,6 +85,14 @@ public StringFilterConnector byUrl() { return cf.string(Columns.URL); } + public StringFilterConnector byColor() { + return cf.string(Columns.COLOR); + } + + public StringFilterConnector byIcon() { + return cf.string(Columns.ICON); + } + public IndicatorCollectionRepository withLegendSets() { return cf.withChild(IndicatorFields.LEGEND_SETS); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.java index cf94c01cc4..5d7cd65a04 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.java @@ -31,7 +31,7 @@ import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.arch.helpers.CollectionsHelper; import org.hisp.dhis.android.core.common.CoreColumns; -import org.hisp.dhis.android.core.common.NameableColumns; +import org.hisp.dhis.android.core.common.NameableWithStyleColumns; public final class IndicatorTableInfo { @@ -51,7 +51,7 @@ public CoreColumns columns() { } }; - public static class Columns extends NameableColumns { + public static class Columns extends NameableWithStyleColumns { public final static String ANNUALIZED = "annualized"; public final static String INDICATOR_TYPE = "indicatorType"; @@ -59,6 +59,7 @@ public static class Columns extends NameableColumns { public final static String NUMERATOR_DESCRIPTION = "numeratorDescription"; public final static String DENOMINATOR = "denominator"; public final static String DENOMINATOR_DESCRIPTION = "denominatorDescription"; + public final static String URL = "url"; public final static String DECIMALS = "decimals"; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java index ef0cfad99a..4da0475480 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java @@ -56,7 +56,9 @@ public final class IndicatorFields { fh.field(Columns.DENOMINATOR_DESCRIPTION), fh.field(Columns.URL), fh.nestedField(LEGEND_SETS).with(LegendSetFields.uid), - fh.field(Columns.DECIMALS) + fh.field(Columns.DECIMALS), + fh.field(Columns.COLOR), + fh.field(Columns.ICON) ).build(); private IndicatorFields() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java index 99904cd062..2af1b86a77 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java @@ -28,8 +28,10 @@ package org.hisp.dhis.android.core.indicator.internal; +import androidx.annotation.NonNull; + import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter; -import org.hisp.dhis.android.core.arch.db.stores.binders.internal.NameableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.NameableWithStyleStatementBinder; import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementWrapper; import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; @@ -38,24 +40,23 @@ import org.hisp.dhis.android.core.indicator.Indicator; import org.hisp.dhis.android.core.indicator.IndicatorTableInfo; -import androidx.annotation.NonNull; - public final class IndicatorStore { - private IndicatorStore() {} + private IndicatorStore() { + } - private static StatementBinder BINDER = new NameableStatementBinder() { + private static StatementBinder BINDER = new NameableWithStyleStatementBinder() { @Override public void bindToStatement(@NonNull Indicator o, @NonNull StatementWrapper w) { super.bindToStatement(o, w); - w.bind(11, o.annualized()); - w.bind(12, UidsHelper.getUidOrNull(o.indicatorType())); - w.bind(13, o.numerator()); - w.bind(14, o.numeratorDescription()); - w.bind(15, o.denominator()); - w.bind(16, o.denominatorDescription()); - w.bind(17, o.url()); - w.bind(18, o.decimals()); + w.bind(13, o.annualized()); + w.bind(14, UidsHelper.getUidOrNull(o.indicatorType())); + w.bind(15, o.numerator()); + w.bind(16, o.numeratorDescription()); + w.bind(17, o.denominator()); + w.bind(18, o.denominatorDescription()); + w.bind(19, o.url()); + w.bind(20, o.decimals()); } }; diff --git a/core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.java b/core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.java index 561da203da..b1aa540491 100644 --- a/core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.java +++ b/core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.java @@ -28,6 +28,7 @@ package org.hisp.dhis.android.core.data.indicator; +import org.hisp.dhis.android.core.common.ObjectStyle; import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.indicator.Indicator; @@ -48,7 +49,8 @@ public static Indicator getIndicator() { .denominator("#{c.d}") .denominatorDescription("den descr") .url("dhis2.org") - .decimals(2); + .decimals(2) + .style(ObjectStyle.builder().color("#FF0000").icon("circle").build()); return indicatorBuilder.build(); } } \ No newline at end of file diff --git a/core/src/sharedTest/resources/indicators/indicator.json b/core/src/sharedTest/resources/indicators/indicator.json index 041a0e5b34..071fb0a536 100644 --- a/core/src/sharedTest/resources/indicators/indicator.json +++ b/core/src/sharedTest/resources/indicators/indicator.json @@ -17,5 +17,9 @@ "indicatorType": { "id": "bWuNrMHEoZ0" }, - "decimals": 3 + "decimals": 3, + "style": { + "color": "#FF0000", + "icon": "circle" + } } \ No newline at end of file diff --git a/core/src/sharedTest/resources/indicators/indicators.json b/core/src/sharedTest/resources/indicators/indicators.json index d1e50acf4f..091733c36f 100644 --- a/core/src/sharedTest/resources/indicators/indicators.json +++ b/core/src/sharedTest/resources/indicators/indicators.json @@ -23,7 +23,11 @@ { "id": "rtOkbpGEud4" } - ] + ], + "style": { + "color": "#FF0000", + "icon": "circle" + } } ] } \ No newline at end of file diff --git a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.java b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.java index 29fe7f5946..d64241e996 100644 --- a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.java +++ b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.java @@ -31,6 +31,7 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.BaseObjectShould; import org.hisp.dhis.android.core.common.ObjectShould; +import org.hisp.dhis.android.core.common.ObjectStyle; import org.hisp.dhis.android.core.common.ObjectWithUid; import org.junit.Test; @@ -73,5 +74,6 @@ public void map_from_json_string() throws IOException, ParseException { assertThat(indicator.url()).isEqualTo(""); assertThat(indicator.indicatorType()).isEqualTo(ObjectWithUid.create("bWuNrMHEoZ0")); assertThat(indicator.decimals()).isEqualTo(3); + assertThat(indicator.style()).isEqualTo(ObjectStyle.builder().color("#FF0000").icon("circle").build()); } } \ No newline at end of file From 66f11a3710b5bed7bff8cfce1c445028265e99b5 Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 25 Jun 2023 13:42:03 +0200 Subject: [PATCH 025/478] [ANDROSDK-1688] Refactor Indicator tests to Kotlin --- ...ava => IndicatorStoreIntegrationShould.kt} | 40 ++--- ...ectionRepositoryMockIntegrationShould.java | 150 ------------------ ...llectionRepositoryMockIntegrationShould.kt | 145 +++++++++++++++++ .../core/indicator/IndicatorShould.java | 79 --------- .../android/core/indicator/IndicatorShould.kt | 76 +++++++++ 5 files changed, 238 insertions(+), 252 deletions(-) rename core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/{IndicatorStoreIntegrationShould.java => IndicatorStoreIntegrationShould.kt} (65%) delete mode 100644 core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java create mode 100644 core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt delete mode 100644 core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.java create mode 100644 core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt similarity index 65% rename from core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt index 907ca88602..778bbb85ae 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt @@ -26,33 +26,27 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator.internal; +package org.hisp.dhis.android.core.indicator.internal -import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; -import org.hisp.dhis.android.core.data.indicator.IndicatorSamples; -import org.hisp.dhis.android.core.indicator.Indicator; -import org.hisp.dhis.android.core.indicator.IndicatorTableInfo; -import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; -import org.junit.runner.RunWith; +import org.hisp.dhis.android.core.common.ObjectWithUid +import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.indicator.IndicatorSamples +import org.hisp.dhis.android.core.indicator.Indicator +import org.hisp.dhis.android.core.indicator.IndicatorTableInfo +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory -@RunWith(D2JunitRunner.class) -public class IndicatorStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { - - public IndicatorStoreIntegrationShould() { - super(IndicatorStore.create(TestDatabaseAdapterFactory.get()), IndicatorTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); - } - - @Override - protected Indicator buildObject() { - return IndicatorSamples.getIndicator(); +class IndicatorStoreIntegrationShould : IdentifiableObjectStoreAbstractIntegrationShould( + IndicatorStore.create(TestDatabaseAdapterFactory.get()), + IndicatorTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): Indicator { + return IndicatorSamples.getIndicator() } - @Override - protected Indicator buildObjectToUpdate() { + override fun buildObjectToUpdate(): Indicator { return IndicatorSamples.getIndicator().toBuilder() - .indicatorType(ObjectWithUid.create("new_indicator_type_uid")) - .build(); + .indicatorType(ObjectWithUid.create("new_indicator_type_uid")) + .build() } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java deleted file mode 100644 index 97149ae53f..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2004-2022, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.hisp.dhis.android.testapp.indicator; - -import org.hisp.dhis.android.core.indicator.Indicator; -import org.hisp.dhis.android.core.program.ProgramIndicator; -import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.List; - -import static com.google.common.truth.Truth.assertThat; - -@RunWith(D2JunitRunner.class) -public class IndicatorCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { - - @Test - public void find_all() { - List indicators = d2.indicatorModule().indicators() - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void include_legend_sets_as_children() { - Indicator indicator = d2.indicatorModule().indicators() - .withLegendSets() - .one() - .blockingGet(); - - assertThat(indicator.legendSets().size()).isEqualTo(1); - assertThat(indicator.legendSets().get(0).uid()).isEqualTo("rtOkbpGEud4"); - } - - @Test - public void filter_by_annualized() { - List indicators = d2.indicatorModule().indicators() - .byAnnualized().isFalse() - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_indicator_type_url() { - List indicators = d2.indicatorModule().indicators() - .byIndicatorTypeUid().eq("bWuNrMHEoZ0") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_numerator() { - List indicators = d2.indicatorModule().indicators() - .byNumerator().eq("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}-#{Jtf34kNZhzP.pq2XI5kz2BY}-#{Jtf34kNZhzP.PT59n8BQbqM}") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_numerator_description() { - List indicators = d2.indicatorModule().indicators() - .byNumeratorDescription().eq("ANC1-ANC3") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_denominator() { - List indicators = d2.indicatorModule().indicators() - .byDenominator().eq("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_denominator_description() { - List indicators = d2.indicatorModule().indicators() - .byDenominatorDescription().eq("Total 1st ANC visits") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_url() { - List indicators = d2.indicatorModule().indicators() - .byUrl().eq("url") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_color() { - List indicators = d2.indicatorModule().indicators() - .byColor().eq("#FF0000") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_icon() { - List indicators = d2.indicatorModule().indicators() - .byIcon().eq("circle") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_dataSetUid() { - List indicators = d2.indicatorModule().indicators() - .byDataSetUid("lyLU2wR22tC") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } - - @Test - public void filter_by_sectionUid() { - List indicators = d2.indicatorModule().indicators() - .bySectionUid("Y2rk0vzgvAx") - .blockingGet(); - assertThat(indicators.size()).isEqualTo(1); - } -} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt new file mode 100644 index 0000000000..03777dfe3a --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2004-2023, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.android.testapp.indicator + +import com.google.common.truth.Truth +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.Test +import org.junit.runner.RunWith + + +@RunWith(D2JunitRunner::class) +class IndicatorCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTestFullDispatcher() { + @Test + fun find_all() { + val indicators = d2.indicatorModule().indicators() + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun include_legend_sets_as_children() { + val indicator = d2.indicatorModule().indicators() + .withLegendSets() + .one() + .blockingGet() + Truth.assertThat(indicator.legendSets()!!.size).isEqualTo(1) + Truth.assertThat(indicator.legendSets()!![0].uid()).isEqualTo("rtOkbpGEud4") + } + + @Test + fun filter_by_annualized() { + val indicators = d2.indicatorModule().indicators() + .byAnnualized().isFalse + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_indicator_type_url() { + val indicators = d2.indicatorModule().indicators() + .byIndicatorTypeUid().eq("bWuNrMHEoZ0") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_numerator() { + val indicators = d2.indicatorModule().indicators() + .byNumerator() + .eq("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}-#{Jtf34kNZhzP.pq2XI5kz2BY}-#{Jtf34kNZhzP.PT59n8BQbqM}") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_numerator_description() { + val indicators = d2.indicatorModule().indicators() + .byNumeratorDescription().eq("ANC1-ANC3") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_denominator() { + val indicators = d2.indicatorModule().indicators() + .byDenominator().eq("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_denominator_description() { + val indicators = d2.indicatorModule().indicators() + .byDenominatorDescription().eq("Total 1st ANC visits") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_url() { + val indicators = d2.indicatorModule().indicators() + .byUrl().eq("url") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_color() { + val indicators = d2.indicatorModule().indicators() + .byColor().eq("#FF0000") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_icon() { + val indicators = d2.indicatorModule().indicators() + .byIcon().eq("circle") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_dataSetUid() { + val indicators = d2.indicatorModule().indicators() + .byDataSetUid("lyLU2wR22tC") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } + + @Test + fun filter_by_sectionUid() { + val indicators = d2.indicatorModule().indicators() + .bySectionUid("Y2rk0vzgvAx") + .blockingGet() + Truth.assertThat(indicators.size).isEqualTo(1) + } +} \ No newline at end of file diff --git a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.java b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.java deleted file mode 100644 index d64241e996..0000000000 --- a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2004-2022, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.hisp.dhis.android.core.indicator; - -import org.hisp.dhis.android.core.common.BaseIdentifiableObject; -import org.hisp.dhis.android.core.common.BaseObjectShould; -import org.hisp.dhis.android.core.common.ObjectShould; -import org.hisp.dhis.android.core.common.ObjectStyle; -import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.junit.Test; - -import java.io.IOException; -import java.text.ParseException; - -import static com.google.common.truth.Truth.assertThat; - -public class IndicatorShould extends BaseObjectShould implements ObjectShould { - - public IndicatorShould() { - super("indicators/indicator.json"); - } - - @Override - @Test - public void map_from_json_string() throws IOException, ParseException { - Indicator indicator = objectMapper.readValue(jsonStream, Indicator.class); - - assertThat(indicator.code()).isEqualTo("IN_52462"); - assertThat(indicator.lastUpdated()).isEqualTo( - BaseIdentifiableObject.DATE_FORMAT.parse("2013-03-21T11:17:44.926")); - assertThat(indicator.uid()).isEqualTo("ReUHfIn0pTQ"); - assertThat(indicator.created()).isEqualTo( - BaseIdentifiableObject.DATE_FORMAT.parse("2012-11-05T09:16:29.054")); - assertThat(indicator.name()).isEqualTo("ANC 1-3 Dropout Rate"); - assertThat(indicator.shortName()).isEqualTo("ANC 1-3 Dropout Rate"); - assertThat(indicator.description()).isEqualTo("Indicates the percentage of clients dropping" + - " out between the 1st and the 3rd ANC visit. Calculated as the difference between" + - " ANC1 and ANC3 by the ANC 1 visits."); - assertThat(indicator.deleted()).isNull(); - - assertThat(indicator.annualized()).isFalse(); - assertThat(indicator.numerator()).isEqualTo("#{fbfJHSPpUQD.pq2XI5kz2BY}+#" + - "{fbfJHSPpUQD.PT59n8BQbqM}-#{Jtf34kNZhzP.pq2XI5kz2BY}-#{Jtf34kNZhzP.PT59n8BQbqM}"); - assertThat(indicator.numeratorDescription()).isEqualTo("ANC1-ANC3"); - assertThat(indicator.denominator()) - .isEqualTo("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}"); - assertThat(indicator.denominatorDescription()).isEqualTo("Total 1st ANC visits"); - assertThat(indicator.url()).isEqualTo(""); - assertThat(indicator.indicatorType()).isEqualTo(ObjectWithUid.create("bWuNrMHEoZ0")); - assertThat(indicator.decimals()).isEqualTo(3); - assertThat(indicator.style()).isEqualTo(ObjectStyle.builder().color("#FF0000").icon("circle").build()); - } -} \ No newline at end of file diff --git a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt new file mode 100644 index 0000000000..6a0180f91b --- /dev/null +++ b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2004-2023, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.android.core.indicator + +import com.google.common.truth.Truth +import java.io.IOException +import java.text.ParseException +import org.hisp.dhis.android.core.common.BaseIdentifiableObject +import org.hisp.dhis.android.core.common.BaseObjectShould +import org.hisp.dhis.android.core.common.ObjectShould +import org.hisp.dhis.android.core.common.ObjectStyle +import org.hisp.dhis.android.core.common.ObjectWithUid +import org.junit.Test + +class IndicatorShould : BaseObjectShould("indicators/indicator.json"), ObjectShould { + @Test + @Throws(IOException::class, ParseException::class) + override fun map_from_json_string() { + val indicator = objectMapper.readValue(jsonStream, Indicator::class.java) + Truth.assertThat(indicator.code()).isEqualTo("IN_52462") + Truth.assertThat(indicator.lastUpdated()).isEqualTo( + BaseIdentifiableObject.DATE_FORMAT.parse("2013-03-21T11:17:44.926") + ) + Truth.assertThat(indicator.uid()).isEqualTo("ReUHfIn0pTQ") + Truth.assertThat(indicator.created()).isEqualTo( + BaseIdentifiableObject.DATE_FORMAT.parse("2012-11-05T09:16:29.054") + ) + Truth.assertThat(indicator.name()).isEqualTo("ANC 1-3 Dropout Rate") + Truth.assertThat(indicator.shortName()).isEqualTo("ANC 1-3 Dropout Rate") + Truth.assertThat(indicator.description()).isEqualTo( + "Indicates the percentage of clients dropping" + + " out between the 1st and the 3rd ANC visit. Calculated as the difference between" + + " ANC1 and ANC3 by the ANC 1 visits." + ) + Truth.assertThat(indicator.deleted()).isNull() + Truth.assertThat(indicator.annualized()).isFalse() + Truth.assertThat(indicator.numerator()).isEqualTo( + "#{fbfJHSPpUQD.pq2XI5kz2BY}+#" + + "{fbfJHSPpUQD.PT59n8BQbqM}-#{Jtf34kNZhzP.pq2XI5kz2BY}-#{Jtf34kNZhzP.PT59n8BQbqM}" + ) + Truth.assertThat(indicator.numeratorDescription()).isEqualTo("ANC1-ANC3") + Truth.assertThat(indicator.denominator()) + .isEqualTo("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}") + Truth.assertThat(indicator.denominatorDescription()).isEqualTo("Total 1st ANC visits") + Truth.assertThat(indicator.url()).isEqualTo("") + Truth.assertThat(indicator.indicatorType()).isEqualTo(ObjectWithUid.create("bWuNrMHEoZ0")) + Truth.assertThat(indicator.decimals()).isEqualTo(3) + Truth.assertThat(indicator.style()).isEqualTo(ObjectStyle.builder().color("#FF0000").icon("circle").build()) + } +} \ No newline at end of file From edb1f93340a613cc96158593be12bc9ae46ad28c Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 26 Jun 2023 09:14:31 +0200 Subject: [PATCH 026/478] [ANDROSDK-1688] Refactor indicator-related code (no base classes, tests already migrated) to Kotlin. --- .../IndicatorStoreIntegrationShould.kt | 6 +- ...llectionRepositoryMockIntegrationShould.kt | 3 +- ...nHelper.java => BaseDatabaseOpenHelper.kt} | 44 +++++------ .../IndicatorCollectionRepository.java | 3 +- ...orTableInfo.java => IndicatorTableInfo.kt} | 79 +++++++++---------- .../IndicatorTypeCollectionRepository.java | 1 + ...bleInfo.java => IndicatorTypeTableInfo.kt} | 51 ++++++------ .../DataSetIndicatorChildrenAppender.java | 2 +- .../indicator/internal/IndicatorFields.java | 3 +- .../internal/IndicatorModuleWiper.java | 4 +- .../indicator/internal/IndicatorStore.java | 3 +- .../internal/IndicatorTypeFields.java | 1 + .../internal/IndicatorTypeStore.java | 2 +- ...icatorSamples.java => IndicatorSamples.kt} | 32 ++++---- 14 files changed, 112 insertions(+), 122 deletions(-) rename core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/{BaseDatabaseOpenHelper.java => BaseDatabaseOpenHelper.kt} (66%) rename core/src/main/java/org/hisp/dhis/android/core/indicator/{IndicatorTableInfo.java => IndicatorTableInfo.kt} (53%) rename core/src/main/java/org/hisp/dhis/android/core/indicator/{IndicatorTypeTableInfo.java => IndicatorTypeTableInfo.kt} (64%) rename core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/{IndicatorSamples.java => IndicatorSamples.kt} (76%) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt index 778bbb85ae..85a05d0b6a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt @@ -41,12 +41,12 @@ class IndicatorStoreIntegrationShould : IdentifiableObjectStoreAbstractIntegrati TestDatabaseAdapterFactory.get() ) { override fun buildObject(): Indicator { - return IndicatorSamples.getIndicator() + return IndicatorSamples.indicator } override fun buildObjectToUpdate(): Indicator { - return IndicatorSamples.getIndicator().toBuilder() + return IndicatorSamples.indicator.toBuilder() .indicatorType(ObjectWithUid.create("new_indicator_type_uid")) .build() } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt index 03777dfe3a..7271446fb8 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt @@ -34,7 +34,6 @@ import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.Test import org.junit.runner.RunWith - @RunWith(D2JunitRunner::class) class IndicatorCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTestFullDispatcher() { @Test @@ -142,4 +141,4 @@ class IndicatorCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe .blockingGet() Truth.assertThat(indicators.size).isEqualTo(1) } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt similarity index 66% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt index 7b8897890c..15117d4663 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt @@ -26,39 +26,39 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.db.access.internal; +package org.hisp.dhis.android.core.arch.db.access.internal -import android.content.Context; -import android.content.res.AssetManager; +import android.content.Context +import android.content.res.AssetManager +import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter -import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter; +internal class BaseDatabaseOpenHelper(context: Context, targetVersion: Int) { + private val assetManager: AssetManager + private val targetVersion: Int -class BaseDatabaseOpenHelper { - - static final int VERSION = 148; - - private final AssetManager assetManager; - private final int targetVersion; + init { + assetManager = context.assets + this.targetVersion = targetVersion + } - BaseDatabaseOpenHelper(Context context, int targetVersion) { - this.assetManager = context.getAssets(); - this.targetVersion = targetVersion; + fun onOpen(databaseAdapter: DatabaseAdapter) { + databaseAdapter.setForeignKeyConstraintsEnabled(true) + databaseAdapter.enableWriteAheadLogging() } - void onOpen(DatabaseAdapter databaseAdapter) { - databaseAdapter.setForeignKeyConstraintsEnabled(true); - databaseAdapter.enableWriteAheadLogging(); + fun onCreate(databaseAdapter: DatabaseAdapter) { + executor(databaseAdapter).upgradeFromTo(0, targetVersion) } - void onCreate(DatabaseAdapter databaseAdapter) { - executor(databaseAdapter).upgradeFromTo(0, targetVersion); + fun onUpgrade(databaseAdapter: DatabaseAdapter, oldVersion: Int, newVersion: Int) { + executor(databaseAdapter).upgradeFromTo(oldVersion, newVersion) } - void onUpgrade(DatabaseAdapter databaseAdapter, int oldVersion, int newVersion) { - executor(databaseAdapter).upgradeFromTo(oldVersion, newVersion); + private fun executor(databaseAdapter: DatabaseAdapter): DatabaseMigrationExecutor { + return DatabaseMigrationExecutor(databaseAdapter, assetManager) } - private DatabaseMigrationExecutor executor(DatabaseAdapter databaseAdapter) { - return new DatabaseMigrationExecutor(databaseAdapter, assetManager); + companion object { + const val VERSION = 148 } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorCollectionRepository.java index 2b31c27345..eb5302780d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorCollectionRepository.java @@ -35,8 +35,9 @@ import org.hisp.dhis.android.core.arch.repositories.filters.internal.StringFilterConnector; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.dataset.SectionIndicatorLinkTableInfo; -import org.hisp.dhis.android.core.indicator.IndicatorTableInfo.Columns; import org.hisp.dhis.android.core.indicator.internal.IndicatorFields; +import org.hisp.dhis.android.core.indicator.IndicatorTableInfo.Columns; + import java.util.Collections; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt similarity index 53% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt index 5d7cd65a04..f1293ff0b4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt @@ -26,55 +26,48 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator -import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; -import org.hisp.dhis.android.core.arch.helpers.CollectionsHelper; -import org.hisp.dhis.android.core.common.CoreColumns; -import org.hisp.dhis.android.core.common.NameableWithStyleColumns; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo +import org.hisp.dhis.android.core.arch.helpers.CollectionsHelper +import org.hisp.dhis.android.core.common.CoreColumns +import org.hisp.dhis.android.core.common.NameableWithStyleColumns -public final class IndicatorTableInfo { - - private IndicatorTableInfo() { - } - - public static final TableInfo TABLE_INFO = new TableInfo() { - - @Override - public String name() { - return "Indicator"; +object IndicatorTableInfo { + val TABLE_INFO: TableInfo = object : TableInfo() { + override fun name(): String { + return "Indicator" } - @Override - public CoreColumns columns() { - return new Columns(); + override fun columns(): CoreColumns { + return Columns() } - }; - - public static class Columns extends NameableWithStyleColumns { - - public final static String ANNUALIZED = "annualized"; - public final static String INDICATOR_TYPE = "indicatorType"; - public final static String NUMERATOR = "numerator"; - public final static String NUMERATOR_DESCRIPTION = "numeratorDescription"; - public final static String DENOMINATOR = "denominator"; - public final static String DENOMINATOR_DESCRIPTION = "denominatorDescription"; + } - public final static String URL = "url"; - public final static String DECIMALS = "decimals"; + class Columns : NameableWithStyleColumns() { + override fun all(): Array { + return CollectionsHelper.appendInNewArray( + super.all(), + ANNUALIZED, + INDICATOR_TYPE, + NUMERATOR, + NUMERATOR_DESCRIPTION, + DENOMINATOR, + DENOMINATOR_DESCRIPTION, + URL, + DECIMALS + ) + } - @Override - public String[] all() { - return CollectionsHelper.appendInNewArray(super.all(), - ANNUALIZED, - INDICATOR_TYPE, - NUMERATOR, - NUMERATOR_DESCRIPTION, - DENOMINATOR, - DENOMINATOR_DESCRIPTION, - URL, - DECIMALS - ); + companion object { + const val ANNUALIZED = "annualized" + const val INDICATOR_TYPE = "indicatorType" + const val NUMERATOR = "numerator" + const val NUMERATOR_DESCRIPTION = "numeratorDescription" + const val DENOMINATOR = "denominator" + const val DENOMINATOR_DESCRIPTION = "denominatorDescription" + const val URL = "url" + const val DECIMALS = "decimals" } } -} +} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeCollectionRepository.java index a3d4f8cfc8..d5a37f72ef 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeCollectionRepository.java @@ -36,6 +36,7 @@ import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.indicator.IndicatorTypeTableInfo.Columns; + import java.util.Map; import javax.inject.Inject; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeTableInfo.kt similarity index 64% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeTableInfo.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeTableInfo.kt index 625d9865f5..c6a8e11ea8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeTableInfo.kt @@ -26,41 +26,36 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator -import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; -import org.hisp.dhis.android.core.arch.helpers.CollectionsHelper; -import org.hisp.dhis.android.core.common.CoreColumns; -import org.hisp.dhis.android.core.common.IdentifiableColumns; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo +import org.hisp.dhis.android.core.arch.helpers.CollectionsHelper +import org.hisp.dhis.android.core.common.CoreColumns +import org.hisp.dhis.android.core.common.IdentifiableColumns -public final class IndicatorTypeTableInfo { - - private IndicatorTypeTableInfo() { - } - - public static final TableInfo TABLE_INFO = new TableInfo() { - - @Override - public String name() { - return "IndicatorType"; +object IndicatorTypeTableInfo { + val TABLE_INFO: TableInfo = object : TableInfo() { + override fun name(): String { + return "IndicatorType" } - @Override - public CoreColumns columns() { - return new Columns(); + override fun columns(): CoreColumns { + return Columns() } - }; + } - public static class Columns extends IdentifiableColumns { - public final static String NUMBER = "number"; - public final static String FACTOR = "factor"; + class Columns : IdentifiableColumns() { + override fun all(): Array { + return CollectionsHelper.appendInNewArray( + super.all(), + NUMBER, + FACTOR + ) + } - @Override - public String[] all() { - return CollectionsHelper.appendInNewArray(super.all(), - NUMBER, - FACTOR - ); + companion object { + const val NUMBER = "number" + const val FACTOR = "factor" } } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorChildrenAppender.java index d9d6c408ba..9bad7abdb6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorChildrenAppender.java @@ -40,7 +40,7 @@ public final class DataSetIndicatorChildrenAppender extends ChildrenAppender { private static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( - IndicatorTableInfo.TABLE_INFO, + IndicatorTableInfo.INSTANCE.getTABLE_INFO(), DataSetIndicatorLinkTableInfo.Columns.DATA_SET, DataSetIndicatorLinkTableInfo.Columns.INDICATOR); private final LinkChildStore linkChildStore; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java index 4da0475480..03188b763f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java @@ -32,9 +32,10 @@ import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; import org.hisp.dhis.android.core.arch.fields.internal.FieldsHelper; import org.hisp.dhis.android.core.indicator.Indicator; -import org.hisp.dhis.android.core.indicator.IndicatorTableInfo.Columns; import org.hisp.dhis.android.core.legendset.LegendSet; import org.hisp.dhis.android.core.legendset.internal.LegendSetFields; +import org.hisp.dhis.android.core.indicator.IndicatorTableInfo.Columns; + public final class IndicatorFields { diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorModuleWiper.java index c051e7cc94..15850eed29 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorModuleWiper.java @@ -51,8 +51,8 @@ public final class IndicatorModuleWiper implements ModuleWiper { @Override public void wipeMetadata() { tableWiper.wipeTables( - IndicatorTableInfo.TABLE_INFO, - IndicatorTypeTableInfo.TABLE_INFO, + IndicatorTableInfo.INSTANCE.getTABLE_INFO(), + IndicatorTypeTableInfo.INSTANCE.getTABLE_INFO(), DataSetIndicatorLinkTableInfo.TABLE_INFO); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java index 2af1b86a77..dbf7ee93fa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java @@ -40,6 +40,7 @@ import org.hisp.dhis.android.core.indicator.Indicator; import org.hisp.dhis.android.core.indicator.IndicatorTableInfo; + public final class IndicatorStore { private IndicatorStore() { @@ -61,7 +62,7 @@ public void bindToStatement(@NonNull Indicator o, @NonNull StatementWrapper w) { }; public static IdentifiableObjectStore create(DatabaseAdapter databaseAdapter) { - return StoreFactory.objectWithUidStore(databaseAdapter, IndicatorTableInfo.TABLE_INFO, BINDER, + return StoreFactory.objectWithUidStore(databaseAdapter, IndicatorTableInfo.INSTANCE.getTABLE_INFO(), BINDER, Indicator::create); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeFields.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeFields.java index 0b2df9b089..53c1c267df 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeFields.java @@ -34,6 +34,7 @@ import org.hisp.dhis.android.core.indicator.IndicatorType; import org.hisp.dhis.android.core.indicator.IndicatorTypeTableInfo.Columns; + final class IndicatorTypeFields { private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeStore.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeStore.java index 883207562e..b800db76ef 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeStore.java @@ -53,7 +53,7 @@ public void bindToStatement(@NonNull IndicatorType o, @NonNull StatementWrapper }; public static IdentifiableObjectStore create(DatabaseAdapter databaseAdapter) { - return StoreFactory.objectWithUidStore(databaseAdapter, IndicatorTypeTableInfo.TABLE_INFO, BINDER, + return StoreFactory.objectWithUidStore(databaseAdapter, IndicatorTypeTableInfo.INSTANCE.getTABLE_INFO(), BINDER, IndicatorType::create); } } \ No newline at end of file diff --git a/core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.java b/core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.kt similarity index 76% rename from core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.java rename to core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.kt index b1aa540491..0e9fa14516 100644 --- a/core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.java +++ b/core/src/sharedTest/java/org/hisp/dhis/android/core/data/indicator/IndicatorSamples.kt @@ -26,21 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.indicator; +package org.hisp.dhis.android.core.data.indicator -import org.hisp.dhis.android.core.common.ObjectStyle; -import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.indicator.Indicator; +import org.hisp.dhis.android.core.common.ObjectStyle +import org.hisp.dhis.android.core.common.ObjectWithUid +import org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillNameableProperties +import org.hisp.dhis.android.core.indicator.Indicator -import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillNameableProperties; - -public class IndicatorSamples { - - public static Indicator getIndicator() { - Indicator.Builder indicatorBuilder = Indicator.builder(); - - fillNameableProperties(indicatorBuilder); - indicatorBuilder +object IndicatorSamples { + val indicator: Indicator + get() { + val indicatorBuilder = Indicator.builder() + fillNameableProperties(indicatorBuilder) + indicatorBuilder .id(1L) .annualized(false) .indicatorType(ObjectWithUid.create("bWuNrMHEoZ0")) @@ -50,7 +48,7 @@ public static Indicator getIndicator() { .denominatorDescription("den descr") .url("dhis2.org") .decimals(2) - .style(ObjectStyle.builder().color("#FF0000").icon("circle").build()); - return indicatorBuilder.build(); - } -} \ No newline at end of file + .style(ObjectStyle.builder().color("#FF0000").icon("circle").build()) + return indicatorBuilder.build() + } +} From f6fb280ae8dc69b83c1f4da1488faec26295ec85 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 27 Jun 2023 11:08:55 +0200 Subject: [PATCH 027/478] [ANDROSDK-1688] Added new line to end of new Kotlin files --- .../core/arch/db/access/internal/BaseDatabaseOpenHelper.kt | 2 +- .../org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt | 2 +- .../org/hisp/dhis/android/core/indicator/IndicatorShould.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt b/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt index 15117d4663..5c6147a93d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt @@ -61,4 +61,4 @@ internal class BaseDatabaseOpenHelper(context: Context, targetVersion: Int) { companion object { const val VERSION = 148 } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt index f1293ff0b4..a049d99533 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt @@ -70,4 +70,4 @@ object IndicatorTableInfo { const val DECIMALS = "decimals" } } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt index 6a0180f91b..3e9f654b69 100644 --- a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt +++ b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt @@ -73,4 +73,4 @@ class IndicatorShould : BaseObjectShould("indicators/indicator.json"), ObjectSho Truth.assertThat(indicator.decimals()).isEqualTo(3) Truth.assertThat(indicator.style()).isEqualTo(ObjectStyle.builder().color("#FF0000").icon("circle").build()) } -} \ No newline at end of file +} From 5fd80dcea985e8d2a235ae6f6c899dc237880cf6 Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 27 Jun 2023 11:08:55 +0200 Subject: [PATCH 028/478] [ANDROSDK-1688] Added new line to end of new Kotlin files --- .../IndicatorCollectionRepositoryMockIntegrationShould.kt | 5 ++++- .../core/arch/db/access/internal/BaseDatabaseOpenHelper.kt | 2 +- .../hisp/dhis/android/core/indicator/IndicatorTableInfo.kt | 2 +- .../org/hisp/dhis/android/core/indicator/IndicatorShould.kt | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt index 7271446fb8..ebff92efb3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.kt @@ -73,7 +73,10 @@ class IndicatorCollectionRepositoryMockIntegrationShould : BaseMockIntegrationTe fun filter_by_numerator() { val indicators = d2.indicatorModule().indicators() .byNumerator() - .eq("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}-#{Jtf34kNZhzP.pq2XI5kz2BY}-#{Jtf34kNZhzP.PT59n8BQbqM}") + .eq( + "#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}" + + "-#{Jtf34kNZhzP.pq2XI5kz2BY}-#{Jtf34kNZhzP.PT59n8BQbqM}" + ) .blockingGet() Truth.assertThat(indicators.size).isEqualTo(1) } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt b/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt index 15117d4663..5c6147a93d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/access/internal/BaseDatabaseOpenHelper.kt @@ -61,4 +61,4 @@ internal class BaseDatabaseOpenHelper(context: Context, targetVersion: Int) { companion object { const val VERSION = 148 } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt index f1293ff0b4..a049d99533 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTableInfo.kt @@ -70,4 +70,4 @@ object IndicatorTableInfo { const val DECIMALS = "decimals" } } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt index 6a0180f91b..3e9f654b69 100644 --- a/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt +++ b/core/src/test/java/org/hisp/dhis/android/core/indicator/IndicatorShould.kt @@ -73,4 +73,4 @@ class IndicatorShould : BaseObjectShould("indicators/indicator.json"), ObjectSho Truth.assertThat(indicator.decimals()).isEqualTo(3) Truth.assertThat(indicator.style()).isEqualTo(ObjectStyle.builder().color("#FF0000").icon("circle").build()) } -} \ No newline at end of file +} From d1738617ae489d6c065398d8fb19fc4069f11ac3 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 29 Jun 2023 13:37:27 +0200 Subject: [PATCH 029/478] [ANDROSDK-1688] fix: send style as object (nested field) instead of separate fields --- .../android/core/indicator/internal/IndicatorFields.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java index 03188b763f..29a0d7fa5f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java @@ -31,15 +31,18 @@ import org.hisp.dhis.android.core.arch.api.fields.internal.Field; import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; import org.hisp.dhis.android.core.arch.fields.internal.FieldsHelper; +import org.hisp.dhis.android.core.common.ObjectStyle; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleFields; import org.hisp.dhis.android.core.indicator.Indicator; +import org.hisp.dhis.android.core.indicator.IndicatorTableInfo.Columns; import org.hisp.dhis.android.core.legendset.LegendSet; import org.hisp.dhis.android.core.legendset.internal.LegendSetFields; -import org.hisp.dhis.android.core.indicator.IndicatorTableInfo.Columns; public final class IndicatorFields { public static final String LEGEND_SETS = "legendSets"; + public static final String OBJECT_STYLE = "style"; private static final FieldsHelper fh = new FieldsHelper<>(); public static final Field uid = fh.uid(); @@ -58,8 +61,7 @@ public final class IndicatorFields { fh.field(Columns.URL), fh.nestedField(LEGEND_SETS).with(LegendSetFields.uid), fh.field(Columns.DECIMALS), - fh.field(Columns.COLOR), - fh.field(Columns.ICON) + fh.nestedField(OBJECT_STYLE).with(ObjectStyleFields.allFields) ).build(); private IndicatorFields() { From e6c40f77689aa1a21d5e180df646d58eacb05c81 Mon Sep 17 00:00:00 2001 From: Victor Garcia Date: Wed, 21 Jun 2023 09:21:02 +1000 Subject: [PATCH 030/478] [ANDROSDK-1698] Refactor Handler and Store --- .../core/MockIntegrationTestObjects.kt | 5 +- .../AnalyticsRepositoryIntegrationShould.kt | 4 +- .../BaseEvaluatorIntegrationShould.kt | 95 +++++---- ...gramIndicatorEvaluatorIntegrationShould.kt | 4 +- .../AnalyticExpressionEngineFactoryHelper.kt | 24 +-- .../EventLineListIntegrationShould.kt | 64 +++--- .../collection/PagingMockIntegrationShould.kt | 4 +- ...ava => AttributeStoreIntegrationShould.kt} | 50 ++--- ...ributeValueLinkStoreIntegrationShould.java | 2 +- ...ributeValueLinkStoreIntegrationShould.java | 2 +- ...ributeValueLinkStoreIntegrationShould.java | 2 +- ...CategoryComboLinkStoreIntegrationShould.kt | 3 +- ...egoryOptionLinkStoreIntegrationShould.java | 2 +- ...yComboEndpointCallRealIntegrationShould.kt | 10 +- ...egoryOptionLinkStoreIntegrationShould.java | 2 +- ...anisationUnitLinkStoreIntegrationShould.kt | 2 +- ...ntifiableObjectStoreIntegrationShould.java | 4 +- .../common/ObjectStoreIntegrationShould.java | 4 +- ...DeviceRenderingStoreIntegrationShould.java | 4 +- .../DataStatePropagatorIntegrationShould.kt | 25 +-- .../ConfigurationStoreIntegrationShould.java | 2 +- ...ConfigurationMigrationIntegrationShould.kt | 6 +- .../ConstantStoreIntegrationShould.java | 2 +- ...aElementOperandStoreIntegrationShould.java | 2 +- .../DataElementStoreIntegrationShould.java | 2 +- ...InputPeriodLinkStoreIntegrationShould.java | 2 +- ...strationPostCallRealIntegrationShould.java | 2 +- ...mentOperandLinkStoreIntegrationShould.java | 2 +- ...DataElementLinkStoreIntegrationShould.java | 2 +- .../DataSetInstanceStoreIntegrationShould.kt | 7 +- ...isationUnitLinkStoreIntegrationShould.java | 2 +- .../DataSetStoreIntegrationShould.java | 2 +- ...DataElementLinkStoreIntegrationShould.java | 2 +- ...reyedFieldsLinkStoreIntegrationShould.java | 2 +- ...tionIndicatorLinkStoreIntegrationShould.kt | 3 +- .../SectionStoreIntegrationShould.java | 2 +- .../DataStoreEntryStoreIntegrationShould.kt | 4 +- .../LocalDataStoreStoreIntegrationShould.kt | 4 +- .../DataStorePostCallMockIntegrationShould.kt | 2 +- ...DataValueConflictStoreIntegrationShould.kt | 2 +- ...aValueEndpointCallRealIntegrationShould.kt | 6 +- ...ataValuePostCallRealIntegrationShould.java | 2 +- ...ggregatedDataSyncStoreIntegrationShould.kt | 3 +- .../EnrollmentStoreIntegrationShould.java | 2 +- ...tWithLimitCallBaseMockIntegrationShould.kt | 8 +- .../EventDataFilterStoreIntegrationShould.kt | 3 +- ...ntEndpointCallBaseMockIntegrationShould.kt | 6 +- .../EventEndpointCallRealIntegrationShould.kt | 7 +- .../EventFilterStoreIntegrationShould.kt | 2 +- .../EventPostBaseMockIntegrationShould.kt | 11 +- .../EventPostCallRealIntegrationShould.kt | 5 +- .../internal/EventStoreIntegrationShould.java | 2 +- .../EventSyncStoreIntegrationShould.java | 2 +- ...sionDimensionItemStoreIntegrationShould.kt | 4 +- ...aseFileResourceRoutineIntegrationShould.kt | 44 ++-- .../FileResourceStoreIntegrationShould.kt | 2 +- ...rImportConflictStoreIntegrationShould.java | 2 +- ...etIndicatorLinkStoreIntegrationShould.java | 2 +- .../IndicatorStoreIntegrationShould.kt | 2 +- ...mentLegendSetLinkStoreIntegrationShould.kt | 4 +- ...atorLegendSetLinkStoreIntegrationShould.kt | 7 +- ...orLegendSetLinkStoreIntegrationShould.java | 4 +- .../LegendSetStoreIntegrationShould.java | 3 +- .../LegendStoreIntegrationShould.java | 3 +- .../D2ErrorStoreIntegrationShould.java | 2 +- .../internal/ForeignKeyCleanerShould.kt | 12 +- ...ignKeyViolationStoreIntegrationShould.java | 2 +- ...erImageryProviderStoreIntegrationShould.kt | 7 +- .../MapLayerStoreIntegrationShould.kt | 7 +- .../internal/NoteStoreIntegrationShould.java | 2 +- ...GroupOptionLinkStoreIntegrationShould.java | 2 +- .../OptionGroupStoreIntegrationShould.java | 2 +- ...ganisationUnitCallMockIntegrationShould.kt | 28 +-- ...sationUnitGroupStoreIntegrationShould.java | 2 +- ...sationUnitLevelStoreIntegrationShould.java | 2 +- ...onUnitGroupLinkStoreIntegrationShould.java | 2 +- ...UnitProgramLinkStoreIntegrationShould.java | 2 +- ...rganisationUnitStoreIntegrationShould.java | 2 +- .../period/PeriodMockIntegrationShould.java | 2 +- .../internal/PeriodHelperIntegrationShould.kt | 2 +- .../PeriodStoreIntegrationShould.java | 4 +- ...icsPeriodBoundaryStoreIntegrationShould.kt | 3 +- ...rogramEndpointCallMockIntegrationShould.kt | 10 +- ...rogramIndicatorStoreIntegrationShould.java | 2 +- ...ogramRuleActionStoreIntegrationShould.java | 2 +- .../ProgramRuleStoreIntegrationShould.java | 2 +- ...ramRuleVariableStoreIntegrationShould.java | 2 +- ...onAttributeLinkStoreIntegrationShould.java | 2 +- .../ProgramSectionStoreIntegrationShould.kt | 3 +- ...tageDataElementStoreIntegrationShould.java | 2 +- ...DataElementLinkStoreIntegrationShould.java | 2 +- ...ogramStageSectionStoreIntegrationShould.kt | 3 +- .../ProgramStageStoreIntegrationShould.java | 2 +- .../ProgramStoreIntegrationShould.java | 2 +- ...EntityAttributeStoreIntegrationShould.java | 2 +- ...amIndicatorSQLExecutorIntegrationShould.kt | 12 +- .../BaseTrackerDataIntegrationHelper.kt | 18 +- ...ProgramIndicatorEngineIntegrationShould.kt | 24 +-- ...ributeValueFilterStoreIntegrationShould.kt | 4 +- ...stEventDataFilterStoreIntegrationShould.kt | 4 +- ...mStageWorkingListStoreIntegrationShould.kt | 4 +- ...nshipConstraintStoreIntegrationShould.java | 2 +- .../RelationshipItemStoreIntegrationShould.kt | 3 +- .../RelationshipStoreIntegrationShould.java | 2 +- .../ResourceStoreIntegrationShould.java | 4 +- ...DhisVisualizationStoreIntegrationShould.kt | 2 +- ...yticsTeiAttributeStoreIntegrationShould.kt | 2 +- ...icsTeiDataElementStoreIntegrationShould.kt | 2 +- ...yticsTeiIndicatorStoreIntegrationShould.kt | 2 +- ...alyticsTeiSettingStoreIntegrationShould.kt | 2 +- ...iWHONutritionDataStoreIntegrationShould.kt | 3 +- .../DataSetSettingStoreIntegrationShould.java | 2 +- .../FilterSettingStoreIntegrationShould.kt | 2 +- .../GeneralSettingsStoreIntegrationShould.kt | 2 +- .../LatestAppVersionStoreIntegrationShould.kt | 3 +- ...figurationSettingStoreIntegrationShould.kt | 2 +- .../ProgramSettingStoreIntegrationShould.java | 2 +- ...onizationSettingsStoreIntegrationShould.kt | 2 +- .../SystemSettingStoreIntegrationShould.java | 2 +- .../UserSettingsStoreIntegrationShould.java | 2 +- .../SMSConfigStoreIntegrationShould.kt | 2 +- .../SMSMetadataIdStoreIntegrationShould.kt | 2 +- ...OngoingSubmissionStoreIntegrationShould.kt | 2 +- .../SystemInfoStoreIntegrationShould.java | 2 +- ...rvedValueManagerRealIntegrationShould.java | 34 +-- ...ributeValueFilterStoreIntegrationShould.kt | 3 +- .../BasePayloadGeneratorMockIntegration.kt | 42 ++-- ...vedValueSettingStoreIntegrationShould.java | 2 +- ...alueEndpointCallRealIntegrationShould.java | 4 +- ...teReservedValueStoreIntegrationShould.java | 16 +- ...EntityAttributeStoreIntegrationShould.java | 2 +- ...yAttributeValueStoreIntegrationShould.java | 2 +- ...EntityDataValueStoreIntegrationShould.java | 16 +- ...tyInstanceCallBaseMockIntegrationShould.kt | 14 +- ...anceEventFilterStoreIntegrationShould.java | 2 +- ...ityInstanceFilterStoreIntegrationShould.kt | 3 +- ...InstancePostCallRealIntegrationShould.java | 40 ++-- ...dEntityInstanceStoreIntegrationShould.java | 2 +- ...ityInstanceSyncStoreIntegrationShould.java | 2 +- ...tyTypeAttributeStoreIntegrationShould.java | 2 +- ...ackedEntityTypeStoreIntegrationShould.java | 2 +- .../ProgramOwnerStoreIntegrationShould.kt | 3 +- .../ProgramTempOwnerStoreIntegrationShould.kt | 3 +- ...ceLocalQueryHelperMockIntegrationShould.kt | 2 +- .../TrackerJobObjectStoreIntegrationShould.kt | 3 +- .../StockUseCaseStoreIntegrationShould.kt | 3 +- ...seTransactionLinkStoreIntegrationShould.kt | 3 +- ...thenticatedUserStoreIntegrationShould.java | 2 +- .../AuthorityStoreIntegrationShould.java | 2 +- .../LogoutCallRealIntegrationShould.kt | 2 +- .../internal/UserCallMockIntegrationShould.kt | 2 +- ...anisationUnitLinkStoreIntegrationShould.kt | 3 +- .../UserRoleStoreIntegrationShould.kt | 2 +- .../internal/UserStoreIntegrationShould.kt | 2 +- .../BaseMockIntegrationTestFullDispatcher.kt | 17 +- .../ValidationRuleStoreIntegrationShould.java | 2 +- ...tionDimensionItemStoreIntegrationShould.kt | 2 +- .../VisualizationStoreIntegrationShould.kt | 2 +- .../wipe/WipeDBCallMockIntegrationShould.kt | 48 ++--- .../wipe/WipeDBCallRealIntegrationShould.kt | 2 +- .../LocalAnalyticsDatabaseFiller.kt | 40 ++-- ...reObjectRepositoryMockIntegrationShould.kt | 8 +- ...ueObjectRepositoryMockIntegrationShould.kt | 6 +- ...ObjectRepositoryMockIntegrationShould.java | 6 +- ...ObjectRepositoryMockIntegrationShould.java | 10 +- .../FileResourceAddMockIntegrationShould.kt | 2 +- ...ObjectRepositoryMockIntegrationShould.java | 6 +- ...llectionRepositoryBaseIntegrationShould.kt | 4 +- .../AnalyticsOrganisationUnitHelper.kt | 15 +- .../AnalyticsServiceMetadataHelper.kt | 47 ++-- ...icsVisualizationsServiceDimensionHelper.kt | 21 +- .../AnalyticExpressionEngineFactory.kt | 16 +- .../indicatorengine/IndicatorContext.kt | 4 +- .../indicatorengine/IndicatorEngine.kt | 7 +- .../indicatorengine/IndicatorSQLEngine.kt | 7 +- .../internal/APICallExecutorImpl.java | 8 +- .../internal/CoroutineAPICallExecutorImpl.kt | 4 +- .../internal/RxAPICallExecutorImpl.kt | 4 +- .../executors/internal/D2CallExecutor.java | 8 +- .../cleaners/internal/CollectionCleaner.kt | 2 +- .../arch/cleaners/internal/LinkCleaner.kt | 2 +- .../arch/cleaners/internal/OrphanCleaner.kt | 2 +- .../cleaners/internal/ParentOrphanCleaner.kt | 2 +- .../cleaners/internal/SubCollectionCleaner.kt | 2 +- .../core/arch/d2/internal/D2DIComponent.kt | 20 +- .../internal/DatabaseImportExportImpl.kt | 18 +- .../internal/SQLStatementBuilderImpl.java | 4 - .../IdentifiableDataObjectStoreImpl.kt | 20 +- ...dentifiableDeletableDataObjectStoreImpl.kt | 21 +- .../internal/IdentifiableObjectStoreImpl.kt | 14 ++ .../arch/db/stores/internal/LinkStoreImpl.kt | 21 ++ .../db/stores/internal/ObjectStoreImpl.kt | 14 ++ .../internal/ObjectWithoutUidStoreImpl.kt | 22 ++ .../arch/db/stores/internal/StoreFactory.kt | 63 ------ .../core/arch/handlers/internal/Handler.kt | 2 +- .../arch/handlers/internal/HandlerBaseImpl.kt | 2 +- .../internal/HandlerWithTransformer.kt | 2 +- .../internal/IdentifiableDataHandler.kt | 2 +- .../arch/handlers/internal/LinkHandler.kt | 2 +- .../internal/OrderedLinkHandlerImpl.kt | 4 +- .../internal/AttributeEntityDIModule.kt} | 26 +-- .../internal/AttributeHandler.kt} | 14 +- .../internal/AttributePackageDIModule.kt} | 10 +- .../attribute/internal/AttributeStore.java | 94 -------- .../core/attribute/internal/AttributeStore.kt | 34 +++ .../attribute/internal/AttributeStoreImpl.kt | 88 ++++++++ .../DataElementAttributeValueLinkHandler.kt | 37 ++++ .../DataElementAttributeValueLinkStore.kt | 34 +++ ...DataElementAttributeValueLinkStoreImpl.kt} | 48 +++-- .../ProgramAttributeValueLinkHandler.kt | 37 ++++ .../ProgramAttributeValueLinkStore.kt | 34 +++ ... => ProgramAttributeValueLinkStoreImpl.kt} | 47 ++-- .../ProgramStageAttributeValueLinkHandler.kt | 37 ++++ .../ProgramStageAttributeValueLinkStore.kt | 34 +++ ...rogramStageAttributeValueLinkStoreImpl.kt} | 47 ++-- .../CategoryCollectionRepository.java | 4 +- .../CategoryComboCollectionRepository.java | 4 +- .../CategoryOptionCollectionRepository.java | 4 +- .../core/category/internal/CategoryCall.kt | 3 +- .../CategoryCategoryComboEntityDIModule.kt | 16 +- .../CategoryCategoryComboLinkHandler.kt | 38 ++++ .../CategoryCategoryComboLinkStore.kt | 25 +-- .../CategoryCategoryComboLinkStoreImpl.kt | 57 +++++ .../CategoryCategoryOptionEntityDIModule.kt | 16 +- .../CategoryCategoryOptionLinkHandler.kt | 37 ++++ .../CategoryCategoryOptionLinkPersistor.kt | 3 +- .../CategoryCategoryOptionLinkStore.kt | 27 +-- .../CategoryCategoryOptionLinkStoreImpl.kt | 57 +++++ .../category/internal/CategoryComboCall.kt | 3 +- .../internal/CategoryComboEntityDIModule.kt | 19 +- .../category/internal/CategoryComboHandler.kt | 21 +- .../category/internal/CategoryComboStore.kt | 28 +-- .../internal/CategoryComboStoreImpl.kt | 57 +++++ .../internal/CategoryEntityDIModule.kt | 15 +- .../core/category/internal/CategoryHandler.kt | 36 ++++ .../category/internal/CategoryOptionCall.kt | 3 +- ...OptionComboCategoryOptionEntityDIModule.kt | 16 +- ...ategoryOptionComboCategoryOptionHandler.kt | 37 ++++ ...egoryOptionComboCategoryOptionLinkStore.kt | 24 +-- ...yOptionComboCategoryOptionLinkStoreImpl.kt | 56 +++++ .../CategoryOptionComboEntityDIModule.kt | 11 +- .../internal/CategoryOptionComboHandler.kt | 9 +- .../internal/CategoryOptionComboStoreImpl.kt | 26 +-- .../internal/CategoryOptionEntityDIModule.kt | 13 +- .../internal/CategoryOptionHandler.kt | 5 +- ...yOptionOrganisationUnitChildrenAppender.kt | 2 +- ...oryOptionOrganisationUnitEntityDIModule.kt | 13 +- ...tegoryOptionOrganisationUnitLinkHandler.kt | 38 ++++ ...CategoryOptionOrganisationUnitLinkStore.kt | 24 +-- ...goryOptionOrganisationUnitLinkStoreImpl.kt | 56 +++++ .../CategoryOptionOrganisationUnitsCall.kt | 3 +- .../category/internal/CategoryOptionStore.kt | 29 +-- .../internal/CategoryOptionStoreImpl.kt | 60 ++++++ .../core/category/internal/CategoryStore.kt | 28 +-- .../internal/CategoryStoreImpl.kt} | 52 ++--- .../internal/CommonPackageDIModule.java | 2 +- .../internal/DataStatePropagatorImpl.kt | 8 +- .../common/internal/TrackerDataManagerImpl.kt | 4 +- ...alueTypeDeviceRenderingEntityDIModule.java | 56 ----- .../ValueTypeDeviceRenderingEntityDIModule.kt | 48 +++++ .../ValueTypeDeviceRenderingHandler.kt | 36 ++++ .../ValueTypeDeviceRenderingStore.kt} | 10 +- ...a => ValueTypeDeviceRenderingStoreImpl.kt} | 79 +++---- ...va => ValueTypeRenderingEntityDIModule.kt} | 22 +- ...dler.java => ValueTypeRenderingHandler.kt} | 65 +++--- .../internal/ConfigurationPackageDIModule.kt | 7 +- .../internal/ConfigurationStore.kt} | 10 +- ...onStore.java => ConfigurationStoreImpl.kt} | 37 ++-- .../DatabaseConfigurationInsecureStore.kt | 9 +- .../DatabaseConfigurationInsecureStoreImpl.kt | 36 ++++ .../DatabaseConfigurationMigration.kt | 5 +- .../DatabaseConfigurationTransformer.kt | 4 +- .../DatabaseEncryptionPasswordManager.java | 6 - .../internal/MultiUserDatabaseManager.kt | 3 +- .../MultiUserDatabaseManagerForD2Manager.kt | 5 +- .../internal/migration/Migration260.kt | 4 +- .../ConstantCollectionRepository.java | 4 +- .../internal/ConstantCallFactory.java | 5 +- .../core/constant/internal/ConstantHandler.kt | 42 ++++ ...Module.java => ConstantPackageDIModule.kt} | 71 +++---- .../core/constant/internal/ConstantStore.kt | 27 +-- .../internal/ConstantStoreImpl.kt} | 51 ++--- .../DataApprovalCollectionRepository.java | 4 +- .../dataapproval/internal/DataApprovalCall.kt | 3 +- .../internal/DataApprovalEntityDIModule.kt | 56 +++++ .../internal/DataApprovalHandler.kt | 36 ++++ .../internal/DataApprovalStore.kt | 34 +++ ...valStore.java => DataApprovalStoreImpl.kt} | 87 ++++---- .../DataElementCollectionRepository.java | 4 +- ...taElementAttributeValueEntityDIModule.java | 58 ----- ...DataElementAttributeValueEntityDIModule.kt | 53 +++++ .../DataElementEndpointCallFactory.java | 5 +- .../internal/DataElementEntityDIModule.java | 65 ------ .../internal/DataElementEntityDIModule.kt} | 57 ++--- .../internal/DataElementHandler.java | 94 -------- .../internal/DataElementHandler.kt | 75 +++++++ .../DataElementLegendSetEntityDIModule.java | 58 ----- .../DataElementLegendSetEntityDIModule.kt} | 34 ++- .../DataElementOperandEntityDIModule.kt | 48 +++++ .../internal/DataElementOperandHandler.kt} | 15 +- .../internal/DataElementOperandStore.kt} | 17 +- ...re.java => DataElementOperandStoreImpl.kt} | 47 ++-- .../dataelement/internal/DataElementStore.kt | 34 +++ ...mentStore.java => DataElementStoreImpl.kt} | 68 +++--- .../dataset/DataSetCollectionRepository.java | 10 +- ...ompleteRegistrationCollectionRepository.kt | 4 +- .../dataset/SectionCollectionRepository.java | 4 +- .../DataInputPeriodChildrenAppender.java | 2 +- .../DataInputPeriodEntityDIModule.kt} | 26 +-- .../internal/DataInputPeriodHandler.kt | 36 ++++ .../dataset/internal/DataInputPeriodStore.kt | 34 +++ ...Store.java => DataInputPeriodStoreImpl.kt} | 67 +++--- ...ataSetCompleteRegistrationCallProcessor.kt | 3 +- ...SetCompleteRegistrationEntityDIModule.java | 67 ------ ...aSetCompleteRegistrationEntityDIModule.kt} | 37 ++-- .../DataSetCompleteRegistrationHandler.kt | 36 ++++ ...va => DataSetCompleteRegistrationStore.kt} | 38 ++-- .../DataSetCompleteRegistrationStoreImpl.java | 144 ------------- .../DataSetCompleteRegistrationStoreImpl.kt | 133 ++++++++++++ ...lsoryDataElementOperandEntityDIModule.java | 57 ----- ...pulsoryDataElementOperandEntityDIModule.kt | 50 +++++ ...aSetCompulsoryDataElementOperandHandler.kt | 37 ++++ ...etCompulsoryDataElementOperandLinkStore.kt | 34 +++ ...pulsoryDataElementOperandLinkStoreImpl.kt} | 50 +++-- .../internal/DataSetElementEntityDIModule.kt | 48 +++++ .../dataset/internal/DataSetElementHandler.kt | 36 ++++ .../dataset/internal/DataSetElementStore.kt | 34 +++ ...kStore.java => DataSetElementStoreImpl.kt} | 50 ++--- .../internal/DataSetEndpointCallFactory.java | 5 +- .../internal/DataSetEntityDIModule.java | 106 --------- .../dataset/internal/DataSetEntityDIModule.kt | 128 +++++++++++ .../core/dataset/internal/DataSetHandler.java | 130 ----------- .../core/dataset/internal/DataSetHandler.kt | 102 +++++++++ .../internal/DataSetInstanceEntityDIModule.kt | 48 +++++ .../internal/DataSetInstanceStore.java | 54 ----- .../dataset/internal/DataSetInstanceStore.kt | 34 +++ .../internal/DataSetInstanceStoreImpl.kt | 42 ++++ .../internal/DataSetInstanceSummaryStore.java | 54 ----- .../internal/DataSetInstanceSummaryStore.kt | 34 +++ .../DataSetInstanceSummaryStoreImpl.kt | 42 ++++ .../internal/DataSetModuleDownloader.kt | 4 +- ...taSetOrganisationUnitLinkEntityDIModule.kt | 14 +- .../DataSetOrganisationUnitLinkHandler.kt | 37 ++++ .../DataSetOrganisationUnitLinkStore.kt | 34 +++ ...> DataSetOrganisationUnitLinkStoreImpl.kt} | 46 ++-- .../core/dataset/internal/DataSetStore.kt | 34 +++ .../internal/DataSetStoreImpl.kt} | 79 +++---- .../SectionDataElementEntityDIModule.java | 56 ----- .../SectionDataElementEntityDIModule.kt | 48 +++++ .../internal/SectionDataElementLinkHandler.kt | 37 ++++ .../internal/SectionDataElementLinkStore.kt | 34 +++ ...ava => SectionDataElementLinkStoreImpl.kt} | 48 ++--- .../dataset/internal/SectionEntityDIModule.kt | 12 +- .../SectionGreyedFieldsEntityDIModule.java | 57 ----- .../SectionGreyedFieldsEntityDIModule.kt | 48 +++++ .../SectionGreyedFieldsLinkHandler.kt | 37 ++++ .../internal/SectionGreyedFieldsLinkStore.kt | 34 +++ ...va => SectionGreyedFieldsLinkStoreImpl.kt} | 50 +++-- .../core/dataset/internal/SectionHandler.kt | 22 +- .../SectionIndicatorEntityDIModule.kt | 13 +- .../internal/SectionIndicatorLinkHandler.kt | 36 ++++ .../internal/SectionIndicatorLinkStore.kt | 22 +- .../SectionIndicatorLinkStoreImpl.kt} | 44 ++-- .../core/dataset/internal/SectionStore.kt | 34 +++ .../core/dataset/internal/SectionStoreImpl.kt | 62 ++++++ .../LocalDataStoreCollectionRepository.java | 3 +- .../internal/DataStoreDownloadCall.kt | 3 +- .../internal/DataStoreEntityDIModule.kt | 7 +- .../internal/DataStoreEntryStoreImpl.kt | 35 +-- .../datastore/internal/DataStoreHandler.kt | 5 +- .../internal/LocalDataStoreEntityDIModule.kt | 5 +- .../datastore/internal/LocalDataStoreStore.kt | 36 +--- .../internal/LocalDataStoreStoreImpl.kt | 66 ++++++ ...DataValueConflictCollectionRepository.java | 3 +- .../core/datavalue/internal/DataValueCall.kt | 3 +- ....kt => DataValueConflictEntityDIModule.kt} | 7 +- .../internal/DataValueConflictParser.kt | 9 +- .../internal/DataValueConflictStore.kt | 28 +-- .../internal/DataValueConflictStoreImpl.kt} | 56 ++--- .../internal/DataValueEntityDIModule.kt} | 37 ++-- .../datavalue/internal/DataValueHandler.kt | 7 +- .../internal/DataValueImportHandler.kt | 3 +- .../datavalue/internal/DataValuePostCall.kt | 4 +- .../datavalue/internal/DataValueStore.java | 148 ------------- .../core/datavalue/internal/DataValueStore.kt | 51 +++++ .../datavalue/internal/DataValueStoreImpl.kt | 137 ++++++++++++ .../conflicts/PastExpiryDateConflict.kt | 6 +- .../data/internal/AggregatedDataCall.kt | 3 +- .../AggregatedDataCallBundleFactory.kt | 3 +- .../internal/AggregatedDataPackageDIModule.kt | 5 +- .../data/internal/AggregatedDataSyncStore.kt | 31 +-- .../internal/AggregatedDataSyncStoreImpl.kt | 64 ++++++ .../internal/EnrollmentEntityDIModule.java | 95 --------- .../internal/EnrollmentEntityDIModule.kt | 120 +++++++++++ .../enrollment/internal/EnrollmentHandler.kt | 5 +- .../EnrollmentPersistenceCallFactory.kt | 3 +- .../internal/EnrollmentServiceImpl.kt | 7 +- .../internal/EnrollmentStoreImpl.kt | 30 +-- .../core/event/EventCollectionRepository.java | 11 +- .../EventFilterCollectionRepository.java | 4 +- .../internal/EventDataFilterEntityDIModule.kt | 13 +- .../event/internal/EventDataFilterHandler.kt | 36 ++++ .../event/internal/EventDataFilterStore.kt | 49 +---- .../internal/EventDataFilterStoreImpl.kt | 81 +++++++ .../event/internal/EventEntityDIModule.java | 87 -------- .../event/internal/EventEntityDIModule.kt | 103 +++++++++ .../core/event/internal/EventFilterCall.java | 2 +- .../internal/EventFilterEntityDIModule.java | 69 ------ .../internal/EventFilterEntityDIModule.kt | 64 ++++++ ...FilterEventDataFilterChildrenAppender.java | 2 +- .../core/event/internal/EventFilterHandler.kt | 11 +- .../core/event/internal/EventFilterStore.kt | 39 +--- .../event/internal/EventFilterStoreImpl.kt | 72 +++++++ .../core/event/internal/EventHandler.kt | 4 +- .../event/internal/EventLastUpdatedManager.kt | 3 +- .../internal/EventPersistenceCallFactory.kt | 8 +- .../event/internal/EventQueryBundleFactory.kt | 4 +- .../core/event/internal/EventStoreImpl.kt | 29 +-- .../event/internal/EventSyncEntityDIModule.kt | 42 ++++ .../internal/EventSyncStore.kt} | 9 +- .../core/event/internal/EventSyncStoreImpl.kt | 65 ++++++ ...sionDimensionItemCollectionRepository.java | 4 +- .../internal/ExpressionDimensionItemCall.kt | 3 +- .../ExpressionDimensionItemEntityDIModule.kt | 10 +- .../ExpressionDimensionItemHandler.kt | 8 +- .../internal/ExpressionDimensionItemStore.kt | 27 +-- .../ExpressionDimensionItemStoreImpl.kt} | 56 ++--- .../FileResourceCollectionRepository.java | 7 +- .../core/fileresource/FileResourceRoutine.kt | 4 +- .../internal/FileResourceDownloadCall.kt | 17 +- .../FileResourceDownloadCallHelper.kt | 13 +- .../internal/FileResourceEntityDIModule.kt | 12 +- .../internal/FileResourceHandler.kt | 36 ++++ .../internal/FileResourceHelper.kt | 11 +- .../internal/FileResourcePostCall.kt | 6 +- .../internal/FileResourceStore.kt | 34 +++ .../internal/FileResourceStoreImpl.kt | 29 +-- ...=> TrackerImportConflictEntityDIModule.kt} | 32 ++- .../internal/TrackerImportConflictParser.kt | 29 ++- .../TrackerImportConflictStoreImpl.java | 107 ---------- .../TrackerImportConflictStoreImpl.kt | 104 +++++++++ .../IndicatorCollectionRepository.java | 7 +- .../IndicatorTypeCollectionRepository.java | 5 +- .../DataSetIndicatorEngineImpl.kt | 5 +- .../DataSetIndicatorEntityDIModule.java | 56 ----- .../DataSetIndicatorEntityDIModule.kt} | 22 +- .../internal/DataSetIndicatorLinkHandler.kt | 40 ++++ .../internal/DataSetIndicatorLinkStore.kt | 34 +++ ....java => DataSetIndicatorLinkStoreImpl.kt} | 45 ++-- .../IndicatorEndpointCallFactory.java | 9 +- .../internal/IndicatorEntityDIModule.kt | 52 +++++ .../indicator/internal/IndicatorHandler.kt | 10 +- .../core/indicator/internal/IndicatorStore.kt | 34 +++ .../indicator/internal/IndicatorStoreImpl.kt | 64 ++++++ .../IndicatorTypeEndpointCallFactory.java | 9 +- .../internal/IndicatorTypeEntityDIModule.kt | 50 +++++ .../internal/IndicatorTypeHandler.kt | 39 ++++ .../indicator/internal/IndicatorTypeStore.kt | 34 +++ ...peStore.java => IndicatorTypeStoreImpl.kt} | 54 +++-- .../legendset/LegendCollectionRepository.java | 4 +- .../LegendSetCollectionRepository.java | 4 +- .../DataElementLegendSetLinkHandler.kt | 37 ++++ .../internal/DataElementLegendSetLinkStore.kt | 34 +++ ...a => DataElementLegendSetLinkStoreImpl.kt} | 47 ++-- .../IndicatorLegendSetEntityDIModule.kt | 15 +- .../internal/IndicatorLegendSetLinkHandler.kt | 37 ++++ .../internal/IndicatorLegendSetLinkStore.kt | 27 +-- .../IndicatorLegendSetLinkStoreImpl.kt | 57 +++++ .../internal/LegendChildrenAppender.java | 2 +- .../internal/LegendEntityDIModule.kt} | 38 ++-- .../core/legendset/internal/LegendHandler.kt | 36 ++++ .../core/legendset/internal/LegendSetCall.kt | 4 +- .../internal/LegendSetEntityDIModule.java | 75 ------- .../internal/LegendSetEntityDIModule.kt} | 66 +++--- .../internal/LegendSetHandler.kt} | 57 +++-- .../core/legendset/internal/LegendSetStore.kt | 34 +++ .../internal/LegendSetStoreImpl.kt} | 53 +++-- .../core/legendset/internal/LegendStore.kt | 34 +++ .../{LegendStore.java => LegendStoreImpl.kt} | 65 +++--- .../ProgramIndicatorLegendSetLinkHandler.kt | 37 ++++ .../ProgramIndicatorLegendSetLinkStore.kt | 34 +++ ...ProgramIndicatorLegendSetLinkStoreImpl.kt} | 47 ++-- .../D2ErrorCollectionRepository.java | 4 +- ...reignKeyViolationCollectionRepository.java | 4 +- .../maintenance/PerformanceHintsService.java | 12 +- .../internal/D2ErrorEntityDIModule.kt | 50 +++++ .../core/maintenance/internal/D2ErrorStore.kt | 34 +++ .../internal/D2ErrorStoreImpl.kt} | 49 +++-- .../internal/ForeignKeyCleanerImpl.java | 7 +- ...a => ForeignKeyViolationEntityDIModule.kt} | 33 ++- .../internal/ForeignKeyViolationStore.kt | 34 +++ ...e.java => ForeignKeyViolationStoreImpl.kt} | 57 ++--- .../internal/MaintenancePackageDIModule.java | 4 +- .../map/layer/MapLayerCollectionRepository.kt | 4 +- .../layer/internal/MapLayerEntityDIModule.kt | 17 +- .../map/layer/internal/MapLayerHandler.kt | 12 +- .../MapLayerImagerProviderChildrenAppender.kt | 4 +- .../MapLayerImageryProviderEntityDIModule.kt | 14 +- .../MapLayerImageryProviderHandler.kt | 36 ++++ .../internal/MapLayerImageryProviderStore.kt | 25 +-- .../MapLayerImageryProviderStoreImpl.kt | 57 +++++ .../core/map/layer/internal/MapLayerStore.kt | 30 +-- .../map/layer/internal/MapLayerStoreImpl.kt | 63 ++++++ .../layer/internal/bing/BingCallFactory.kt | 4 +- .../map/layer/internal/osm/OSMCallFactory.kt | 4 +- .../core/note/NoteCollectionRepository.java | 4 +- .../internal/NoteEntityDIModule.kt} | 42 ++-- .../NoteForEnrollmentChildrenAppender.java | 2 +- .../NoteForEventChildrenAppender.java | 2 +- .../android/core/note/internal/NoteHandler.kt | 36 ++++ .../android/core/note/internal/NoteStore.kt | 34 +++ .../{NoteStore.java => NoteStoreImpl.kt} | 71 ++++--- .../note/internal/NoteUniquenessManager.java | 5 +- .../option/OptionCollectionRepository.java | 4 +- .../OptionGroupCollectionRepository.java | 4 +- .../option/OptionSetCollectionRepository.java | 4 +- .../core/option/internal/OptionCall.kt | 3 +- ...yDIModule.java => OptionEntityDIModule.kt} | 67 +++--- .../core/option/internal/OptionGroupCall.java | 5 +- ...dule.java => OptionGroupEntityDIModule.kt} | 59 ++--- .../option/internal/OptionGroupHandler.java | 71 ------- .../internal/OptionGroupHandler.kt} | 52 +++-- .../OptionGroupOptionEntityDIModule.java | 56 ----- .../OptionGroupOptionEntityDIModule.kt | 48 +++++ .../internal/OptionGroupOptionLinkHandler.kt | 37 ++++ .../internal/OptionGroupOptionLinkStore.kt | 34 +++ ...java => OptionGroupOptionLinkStoreImpl.kt} | 44 ++-- .../core/option/internal/OptionGroupStore.kt | 34 +++ .../option/internal/OptionGroupStoreImpl.kt | 58 +++++ .../core/option/internal/OptionHandler.kt | 42 ++++ .../core/option/internal/OptionSetCall.kt | 3 +- .../internal/OptionSetEntityDIModule.kt} | 53 ++--- .../core/option/internal/OptionSetHandler.kt | 36 ++++ .../core/option/internal/OptionSetStore.kt | 34 +++ .../option/internal/OptionSetStoreImpl.kt | 59 +++++ .../core/option/internal/OptionStore.kt | 34 +++ .../core/option/internal/OptionStoreImpl.kt | 60 ++++++ .../OrganisationUnitCollectionRepository.java | 4 +- ...nisationUnitGroupCollectionRepository.java | 4 +- ...nisationUnitLevelCollectionRepository.java | 4 +- .../internal/OrganisationUnitCall.kt | 3 +- .../OrganisationUnitEntityDIModule.kt | 29 ++- .../OrganisationUnitGroupEntityDIModule.kt} | 50 ++--- .../internal/OrganisationUnitGroupHandler.kt | 36 ++++ .../internal/OrganisationUnitGroupStore.kt | 28 +-- .../OrganisationUnitGroupStoreImpl.kt | 60 ++++++ .../internal/OrganisationUnitHandler.kt | 124 ++++++++++- .../internal/OrganisationUnitHandlerImpl.kt | 159 -------------- .../OrganisationUnitLevelEndpointCall.java | 5 +- .../OrganisationUnitLevelEntityDIModule.java | 82 ------- .../OrganisationUnitLevelEntityDIModule.kt} | 51 +++-- .../internal/OrganisationUnitLevelHandler.kt | 36 ++++ .../internal/OrganisationUnitLevelStore.kt | 30 +-- .../OrganisationUnitLevelStoreImpl.kt} | 62 +++--- ...OrganisationUnitGroupLinkEntityDIModule.kt | 17 +- ...ionUnitOrganisationUnitGroupLinkHandler.kt | 37 ++++ ...ationUnitOrganisationUnitGroupLinkStore.kt | 26 +-- ...nUnitOrganisationUnitGroupLinkStoreImpl.kt | 56 +++++ ...ganisationUnitProgramLinkEntityDIModule.kt | 14 +- .../OrganisationUnitProgramLinkHandler.kt | 37 ++++ .../OrganisationUnitProgramLinkStore.kt | 34 +++ ...> OrganisationUnitProgramLinkStoreImpl.kt} | 46 ++-- .../internal/OrganisationUnitStore.kt | 33 +-- .../internal/OrganisationUnitStoreImpl.kt | 66 ++++++ .../internal/service/ExpressionService.kt | 13 +- .../core/period/internal/CalendarProvider.kt | 2 +- .../period/internal/ParentPeriodGenerator.kt | 2 +- .../period/internal/PeriodEntityDIModule.kt | 50 +++++ ...DIModule.java => PeriodPackageDIModule.kt} | 32 ++- .../core/period/internal/PeriodStore.kt | 39 ++++ .../core/period/internal/PeriodStoreImpl.java | 102 --------- .../core/period/internal/PeriodStoreImpl.kt | 95 +++++++++ .../program/ProgramCollectionRepository.java | 4 +- .../ProgramIndicatorCollectionRepository.java | 4 +- ...ProgramRuleActionCollectionRepository.java | 4 +- .../ProgramRuleCollectionRepository.java | 4 +- ...ogramRuleVariableCollectionRepository.java | 4 +- .../ProgramSectionCollectionRepository.java | 4 +- .../ProgramStageCollectionRepository.java | 4 +- ...mStageDataElementCollectionRepository.java | 4 +- ...gramStageSectionsCollectionRepository.java | 4 +- ...edEntityAttributeCollectionRepository.java | 4 +- .../AnalyticsPeriodBoundaryEntityDIModule.kt | 48 +++++ .../AnalyticsPeriodBoundaryHandler.kt | 36 ++++ .../internal/AnalyticsPeriodBoundaryStore.kt | 29 +-- .../AnalyticsPeriodBoundaryStoreImpl.kt | 59 +++++ ...entValueTypeRenderingChildrenAppender.java | 5 +- .../ProgramAttributeValueEntityDIModule.java | 58 ----- .../ProgramAttributeValueEntityDIModule.kt} | 32 ++- .../core/program/internal/ProgramCall.java | 2 +- .../internal/ProgramEntityDIModule.java | 97 --------- .../internal/ProgramEntityDIModule.kt} | 70 +++--- .../core/program/internal/ProgramHandler.java | 134 ------------ .../core/program/internal/ProgramHandler.kt | 99 +++++++++ ...AnalyticsPeriodBoundaryChildrenAppender.kt | 2 +- .../program/internal/ProgramIndicatorCall.kt | 5 +- .../ProgramIndicatorEntityDIModule.kt | 13 +- .../internal/ProgramIndicatorHandler.kt | 12 +- ...ogramIndicatorLegendSetEntityDIModule.java | 58 ----- ...rogramIndicatorLegendSetEntityDIModule.kt} | 32 ++- .../program/internal/ProgramIndicatorStore.kt | 41 +--- .../internal/ProgramIndicatorStoreImpl.kt} | 68 +++--- .../internal/ProgramModuleDownloader.kt | 5 +- .../ProgramRuleActionChildrenAppender.java | 2 +- .../ProgramRuleActionEntityDIModule.java | 65 ------ .../ProgramRuleActionEntityDIModule.kt | 56 +++++ .../internal/ProgramRuleActionHandler.kt | 36 ++++ .../internal/ProgramRuleActionStore.kt | 34 +++ ...ore.java => ProgramRuleActionStoreImpl.kt} | 87 ++++---- .../program/internal/ProgramRuleCall.java | 5 +- ...dule.java => ProgramRuleEntityDIModule.kt} | 80 ++++--- .../program/internal/ProgramRuleHandler.java | 76 ------- .../internal/ProgramRuleHandler.kt} | 64 +++--- .../core/program/internal/ProgramRuleStore.kt | 34 +++ ...RuleStore.java => ProgramRuleStoreImpl.kt} | 69 +++--- .../ProgramRuleVariableEntityDIModule.java | 65 ------ .../ProgramRuleVariableEntityDIModule.kt | 56 +++++ .../internal/ProgramRuleVariableHandler.kt | 36 ++++ .../internal/ProgramRuleVariableStore.kt | 34 +++ ...e.java => ProgramRuleVariableStoreImpl.kt} | 76 +++---- .../ProgramSectionAttributeEntityDIModule.kt | 48 +++++ .../ProgramSectionAttributeLinkHandler.kt | 37 ++++ .../ProgramSectionAttributeLinkStore.kt | 34 +++ ...> ProgramSectionAttributeLinkStoreImpl.kt} | 49 ++--- .../ProgramSectionEntityDIModule.java | 68 ------ .../internal/ProgramSectionEntityDIModule.kt | 52 +++++ .../internal/ProgramSectionHandler.java | 65 ------ ...DIModule.java => ProgramSectionHandler.kt} | 50 +++-- .../program/internal/ProgramSectionStore.kt | 40 +--- .../internal/ProgramSectionStoreImpl.kt | 70 ++++++ ...gramStageAttributeValueEntityDIModule.java | 58 ----- ...rogramStageAttributeValueEntityDIModule.kt | 51 +++++ .../program/internal/ProgramStageCall.java | 5 +- ...ProgramStageDataElementEntityDIModule.java | 69 ------ .../ProgramStageDataElementEntityDIModule.kt | 54 +++++ .../ProgramStageDataElementHandler.kt | 55 +++++ .../internal/ProgramStageDataElementStore.kt | 34 +++ ...va => ProgramStageDataElementStoreImpl.kt} | 76 +++---- ...ule.java => ProgramStageEntityDIModule.kt} | 94 ++++---- .../program/internal/ProgramStageHandler.java | 119 ----------- .../program/internal/ProgramStageHandler.kt | 100 +++++++++ ...StageSectionDataElementEntityDIModule.java | 57 ----- ...amStageSectionDataElementEntityDIModule.kt | 48 +++++ ...ogramStageSectionDataElementLinkHandler.kt | 37 ++++ ...ProgramStageSectionDataElementLinkStore.kt | 34 +++ ...amStageSectionDataElementLinkStoreImpl.kt} | 49 ++--- .../ProgramStageSectionEntityDIModule.java | 70 ------ .../ProgramStageSectionEntityDIModule.kt | 55 +++++ .../internal/ProgramStageSectionHandler.java | 81 ------- ...ler.java => ProgramStageSectionHandler.kt} | 73 +++---- ...SectionProgramIndicatorEntityDIModule.java | 57 ----- ...geSectionProgramIndicatorEntityDIModule.kt | 50 +++++ ...StageSectionProgramIndicatorLinkHandler.kt | 37 ++++ ...amStageSectionProgramIndicatorLinkStore.kt | 34 +++ ...geSectionProgramIndicatorLinkStoreImpl.kt} | 48 ++--- .../internal/ProgramStageSectionStore.kt | 32 +-- .../internal/ProgramStageSectionStoreImpl.kt | 63 ++++++ .../program/internal/ProgramStageStore.java | 88 -------- .../program/internal/ProgramStageStore.kt | 34 +++ .../program/internal/ProgramStageStoreImpl.kt | 87 ++++++++ .../core/program/internal/ProgramStore.java | 100 --------- ...ramStoreInterface.java => ProgramStore.kt} | 18 +- .../core/program/internal/ProgramStoreImpl.kt | 91 ++++++++ ...mTrackedEntityAttributeEntityDIModule.java | 69 ------ ...ramTrackedEntityAttributeEntityDIModule.kt | 54 +++++ .../ProgramTrackedEntityAttributeHandler.kt} | 34 ++- .../ProgramTrackedEntityAttributeStore.kt | 34 +++ ...ProgramTrackedEntityAttributeStoreImpl.kt} | 83 ++++---- ...uteValueTypeRenderingChildrenAppender.java | 5 +- ...gramTrackedEntityTypeChildrenAppender.java | 6 +- .../internal/ProgramIndicatorEngineImpl.kt | 20 +- .../internal/ProgramIndicatorSQLExecutor.kt | 19 +- ...mStageWorkingListCollectionRepository.java | 4 +- ...istAttributeValueFilterChildrenAppender.kt | 2 +- ...gListAttributeValueFilterEntityDIModule.kt | 14 +- ...eWorkingListAttributeValueFilterHandler.kt | 36 ++++ ...ageWorkingListAttributeValueFilterStore.kt | 50 +---- ...orkingListAttributeValueFilterStoreImpl.kt | 80 +++++++ .../internal/ProgramStageWorkingListCall.kt | 3 +- ...geWorkingListDataFilterChildrenAppender.kt | 2 +- .../ProgramStageWorkingListEntityDIModule.kt | 12 +- ...orkingListEventDataFilterEntityDIModule.kt | 14 +- ...mStageWorkingListEventDataFilterHandler.kt | 36 ++++ ...ramStageWorkingListEventDataFilterStore.kt | 50 +---- ...tageWorkingListEventDataFilterStoreImpl.kt | 81 +++++++ .../ProgramStageWorkingListHandler.kt | 10 +- .../internal/ProgramStageWorkingListStore.kt | 49 +---- .../ProgramStageWorkingListStoreImpl.kt | 86 ++++++++ .../RelationshipTypeCollectionRepository.kt | 8 +- ...elationshipConstraintChildrenAppender.java | 5 +- .../RelationshipConstraintEntityDIModule.java | 55 ----- .../RelationshipConstraintEntityDIModule.kt} | 27 +-- .../internal/RelationshipConstraintHandler.kt | 36 ++++ .../internal/RelationshipConstraintStore.kt} | 10 +- ...ava => RelationshipConstraintStoreImpl.kt} | 75 +++---- .../RelationshipDHISVersionManager.java | 5 +- .../internal/RelationshipEntityDIModule.kt | 55 +++++ .../internal/RelationshipHandler.kt | 61 +++++- .../internal/RelationshipHandlerImpl.kt | 90 -------- ...> RelationshipItemElementStoreSelector.kt} | 10 +- ...ationshipItemElementStoreSelectorImpl.java | 80 ------- ...lationshipItemElementStoreSelectorImpl.kt} | 51 ++--- .../RelationshipItemEntityDIModule.kt} | 48 ++--- .../internal/RelationshipItemHandler.kt | 36 ++++ .../internal/RelationshipItemStoreImpl.kt | 35 +-- .../internal/RelationshipStoreImpl.kt | 33 ++- .../internal/RelationshipTypeCall.java | 5 +- .../RelationshipTypeEntityDIModule.kt | 26 ++- .../internal/RelationshipTypeHandler.java | 70 ------ .../internal/RelationshipTypeHandler.kt} | 68 +++--- .../internal/RelationshipTypeStore.kt | 34 +++ ...tore.java => RelationshipTypeStoreImpl.kt} | 65 +++--- ...IModule.java => ResourceEntityDIModule.kt} | 21 +- ...esourceHandler.java => ResourceHandler.kt} | 62 +++--- .../internal/ResourcePackageDIModule.kt | 33 +++ .../core/resource/internal/ResourceStore.kt | 35 +++ .../resource/internal/ResourceStoreImpl.java | 83 -------- .../internal/ResourceStoreImpl.kt} | 81 +++---- ...VisualizationsSettingObjectRepository.java | 6 +- ...alyticsTeiSettingCollectionRepository.java | 8 +- .../AppearanceSettingsObjectRepository.java | 12 +- .../DataSetSettingsObjectRepository.java | 6 +- .../GeneralSettingObjectRepository.java | 11 +- .../LatestAppVersionObjectRepository.kt | 4 +- .../ProgramSettingsObjectRepository.java | 6 +- ...ynchronizationSettingObjectRepository.java | 6 +- .../SystemSettingCollectionRepository.java | 4 +- .../UserSettingsObjectRepository.java | 6 +- ...nalyticsDhisVisualizationSettingHandler.kt | 3 +- .../AnalyticsDhisVisualizationStore.kt | 33 +-- .../AnalyticsDhisVisualizationStoreImpl.kt | 70 ++++++ .../settings/internal/AnalyticsSettingCall.kt | 6 +- .../AnalyticsSettingEntityDIModule.kt | 83 ++------ .../internal/AnalyticsTeiAttributeHandler.kt | 39 ++++ .../internal/AnalyticsTeiAttributeStore.kt | 24 +-- .../AnalyticsTeiAttributeStoreImpl.kt} | 36 ++-- .../AnalyticsTeiDataChildrenAppender.kt | 15 +- .../AnalyticsTeiDataElementHandler.kt | 39 ++++ .../internal/AnalyticsTeiDataElementStore.kt | 25 +-- .../AnalyticsTeiDataElementStoreImpl.kt | 58 +++++ .../internal/AnalyticsTeiIndicatorHandler.kt | 39 ++++ .../internal/AnalyticsTeiIndicatorStore.kt | 25 +-- .../AnalyticsTeiIndicatorStoreImpl.kt | 58 +++++ .../internal/AnalyticsTeiSettingHandler.kt | 14 +- .../internal/AnalyticsTeiSettingStore.kt | 37 +--- .../internal/AnalyticsTeiSettingStoreImpl.kt | 69 ++++++ .../AnalyticsTeiWHONutritionDataHandler.kt | 14 +- .../AnalyticsTeiWHONutritionDataStore.kt | 26 +-- .../AnalyticsTeiWHONutritionDataStoreImpl.kt | 59 +++++ .../internal/AppearanceSettingCall.kt | 7 +- .../settings/internal/DataSetSettingCall.kt | 4 +- .../DataSetSettingEntityDIModule.java | 54 ----- .../internal/DataSetSettingEntityDIModule.kt | 42 ++++ .../internal/DataSetSettingHandler.kt | 9 +- .../settings/internal/DataSetSettingStore.kt | 34 +++ ...gStore.java => DataSetSettingStoreImpl.kt} | 63 +++--- .../internal/FilterSettingEntityDIModule.kt | 13 +- .../settings/internal/FilterSettingHandler.kt | 9 +- .../settings/internal/FilterSettingStore.kt | 34 +-- .../internal/FilterSettingStoreImpl.kt | 68 ++++++ .../settings/internal/GeneralSettingCall.kt | 3 +- .../internal/GeneralSettingEntityDIModule.kt | 13 +- .../internal/GeneralSettingHandler.kt | 6 +- .../settings/internal/GeneralSettingStore.kt | 38 +--- .../internal/GeneralSettingStoreImpl.kt | 73 +++++++ .../settings/internal/LatestAppVersionCall.kt | 3 +- .../internal/LatestAppVersionDIModule.kt | 13 +- .../internal/LatestAppVersionHandler.kt | 6 +- .../internal/LatestAppVersionStore.kt | 31 +-- .../internal/LatestAppVersionStoreImpl.kt | 66 ++++++ ...ogramConfigurationSettingEntityDIModule.kt | 13 +- .../ProgramConfigurationSettingHandler.kt | 9 +- .../ProgramConfigurationSettingStore.kt | 35 +-- .../ProgramConfigurationSettingStoreImpl.kt | 69 ++++++ .../settings/internal/ProgramSettingCall.kt | 4 +- .../ProgramSettingEntityDIModule.java | 54 ----- .../internal/ProgramSettingEntityDIModule.kt | 42 ++++ .../internal/ProgramSettingHandler.kt | 6 +- .../settings/internal/ProgramSettingStore.kt | 34 +++ ...gStore.java => ProgramSettingStoreImpl.kt} | 89 ++++---- .../internal/SynchronizationSettingCall.kt | 3 +- .../SynchronizationSettingEntityDIModule.kt | 19 +- .../internal/SynchronizationSettingHandler.kt | 15 +- .../internal/SynchronizationSettingStore.kt | 34 +-- .../SynchronizationSettingStoreImpl.kt | 69 ++++++ .../settings/internal/SystemSettingCall.kt | 3 +- .../internal/SystemSettingEntityDIModule.java | 67 ------ .../internal/SystemSettingEntityDIModule.kt | 50 +++++ .../settings/internal/SystemSettingHandler.kt | 39 ++++ .../settings/internal/SystemSettingStore.kt | 34 +++ ...ngStore.java => SystemSettingStoreImpl.kt} | 63 +++--- .../settings/internal/UserSettingsCall.kt | 3 +- .../internal/UserSettingsEntityDIModule.java | 66 ------ .../internal/UserSettingsEntityDIModule.kt | 50 +++++ .../settings/internal/UserSettingsHandler.kt | 9 +- .../settings/internal/UserSettingsStore.kt | 34 +++ ...ngsStore.java => UserSettingsStoreImpl.kt} | 59 ++--- .../internal/MetadataIdsStore.kt | 3 +- .../internal/OngoingSubmissionsStore.kt | 3 +- .../internal/SMSConfigStoreImpl.kt | 42 +--- .../internal/SMSMetadataIdStore.kt | 37 +--- .../internal/SMSMetadataIdStoreImpl.kt | 66 ++++++ .../internal/SMSOngoingSubmissionStore.kt | 36 +--- .../internal/SMSOngoingSubmissionStoreImpl.kt | 65 ++++++ .../{SmsDIModule.java => SmsDIModule.kt} | 91 ++++---- .../core/systeminfo/SystemInfoModule.kt | 4 +- .../SystemInfoObjectRepository.java | 4 +- .../internal/DHISVersionManagerImpl.kt | 8 +- .../systeminfo/internal/SystemInfoCall.kt | 3 +- .../internal/SystemInfoEntityDIModule.java | 76 ------- .../internal/SystemInfoEntityDIModule.kt | 50 +++++ .../systeminfo/internal/SystemInfoHandler.kt | 39 ++++ .../internal/SystemInfoModuleDownloader.kt | 4 +- .../internal/SystemInfoModuleImpl.kt | 7 +- .../systeminfo/internal/SystemInfoStore.kt | 34 +++ ...mInfoStore.java => SystemInfoStoreImpl.kt} | 64 +++--- ...edEntityAttributeCollectionRepository.java | 4 +- ...edEntityAttributeReservedValueManager.java | 72 +++---- ...ityInstanceFilterCollectionRepository.java | 4 +- ...tityTypeAttributeCollectionRepository.java | 4 +- ...TrackedEntityTypeCollectionRepository.java | 4 +- .../AttributeValueFilterEntityDIModule.kt | 15 +- .../internal/AttributeValueFilterHandler.kt | 39 ++++ .../internal/AttributeValueFilterStore.kt | 49 +---- .../internal/AttributeValueFilterStoreImpl.kt | 81 +++++++ ...porterTrackedEntityPostPayloadGenerator.kt | 9 +- ...erImporterTrackedEntityPostStateManager.kt | 5 +- .../OldTrackerImporterPayloadGenerator.kt | 19 +- .../internal/ReservedValueSettingDIModule.kt | 42 ++++ .../internal/ReservedValueSettingStore.kt | 19 +- .../ReservedValueSettingStoreImpl.kt} | 45 ++-- .../internal/TrackedEntityAttributeCall.java | 5 +- .../TrackedEntityAttributeEntityDIModule.java | 55 ----- .../TrackedEntityAttributeEntityDIModule.kt | 42 ++++ ....java => TrackedEntityAttributeHandler.kt} | 75 +++---- ...TrackedEntityAttributeLegendSetDIModule.kt | 25 +-- ...ckedEntityAttributeLegendSetLinkHandler.kt | 40 ++++ ...rackedEntityAttributeLegendSetLinkStore.kt | 34 +++ ...edEntityAttributeLegendSetLinkStoreImpl.kt | 58 +++++ ...ibuteReservedValueEndpointCallFactory.java | 5 +- ...yAttributeReservedValueEntityDIModule.java | 62 ------ ...ityAttributeReservedValueEntityDIModule.kt | 49 +++++ ...ckedEntityAttributeReservedValueHandler.kt | 39 ++++ ...ckedEntityAttributeReservedValueStore.java | 137 ------------ ...ackedEntityAttributeReservedValueStore.kt} | 33 ++- ...edEntityAttributeReservedValueStoreImpl.kt | 122 +++++++++++ ...yAttributeReservedValueStoreInterface.java | 49 ----- .../internal/TrackedEntityAttributeStore.kt | 34 +++ ...ava => TrackedEntityAttributeStoreImpl.kt} | 91 ++++---- ...dEntityAttributeValueChildrenAppender.java | 2 +- ...ackedEntityAttributeValueEntityDIModule.kt | 50 +++++ .../TrackedEntityAttributeValueHandler.kt | 11 +- .../TrackedEntityAttributeValueStoreImpl.kt | 41 ++-- ...rackedEntityDataValueChildrenAppender.java | 2 +- .../TrackedEntityDataValueEntityDIModule.kt | 50 +++++ .../TrackedEntityDataValueHandler.java | 74 ------- .../TrackedEntityDataValueHandler.kt} | 48 ++--- ...re.java => TrackedEntityDataValueStore.kt} | 41 ++-- .../TrackedEntityDataValueStoreImpl.java | 201 ------------------ .../TrackedEntityDataValueStoreImpl.kt | 164 ++++++++++++++ .../TrackedEntityInstanceEntityDIModule.kt | 9 +- ...tityInstanceEventFilterEntityDIModule.java | 56 ----- ...EntityInstanceEventFilterEntityDIModule.kt | 42 ++++ ...TrackedEntityInstanceEventFilterHandler.kt | 39 ++++ .../TrackedEntityInstanceEventFilterStore.kt | 38 +--- ...ackedEntityInstanceEventFilterStoreImpl.kt | 68 ++++++ ...terAttributeValueFilterChildrenAppender.kt | 2 +- .../TrackedEntityInstanceFilterCall.kt | 3 +- ...ackedEntityInstanceFilterEntityDIModule.kt | 16 +- ...nstanceFilterEvenFilterChildrenAppender.kt | 2 +- .../TrackedEntityInstanceFilterHandler.kt | 8 +- .../TrackedEntityInstanceFilterStore.kt | 43 +--- .../TrackedEntityInstanceFilterStoreImpl.kt | 76 +++++++ .../internal/TrackedEntityInstanceHandler.kt | 14 +- ...TrackedEntityInstanceLastUpdatedManager.kt | 3 +- ...ore.java => TrackedEntityInstanceStore.kt} | 34 ++- .../TrackedEntityInstanceStoreImpl.java | 130 ----------- .../TrackedEntityInstanceStoreImpl.kt | 108 ++++++++++ ...TrackedEntityInstanceSyncEntityDIModule.kt | 42 ++++ .../TrackedEntityInstanceSyncStore.java | 63 ------ .../TrackedEntityInstanceSyncStore.kt | 33 +++ .../TrackedEntityInstanceSyncStoreImpl.kt | 65 ++++++ .../TrackedEntityInstanceUidHelperImpl.kt | 5 +- ...edEntityTypeAttributeChildrenAppender.java | 2 +- ...rackedEntityTypeAttributeEntityDIModule.kt | 50 +++++ .../TrackedEntityTypeAttributeHandler.kt | 39 ++++ .../TrackedEntityTypeAttributeStore.kt | 34 +++ ...=> TrackedEntityTypeAttributeStoreImpl.kt} | 72 +++---- .../internal/TrackedEntityTypeCall.java | 5 +- .../TrackedEntityTypeEntityDIModule.java | 80 ------- ...ava => TrackedEntityTypeEntityDIModule.kt} | 48 ++--- .../internal/TrackedEntityTypeHandler.java | 72 ------- .../internal/TrackedEntityTypeHandler.kt} | 52 ++--- .../internal/TrackedEntityTypeStore.kt | 34 +++ ...ore.java => TrackedEntityTypeStoreImpl.kt} | 58 ++--- .../internal/TrackerPostStateManager.kt | 5 +- .../internal/TrackerQueryBundleFactory.kt | 4 +- .../internal/TrackerQueryFactory.kt | 4 +- .../TrackerQueryFactoryCommonHelper.kt | 5 +- .../ownership/OwnershipEntityDIModule.kt | 16 +- .../ownership/OwnershipManagerImpl.kt | 5 +- .../ownership/ProgramOwnerHandler.kt | 12 +- .../ownership/ProgramOwnerPostCall.kt | 3 +- .../ownership/ProgramOwnerStore.kt | 36 +--- .../ownership/ProgramOwnerStoreImpl.kt} | 65 +++--- .../ownership/ProgramTempOwnerStore.kt | 40 +--- .../ownership/ProgramTempOwnerStoreImpl.kt | 72 +++++++ .../tracker/TrackerPostParentCallHelper.kt | 5 +- .../tracker/importer/internal/JobQueryCall.kt | 3 +- .../internal/JobReportEnrollmentHandler.kt | 5 +- .../internal/JobReportEventHandler.kt | 5 +- .../TrackerImporterBreakTheGlassHelper.kt | 4 +- .../TrackerImporterPackageDIModule.kt | 14 +- .../internal/TrackerImporterPostCall.kt | 5 +- .../TrackerImporterProgramOwnerPostCall.kt | 4 +- .../internal/TrackerJobObjectHandler.kt | 38 ++++ .../internal/TrackerJobObjectStore.kt | 40 +--- .../internal/TrackerJobObjectStoreImpl.kt | 69 ++++++ .../interpreters/InterpreterHelper.kt | 21 +- .../stock/StockUseCaseCollectionRepository.kt | 4 +- .../stock/internal/StockUseCaseCall.kt | 3 +- .../internal/StockUseCaseEntityDIModule.kt | 20 +- .../stock/internal/StockUseCaseHandler.kt | 9 +- .../stock/internal/StockUseCaseStore.kt | 26 +-- .../stock/internal/StockUseCaseStoreImpl.kt | 59 +++++ ...StockUseCaseTransactionChildrenAppender.kt | 4 +- .../StockUseCaseTransactionEntityDIModule.kt | 15 +- .../StockUseCaseTransactionLinkHandler.kt | 39 ++++ .../StockUseCaseTransactionLinkStore.kt | 35 +-- .../StockUseCaseTransactionLinkStoreImpl.kt | 68 ++++++ .../AuthenticatedUserObjectRepository.java | 4 +- .../user/AuthorityCollectionRepository.java | 4 +- .../user/UserCredentialsObjectRepository.kt | 4 +- .../core/user/UserObjectRepository.java | 4 +- .../user/UserRoleCollectionRepository.java | 4 +- .../core/user/internal/AccountManagerImpl.kt | 5 +- .../AuthenticatedUserEntityDIModule.java | 59 ----- .../AuthenticatedUserEntityDIModule.kt | 50 +++++ .../user/internal/AuthenticatedUserStore.kt | 34 +++ ...ore.java => AuthenticatedUserStoreImpl.kt} | 63 +++--- .../user/internal/AuthorityCallProcessor.java | 2 +- .../AuthorityEndpointCallFactory.java | 2 +- .../internal/AuthorityEntityDIModule.java | 68 ------ .../user/internal/AuthorityEntityDIModule.kt | 50 +++++ .../core/user/internal/AuthorityHandler.kt | 39 ++++ .../core/user/internal/AuthorityStore.kt | 34 +++ .../core/user/internal/AuthorityStoreImpl.kt | 58 +++++ .../android/core/user/internal/LogInCall.kt | 14 +- .../android/core/user/internal/UserCall.kt | 3 +- .../core/user/internal/UserEntityDIModule.kt | 16 +- .../android/core/user/internal/UserHandler.kt | 6 +- .../UserOrganisationUnitLinkEntityDIModule.kt | 13 +- .../UserOrganisationUnitLinkHandler.kt | 40 ++++ .../UserOrganisationUnitLinkStoreImpl.kt | 37 +--- .../user/internal/UserRoleChildrenAppender.kt | 4 +- .../user/internal/UserRoleEntityDIModule.java | 77 ------- .../internal/UserRoleEntityDIModule.kt} | 43 ++-- .../core/user/internal/UserRoleHandler.kt | 39 ++++ .../core/user/internal/UserRoleStore.kt | 34 +++ .../core/user/internal/UserRoleStoreImpl.kt | 55 +++++ .../android/core/user/internal/UserStore.java | 70 ------ .../android/core/user/internal/UserStore.kt | 34 +++ .../core/user/internal/UserStoreImpl.kt | 70 ++++++ .../ValidationRuleCollectionRepository.java | 8 +- .../engine/internal/ValidationEngineImpl.kt | 5 +- ...taSetValidationRuleLinkEntityDIModule.java | 56 ----- ...DataSetValidationRuleLinkEntityDIModule.kt | 42 ++++ .../DataSetValidationRuleLinkHandler.kt | 40 ++++ .../DataSetValidationRuleLinkStore.kt | 34 +++ ... => DataSetValidationRuleLinkStoreImpl.kt} | 44 ++-- ...dule.java => ValidationPackageDIModule.kt} | 53 +++-- .../internal/ValidationRuleCall.java | 7 +- .../internal/ValidationRuleEntityDIModule.kt} | 42 ++-- .../internal/ValidationRuleHandler.kt | 44 ++++ .../internal/ValidationRuleStore.kt | 34 +++ ...eStore.java => ValidationRuleStoreImpl.kt} | 77 ++++--- .../internal/ValidationRuleUidsCallImpl.java | 5 +- .../VisualizationCollectionRepository.java | 4 +- .../internal/VisualizationCall.kt | 3 +- ...isualizationDimensionItemEntityDIModule.kt | 15 +- .../VisualizationDimensionItemHandler.kt | 39 ++++ .../VisualizationDimensionItemStore.kt | 26 +-- .../VisualizationDimensionItemStoreImpl.kt | 57 +++++ .../internal/VisualizationEntityDIModule.kt | 15 +- .../internal/VisualizationHandler.kt | 6 +- .../internal/VisualizationModuleDownloader.kt | 5 +- .../internal/VisualizationStore.kt | 54 +---- .../internal/VisualizationStoreImpl.kt | 86 ++++++++ .../AnalyticsOrganisationUnitHelperShould.kt | 14 +- .../AnalyticsServiceMetadataHelperShould.kt | 40 ++-- ...ualizationsServiceDimensionHelperShould.kt | 12 +- .../internal/APICallExecutorShould.java | 4 +- .../CoroutineAPICallExecutorShould.kt | 4 +- .../internal/CategoryComboHandlerShould.kt | 19 +- .../internal/TrackerDataManagerShould.kt | 12 +- .../ValueTypeRenderingHandlerShould.java | 19 +- ...erDatabaseManagerForD2ManagerUnitShould.kt | 3 +- .../MultiUserDatabaseManagerUnitShould.kt | 3 +- .../internal/DataElementHandlerShould.java | 177 --------------- .../internal/DataElementHandlerShould.kt | 146 +++++++++++++ .../internal/DataSetHandlerShould.java | 34 +-- .../internal/SectionHandlerShould.java | 41 ++-- .../DataValueImportHandlerShould.java | 16 +- .../AggregatedDataCallBundleFactoryShould.kt | 3 +- .../enrollment/EnrollmentServiceShould.kt | 4 +- .../internal/EventFilterHandlerShould.java | 20 +- .../core/event/internal/EventHandlerShould.kt | 4 +- .../internal/EventQueryBundleFactoryShould.kt | 8 +- .../internal/LegendSetHandlerShould.java | 25 ++- .../layer/internal/MapLayerHandlerShould.kt | 7 +- .../option/internal/OptionHandlerShould.java | 11 +- .../OrganisationUnitCallUnitShould.kt | 5 +- .../internal/OrganisationUnitHandlerShould.kt | 23 +- .../expression/ExpressionServiceShould.kt | 11 +- .../internal/ProgramEndpointCallShould.java | 20 +- .../internal/ProgramHandlerShould.java | 37 ++-- .../ProgramIndicatorHandlerShould.java | 31 ++- .../internal/ProgramModuleDownloaderShould.kt | 5 +- .../internal/ProgramRuleHandlerShould.java | 26 ++- .../internal/ProgramSectionHandlerShould.java | 25 ++- .../ProgramStageDataElementHandlerShould.java | 28 ++- .../internal/ProgramStageHandlerShould.java | 36 ++-- .../ProgramStageSectionHandlerShould.java | 26 +-- ...amTrackedEntityAttributeHandlerShould.java | 19 +- .../ProgramStageWorkingListHandlerShould.kt | 9 +- .../RelationshipDHISVersionManagerShould.kt | 3 +- .../internal/RelationshipHandlerShould.kt | 7 +- .../internal/AnalyticsSettingCallShould.kt | 7 +- .../AnalyticsTeiSettingHandlerShould.kt | 12 +- ...alyticsTeiWHONutritionDataHandlerShould.kt | 9 +- .../internal/AppearanceSettingsCallShould.kt | 7 +- .../internal/DataSetSettingCallShould.kt | 4 +- .../internal/DataSetSettingHandlerShould.java | 15 +- .../internal/FilterSettingHandlerShould.kt | 3 +- .../internal/GeneralSettingCallShould.kt | 3 +- .../internal/GeneralSettingsHandlerShould.kt | 3 +- ...rogramConfigurationSettingHandlerShould.kt | 4 +- .../internal/ProgramSettingCallShould.kt | 4 +- .../internal/ProgramSettingHandlerShould.java | 15 +- .../SynchronizationSettingCallShould.kt | 3 +- .../SynchronizationSettingsHandlerShould.kt | 9 +- .../internal/DHISVersionManagerShould.kt | 9 +- .../internal/SystemInfoCallShould.kt | 3 +- .../TrackedEntityAttributeHandlerShould.java | 8 +- ...ckedEntityInstanceFilterHandlerShould.java | 9 +- .../TrackedEntityInstanceHandlerShould.kt | 15 +- ...TrackedEntityInstanceQueryFactoryShould.kt | 8 +- .../TrackedEntityInstanceUidHelperShould.java | 13 +- .../ownership/OwnershipManagerShould.kt | 5 +- .../TrackerPostParentCallHelperShould.kt | 7 +- .../usecase/stock/StockUseCaseCallShould.kt | 4 +- .../internal/AuthorityEndpointCallShould.kt | 3 +- .../core/user/internal/LogInCallUnitShould.kt | 13 +- .../core/user/internal/UserCallShould.kt | 3 +- .../core/user/internal/UserHandlerShould.kt | 6 +- .../internal/VisualizationHandlerShould.kt | 8 +- 1056 files changed, 17753 insertions(+), 13354 deletions(-) rename core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/{AttributeStoreIntegrationShould.java => AttributeStoreIntegrationShould.kt} (60%) rename core/src/main/java/org/hisp/dhis/android/core/{dataset/internal/DataSetInstanceEntityDIModule.java => attribute/internal/AttributeEntityDIModule.kt} (79%) rename core/src/main/java/org/hisp/dhis/android/core/{arch/di/internal/IdentifiableStoreProvider.java => attribute/internal/AttributeHandler.kt} (82%) rename core/src/main/java/org/hisp/dhis/android/core/{resource/internal/ResourcePackageDIModule.java => attribute/internal/AttributePackageDIModule.kt} (90%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/AttributeStore.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/AttributeStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/attribute/internal/{DataElementAttributeValueLinkStore.java => DataElementAttributeValueLinkStoreImpl.kt} (67%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/attribute/internal/{ProgramAttributeValueLinkStore.java => ProgramAttributeValueLinkStoreImpl.kt} (68%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/attribute/internal/{ProgramStageAttributeValueLinkStore.java => ProgramStageAttributeValueLinkStoreImpl.kt} (67%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionOrganisationUnitLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionOrganisationUnitLinkStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionStoreImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/{legendset/internal/LegendSetStore.java => category/internal/CategoryStoreImpl.kt} (66%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingHandler.kt rename core/src/main/java/org/hisp/dhis/android/core/{arch/di/internal/ObjectWithoutUidStoreProvider.java => common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingStore.kt} (86%) rename core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/{ValueTypeDeviceRenderingStore.java => ValueTypeDeviceRenderingStoreImpl.kt} (59%) rename core/src/main/java/org/hisp/dhis/android/core/common/valuetype/rendering/internal/{ValueTypeRenderingEntityDIModule.java => ValueTypeRenderingEntityDIModule.kt} (80%) rename core/src/main/java/org/hisp/dhis/android/core/common/valuetype/rendering/internal/{ValueTypeRenderingHandler.java => ValueTypeRenderingHandler.kt} (58%) rename core/src/main/java/org/hisp/dhis/android/core/{resource/internal/ResourceStore.java => configuration/internal/ConfigurationStore.kt} (87%) rename core/src/main/java/org/hisp/dhis/android/core/configuration/internal/{ConfigurationStore.java => ConfigurationStoreImpl.kt} (73%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationInsecureStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantHandler.kt rename core/src/main/java/org/hisp/dhis/android/core/constant/internal/{ConstantPackageDIModule.java => ConstantPackageDIModule.kt} (60%) rename core/src/main/java/org/hisp/dhis/android/core/{user/internal/UserRoleStore.java => constant/internal/ConstantStoreImpl.kt} (68%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalStore.kt rename core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/{DataApprovalStore.java => DataApprovalStoreImpl.kt} (52%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementAttributeValueEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementAttributeValueEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{dataapproval/internal/DataApprovalEntityDIModule.java => dataelement/internal/DataElementEntityDIModule.kt} (56%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementHandler.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementHandler.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementLegendSetEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{dataset/internal/DataInputPeriodEntityDIModule.java => dataelement/internal/DataElementLegendSetEntityDIModule.kt} (70%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandEntityDIModule.kt rename core/src/main/java/org/hisp/dhis/android/core/{arch/di/internal/IdentifiableEntityDIModule.java => dataelement/internal/DataElementOperandHandler.kt} (81%) rename core/src/main/java/org/hisp/dhis/android/core/{attribute/internal/AttributePackageDIModule.java => dataelement/internal/DataElementOperandStore.kt} (84%) rename core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/{DataElementOperandStore.java => DataElementOperandStoreImpl.kt} (68%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStore.kt rename core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/{DataElementStore.java => DataElementStoreImpl.kt} (60%) rename core/src/main/java/org/hisp/dhis/android/core/{trackedentity/internal/TrackedEntityInstanceSyncEntityDIModule.java => dataset/internal/DataInputPeriodEntityDIModule.kt} (79%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodStore.kt rename core/src/main/java/org/hisp/dhis/android/core/dataset/internal/{DataInputPeriodLinkStore.java => DataInputPeriodStoreImpl.kt} (61%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{datavalue/internal/DataValueEntityDIModule.java => dataset/internal/DataSetCompleteRegistrationEntityDIModule.kt} (71%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationHandler.kt rename core/src/main/java/org/hisp/dhis/android/core/dataset/internal/{DataSetCompleteRegistrationStore.java => DataSetCompleteRegistrationStore.kt} (70%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationStoreImpl.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/dataset/internal/{DataSetCompulsoryDataElementOperandLinkStore.java => DataSetCompulsoryDataElementOperandLinkStoreImpl.kt} (66%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementStore.kt rename core/src/main/java/org/hisp/dhis/android/core/dataset/internal/{DataSetDataElementLinkStore.java => DataSetElementStoreImpl.kt} (65%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetHandler.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceStore.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceSummaryStore.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceSummaryStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceSummaryStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/dataset/internal/{DataSetOrganisationUnitLinkStore.java => DataSetOrganisationUnitLinkStoreImpl.kt} (69%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetStore.kt rename core/src/main/java/org/hisp/dhis/android/core/{indicator/internal/IndicatorStore.java => dataset/internal/DataSetStoreImpl.kt} (52%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/dataset/internal/{SectionDataElementLinkStore.java => SectionDataElementLinkStoreImpl.kt} (69%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/dataset/internal/{SectionGreyedFieldsLinkStore.java => SectionGreyedFieldsLinkStoreImpl.kt} (69%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionIndicatorLinkHandler.kt rename core/src/main/java/org/hisp/dhis/android/core/{program/internal/AnalyticsPeriodBoundaryEntityDIModule.java => dataset/internal/SectionIndicatorLinkStoreImpl.kt} (66%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/datastore/internal/LocalDataStoreStoreImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/{DataValueConflictDIModule.kt => DataValueConflictEntityDIModule.kt} (89%) rename core/src/main/java/org/hisp/dhis/android/core/{maintenance/internal/D2ErrorStore.java => datavalue/internal/DataValueConflictStoreImpl.kt} (61%) rename core/src/main/java/org/hisp/dhis/android/core/{maintenance/internal/D2ErrorEntityDIModule.java => datavalue/internal/DataValueEntityDIModule.kt} (74%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueStore.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventDataFilterHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventDataFilterStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventFilterEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventFilterEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventFilterStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventSyncEntityDIModule.kt rename core/src/main/java/org/hisp/dhis/android/core/{imports/internal/EnrollmentWebResponseHandlerSummary.kt => event/internal/EventSyncStore.kt} (86%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/{option/internal/OptionGroupStore.java => expressiondimensionitem/internal/ExpressionDimensionItemStoreImpl.kt} (62%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStore.kt rename core/src/main/java/org/hisp/dhis/android/core/imports/internal/{TrackerImportConflictEntityDIModule.java => TrackerImportConflictEntityDIModule.kt} (75%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreImpl.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{event/internal/EventSyncEntityDIModule.java => indicator/internal/DataSetIndicatorEntityDIModule.kt} (81%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/indicator/internal/{DataSetIndicatorLinkStore.java => DataSetIndicatorLinkStoreImpl.kt} (70%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeStore.kt rename core/src/main/java/org/hisp/dhis/android/core/indicator/internal/{IndicatorTypeStore.java => IndicatorTypeStoreImpl.kt} (66%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/DataElementLegendSetLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/DataElementLegendSetLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/legendset/internal/{DataElementLegendSetLinkStore.java => DataElementLegendSetLinkStoreImpl.kt} (68%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/IndicatorLegendSetLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/IndicatorLegendSetLinkStoreImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/{period/PeriodEntityDIModule.java => legendset/internal/LegendEntityDIModule.kt} (75%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendHandler.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{option/internal/OptionSetEntityDIModule.java => legendset/internal/LegendSetEntityDIModule.kt} (61%) rename core/src/main/java/org/hisp/dhis/android/core/{option/internal/OptionHandler.java => legendset/internal/LegendSetHandler.kt} (61%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStore.kt rename core/src/main/java/org/hisp/dhis/android/core/{option/internal/OptionSetStore.java => legendset/internal/LegendSetStoreImpl.kt} (65%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendStore.kt rename core/src/main/java/org/hisp/dhis/android/core/legendset/internal/{LegendStore.java => LegendStoreImpl.kt} (61%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/ProgramIndicatorLegendSetLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/legendset/internal/ProgramIndicatorLegendSetLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/legendset/internal/{ProgramIndicatorLegendSetLinkStore.java => ProgramIndicatorLegendSetLinkStoreImpl.kt} (67%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStore.kt rename core/src/main/java/org/hisp/dhis/android/core/{user/internal/AuthorityStore.java => maintenance/internal/D2ErrorStoreImpl.kt} (68%) rename core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/{ForeignKeyViolationEntityDIModule.java => ForeignKeyViolationEntityDIModule.kt} (75%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStore.kt rename core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/{ForeignKeyViolationStore.java => ForeignKeyViolationStoreImpl.kt} (66%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/map/layer/internal/MapLayerImageryProviderHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/map/layer/internal/MapLayerImageryProviderStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/map/layer/internal/MapLayerStoreImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/{trackedentity/internal/TrackedEntityDataValueEntityDIModule.java => note/internal/NoteEntityDIModule.kt} (69%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/note/internal/NoteHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/note/internal/NoteStore.kt rename core/src/main/java/org/hisp/dhis/android/core/note/internal/{NoteStore.java => NoteStoreImpl.kt} (62%) rename core/src/main/java/org/hisp/dhis/android/core/option/internal/{OptionEntityDIModule.java => OptionEntityDIModule.kt} (60%) rename core/src/main/java/org/hisp/dhis/android/core/option/internal/{OptionGroupEntityDIModule.java => OptionGroupEntityDIModule.kt} (61%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionGroupHandler.java rename core/src/main/java/org/hisp/dhis/android/core/{validation/internal/ValidationRuleHandler.java => option/internal/OptionGroupHandler.kt} (60%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/option/internal/{OptionGroupOptionLinkStore.java => OptionGroupOptionLinkStoreImpl.kt} (68%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionGroupStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionGroupStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionHandler.kt rename core/src/main/java/org/hisp/dhis/android/core/{indicator/internal/IndicatorEntityDIModule.java => option/internal/OptionSetEntityDIModule.kt} (62%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionSetHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionSetStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionSetStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/option/internal/OptionStoreImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/{validation/internal/ValidationRuleEntityDIModule.java => organisationunit/internal/OrganisationUnitGroupEntityDIModule.kt} (63%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitHandlerImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{note/internal/NoteEntityDIModule.java => organisationunit/internal/OrganisationUnitLevelEntityDIModule.kt} (62%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelHandler.kt rename core/src/main/java/org/hisp/dhis/android/core/{dataset/internal/SectionStore.java => organisationunit/internal/OrganisationUnitLevelStoreImpl.kt} (61%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/{OrganisationUnitProgramLinkStore.java => OrganisationUnitProgramLinkStoreImpl.kt} (68%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/period/internal/PeriodEntityDIModule.kt rename core/src/main/java/org/hisp/dhis/android/core/period/internal/{PeriodPackageDIModule.java => PeriodPackageDIModule.kt} (74%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/period/internal/PeriodStore.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/period/internal/PeriodStoreImpl.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/period/internal/PeriodStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/AnalyticsPeriodBoundaryEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/AnalyticsPeriodBoundaryHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/AnalyticsPeriodBoundaryStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramAttributeValueEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{dataset/internal/DataSetElementEntityDIModule.java => program/internal/ProgramAttributeValueEntityDIModule.kt} (70%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{organisationunit/internal/OrganisationUnitGroupEntityDIModule.java => program/internal/ProgramEntityDIModule.kt} (55%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramHandler.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramHandler.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramIndicatorLegendSetEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{attribute/internal/AttributeEntityDIModule.java => program/internal/ProgramIndicatorLegendSetEntityDIModule.kt} (69%) rename core/src/main/java/org/hisp/dhis/android/core/{option/internal/OptionStore.java => program/internal/ProgramIndicatorStoreImpl.kt} (54%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionStore.kt rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramRuleActionStore.java => ProgramRuleActionStoreImpl.kt} (52%) rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramRuleEntityDIModule.java => ProgramRuleEntityDIModule.kt} (55%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleHandler.java rename core/src/main/java/org/hisp/dhis/android/core/{legendset/internal/LegendSetHandler.java => program/internal/ProgramRuleHandler.kt} (56%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleStore.kt rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramRuleStore.java => ProgramRuleStoreImpl.kt} (59%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableStore.kt rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramRuleVariableStore.java => ProgramRuleVariableStoreImpl.kt} (57%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramSectionAttributeLinkStore.java => ProgramSectionAttributeLinkStoreImpl.kt} (68%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramSectionEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramSectionEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramSectionHandler.java rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramSectionAttributeEntityDIModule.java => ProgramSectionHandler.kt} (61%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramSectionStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageAttributeValueEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageAttributeValueEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementStore.kt rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramStageDataElementStore.java => ProgramStageDataElementStoreImpl.kt} (55%) rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramStageEntityDIModule.java => ProgramStageEntityDIModule.kt} (52%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageHandler.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageHandler.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramStageSectionDataElementLinkStore.java => ProgramStageSectionDataElementLinkStoreImpl.kt} (66%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionHandler.java rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramStageDataElementHandler.java => ProgramStageSectionHandler.kt} (50%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionProgramIndicatorEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionProgramIndicatorEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionProgramIndicatorLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionProgramIndicatorLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramStageSectionProgramIndicatorLinkStore.java => ProgramStageSectionProgramIndicatorLinkStoreImpl.kt} (66%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageStore.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStageStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStore.java rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramStoreInterface.java => ProgramStore.kt} (81%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeEntityDIModule.kt rename core/src/main/java/org/hisp/dhis/android/core/{event/internal/EventPostNoteStore.kt => program/internal/ProgramTrackedEntityAttributeHandler.kt} (62%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeStore.kt rename core/src/main/java/org/hisp/dhis/android/core/program/internal/{ProgramTrackedEntityAttributeStore.java => ProgramTrackedEntityAttributeStoreImpl.kt} (56%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/programstageworkinglist/internal/ProgramStageWorkingListAttributeValueFilterHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/programstageworkinglist/internal/ProgramStageWorkingListAttributeValueFilterStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/programstageworkinglist/internal/ProgramStageWorkingListEventDataFilterHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/programstageworkinglist/internal/ProgramStageWorkingListEventDataFilterStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/programstageworkinglist/internal/ProgramStageWorkingListStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{trackedentity/internal/ReservedValueSettingDIModule.java => relationship/internal/RelationshipConstraintEntityDIModule.kt} (77%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintHandler.kt rename core/src/main/java/org/hisp/dhis/android/core/{arch/di/internal/ObjectWithoutUidEntityDIModule.java => relationship/internal/RelationshipConstraintStore.kt} (85%) rename core/src/main/java/org/hisp/dhis/android/core/relationship/internal/{RelationshipConstraintStore.java => RelationshipConstraintStoreImpl.kt} (55%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipHandlerImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/relationship/internal/{RelationshipItemElementStoreSelector.java => RelationshipItemElementStoreSelector.kt} (86%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemElementStoreSelectorImpl.java rename core/src/main/java/org/hisp/dhis/android/core/{constant/internal/ConstantHandler.java => relationship/internal/RelationshipItemElementStoreSelectorImpl.kt} (62%) rename core/src/main/java/org/hisp/dhis/android/core/{legendset/internal/LegendEntityDIModule.java => relationship/internal/RelationshipItemEntityDIModule.kt} (63%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemHandler.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipTypeHandler.java rename core/src/main/java/org/hisp/dhis/android/core/{indicator/internal/IndicatorTypeEntityDIModule.java => relationship/internal/RelationshipTypeHandler.kt} (53%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/relationship/internal/RelationshipTypeStore.kt rename core/src/main/java/org/hisp/dhis/android/core/relationship/internal/{RelationshipTypeStore.java => RelationshipTypeStoreImpl.kt} (63%) rename core/src/main/java/org/hisp/dhis/android/core/resource/internal/{ResourceEntityDIModule.java => ResourceEntityDIModule.kt} (85%) rename core/src/main/java/org/hisp/dhis/android/core/resource/internal/{ResourceHandler.java => ResourceHandler.kt} (62%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/resource/internal/ResourcePackageDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/resource/internal/ResourceStore.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/resource/internal/ResourceStoreImpl.java rename core/src/main/java/org/hisp/dhis/android/core/{dataset/internal/DataSetStore.java => resource/internal/ResourceStoreImpl.kt} (50%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/AnalyticsDhisVisualizationStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiAttributeHandler.kt rename core/src/main/java/org/hisp/dhis/android/core/{trackedentity/TrackedEntityAttributeLegendSetLinkStore.kt => settings/internal/AnalyticsTeiAttributeStoreImpl.kt} (70%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiDataElementHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiDataElementStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiIndicatorHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiIndicatorStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiSettingStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiWHONutritionDataStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/DataSetSettingEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/DataSetSettingEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/DataSetSettingStore.kt rename core/src/main/java/org/hisp/dhis/android/core/settings/internal/{DataSetSettingStore.java => DataSetSettingStoreImpl.kt} (60%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/FilterSettingStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/GeneralSettingStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/LatestAppVersionStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/ProgramConfigurationSettingStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/ProgramSettingEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/ProgramSettingEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/ProgramSettingStore.kt rename core/src/main/java/org/hisp/dhis/android/core/settings/internal/{ProgramSettingStore.java => ProgramSettingStoreImpl.kt} (51%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/SynchronizationSettingStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/SystemSettingEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/SystemSettingEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/SystemSettingHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/SystemSettingStore.kt rename core/src/main/java/org/hisp/dhis/android/core/settings/internal/{SystemSettingStore.java => SystemSettingStoreImpl.kt} (63%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/UserSettingsEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/UserSettingsEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/settings/internal/UserSettingsStore.kt rename core/src/main/java/org/hisp/dhis/android/core/settings/internal/{UserSettingsStore.java => UserSettingsStoreImpl.kt} (64%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/sms/data/localdbrepository/internal/SMSMetadataIdStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/sms/data/localdbrepository/internal/SMSOngoingSubmissionStoreImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/sms/internal/{SmsDIModule.java => SmsDIModule.kt} (60%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/systeminfo/internal/SystemInfoEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/systeminfo/internal/SystemInfoEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/systeminfo/internal/SystemInfoHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/systeminfo/internal/SystemInfoStore.kt rename core/src/main/java/org/hisp/dhis/android/core/systeminfo/internal/{SystemInfoStore.java => SystemInfoStoreImpl.kt} (60%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/AttributeValueFilterHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/AttributeValueFilterStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/ReservedValueSettingDIModule.kt rename core/src/main/java/org/hisp/dhis/android/core/{dataelement/internal/DataElementOperandEntityDIModule.java => trackedentity/internal/ReservedValueSettingStoreImpl.kt} (67%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeEntityDIModule.kt rename core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/{TrackedEntityAttributeHandler.java => TrackedEntityAttributeHandler.kt} (54%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeLegendSetLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeLegendSetLinkStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeLegendSetLinkStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueHandler.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueStore.java rename core/src/main/java/org/hisp/dhis/android/core/{period/internal/PeriodStore.java => trackedentity/internal/TrackedEntityAttributeReservedValueStore.kt} (73%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueStoreInterface.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeStore.kt rename core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/{TrackedEntityAttributeStore.java => TrackedEntityAttributeStoreImpl.kt} (52%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeValueEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityDataValueEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityDataValueHandler.java rename core/src/main/java/org/hisp/dhis/android/core/{relationship/internal/RelationshipItemEntityDIModule.java => trackedentity/internal/TrackedEntityDataValueHandler.kt} (58%) rename core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/{TrackedEntityDataValueStore.java => TrackedEntityDataValueStore.kt} (67%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityDataValueStoreImpl.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityDataValueStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceEventFilterEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceEventFilterEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceEventFilterHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceEventFilterStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceFilterStoreImpl.kt rename core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/{TrackedEntityInstanceStore.java => TrackedEntityInstanceStore.kt} (74%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceStoreImpl.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceSyncEntityDIModule.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceSyncStore.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceSyncStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceSyncStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeAttributeEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeAttributeHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeAttributeStore.kt rename core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/{TrackedEntityTypeAttributeStore.java => TrackedEntityTypeAttributeStoreImpl.kt} (60%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/{TrackedEntityTypeAttributeEntityDIModule.java => TrackedEntityTypeEntityDIModule.kt} (64%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeHandler.java rename core/src/main/java/org/hisp/dhis/android/core/{program/internal/ProgramTrackedEntityAttributeHandler.java => trackedentity/internal/TrackedEntityTypeHandler.kt} (57%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeStore.kt rename core/src/main/java/org/hisp/dhis/android/core/trackedentity/internal/{TrackedEntityTypeStore.java => TrackedEntityTypeStoreImpl.kt} (66%) rename core/src/main/java/org/hisp/dhis/android/core/{event/internal/EventSyncStore.java => trackedentity/ownership/ProgramOwnerStoreImpl.kt} (61%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/trackedentity/ownership/ProgramTempOwnerStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/tracker/importer/internal/TrackerJobObjectHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/tracker/importer/internal/TrackerJobObjectStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/usecase/stock/internal/StockUseCaseStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/usecase/stock/internal/StockUseCaseTransactionLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/usecase/stock/internal/StockUseCaseTransactionLinkStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserStore.kt rename core/src/main/java/org/hisp/dhis/android/core/user/internal/{AuthenticatedUserStore.java => AuthenticatedUserStoreImpl.kt} (62%) delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/AuthorityEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/AuthorityEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/AuthorityHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/AuthorityStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/AuthorityStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/UserOrganisationUnitLinkHandler.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/UserRoleEntityDIModule.java rename core/src/main/java/org/hisp/dhis/android/core/{relationship/internal/RelationshipEntityDIModule.java => user/internal/UserRoleEntityDIModule.kt} (68%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/UserRoleHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/UserRoleStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/UserRoleStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/UserStore.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/UserStore.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/user/internal/UserStoreImpl.kt delete mode 100644 core/src/main/java/org/hisp/dhis/android/core/validation/internal/DataSetValidationRuleLinkEntityDIModule.java create mode 100644 core/src/main/java/org/hisp/dhis/android/core/validation/internal/DataSetValidationRuleLinkEntityDIModule.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/validation/internal/DataSetValidationRuleLinkHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/validation/internal/DataSetValidationRuleLinkStore.kt rename core/src/main/java/org/hisp/dhis/android/core/validation/internal/{DataSetValidationRuleLinkStore.java => DataSetValidationRuleLinkStoreImpl.kt} (69%) rename core/src/main/java/org/hisp/dhis/android/core/validation/internal/{ValidationPackageDIModule.java => ValidationPackageDIModule.kt} (65%) rename core/src/main/java/org/hisp/dhis/android/core/{trackedentity/internal/TrackedEntityAttributeValueEntityDIModule.java => validation/internal/ValidationRuleEntityDIModule.kt} (66%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/validation/internal/ValidationRuleHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/validation/internal/ValidationRuleStore.kt rename core/src/main/java/org/hisp/dhis/android/core/validation/internal/{ValidationRuleStore.java => ValidationRuleStoreImpl.kt} (56%) create mode 100644 core/src/main/java/org/hisp/dhis/android/core/visualization/internal/VisualizationDimensionItemHandler.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/visualization/internal/VisualizationDimensionItemStoreImpl.kt create mode 100644 core/src/main/java/org/hisp/dhis/android/core/visualization/internal/VisualizationStoreImpl.kt delete mode 100644 core/src/test/java/org/hisp/dhis/android/core/dataelement/internal/DataElementHandlerShould.java create mode 100644 core/src/test/java/org/hisp/dhis/android/core/dataelement/internal/DataElementHandlerShould.kt diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/MockIntegrationTestObjects.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/MockIntegrationTestObjects.kt index 132b668207..3784d637bb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/MockIntegrationTestObjects.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/MockIntegrationTestObjects.kt @@ -44,8 +44,9 @@ class MockIntegrationTestObjects(val content: MockIntegrationTestDatabaseContent val d2: D2 = forNewDatabase() val databaseAdapter: DatabaseAdapter = d2.databaseAdapter() - var serverDate = Date() - var resourceHandler: ResourceHandler = ResourceHandler.create(databaseAdapter) + + private var serverDate = Date() + private var resourceHandler: ResourceHandler = ResourceHandler.create(databaseAdapter) @JvmField internal val d2DIComponent: D2DIComponent = d2.d2DIComponent diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/AnalyticsRepositoryIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/AnalyticsRepositoryIntegrationShould.kt index 4d1ffe2977..243f6d4ab0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/AnalyticsRepositoryIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/AnalyticsRepositoryIntegrationShould.kt @@ -34,7 +34,7 @@ import org.hisp.dhis.android.core.analytics.aggregated.DimensionItem import org.hisp.dhis.android.core.arch.helpers.Result import org.hisp.dhis.android.core.common.AggregationType import org.hisp.dhis.android.core.common.RelativePeriod -import org.hisp.dhis.android.core.dataelement.internal.DataElementStore +import org.hisp.dhis.android.core.dataelement.internal.DataElementStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher import org.junit.Test @@ -91,7 +91,7 @@ class AnalyticsRepositoryIntegrationShould : BaseMockIntegrationTestFullDispatch @Test fun should_fail_if_unsupported_aggregation_type() { - val dataElementStore = DataElementStore.create(databaseAdapter) + val dataElementStore = DataElementStoreImpl(databaseAdapter) val dataElement = dataElementStore.selectByUid("g9eOBujte1U")!! val varianceDataElement = dataElement.toBuilder().aggregationType(AggregationType.VARIANCE.name).build() diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/BaseEvaluatorIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/BaseEvaluatorIntegrationShould.kt index 996a9eca31..12398f87ef 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/BaseEvaluatorIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/BaseEvaluatorIntegrationShould.kt @@ -69,32 +69,43 @@ import org.hisp.dhis.android.core.analytics.aggregated.internal.evaluator.BaseEv import org.hisp.dhis.android.core.analytics.aggregated.internal.evaluator.BaseEvaluatorSamples.relationshipTypeFrom import org.hisp.dhis.android.core.analytics.aggregated.internal.evaluator.BaseEvaluatorSamples.relationshipTypeTo import org.hisp.dhis.android.core.analytics.aggregated.internal.evaluator.BaseEvaluatorSamples.trackedEntityType -import org.hisp.dhis.android.core.category.internal.* +import org.hisp.dhis.android.core.category.internal.CategoryCategoryComboLinkStoreImpl +import org.hisp.dhis.android.core.category.internal.CategoryCategoryOptionLinkStoreImpl +import org.hisp.dhis.android.core.category.internal.CategoryComboStoreImpl +import org.hisp.dhis.android.core.category.internal.CategoryOptionComboCategoryOptionLinkStoreImpl +import org.hisp.dhis.android.core.category.internal.CategoryOptionComboStoreImpl +import org.hisp.dhis.android.core.category.internal.CategoryOptionStoreImpl +import org.hisp.dhis.android.core.category.internal.CategoryStoreImpl import org.hisp.dhis.android.core.common.RelativeOrganisationUnit import org.hisp.dhis.android.core.common.RelativePeriod -import org.hisp.dhis.android.core.constant.internal.ConstantStore -import org.hisp.dhis.android.core.dataelement.internal.DataElementStore +import org.hisp.dhis.android.core.constant.internal.ConstantStoreImpl +import org.hisp.dhis.android.core.dataelement.internal.DataElementStoreImpl import org.hisp.dhis.android.core.datavalue.DataValue -import org.hisp.dhis.android.core.datavalue.internal.DataValueStore +import org.hisp.dhis.android.core.datavalue.internal.DataValueStoreImpl import org.hisp.dhis.android.core.enrollment.Enrollment import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl import org.hisp.dhis.android.core.event.Event import org.hisp.dhis.android.core.event.internal.EventStoreImpl -import org.hisp.dhis.android.core.expressiondimensionitem.internal.ExpressionDimensionItemStore -import org.hisp.dhis.android.core.indicator.internal.IndicatorStore -import org.hisp.dhis.android.core.indicator.internal.IndicatorTypeStore -import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitGroupStore -import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitLevelStore -import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore +import org.hisp.dhis.android.core.expressiondimensionitem.internal.ExpressionDimensionItemStoreImpl +import org.hisp.dhis.android.core.indicator.internal.IndicatorStoreImpl +import org.hisp.dhis.android.core.indicator.internal.IndicatorTypeStoreImpl +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitGroupStoreImpl +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitLevelStoreImpl +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStoreImpl import org.hisp.dhis.android.core.parser.internal.service.ExpressionService import org.hisp.dhis.android.core.period.internal.PeriodStoreImpl -import org.hisp.dhis.android.core.program.internal.ProgramStageStore -import org.hisp.dhis.android.core.program.internal.ProgramStore -import org.hisp.dhis.android.core.relationship.internal.* +import org.hisp.dhis.android.core.program.internal.ProgramStageStoreImpl +import org.hisp.dhis.android.core.program.internal.ProgramStoreImpl +import org.hisp.dhis.android.core.relationship.internal.RelationshipConstraintStoreImpl +import org.hisp.dhis.android.core.relationship.internal.RelationshipTypeStoreImpl import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance -import org.hisp.dhis.android.core.trackedentity.internal.* +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeStoreImpl +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeValueStoreImpl +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStoreImpl +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityTypeStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyDispatcher import org.junit.After import org.junit.Before @@ -102,43 +113,43 @@ import org.junit.Before internal open class BaseEvaluatorIntegrationShould : BaseMockIntegrationTestEmptyDispatcher() { // Data stores - protected val dataValueStore = DataValueStore.create(databaseAdapter) - protected val eventStore = EventStoreImpl.create(databaseAdapter) - protected val enrollmentStore = EnrollmentStoreImpl.create(databaseAdapter) - protected val trackedEntityStore = TrackedEntityInstanceStoreImpl.create(databaseAdapter) - protected val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl.create(databaseAdapter) - protected val trackedEntityAttributeValueStore = TrackedEntityAttributeValueStoreImpl.create(databaseAdapter) + protected val dataValueStore = DataValueStoreImpl(databaseAdapter) + protected val eventStore = EventStoreImpl(databaseAdapter) + protected val enrollmentStore = EnrollmentStoreImpl(databaseAdapter) + protected val trackedEntityStore = TrackedEntityInstanceStoreImpl(databaseAdapter) + protected val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl(databaseAdapter) + protected val trackedEntityAttributeValueStore = TrackedEntityAttributeValueStoreImpl(databaseAdapter) // Metadata stores - protected val categoryStore = CategoryStore.create(databaseAdapter) - protected val categoryOptionStore = CategoryOptionStore.create(databaseAdapter) - protected val categoryCategoryOptionStore = CategoryCategoryOptionLinkStore.create(databaseAdapter) - protected val categoryComboStore = CategoryComboStore.create(databaseAdapter) - protected val categoryOptionComboStore = CategoryOptionComboStoreImpl.create(databaseAdapter) - protected val categoryCategoryComboLinkStore = CategoryCategoryComboLinkStore.create(databaseAdapter) - protected val categoryOptionComboCategoryOptionLinkStore = CategoryOptionComboCategoryOptionLinkStore.create( + protected val categoryStore = CategoryStoreImpl(databaseAdapter) + protected val categoryOptionStore = CategoryOptionStoreImpl(databaseAdapter) + protected val categoryCategoryOptionStore = CategoryCategoryOptionLinkStoreImpl(databaseAdapter) + protected val categoryComboStore = CategoryComboStoreImpl(databaseAdapter) + protected val categoryOptionComboStore = CategoryOptionComboStoreImpl(databaseAdapter) + protected val categoryCategoryComboLinkStore = CategoryCategoryComboLinkStoreImpl(databaseAdapter) + protected val categoryOptionComboCategoryOptionLinkStore = CategoryOptionComboCategoryOptionLinkStoreImpl( databaseAdapter ) - protected val dataElementStore = DataElementStore.create(databaseAdapter) - protected val organisationUnitStore = OrganisationUnitStore.create(databaseAdapter) - protected val organisationUnitLevelStore = OrganisationUnitLevelStore.create(databaseAdapter) - protected val organisationUnitGroupStore = OrganisationUnitGroupStore.create(databaseAdapter) - protected val periodStore = PeriodStoreImpl.create(databaseAdapter) + protected val dataElementStore = DataElementStoreImpl(databaseAdapter) + protected val organisationUnitStore = OrganisationUnitStoreImpl(databaseAdapter) + protected val organisationUnitLevelStore = OrganisationUnitLevelStoreImpl(databaseAdapter) + protected val organisationUnitGroupStore = OrganisationUnitGroupStoreImpl(databaseAdapter) + protected val periodStore = PeriodStoreImpl(databaseAdapter) - protected val trackedEntityTypeStore = TrackedEntityTypeStore.create(databaseAdapter) - protected val trackedEntityAttributeStore = TrackedEntityAttributeStore.create(databaseAdapter) - protected val programStore = ProgramStore.create(databaseAdapter) - protected val programStageStore = ProgramStageStore.create(databaseAdapter) + protected val trackedEntityTypeStore = TrackedEntityTypeStoreImpl(databaseAdapter) + protected val trackedEntityAttributeStore = TrackedEntityAttributeStoreImpl(databaseAdapter) + protected val programStore = ProgramStoreImpl(databaseAdapter) + protected val programStageStore = ProgramStageStoreImpl(databaseAdapter) - protected val indicatorTypeStore = IndicatorTypeStore.create(databaseAdapter) - protected val indicatorStore = IndicatorStore.create(databaseAdapter) + protected val indicatorTypeStore = IndicatorTypeStoreImpl.create(databaseAdapter) + protected val indicatorStore = IndicatorStoreImpl.create(databaseAdapter) - protected val relationshipTypeStore = RelationshipTypeStore.create(databaseAdapter) - protected val relationshipConstraintStore = RelationshipConstraintStore.create(databaseAdapter) + protected val relationshipTypeStore = RelationshipTypeStoreImpl(databaseAdapter) + protected val relationshipConstraintStore = RelationshipConstraintStoreImpl(databaseAdapter) - protected val constantStore = ConstantStore.create(databaseAdapter) + protected val constantStore = ConstantStoreImpl(databaseAdapter) - protected val expressionDimensionItemStore = ExpressionDimensionItemStore.create(databaseAdapter) + protected val expressionDimensionItemStore = ExpressionDimensionItemStoreImpl(databaseAdapter) protected val expressionService = ExpressionService( dataElementStore, diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/ProgramIndicatorEvaluatorIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/ProgramIndicatorEvaluatorIntegrationShould.kt index 57dfbbfd5c..7d70077865 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/ProgramIndicatorEvaluatorIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/ProgramIndicatorEvaluatorIntegrationShould.kt @@ -59,8 +59,8 @@ import org.junit.runner.RunWith internal class ProgramIndicatorEvaluatorIntegrationShould : BaseEvaluatorIntegrationShould() { private val programIndicatorEvaluator = ProgramIndicatorEvaluator( - EventStoreImpl.create(databaseAdapter), - EnrollmentStoreImpl.create(databaseAdapter), + EventStoreImpl(databaseAdapter), + EnrollmentStoreImpl(databaseAdapter), d2.programModule().programIndicatorEngine() ) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/analyticexpressionengine/AnalyticExpressionEngineFactoryHelper.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/analyticexpressionengine/AnalyticExpressionEngineFactoryHelper.kt index 823d504121..ccc7207d22 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/analyticexpressionengine/AnalyticExpressionEngineFactoryHelper.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/aggregated/internal/evaluator/analyticexpressionengine/AnalyticExpressionEngineFactoryHelper.kt @@ -32,11 +32,11 @@ import org.hisp.dhis.android.core.analytics.aggregated.internal.evaluator.DataEl import org.hisp.dhis.android.core.analytics.aggregated.internal.evaluator.EventDataItemSQLEvaluator import org.hisp.dhis.android.core.analytics.aggregated.internal.evaluator.ProgramIndicatorSQLEvaluator import org.hisp.dhis.android.core.category.internal.CategoryOptionComboStoreImpl -import org.hisp.dhis.android.core.constant.internal.ConstantStore -import org.hisp.dhis.android.core.dataelement.internal.DataElementStore -import org.hisp.dhis.android.core.program.internal.ProgramStore +import org.hisp.dhis.android.core.constant.internal.ConstantStoreImpl +import org.hisp.dhis.android.core.dataelement.internal.DataElementStoreImpl +import org.hisp.dhis.android.core.program.internal.ProgramStoreImpl import org.hisp.dhis.android.core.program.programindicatorengine.internal.ProgramIndicatorSQLExecutor -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeStore +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeStoreImpl internal object AnalyticExpressionEngineFactoryHelper { @@ -46,9 +46,9 @@ internal object AnalyticExpressionEngineFactoryHelper { val dataElementEvaluator = DataElementSQLEvaluator(databaseAdapter) val programIndicatorExecutor = ProgramIndicatorSQLExecutor( - ConstantStore.create(databaseAdapter), - DataElementStore.create(databaseAdapter), - TrackedEntityAttributeStore.create(databaseAdapter), + ConstantStoreImpl(databaseAdapter), + DataElementStoreImpl(databaseAdapter), + TrackedEntityAttributeStoreImpl(databaseAdapter), databaseAdapter ) @@ -59,15 +59,15 @@ internal object AnalyticExpressionEngineFactoryHelper { val eventDataItemEvaluator = EventDataItemSQLEvaluator(databaseAdapter) return AnalyticExpressionEngineFactory( - DataElementStore.create(databaseAdapter), - TrackedEntityAttributeStore.create(databaseAdapter), - CategoryOptionComboStoreImpl.create(databaseAdapter), - ProgramStore.create(databaseAdapter), + DataElementStoreImpl(databaseAdapter), + TrackedEntityAttributeStoreImpl(databaseAdapter), + CategoryOptionComboStoreImpl(databaseAdapter), + ProgramStoreImpl(databaseAdapter), d2.programModule().programIndicators(), dataElementEvaluator, programIndicatorEvaluator, eventDataItemEvaluator, - ConstantStore.create(databaseAdapter), + ConstantStoreImpl(databaseAdapter), ) } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListIntegrationShould.kt index 691368faa3..53c2455ba3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListIntegrationShould.kt @@ -49,33 +49,33 @@ import org.hisp.dhis.android.core.analytics.linelist.EventLineListParams import org.hisp.dhis.android.core.analytics.linelist.EventLineListService import org.hisp.dhis.android.core.analytics.linelist.EventLineListServiceImpl import org.hisp.dhis.android.core.analytics.linelist.LineListItem -import org.hisp.dhis.android.core.category.internal.CategoryComboStore +import org.hisp.dhis.android.core.category.internal.CategoryComboStoreImpl import org.hisp.dhis.android.core.category.internal.CategoryOptionComboStoreImpl import org.hisp.dhis.android.core.common.* -import org.hisp.dhis.android.core.dataelement.internal.DataElementStore +import org.hisp.dhis.android.core.dataelement.internal.DataElementStoreImpl import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl import org.hisp.dhis.android.core.event.Event import org.hisp.dhis.android.core.event.internal.EventStoreImpl import org.hisp.dhis.android.core.legendset.DataElementLegendSetLink import org.hisp.dhis.android.core.legendset.ProgramIndicatorLegendSetLink -import org.hisp.dhis.android.core.legendset.internal.DataElementLegendSetLinkStore -import org.hisp.dhis.android.core.legendset.internal.LegendSetStore -import org.hisp.dhis.android.core.legendset.internal.LegendStore -import org.hisp.dhis.android.core.legendset.internal.ProgramIndicatorLegendSetLinkStore -import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitLevelStore -import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitOrganisationUnitGroupLinkStore -import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore +import org.hisp.dhis.android.core.legendset.internal.DataElementLegendSetLinkStoreImpl +import org.hisp.dhis.android.core.legendset.internal.LegendSetStoreImpl +import org.hisp.dhis.android.core.legendset.internal.LegendStoreImpl +import org.hisp.dhis.android.core.legendset.internal.ProgramIndicatorLegendSetLinkStoreImpl +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitLevelStoreImpl +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitOrganisationUnitGroupLinkStoreImpl +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStoreImpl import org.hisp.dhis.android.core.period.PeriodType import org.hisp.dhis.android.core.period.internal.CalendarProviderFactory import org.hisp.dhis.android.core.period.internal.ParentPeriodGeneratorImpl import org.hisp.dhis.android.core.program.ProgramIndicator -import org.hisp.dhis.android.core.program.internal.ProgramIndicatorStore -import org.hisp.dhis.android.core.program.internal.ProgramStageStore -import org.hisp.dhis.android.core.program.internal.ProgramStore +import org.hisp.dhis.android.core.program.internal.ProgramIndicatorStoreImpl +import org.hisp.dhis.android.core.program.internal.ProgramStageStoreImpl +import org.hisp.dhis.android.core.program.internal.ProgramStoreImpl import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStoreImpl -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityTypeStore +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityTypeStoreImpl import org.hisp.dhis.android.core.user.internal.UserOrganisationUnitLinkStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyDispatcher import org.hisp.dhis.android.core.utils.runner.D2JunitRunner @@ -88,25 +88,25 @@ import org.junit.runner.RunWith class EventLineListIntegrationShould : BaseMockIntegrationTestEmptyDispatcher() { // Stores - private val trackedEntityTypeStore = TrackedEntityTypeStore.create(databaseAdapter) - private val categoryComboStore = CategoryComboStore.create(databaseAdapter) - private val categoryOptionComboStore = CategoryOptionComboStoreImpl.create(databaseAdapter) - private val programStore = ProgramStore.create(databaseAdapter) - private val programStageStore = ProgramStageStore.create(databaseAdapter) - private val dataElementStore = DataElementStore.create(databaseAdapter) - private val dataElementLegendSetLinkStore = DataElementLegendSetLinkStore.create(databaseAdapter) - private val organisationUnitStore = OrganisationUnitStore.create(databaseAdapter) - private val userOrganisationUnitStore = UserOrganisationUnitLinkStoreImpl.create(databaseAdapter) - private val organisationUnitGroupLinkStore = OrganisationUnitOrganisationUnitGroupLinkStore.create(databaseAdapter) - private val organisationUnitLevelStore = OrganisationUnitLevelStore.create(databaseAdapter) - private val trackedEntityInstanceStore = TrackedEntityInstanceStoreImpl.create(databaseAdapter) - private val eventStore = EventStoreImpl.create(databaseAdapter) - private val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl.create(databaseAdapter) - private val programIndicatorStore = ProgramIndicatorStore.create(databaseAdapter) - private val programIndicatorLegendSetLinkStore = ProgramIndicatorLegendSetLinkStore.create(databaseAdapter) - private val enrollmentStore = EnrollmentStoreImpl.create(databaseAdapter) - private val legendSetStore = LegendSetStore.create(databaseAdapter) - private val legendStore = LegendStore.create(databaseAdapter) + private val trackedEntityTypeStore = TrackedEntityTypeStoreImpl(databaseAdapter) + private val categoryComboStore = CategoryComboStoreImpl(databaseAdapter) + private val categoryOptionComboStore = CategoryOptionComboStoreImpl(databaseAdapter) + private val programStore = ProgramStoreImpl(databaseAdapter) + private val programStageStore = ProgramStageStoreImpl(databaseAdapter) + private val dataElementStore = DataElementStoreImpl(databaseAdapter) + private val dataElementLegendSetLinkStore = DataElementLegendSetLinkStoreImpl(databaseAdapter) + private val organisationUnitStore = OrganisationUnitStoreImpl(databaseAdapter) + private val userOrganisationUnitStore = UserOrganisationUnitLinkStoreImpl(databaseAdapter) + private val organisationUnitGroupLinkStore = OrganisationUnitOrganisationUnitGroupLinkStoreImpl(databaseAdapter) + private val organisationUnitLevelStore = OrganisationUnitLevelStoreImpl(databaseAdapter) + private val trackedEntityInstanceStore = TrackedEntityInstanceStoreImpl(databaseAdapter) + private val eventStore = EventStoreImpl(databaseAdapter) + private val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl(databaseAdapter) + private val programIndicatorStore = ProgramIndicatorStoreImpl(databaseAdapter) + private val programIndicatorLegendSetLinkStore = ProgramIndicatorLegendSetLinkStoreImpl(databaseAdapter) + private val enrollmentStore = EnrollmentStoreImpl(databaseAdapter) + private val legendSetStore = LegendSetStoreImpl(databaseAdapter) + private val legendStore = LegendStoreImpl(databaseAdapter) private val calendarProvider = CalendarProviderFactory.createFixed() private val dateFilterPeriodHelper = DateFilterPeriodHelper(calendarProvider, ParentPeriodGeneratorImpl.create(calendarProvider)) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.kt index 6e4d927860..56a72dfc12 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.kt @@ -31,9 +31,9 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule import androidx.paging.PagedList import com.jraska.livedata.TestObserver import org.hisp.dhis.android.core.arch.db.querybuilders.internal.OrderByClauseBuilder -import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope import org.hisp.dhis.android.core.category.CategoryOption +import org.hisp.dhis.android.core.category.internal.CategoryOptionStore import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.Before @@ -48,7 +48,7 @@ class PagingMockIntegrationShould : BaseMockIntegrationTestFullDispatcher() { @get:Rule val rule: TestRule = InstantTaskExecutorRule() - private lateinit var store: IdentifiableObjectStore + private lateinit var store: CategoryOptionStore private lateinit var allValues: List private val empty = RepositoryScope.empty() diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.kt similarity index 60% rename from core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.kt index fba040971d..db42af7f18 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.kt @@ -25,38 +25,30 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +package org.hisp.dhis.android.core.attribute.internal -package org.hisp.dhis.android.core.attribute.internal; +import org.hisp.dhis.android.core.attribute.Attribute +import org.hisp.dhis.android.core.attribute.AttributeTableInfo +import org.hisp.dhis.android.core.common.ValueType +import org.hisp.dhis.android.core.data.attribute.AttributeSamples +import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith -import org.hisp.dhis.android.core.attribute.Attribute; -import org.hisp.dhis.android.core.attribute.AttributeTableInfo; -import org.hisp.dhis.android.core.common.ValueType; -import org.hisp.dhis.android.core.data.attribute.AttributeSamples; -import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; -import org.hisp.dhis.android.core.data.legendset.LegendSetSamples; -import org.hisp.dhis.android.core.legendset.LegendSet; -import org.hisp.dhis.android.core.legendset.LegendSetTableInfo; -import org.hisp.dhis.android.core.legendset.internal.LegendSetStore; -import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; -import org.junit.runner.RunWith; - -@RunWith(D2JunitRunner.class) -public class AttributeStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { - - public AttributeStoreIntegrationShould() { - super(AttributeStore.create(TestDatabaseAdapterFactory.get()), AttributeTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); - } - - @Override - protected Attribute buildObject() { - return AttributeSamples.getAttribute(); +@RunWith(D2JunitRunner::class) +class AttributeStoreIntegrationShould : IdentifiableObjectStoreAbstractIntegrationShould( + AttributeStoreImpl(TestDatabaseAdapterFactory.get()), + AttributeTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): Attribute { + return AttributeSamples.getAttribute() } - @Override - protected Attribute buildObjectToUpdate() { + override fun buildObjectToUpdate(): Attribute { return AttributeSamples.getAttribute().toBuilder() - .valueType(ValueType.AGE) - .build(); + .valueType(ValueType.AGE) + .build() } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkStoreIntegrationShould.java index 719ebaef89..aeddb1a8bc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class DataElementAttributeValueLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public DataElementAttributeValueLinkStoreIntegrationShould() { - super(DataElementAttributeValueLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new DataElementAttributeValueLinkStoreImpl(TestDatabaseAdapterFactory.get()), DataElementAttributeValueLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkStoreIntegrationShould.java index fa20f8cfcc..319a81ab2d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class ProgramAttributeValueLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public ProgramAttributeValueLinkStoreIntegrationShould() { - super(ProgramAttributeValueLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new ProgramAttributeValueLinkStoreImpl(TestDatabaseAdapterFactory.get()), ProgramAttributeValueLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkStoreIntegrationShould.java index 1e7d874c02..3d39a9c4e1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class ProgramStageAttributeValueLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public ProgramStageAttributeValueLinkStoreIntegrationShould() { - super(ProgramStageAttributeValueLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new ProgramStageAttributeValueLinkStoreImpl(TestDatabaseAdapterFactory.get()), ProgramStageAttributeValueLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.kt index c182920df3..0b84041e5d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.kt @@ -30,7 +30,6 @@ package org.hisp.dhis.android.core.category.internal import com.google.common.truth.Truth.assertThat import org.hisp.dhis.android.core.category.CategoryCategoryComboLink import org.hisp.dhis.android.core.category.CategoryCategoryComboLinkTableInfo -import org.hisp.dhis.android.core.category.internal.CategoryCategoryComboLinkStore.create import org.hisp.dhis.android.core.data.category.CategoryCategoryComboLinkSamples import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory @@ -40,7 +39,7 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class CategoryCategoryComboLinkStoreIntegrationShould : LinkStoreAbstractIntegrationShould( - create(TestDatabaseAdapterFactory.get()), + CategoryCategoryComboLinkStoreImpl(TestDatabaseAdapterFactory.get()), CategoryCategoryComboLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { override fun addMasterUid(): String { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java index 71dd213770..99694041a0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class CategoryCategoryOptionLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public CategoryCategoryOptionLinkStoreIntegrationShould() { - super(CategoryCategoryOptionLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new CategoryCategoryOptionLinkStoreImpl(TestDatabaseAdapterFactory.get()), CategoryCategoryOptionLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.kt index dbe0145493..c795342db9 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.kt @@ -66,32 +66,32 @@ class CategoryComboEndpointCallRealIntegrationShould : BaseRealIntegrationTest() } private fun assertNotCombosInDB() { - val categoryComboStore = CategoryComboStore.create(d2.databaseAdapter()) + val categoryComboStore = CategoryComboStoreImpl(d2.databaseAdapter()) val categoryCombos = categoryComboStore.selectAll() assertThat(categoryCombos.isEmpty()).isTrue() } private fun assertThereAreCombosInDB() { - val categoryComboStore = CategoryComboStore.create(d2.databaseAdapter()) + val categoryComboStore = CategoryComboStoreImpl(d2.databaseAdapter()) val categoryCombos = categoryComboStore.selectAll() assertThat(categoryCombos.isNotEmpty()).isTrue() } private val categoryCategoryComboLinks: List get() { - val categoryCategoryComboLinkStore = CategoryCategoryComboLinkStore.create(d2.databaseAdapter()) + val categoryCategoryComboLinkStore = CategoryCategoryComboLinkStoreImpl(d2.databaseAdapter()) return categoryCategoryComboLinkStore.selectAll() } private fun assertThereAreCategoryOptionCombosInDB() { val categoryOptionComboStore: IdentifiableObjectStore = - CategoryOptionComboStoreImpl.create(d2.databaseAdapter()) + CategoryOptionComboStoreImpl(d2.databaseAdapter()) val categoryOptionCombos = categoryOptionComboStore.selectAll() assertThat(categoryOptionCombos.isNotEmpty()).isTrue() } private fun assertThereAreCategoriesInDB() { - val categoryOptionStore = CategoryOptionStore.create(d2.databaseAdapter()) + val categoryOptionStore = CategoryOptionStoreImpl(d2.databaseAdapter()) val categoryOptionUids = categoryOptionStore.selectUids() assertThat(categoryOptionUids.isNotEmpty()).isTrue() } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java index b4ca21cd74..8f0fe9d348 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class CategoryOptionComboCategoryOptionLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public CategoryOptionComboCategoryOptionLinkStoreIntegrationShould() { - super(CategoryOptionComboCategoryOptionLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new CategoryOptionComboCategoryOptionLinkStoreImpl(TestDatabaseAdapterFactory.get()), CategoryOptionComboCategoryOptionLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionOrganisationUnitLinkStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionOrganisationUnitLinkStoreIntegrationShould.kt index e0bc6a40b0..3919c5c414 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionOrganisationUnitLinkStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionOrganisationUnitLinkStoreIntegrationShould.kt @@ -39,7 +39,7 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class CategoryOptionOrganisationUnitLinkStoreIntegrationShould : LinkStoreAbstractIntegrationShould( - CategoryOptionOrganisationUnitLinkStore.create(TestDatabaseAdapterFactory.get()), + CategoryOptionOrganisationUnitLinkStoreImpl(TestDatabaseAdapterFactory.get()), CategoryOptionOrganisationUnitLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreIntegrationShould.java index c388bc97bd..86aac9b21c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreIntegrationShould.java @@ -34,7 +34,7 @@ import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.option.OptionSet; import org.hisp.dhis.android.core.option.OptionSetTableInfo; -import org.hisp.dhis.android.core.option.internal.OptionSetStore; +import org.hisp.dhis.android.core.option.internal.OptionSetStoreImpl; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Before; import org.junit.Test; @@ -59,7 +59,7 @@ public void setUp() throws IOException { super.setUp(); this.optionSet = StoreMocks.generateOptionSet(); this.updatedOptionSet = StoreMocks.generateUpdatedOptionSet(); - this.store = OptionSetStore.create(databaseAdapter()); + this.store = new OptionSetStoreImpl(databaseAdapter()); } private Cursor getCursor() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ObjectStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ObjectStoreIntegrationShould.java index 0cddec6e6a..34359a3340 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ObjectStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ObjectStoreIntegrationShould.java @@ -34,7 +34,7 @@ import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.option.OptionSet; import org.hisp.dhis.android.core.option.OptionSetTableInfo; -import org.hisp.dhis.android.core.option.internal.OptionSetStore; +import org.hisp.dhis.android.core.option.internal.OptionSetStoreImpl; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Before; import org.junit.Test; @@ -56,7 +56,7 @@ public class ObjectStoreIntegrationShould extends BaseIntegrationTestWithDatabas public void setUp() throws IOException { super.setUp(); this.optionSet = StoreMocks.generateOptionSet(); - this.store = OptionSetStore.create(databaseAdapter()); + this.store = new OptionSetStoreImpl(databaseAdapter()); } @Test diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStoreIntegrationShould.java index 8f7a762387..dddd4301a5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStoreIntegrationShould.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.common; -import org.hisp.dhis.android.core.common.valuetype.devicerendering.internal.ValueTypeDeviceRenderingStore; +import org.hisp.dhis.android.core.common.valuetype.devicerendering.internal.ValueTypeDeviceRenderingStoreImpl; import org.hisp.dhis.android.core.data.common.ValueTypeDeviceRenderingSamples; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; @@ -40,7 +40,7 @@ public class ValueTypeDeviceRenderingStoreIntegrationShould extends ObjectWithoutUidStoreAbstractIntegrationShould { public ValueTypeDeviceRenderingStoreIntegrationShould() { - super(ValueTypeDeviceRenderingStore.create(TestDatabaseAdapterFactory.get()), + super(new ValueTypeDeviceRenderingStoreImpl(TestDatabaseAdapterFactory.get()), ValueTypeDeviceRenderingTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.kt index 043c100098..3b157e0b2a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.kt @@ -32,28 +32,25 @@ import com.google.common.truth.Truth.assertThat import java.io.IOException import java.text.ParseException import java.util.* -import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore -import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore import org.hisp.dhis.android.core.common.BaseIdentifiableObject import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.enrollment.Enrollment import org.hisp.dhis.android.core.enrollment.EnrollmentCreateProjection import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore -import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl.Companion.create +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl import org.hisp.dhis.android.core.event.EventCreateProjection import org.hisp.dhis.android.core.event.internal.EventStore import org.hisp.dhis.android.core.event.internal.EventStoreImpl import org.hisp.dhis.android.core.maintenance.D2Error import org.hisp.dhis.android.core.relationship.Relationship import org.hisp.dhis.android.core.relationship.RelationshipHelper -import org.hisp.dhis.android.core.relationship.RelationshipType import org.hisp.dhis.android.core.relationship.internal.* import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceCreateProjection import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStore import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStoreImpl -import org.hisp.dhis.android.core.trackedentity.ownership.ProgramOwner import org.hisp.dhis.android.core.trackedentity.ownership.ProgramOwnerStore +import org.hisp.dhis.android.core.trackedentity.ownership.ProgramOwnerStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher import org.junit.Before import org.junit.Test @@ -67,21 +64,21 @@ class DataStatePropagatorIntegrationShould : BaseMockIntegrationTestFullDispatch private lateinit var eventStore: EventStore private lateinit var relationshipStore: RelationshipStore private lateinit var relationshipItemStore: RelationshipItemStore - private lateinit var relationshipTypeStore: IdentifiableObjectStore - private lateinit var programOwnerStore: ObjectWithoutUidStore + private lateinit var relationshipTypeStore: RelationshipTypeStore + private lateinit var programOwnerStore: ProgramOwnerStore private val relationshipType = "WiH6923nMtb" @Before @Throws(IOException::class) fun setUp() { - trackedEntityInstanceStore = TrackedEntityInstanceStoreImpl.create(d2.databaseAdapter()) - enrollmentStore = create(d2.databaseAdapter()) - eventStore = EventStoreImpl.create(d2.databaseAdapter()) - relationshipStore = RelationshipStoreImpl.create(d2.databaseAdapter()) - relationshipItemStore = RelationshipItemStoreImpl.create(d2.databaseAdapter()) - relationshipTypeStore = RelationshipTypeStore.create(d2.databaseAdapter()) - programOwnerStore = ProgramOwnerStore.create(d2.databaseAdapter()) + trackedEntityInstanceStore = TrackedEntityInstanceStoreImpl(d2.databaseAdapter()) + enrollmentStore = EnrollmentStoreImpl(d2.databaseAdapter()) + eventStore = EventStoreImpl(d2.databaseAdapter()) + relationshipStore = RelationshipStoreImpl(d2.databaseAdapter()) + relationshipItemStore = RelationshipItemStoreImpl(d2.databaseAdapter()) + relationshipTypeStore = RelationshipTypeStoreImpl(d2.databaseAdapter()) + programOwnerStore = ProgramOwnerStoreImpl(d2.databaseAdapter()) propagator = DataStatePropagatorImpl( trackedEntityInstanceStore, enrollmentStore, eventStore, diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/ConfigurationStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/ConfigurationStoreIntegrationShould.java index b3e6ce3ea7..ac84f248d3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/ConfigurationStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/ConfigurationStoreIntegrationShould.java @@ -38,7 +38,7 @@ public class ConfigurationStoreIntegrationShould extends ObjectStoreAbstractIntegrationShould { public ConfigurationStoreIntegrationShould() { - super(ConfigurationStore.create(TestDatabaseAdapterFactory.get()), + super(new ConfigurationStoreImpl(TestDatabaseAdapterFactory.get()), ConfigurationTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationMigrationIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationMigrationIntegrationShould.kt index 739ed9796b..e29ea12e96 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationMigrationIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationMigrationIntegrationShould.kt @@ -66,13 +66,13 @@ class DatabaseConfigurationMigrationIntegrationShould { .build() private lateinit var migration: DatabaseConfigurationMigration - private lateinit var databasesConfigurationStore: ObjectKeyValueStore + private lateinit var databasesConfigurationStore: DatabaseConfigurationInsecureStore private lateinit var credentialsSecureStore: CredentialsSecureStore @Before @Throws(IOException::class) fun setUp() { - databasesConfigurationStore = DatabaseConfigurationInsecureStore[insecureStore] + databasesConfigurationStore = DatabaseConfigurationInsecureStoreImpl(insecureStore) credentialsSecureStore = CredentialsSecureStoreImpl(chunkedSecureStore) migration = DatabaseConfigurationMigration( @@ -181,7 +181,7 @@ class DatabaseConfigurationMigrationIntegrationShould { databaseAdapter.execSQL("CREATE TABLE UserCredentials (_id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT)") databaseAdapter.setForeignKeyConstraintsEnabled(false) databaseAdapter.execSQL("INSERT INTO UserCredentials (username) VALUES ('${credentials.username()}')") - val configurationStore = ConfigurationStore.create(databaseAdapter) + val configurationStore = ConfigurationStoreImpl(databaseAdapter) configurationStore.insert(Configuration.forServerUrl(serverUrl)) } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java index 39f3d7ae7e..1e5c163024 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class ConstantStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { public ConstantStoreIntegrationShould() { - super(ConstantStore.create(TestDatabaseAdapterFactory.get()), ConstantTableInfo.TABLE_INFO, + super(new ConstantStoreImpl(TestDatabaseAdapterFactory.get()), ConstantTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java index 96f5684bc8..3f4e979c9f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java @@ -42,7 +42,7 @@ public class DataElementOperandStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { public DataElementOperandStoreIntegrationShould() { - super(DataElementOperandStore.create(TestDatabaseAdapterFactory.get()), DataElementOperandTableInfo.TABLE_INFO, + super(new DataElementOperandStoreImpl(TestDatabaseAdapterFactory.get()), DataElementOperandTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStoreIntegrationShould.java index 2e1d7db62d..6199a1126a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStoreIntegrationShould.java @@ -40,7 +40,7 @@ public class DataElementStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { public DataElementStoreIntegrationShould() { - super(DataElementStore.create(TestDatabaseAdapterFactory.get()), DataElementTableInfo.TABLE_INFO, + super(new DataElementStoreImpl(TestDatabaseAdapterFactory.get()), DataElementTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java index b3cd312839..b5dbf68fc1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java @@ -42,7 +42,7 @@ public class DataInputPeriodLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public DataInputPeriodLinkStoreIntegrationShould() { - super(DataInputPeriodLinkStore.create(TestDatabaseAdapterFactory.get()), DataInputPeriodTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + super(new DataInputPeriodStoreImpl(TestDatabaseAdapterFactory.get()), DataInputPeriodTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } @Override diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java index b8244b8809..3f34068726 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java @@ -47,7 +47,7 @@ public class DataSetCompleteRegistrationPostCallRealIntegrationShould extends Ba @Before public void setUp() { super.setUp(); - dataSetCompleteRegistrationStore = DataSetCompleteRegistrationStoreImpl.create(d2.databaseAdapter()); + dataSetCompleteRegistrationStore = new DataSetCompleteRegistrationStoreImpl(d2.databaseAdapter()); } // commented out since it is a flaky test that works against a real server. diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java index a1b3e858bd..7ef5efa4a9 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould() { - super(DataSetCompulsoryDataElementOperandLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new DataSetCompulsoryDataElementOperandLinkStoreImpl(TestDatabaseAdapterFactory.get()), DataSetCompulsoryDataElementOperandLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java index cd75369b2e..871fc480ed 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java @@ -42,7 +42,7 @@ public class DataSetDataElementLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public DataSetDataElementLinkStoreIntegrationShould() { - super(DataSetDataElementLinkStore.create(TestDatabaseAdapterFactory.get()), DataSetElementLinkTableInfo.TABLE_INFO, + super(new DataSetElementStoreImpl(TestDatabaseAdapterFactory.get()), DataSetElementLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceStoreIntegrationShould.kt index af097e1c93..19a47101b0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetInstanceStoreIntegrationShould.kt @@ -32,6 +32,7 @@ import com.google.common.truth.Truth.assertThat import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.datavalue.DataValue import org.hisp.dhis.android.core.datavalue.internal.DataValueStore +import org.hisp.dhis.android.core.datavalue.internal.DataValueStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataDispatcher import org.junit.After import org.junit.Before @@ -39,13 +40,13 @@ import org.junit.Test class DataSetInstanceStoreIntegrationShould : BaseMockIntegrationTestMetadataDispatcher() { - private lateinit var dataSetInstanceStore: DataSetInstanceStore + private lateinit var dataSetInstanceStore: DataSetInstanceStoreImpl private lateinit var dataValueStore: DataValueStore @Before fun setUp() { - dataSetInstanceStore = DataSetInstanceStore.create(databaseAdapter) - dataValueStore = DataValueStore.create(databaseAdapter) + dataSetInstanceStore = DataSetInstanceStoreImpl(databaseAdapter) + dataValueStore = DataValueStoreImpl(databaseAdapter) dataValueStore.delete() } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java index 367250a0ac..0e86a1cdcb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class DataSetOrganisationUnitLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public DataSetOrganisationUnitLinkStoreIntegrationShould() { - super(DataSetOrganisationUnitLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new DataSetOrganisationUnitLinkStoreImpl(TestDatabaseAdapterFactory.get()), DataSetOrganisationUnitLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java index 272bf82c47..7caff0021e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java @@ -40,7 +40,7 @@ public class DataSetStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { public DataSetStoreIntegrationShould() { - super(DataSetStore.create(TestDatabaseAdapterFactory.get()), DataSetTableInfo.TABLE_INFO, + super(new DataSetStoreImpl(TestDatabaseAdapterFactory.get()), DataSetTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java index dde4e9b02f..c304292d5b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class SectionDataElementLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public SectionDataElementLinkStoreIntegrationShould() { - super(SectionDataElementLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new SectionDataElementLinkStoreImpl(TestDatabaseAdapterFactory.get()), SectionDataElementLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java index 66cb03861b..5c924faa28 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class SectionGreyedFieldsLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public SectionGreyedFieldsLinkStoreIntegrationShould() { - super(SectionGreyedFieldsLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new SectionGreyedFieldsLinkStoreImpl(TestDatabaseAdapterFactory.get()), SectionGreyedFieldsLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionIndicatorLinkStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionIndicatorLinkStoreIntegrationShould.kt index d2113db7d5..434782eaf6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionIndicatorLinkStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionIndicatorLinkStoreIntegrationShould.kt @@ -30,14 +30,13 @@ package org.hisp.dhis.android.core.dataset.internal import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould import org.hisp.dhis.android.core.data.dataset.SectionIndicatorLinkSamples import org.hisp.dhis.android.core.dataset.SectionIndicatorLinkTableInfo -import org.hisp.dhis.android.core.dataset.internal.SectionIndicatorLinkStore.create import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class SectionIndicatorLinkStoreIntegrationShould : LinkStoreAbstractIntegrationShould( - create(TestDatabaseAdapterFactory.get()), + SectionIndicatorLinkStoreImpl(TestDatabaseAdapterFactory.get()), SectionIndicatorLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java index c3c562ae94..def633b006 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java @@ -40,7 +40,7 @@ public class SectionStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould

{ public SectionStoreIntegrationShould() { - super(SectionStore.create(TestDatabaseAdapterFactory.get()), SectionTableInfo.TABLE_INFO, + super(new SectionStoreImpl(TestDatabaseAdapterFactory.get()), SectionTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/DataStoreEntryStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/DataStoreEntryStoreIntegrationShould.kt index c6396f6e0b..0670ab4666 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/DataStoreEntryStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/DataStoreEntryStoreIntegrationShould.kt @@ -29,14 +29,14 @@ package org.hisp.dhis.android.core.datastore import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould import org.hisp.dhis.android.core.data.datastore.DataStoreEntrySamples -import org.hisp.dhis.android.core.datastore.internal.DataStoreEntryStoreImpl.Companion.create +import org.hisp.dhis.android.core.datastore.internal.DataStoreEntryStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class DataStoreEntryStoreIntegrationShould : ObjectWithoutUidStoreAbstractIntegrationShould( - create(TestDatabaseAdapterFactory.get()), + DataStoreEntryStoreImpl(TestDatabaseAdapterFactory.get()), DataStoreEntryTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/LocalDataStoreStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/LocalDataStoreStoreIntegrationShould.kt index a9f79f10d7..71463d8160 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/LocalDataStoreStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/LocalDataStoreStoreIntegrationShould.kt @@ -29,14 +29,14 @@ package org.hisp.dhis.android.core.datastore import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould import org.hisp.dhis.android.core.data.datastore.KeyValuePairSamples.keyValuePairSample -import org.hisp.dhis.android.core.datastore.internal.LocalDataStoreStore.create +import org.hisp.dhis.android.core.datastore.internal.LocalDataStoreStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class LocalDataStoreStoreIntegrationShould : ObjectWithoutUidStoreAbstractIntegrationShould( - create(TestDatabaseAdapterFactory.get()), + LocalDataStoreStoreImpl(TestDatabaseAdapterFactory.get()), LocalDataStoreTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/internal/DataStorePostCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/internal/DataStorePostCallMockIntegrationShould.kt index f72e5acd07..f311e54fb9 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/internal/DataStorePostCallMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datastore/internal/DataStorePostCallMockIntegrationShould.kt @@ -119,7 +119,7 @@ class DataStorePostCallMockIntegrationShould : BaseMockIntegrationTestMetadataEn private fun setState(state: State) { val entries = d2.dataStoreModule().dataStore().blockingGet() - val store = DataStoreEntryStoreImpl.create(databaseAdapter) + val store = DataStoreEntryStoreImpl(databaseAdapter) entries.forEach { store.setState(it, state) } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueConflictStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueConflictStoreIntegrationShould.kt index fa8a42b3d7..a657152d57 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueConflictStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueConflictStoreIntegrationShould.kt @@ -38,7 +38,7 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class DataValueConflictStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( - DataValueConflictStore.create(TestDatabaseAdapterFactory.get()), + DataValueConflictStoreImpl(TestDatabaseAdapterFactory.get()), DataValueConflictTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.kt index a0222dda4a..410a243937 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.kt @@ -31,8 +31,6 @@ import kotlinx.coroutines.runBlocking import org.hisp.dhis.android.core.BaseRealIntegrationTest import org.hisp.dhis.android.core.arch.api.executors.internal.APIDownloader import org.hisp.dhis.android.core.arch.api.executors.internal.APIDownloaderImpl -import org.hisp.dhis.android.core.arch.handlers.internal.Handler -import org.hisp.dhis.android.core.arch.handlers.internal.ObjectWithoutUidHandlerImpl import org.hisp.dhis.android.core.data.datavalue.DataValueUtils import org.hisp.dhis.android.core.datavalue.DataValue import org.hisp.dhis.android.core.domain.aggregated.data.internal.AggregatedDataCallBundle @@ -64,9 +62,7 @@ class DataValueEndpointCallRealIntegrationShould : BaseRealIntegrationTest() { } private suspend fun download(): List { - val dataValueHandler: Handler = ObjectWithoutUidHandlerImpl( - DataValueStore.create(d2.databaseAdapter()) - ) + val dataValueHandler = DataValueHandler(DataValueStoreImpl(d2.databaseAdapter())) val key = AggregatedDataCallBundleKey( periodType = PeriodType.Daily, diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java index 88ad61016d..0ab2486050 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java @@ -42,7 +42,7 @@ public class DataValuePostCallRealIntegrationShould extends BaseRealIntegrationT @Before public void setUp() { super.setUp(); - dataValueStore = DataValueStore.create(d2.databaseAdapter()); + dataValueStore = new DataValueStoreImpl(d2.databaseAdapter()); } // commented out since it is a flaky test that works against a real server. diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreIntegrationShould.kt index c148e95a08..dc012f193e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreIntegrationShould.kt @@ -28,7 +28,6 @@ package org.hisp.dhis.android.core.domain.aggregated.data.internal import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould -import org.hisp.dhis.android.core.domain.aggregated.data.internal.AggregatedDataSyncStore.create import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.runner.RunWith @@ -36,7 +35,7 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) internal class AggregatedDataSyncStoreIntegrationShould : ObjectWithoutUidStoreAbstractIntegrationShould( - create(TestDatabaseAdapterFactory.get()), + AggregatedDataSyncStoreImpl(TestDatabaseAdapterFactory.get()), AggregatedDataSyncTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java index fc48f931bf..f2dc3cf557 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class EnrollmentStoreIntegrationShould extends IdentifiableDataObjectStoreAbstractIntegrationShould { public EnrollmentStoreIntegrationShould() { - super(EnrollmentStoreImpl.create(TestDatabaseAdapterFactory.get()), + super(new EnrollmentStoreImpl(TestDatabaseAdapterFactory.get()), EnrollmentTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventWithLimitCallBaseMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventWithLimitCallBaseMockIntegrationShould.kt index eb5eb0f2ee..35ec4d7855 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventWithLimitCallBaseMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventWithLimitCallBaseMockIntegrationShould.kt @@ -30,7 +30,7 @@ package org.hisp.dhis.android.core.event import com.google.common.truth.Truth.assertThat import org.hisp.dhis.android.core.event.internal.EventStoreImpl import org.hisp.dhis.android.core.settings.SynchronizationSettings -import org.hisp.dhis.android.core.settings.internal.SynchronizationSettingStore +import org.hisp.dhis.android.core.settings.internal.SynchronizationSettingStoreImpl import org.hisp.dhis.android.core.tracker.TrackerExporterVersion import org.hisp.dhis.android.core.tracker.TrackerImporterVersion import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable @@ -46,7 +46,7 @@ abstract class EventWithLimitCallBaseMockIntegrationShould : BaseMockIntegration abstract val downloadEventsByUidLimitedByOneFile: String private lateinit var initSyncParams: SynchronizationSettings - private val syncStore = SynchronizationSettingStore.create(databaseAdapter) + private val syncStore = SynchronizationSettingStoreImpl(databaseAdapter) @Before fun setUp() { @@ -70,7 +70,7 @@ abstract class EventWithLimitCallBaseMockIntegrationShould : BaseMockIntegration dhis2MockServer.enqueueSystemInfoResponse() dhis2MockServer.enqueueMockResponse(downloadEventsFile) d2.eventModule().eventDownloader().limit(eventLimitByOrgUnit).blockingDownload() - val eventStore = EventStoreImpl.create(databaseAdapter) + val eventStore = EventStoreImpl(databaseAdapter) val downloadedEvents = eventStore.querySingleEvents() assertThat(downloadedEvents.size).isEqualTo(eventLimitByOrgUnit) } @@ -85,7 +85,7 @@ abstract class EventWithLimitCallBaseMockIntegrationShould : BaseMockIntegration .`in`("wAiGPfJGMxt", "PpNGhvEYnXe") .limit(eventLimitByOrgUnit) .blockingDownload() - val eventStore = EventStoreImpl.create(databaseAdapter) + val eventStore = EventStoreImpl(databaseAdapter) val downloadedEvents = eventStore.querySingleEvents() assertThat(downloadedEvents.size).isEqualTo(eventLimitByOrgUnit) } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDataFilterStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDataFilterStoreIntegrationShould.kt index d718c5e876..c80f03b497 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDataFilterStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDataFilterStoreIntegrationShould.kt @@ -31,14 +31,13 @@ import org.hisp.dhis.android.core.common.tableinfo.ItemFilterTableInfo import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould import org.hisp.dhis.android.core.data.event.EventDataFilterSamples import org.hisp.dhis.android.core.event.EventDataFilter -import org.hisp.dhis.android.core.event.internal.EventDataFilterStore.create import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class EventDataFilterStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( - create(TestDatabaseAdapterFactory.get()), + EventDataFilterStoreImpl(TestDatabaseAdapterFactory.get()), ItemFilterTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallBaseMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallBaseMockIntegrationShould.kt index 32613d0827..228dcc2fa0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallBaseMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallBaseMockIntegrationShould.kt @@ -31,7 +31,7 @@ import com.google.common.truth.Truth.assertThat import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.event.EventStatus import org.hisp.dhis.android.core.settings.SynchronizationSettings -import org.hisp.dhis.android.core.settings.internal.SynchronizationSettingStore +import org.hisp.dhis.android.core.settings.internal.SynchronizationSettingStoreImpl import org.hisp.dhis.android.core.tracker.TrackerExporterVersion import org.hisp.dhis.android.core.tracker.TrackerImporterVersion import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable @@ -48,7 +48,7 @@ abstract class EventEndpointCallBaseMockIntegrationShould : BaseMockIntegrationT abstract val eventsWithUids: String private lateinit var initSyncParams: SynchronizationSettings - private val syncStore = SynchronizationSettingStore.create(databaseAdapter) + private val syncStore = SynchronizationSettingStoreImpl(databaseAdapter) @Before fun setUp() { @@ -97,7 +97,7 @@ abstract class EventEndpointCallBaseMockIntegrationShould : BaseMockIntegrationT val event = events[0] assertThat(event.uid()).isEqualTo("V1CerIi3sdL") assertThat(events.size).isEqualTo(1) - EventStoreImpl.create(d2.databaseAdapter()).update( + EventStoreImpl(d2.databaseAdapter()).update( event.toBuilder() .syncState(state) .aggregatedSyncState(state) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.kt index 077c9381b4..1cdb13ec2d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.kt @@ -30,7 +30,6 @@ package org.hisp.dhis.android.core.event.internal import com.google.common.truth.Truth.assertThat import org.hisp.dhis.android.core.BaseRealIntegrationTest import org.hisp.dhis.android.core.event.internal.EventCallFactory.create -import org.hisp.dhis.android.core.event.internal.EventStoreImpl.Companion.create import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl class EventEndpointCallRealIntegrationShould : BaseRealIntegrationTest() { @@ -65,20 +64,20 @@ class EventEndpointCallRealIntegrationShould : BaseRealIntegrationTest() { } private fun verifyAtLeastOneEventWithOptionCombo(): Boolean { - val eventStore = create(d2.databaseAdapter()) + val eventStore = EventStoreImpl(d2.databaseAdapter()) val downloadedEvents = eventStore.querySingleEvents() return downloadedEvents.any { it.attributeOptionCombo() != null } } private fun verifyNumberOfDownloadedEvents(numEvents: Int) { - val eventStore = create(d2.databaseAdapter()) + val eventStore = EventStoreImpl(d2.databaseAdapter()) val downloadedEvents = eventStore.querySingleEvents() assertThat(downloadedEvents.size).isEqualTo(numEvents) } private fun verifyNumberOfDownloadedTrackedEntityDataValue(num: Int) { - val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl.create(d2.databaseAdapter()) + val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl(d2.databaseAdapter()) val numPersisted = trackedEntityDataValueStore.selectAll().size assertThat(numPersisted).isEqualTo(num) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventFilterStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventFilterStoreIntegrationShould.kt index 47448d85f0..159c3629c8 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventFilterStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventFilterStoreIntegrationShould.kt @@ -37,7 +37,7 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) internal class EventFilterStoreIntegrationShould : IdentifiableObjectStoreAbstractIntegrationShould( - EventFilterStore.create(TestDatabaseAdapterFactory.get()), + EventFilterStoreImpl(TestDatabaseAdapterFactory.get()), EventFilterTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { override fun buildObject(): EventFilter { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostBaseMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostBaseMockIntegrationShould.kt index ad9fcbc2ea..2bd41b18bd 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostBaseMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostBaseMockIntegrationShould.kt @@ -31,9 +31,8 @@ import com.google.common.truth.Truth.assertThat import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityDataValueSamples import org.hisp.dhis.android.core.event.Event -import org.hisp.dhis.android.core.event.internal.EventStoreImpl.Companion.create import org.hisp.dhis.android.core.settings.SynchronizationSettings -import org.hisp.dhis.android.core.settings.internal.SynchronizationSettingStore +import org.hisp.dhis.android.core.settings.internal.SynchronizationSettingStoreImpl import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl import org.hisp.dhis.android.core.tracker.TrackerExporterVersion import org.hisp.dhis.android.core.tracker.TrackerImporterVersion @@ -55,7 +54,7 @@ abstract class EventPostBaseMockIntegrationShould : BaseMockIntegrationTestMetad private val event4Id = "event4Id" private lateinit var initSyncParams: SynchronizationSettings - private val syncStore = SynchronizationSettingStore.create(databaseAdapter) + private val syncStore = SynchronizationSettingStoreImpl(databaseAdapter) @Before fun setUp() { @@ -169,7 +168,7 @@ abstract class EventPostBaseMockIntegrationShould : BaseMockIntegrationTestMetad eventStore.insert(event3) eventStore.insert(event4) - val tedvStore = TrackedEntityDataValueStoreImpl.create(databaseAdapter) + val tedvStore = TrackedEntityDataValueStoreImpl(databaseAdapter) tedvStore.insert(dataValue1) tedvStore.insert(dataValue2) tedvStore.insert(dataValue3) @@ -185,9 +184,7 @@ abstract class EventPostBaseMockIntegrationShould : BaseMockIntegrationTestMetad @JvmStatic fun setUpClass() { BaseMockIntegrationTestMetadataEnqueable.setUpClass() - eventStore = create( - objects.databaseAdapter - ) + eventStore = EventStoreImpl(objects.databaseAdapter) } } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.kt index 1c2704302b..39ebd679b9 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.kt @@ -37,7 +37,6 @@ import org.hisp.dhis.android.core.common.State import org.hisp.dhis.android.core.event.Event import org.hisp.dhis.android.core.event.EventCreateProjection import org.hisp.dhis.android.core.event.EventStatus -import org.hisp.dhis.android.core.event.internal.EventStoreImpl.Companion.create import org.hisp.dhis.android.core.program.ProgramType import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStore @@ -59,8 +58,8 @@ class EventPostCallRealIntegrationShould : BaseRealIntegrationTest() { @Before override fun setUp() { super.setUp() - eventStore = create(d2.databaseAdapter()) - trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl.create(d2.databaseAdapter()) + eventStore = EventStoreImpl(d2.databaseAdapter()) + trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl(d2.databaseAdapter()) val uidGenerator: UidGenerator = UidGeneratorImpl() eventUid1 = uidGenerator.generate() eventUid2 = uidGenerator.generate() diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java index f232ba0394..5f92679606 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java @@ -42,7 +42,7 @@ public class EventStoreIntegrationShould extends IdentifiableDataObjectStoreAbstractIntegrationShould { public EventStoreIntegrationShould() { - super(EventStoreImpl.create(TestDatabaseAdapterFactory.get()), + super(new EventStoreImpl(TestDatabaseAdapterFactory.get()), EventTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreIntegrationShould.java index 1424671a59..662311f0c5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreIntegrationShould.java @@ -37,7 +37,7 @@ public class EventSyncStoreIntegrationShould extends ObjectWithoutUidStoreAbstractIntegrationShould { public EventSyncStoreIntegrationShould() { - super(EventSyncStore.create(TestDatabaseAdapterFactory.get()), EventSyncTableInfo.TABLE_INFO, + super(new EventSyncStoreImpl(TestDatabaseAdapterFactory.get()), EventSyncTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/expressiondimensionitem/ExpressionDimensionItemStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/expressiondimensionitem/ExpressionDimensionItemStoreIntegrationShould.kt index d7ac6e7212..1685a9a8f1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/expressiondimensionitem/ExpressionDimensionItemStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/expressiondimensionitem/ExpressionDimensionItemStoreIntegrationShould.kt @@ -29,7 +29,7 @@ package org.hisp.dhis.android.core.expressiondimensionitem import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould import org.hisp.dhis.android.core.data.expressiondimensionitem.ExpressionDimensionItemSamples -import org.hisp.dhis.android.core.expressiondimensionitem.internal.ExpressionDimensionItemStore +import org.hisp.dhis.android.core.expressiondimensionitem.internal.ExpressionDimensionItemStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.runner.RunWith @@ -37,7 +37,7 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class ExpressionDimensionItemStoreIntegrationShould : IdentifiableObjectStoreAbstractIntegrationShould( - ExpressionDimensionItemStore.create(TestDatabaseAdapterFactory.get()), + ExpressionDimensionItemStoreImpl(TestDatabaseAdapterFactory.get()), ExpressionDimensionItemTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/BaseFileResourceRoutineIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/BaseFileResourceRoutineIntegrationShould.kt index ea927d025b..680e10ecad 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/BaseFileResourceRoutineIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/BaseFileResourceRoutineIntegrationShould.kt @@ -28,19 +28,18 @@ package org.hisp.dhis.android.core.fileresource.internal -import org.hisp.dhis.android.core.category.internal.CategoryComboStore -import org.hisp.dhis.android.core.dataelement.internal.DataElementStore -import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl +import org.hisp.dhis.android.core.category.internal.CategoryComboStoreImpl +import org.hisp.dhis.android.core.dataelement.internal.DataElementStoreImpl import org.hisp.dhis.android.core.event.internal.EventStoreImpl -import org.hisp.dhis.android.core.option.internal.OptionSetStore -import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore -import org.hisp.dhis.android.core.program.internal.ProgramStageStore -import org.hisp.dhis.android.core.program.internal.ProgramStore -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeStore +import org.hisp.dhis.android.core.option.internal.OptionSetStoreImpl +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStoreImpl +import org.hisp.dhis.android.core.program.internal.ProgramStageStoreImpl +import org.hisp.dhis.android.core.program.internal.ProgramStoreImpl +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeStoreImpl import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeValueStoreImpl import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStoreImpl -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityTypeStore +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityTypeStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataDispatcher import org.junit.After import org.junit.Before @@ -48,24 +47,23 @@ import org.junit.Before internal open class BaseFileResourceRoutineIntegrationShould : BaseMockIntegrationTestMetadataDispatcher() { // Data stores - protected val eventStore = EventStoreImpl.create(databaseAdapter) - protected val enrollmentStore = EnrollmentStoreImpl.create(databaseAdapter) - protected val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl.create(databaseAdapter) - protected val trackedEntityAttributeValueStore = TrackedEntityAttributeValueStoreImpl.create(databaseAdapter) - protected val fileResourceStore = FileResourceStoreImpl.create(d2.databaseAdapter()) - private val optionSetStore = OptionSetStore.create(d2.databaseAdapter()) + protected val eventStore = EventStoreImpl(databaseAdapter) + protected val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl(databaseAdapter) + protected val trackedEntityAttributeValueStore = TrackedEntityAttributeValueStoreImpl(databaseAdapter) + protected val fileResourceStore = FileResourceStoreImpl(d2.databaseAdapter()) + private val optionSetStore = OptionSetStoreImpl(d2.databaseAdapter()) // Metadata stores - protected val categoryComboStore = CategoryComboStore.create(databaseAdapter) + protected val categoryComboStore = CategoryComboStoreImpl(databaseAdapter) - protected val dataElementStore = DataElementStore.create(databaseAdapter) - protected val organisationUnitStore = OrganisationUnitStore.create(databaseAdapter) + protected val dataElementStore = DataElementStoreImpl(databaseAdapter) + protected val organisationUnitStore = OrganisationUnitStoreImpl(databaseAdapter) - protected val trackedEntityTypeStore = TrackedEntityTypeStore.create(databaseAdapter) - protected val trackedEntityAttributeStore = TrackedEntityAttributeStore.create(databaseAdapter) - protected val trackedEntityInstanceStore = TrackedEntityInstanceStoreImpl.create(databaseAdapter) - protected val programStore = ProgramStore.create(databaseAdapter) - protected val programStageStore = ProgramStageStore.create(databaseAdapter) + protected val trackedEntityTypeStore = TrackedEntityTypeStoreImpl(databaseAdapter) + protected val trackedEntityAttributeStore = TrackedEntityAttributeStoreImpl(databaseAdapter) + protected val trackedEntityInstanceStore = TrackedEntityInstanceStoreImpl(databaseAdapter) + protected val programStore = ProgramStoreImpl(databaseAdapter) + protected val programStageStore = ProgramStageStoreImpl(databaseAdapter) @Before fun setUp() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStoreIntegrationShould.kt index 9162d954e6..0d76bd8988 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStoreIntegrationShould.kt @@ -37,7 +37,7 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class FileResourceStoreIntegrationShould : IdentifiableObjectStoreAbstractIntegrationShould( - FileResourceStoreImpl.create(TestDatabaseAdapterFactory.get()), + FileResourceStoreImpl(TestDatabaseAdapterFactory.get()), FileResourceTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { override fun buildObject(): FileResource { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java index 4ce7a8053e..4c1e38d5be 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class TrackerImportConflictStoreIntegrationShould extends ObjectStoreAbstractIntegrationShould { public TrackerImportConflictStoreIntegrationShould() { - super(TrackerImportConflictStoreImpl.create(TestDatabaseAdapterFactory.get()), + super(new TrackerImportConflictStoreImpl(TestDatabaseAdapterFactory.get()), TrackerImportConflictTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java index 1f7c60c84c..2e054a2ffc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java @@ -41,7 +41,7 @@ public class DataSetIndicatorLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public DataSetIndicatorLinkStoreIntegrationShould() { - super(DataSetIndicatorLinkStore.create(TestDatabaseAdapterFactory.get()), + super(DataSetIndicatorLinkStoreImpl.create(TestDatabaseAdapterFactory.get()), DataSetIndicatorLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt index 85a05d0b6a..ce35b6d70f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.kt @@ -36,7 +36,7 @@ import org.hisp.dhis.android.core.indicator.IndicatorTableInfo import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory class IndicatorStoreIntegrationShould : IdentifiableObjectStoreAbstractIntegrationShould( - IndicatorStore.create(TestDatabaseAdapterFactory.get()), + IndicatorStoreImpl.create(TestDatabaseAdapterFactory.get()), IndicatorTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/DataElementLegendSetLinkStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/DataElementLegendSetLinkStoreIntegrationShould.kt index d387889cbf..8f6dc370fc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/DataElementLegendSetLinkStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/DataElementLegendSetLinkStoreIntegrationShould.kt @@ -29,7 +29,7 @@ package org.hisp.dhis.android.core.legendset import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould import org.hisp.dhis.android.core.data.legendset.DataElementLegendSetLinkSamples -import org.hisp.dhis.android.core.legendset.internal.DataElementLegendSetLinkStore +import org.hisp.dhis.android.core.legendset.internal.DataElementLegendSetLinkStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.runner.RunWith @@ -37,7 +37,7 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class DataElementLegendSetLinkStoreIntegrationShould : LinkStoreAbstractIntegrationShould( - DataElementLegendSetLinkStore.create(TestDatabaseAdapterFactory.get()), + DataElementLegendSetLinkStoreImpl(TestDatabaseAdapterFactory.get()), DataElementLegendSetLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() ) { override fun addMasterUid(): String { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/IndicatorLegendSetLinkStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/IndicatorLegendSetLinkStoreIntegrationShould.kt index 0bef7afc44..b62ef49d9c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/IndicatorLegendSetLinkStoreIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/IndicatorLegendSetLinkStoreIntegrationShould.kt @@ -31,7 +31,7 @@ package org.hisp.dhis.android.core.legendset import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould import org.hisp.dhis.android.core.data.legendset.IndicatorLegendSetLinkSamples import org.hisp.dhis.android.core.indicator.IndicatorLegendSetLinkTableInfo -import org.hisp.dhis.android.core.legendset.internal.IndicatorLegendSetLinkStore +import org.hisp.dhis.android.core.legendset.internal.IndicatorLegendSetLinkStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.runner.RunWith @@ -39,8 +39,9 @@ import org.junit.runner.RunWith @RunWith(D2JunitRunner::class) class IndicatorLegendSetLinkStoreIntegrationShould : LinkStoreAbstractIntegrationShould( - IndicatorLegendSetLinkStore.create(TestDatabaseAdapterFactory.get()), - IndicatorLegendSetLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() + IndicatorLegendSetLinkStoreImpl(TestDatabaseAdapterFactory.get()), + IndicatorLegendSetLinkTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() ) { override fun addMasterUid(): String { return IndicatorLegendSetLinkSamples.getIndicatorLegendSetLink().indicator()!! diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStoreIntegrationShould.java index 71d9a95bec..735ca31e49 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStoreIntegrationShould.java @@ -30,7 +30,7 @@ import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.legendset.ProgramIndicatorLegendSetLinkSamples; -import org.hisp.dhis.android.core.legendset.internal.ProgramIndicatorLegendSetLinkStore; +import org.hisp.dhis.android.core.legendset.internal.ProgramIndicatorLegendSetLinkStoreImpl; import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.runner.RunWith; @@ -40,7 +40,7 @@ public class ProgramIndicatorLegendSetLinkStoreIntegrationShould extends LinkStoreAbstractIntegrationShould { public ProgramIndicatorLegendSetLinkStoreIntegrationShould() { - super(ProgramIndicatorLegendSetLinkStore.create(TestDatabaseAdapterFactory.get()), + super(new ProgramIndicatorLegendSetLinkStoreImpl(TestDatabaseAdapterFactory.get()), ProgramIndicatorLegendSetLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java index 76c7351a33..6673247c0f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java @@ -40,7 +40,8 @@ public class LegendSetStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { public LegendSetStoreIntegrationShould() { - super(LegendSetStore.create(TestDatabaseAdapterFactory.get()), LegendSetTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + super(new LegendSetStoreImpl(TestDatabaseAdapterFactory.get()), + LegendSetTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } @Override diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java index 866f0376c5..00bbeb8a1a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java @@ -41,7 +41,8 @@ public class LegendStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { public LegendStoreIntegrationShould() { - super(LegendStore.create(TestDatabaseAdapterFactory.get()), LegendTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + super(new LegendStoreImpl(TestDatabaseAdapterFactory.get()), + LegendTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } @Override diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java index cd8d728795..b2b85c7027 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java @@ -40,7 +40,7 @@ public class D2ErrorStoreIntegrationShould extends ObjectStoreAbstractIntegrationShould { public D2ErrorStoreIntegrationShould() { - super(D2ErrorStore.create(TestDatabaseAdapterFactory.get()), + super(new D2ErrorStoreImpl(TestDatabaseAdapterFactory.get()), D2ErrorTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.kt index 8c75d3402b..d3bb701c34 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.kt @@ -38,12 +38,12 @@ import org.hisp.dhis.android.core.maintenance.ForeignKeyViolationTableInfo import org.hisp.dhis.android.core.option.Option import org.hisp.dhis.android.core.option.OptionSetTableInfo import org.hisp.dhis.android.core.option.OptionTableInfo -import org.hisp.dhis.android.core.option.internal.OptionStore +import org.hisp.dhis.android.core.option.internal.OptionStoreImpl import org.hisp.dhis.android.core.program.ProgramRule import org.hisp.dhis.android.core.program.ProgramRuleAction import org.hisp.dhis.android.core.program.ProgramRuleActionType -import org.hisp.dhis.android.core.program.internal.ProgramRuleActionStore -import org.hisp.dhis.android.core.program.internal.ProgramRuleStore +import org.hisp.dhis.android.core.program.internal.ProgramRuleActionStoreImpl +import org.hisp.dhis.android.core.program.internal.ProgramRuleStoreImpl import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyDispatcher import org.junit.Before import org.junit.Test @@ -92,7 +92,7 @@ class ForeignKeyCleanerShould : BaseMockIntegrationTestEmptyDispatcher() { val PROGRAM_RULE_UID = "program_rule_uid" val program = ObjectWithUid.create("nonexisent-program") executor.executeD2CallTransactionally { - ProgramRuleStore.create(d2.databaseAdapter()).insert( + ProgramRuleStoreImpl(d2.databaseAdapter()).insert( ProgramRule.builder() .uid(PROGRAM_RULE_UID).name("Rule").program(program).build() ) @@ -102,7 +102,7 @@ class ForeignKeyCleanerShould : BaseMockIntegrationTestEmptyDispatcher() { .programRuleActionType(ProgramRuleActionType.ASSIGN) .programRule(ObjectWithUid.create(PROGRAM_RULE_UID)) .build() - ProgramRuleActionStore.create(d2.databaseAdapter()).insert(programRuleAction) + ProgramRuleActionStoreImpl(d2.databaseAdapter()).insert(programRuleAction) assertThat(d2.programModule().programRules().blockingCount()).isEqualTo(1) assertThat(d2.programModule().programRuleActions().blockingCount()).isEqualTo(1) val foreignKeyCleaner = ForeignKeyCleanerImpl.create(d2.databaseAdapter()) @@ -124,7 +124,7 @@ class ForeignKeyCleanerShould : BaseMockIntegrationTestEmptyDispatcher() { .optionSet(optionSet) .build() val optionStore: IdentifiableObjectStore