diff --git a/.buildscript/deploy.sh b/.buildscript/deploy.sh index 227e4d7cea..fd8a338202 100755 --- a/.buildscript/deploy.sh +++ b/.buildscript/deploy.sh @@ -7,7 +7,8 @@ SLUG="dhis2/dhis2-android-sdk" JDK="oraclejdk8" -BRANCH="master" +MASTER_BRANCH="master" +MASTERDEV_BRANCH="master-dev" set -e @@ -17,8 +18,8 @@ elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'." elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "Skipping snapshot deployment: was pull request." -elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then - echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'." +elif [ "$TRAVIS_BRANCH" != "$MASTER_BRANCH" ] && [ "$TRAVIS_BRANCH" != "$MASTERDEV_BRANCH" ]; then + echo "Skipping snapshot deployment: wrong branch. Expected '$MASTER_BRANCH' or '$MASTERDEV_BRANCH' but was '$TRAVIS_BRANCH'." else echo "Deploying snapshot..." ./gradlew uploadArchives -PNEXUS_USERNAME="${NEXUS_USERNAME}" -PNEXUS_PASSWORD="${NEXUS_PASSWORD}" diff --git a/.travis.yml b/.travis.yml index 7fea76e8cb..33495f66de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ branches: - master - develop - master-sms + - master-dev script: - travis_wait 70 "./build.sh" diff --git a/build.sh b/build.sh index f5b5533354..6c97ecaa46 100755 --- a/build.sh +++ b/build.sh @@ -6,4 +6,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PROJECT_DIR=$DIR/ # This will: compile the project, run lint, run tests under JVM, package apk, check the code quality and run tests on the device/emulator. -"$PROJECT_DIR"/gradlew clean build --scan connectedAndroidTest \ No newline at end of file +"$PROJECT_DIR"/gradlew clean checkstyleDebug findbugsDebug pmdDebug lintDebug testDebug connectedDebugAndroidTest --scan \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle index d220081618..c24bf35a44 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -36,8 +36,8 @@ ext { buildToolsVersion: "28.0.3", minSdkVersion : 19, targetSdkVersion : 28, - versionCode : 135, - versionName : "0.16.4-SNAPSHOT" + versionCode : 171, + versionName : "0.17.1-SNAPSHOT" ] libraries = [ @@ -193,7 +193,7 @@ dependencies { api "joda-time:joda-time:2.9.9" // sms compression library - api 'com.github.eHealthAfrica:dhis2-sms-compression:0.0.9' + api 'com.github.eHealthAfrica:dhis2-sms-compression:0.0.12' // Extension which generates mappers for work with cursor and content values api "com.gabrielittner.auto.value:auto-value-cursor-annotations:${libraries.autovaluecursor}" diff --git a/core/gradle.properties b/core/gradle.properties index 71425303c0..4e783dfa5b 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=0.16.4-SNAPSHOT -VERSION_CODE=135 +VERSION_NAME=0.17.1-SNAPSHOT +VERSION_CODE=171 GROUP=org.hisp.dhis diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.java index 97cece2dd6..3baaedaca4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.java @@ -29,8 +29,8 @@ package org.hisp.dhis.android.core; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventStore; -import org.hisp.dhis.android.core.event.EventStoreImpl; +import org.hisp.dhis.android.core.event.internal.EventStore; +import org.hisp.dhis.android.core.event.internal.EventStoreImpl; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/MetadataCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/MetadataCallRealIntegrationShould.java index d700825037..49401abf1f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/MetadataCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/MetadataCallRealIntegrationShould.java @@ -28,13 +28,17 @@ package org.hisp.dhis.android.core; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import android.util.Log; + +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; +import io.reactivex.schedulers.Schedulers; + public class MetadataCallRealIntegrationShould extends BaseRealIntegrationTest { /** * A quick integration test that is probably flaky, but will help with finding bugs related to @@ -73,9 +77,9 @@ make a debugger break point where desired (after sync complete) //Uncomment in order to quickly test changes vs a real server, but keep it uncommented after. //@Test public void response_successful_on_sync_meta_data_once() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); //TODO: add aditional sync + break point. //when debugger stops at the new break point manually change metadata online & resume. @@ -84,32 +88,42 @@ public void response_successful_on_sync_meta_data_once() throws Exception { // adding a new program..etc. } + //@Test + public void download_metadata_in_io_scheduler() throws Exception { + d2.userModule().logIn("android", "Android123") + .flatMapObservable(user -> d2.syncMetaData()) + .subscribeOn(Schedulers.io()) + .subscribe(progress -> Log.i("META", progress.lastCall())); + + Thread.sleep(60000); + } + //@Test public void response_successful_on_sync_meta_data_two_times() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); //first sync: - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); //second sync: - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); } //@Test public void response_successful_on_login_wipe_db_and_login() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); d2.wipeModule().wipeEverything(); - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); } //@Test public void response_successful_on_login_logout_and_login() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.userModule().logOut().call(); + d2.userModule().logOut().blockingAwait(); - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/TeisCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/TeisCallRealIntegrationShould.java index 8109bb7757..3fe32c3c80 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/TeisCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/TeisCallRealIntegrationShould.java @@ -31,10 +31,10 @@ import android.util.Log; import org.hisp.dhis.android.core.arch.call.D2Progress; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -57,12 +57,11 @@ public void setUp() throws IOException { //@Test public void download_tracked_entity_instances() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); TestObserver testObserver = d2.trackedEntityModule().downloadTrackedEntityInstances(5, false, false) - .asObservable() .doOnEach(e -> Log.w("EVENT", e.toString())) .test(); @@ -71,5 +70,7 @@ public void download_tracked_entity_instances() throws Exception { int count = TrackedEntityInstanceStoreImpl.create(databaseAdapter()).count(); assertThat(count >= 5).isTrue(); + + testObserver.dispose(); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/UserAuthenticateCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/UserAuthenticateCallRealIntegrationShould.java index 71aa99cc65..f80370d894 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/UserAuthenticateCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/UserAuthenticateCallRealIntegrationShould.java @@ -28,9 +28,9 @@ package org.hisp.dhis.android.core; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -49,35 +49,35 @@ public void setUp() throws IOException { //@Test public void not_wipe_after_second_login_with_same_user() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); - d2.userModule().logOut().call(); - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logOut().blockingAwait(); + d2.userModule().logIn("android", "Android123").blockingGet(); } //@Test public void wipe_after_second_login_with_different_user() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); - d2.userModule().logOut().call(); - d2.userModule().logIn("admin", "district").call(); + d2.userModule().logOut().blockingAwait(); + d2.userModule().logIn("admin", "district").blockingGet(); } //@Test public void wipe_after_second_login_with_equivalent_user_in_different_server() throws Exception { d2 = D2Factory.create("https://play.dhis2.org/2.29/api/", databaseAdapter()); - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); d2 = D2Factory.create("https://play.dhis2.org/android-current/api/", databaseAdapter()); - d2.userModule().logOut().call(); - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logOut().blockingAwait(); + d2.userModule().logIn("android", "Android123").blockingGet(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.java index c7a825f3a0..444aa3edea 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.java @@ -30,10 +30,10 @@ import com.jraska.livedata.TestObserver; -import org.hisp.dhis.android.core.arch.db.OrderByClauseBuilder; +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.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Before; @@ -42,7 +42,6 @@ import org.junit.rules.TestRule; import org.junit.runner.RunWith; -import java.util.Collections; import java.util.List; import androidx.arch.core.executor.testing.InstantTaskExecutorRule; @@ -57,7 +56,8 @@ public class PagingMockIntegrationShould extends BaseMockIntegrationTestFullDisp private IdentifiableObjectStore store; private List allValues; - private String orderByClause = OrderByClauseBuilder.orderByFromItems(Collections.emptyList()); + private RepositoryScope empty = RepositoryScope.empty(); + private String orderByClause = OrderByClauseBuilder.orderByFromItems(empty.orderBy(), empty.pagingKey()); @Before public void setUp() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImplIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImplIntegrationShould.java index 9109b27412..43ab60f3dc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImplIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImplIntegrationShould.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.arch.repositories.collection; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; import org.hisp.dhis.android.core.data.relationship.RelationshipTypeSamples; import org.hisp.dhis.android.core.relationship.RelationshipType; import org.hisp.dhis.android.core.relationship.RelationshipTypeCollectionRepository; @@ -59,7 +59,7 @@ public static void setUpClass() throws Exception { typeMap = RelationshipTypeSamples.typeMap(); - SyncHandler handler = objects.d2DIComponent.relationshipTypeHandler(); + Handler handler = objects.d2DIComponent.relationshipTypeHandler(); handler.handle(RELATIONSHIP_TYPE_1); handler.handle(RELATIONSHIP_TYPE_2); @@ -68,7 +68,7 @@ public static void setUpClass() throws Exception { } @Test - public void get_all_relationship_types_without_children_when_calling_get_set() { + public void get_all_relationship_types_without_children_when_calling_get() { List types = relationshipTypeCollectionRepository.get(); assertThat(types.size()).isEqualTo(2); @@ -79,7 +79,18 @@ public void get_all_relationship_types_without_children_when_calling_get_set() { } @Test - public void get_all_relationship_types_with_children_when_calling_get_set_with_children() { + public void get_all_relationship_types_without_children_when_calling_get_async() { + List types = relationshipTypeCollectionRepository.getAsync().blockingGet(); + assertThat(types.size()).isEqualTo(2); + + for (RelationshipType targetType: types) { + RelationshipType referenceType = typeMap.get(targetType.uid()); + assertTypesWithoutConstraints(targetType, referenceType); + } + } + + @Test + public void get_all_relationship_types_with_children_when_calling_get_with_children() { List types = relationshipTypeCollectionRepository.withAllChildren().get(); assertThat(types.size()).isEqualTo(2); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould.java index edc36c15d2..61bc200a77 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.arch.repositories.collection; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyOneObjectRepositoryFinalImpl; import org.hisp.dhis.android.core.relationship.RelationshipType; import org.hisp.dhis.android.core.relationship.RelationshipTypeCollectionRepository; @@ -54,7 +54,7 @@ public class ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould exten public static void setUpClass() throws Exception { BaseMockIntegrationTestEmptyDispatcher.setUpClass(); - SyncHandler handler = objects.d2DIComponent.relationshipTypeHandler(); + Handler handler = objects.d2DIComponent.relationshipTypeHandler(); handler.handle(RELATIONSHIP_TYPE_1); handler.handle(RELATIONSHIP_TYPE_2); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/RelationshipTypeAsserts.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/RelationshipTypeAsserts.java index cc4472600f..74681a8784 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/RelationshipTypeAsserts.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/RelationshipTypeAsserts.java @@ -28,8 +28,8 @@ package org.hisp.dhis.android.core.arch.repositories.collection; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.relationship.RelationshipType; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import static com.google.common.truth.Truth.assertThat; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.java similarity index 90% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.java index b074023b14..d20d607a6b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.java @@ -26,8 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; +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; import org.hisp.dhis.android.core.data.category.CategoryCategoryComboLinkSamples; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStoreShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreShould.java similarity index 88% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStoreShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreShould.java index 1bb4a6faf2..5ecc20a0de 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStoreShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreShould.java @@ -26,12 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; - -import androidx.test.runner.AndroidJUnit4; - -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.LinkModelStore; +package org.hisp.dhis.android.core.category.internal; + +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCategoryComboLink; +import org.hisp.dhis.android.core.category.CategoryCombo; +import org.hisp.dhis.android.core.category.internal.CategoryCategoryComboLinkStore; +import org.hisp.dhis.android.core.category.internal.CategoryComboStore; +import org.hisp.dhis.android.core.category.internal.CategoryStore; import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import org.junit.Test; @@ -42,6 +46,8 @@ import java.util.Date; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static org.junit.Assert.assertEquals; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java similarity index 90% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java index e7a7389686..00dc81cb98 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java @@ -26,11 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLink; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLinkTableInfo; +import org.hisp.dhis.android.core.category.internal.CategoryCategoryOptionLinkStore; import org.hisp.dhis.android.core.data.category.CategoryCategoryOptionLinkSamples; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStoreShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreShould.java similarity index 87% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStoreShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreShould.java index 349671a968..7a5ca9678d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStoreShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreShould.java @@ -26,12 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; - -import androidx.test.runner.AndroidJUnit4; - -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.LinkModelStore; +package org.hisp.dhis.android.core.category.internal; + +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLink; +import org.hisp.dhis.android.core.category.CategoryOption; +import org.hisp.dhis.android.core.category.internal.CategoryCategoryOptionLinkStore; +import org.hisp.dhis.android.core.category.internal.CategoryOptionStore; +import org.hisp.dhis.android.core.category.internal.CategoryStore; import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import org.junit.Test; @@ -41,6 +45,8 @@ import java.util.ArrayList; import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static org.junit.Assert.assertEquals; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryComboEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.java similarity index 90% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryComboEndpointCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.java index d636e42672..63429d7419 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryComboEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.java @@ -26,16 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import com.google.common.collect.Lists; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.category.CategoryCategoryComboLink; +import org.hisp.dhis.android.core.category.CategoryCombo; +import org.hisp.dhis.android.core.category.CategoryOption; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -59,7 +63,7 @@ public void setUp() throws IOException { //@Test public void download_categories_combos_and_relatives() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); d2.databaseAdapter().database().setForeignKeyConstraintsEnabled(false); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryComboUidsSeekerMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeekerMockIntegrationShould.java similarity index 94% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryComboUidsSeekerMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeekerMockIntegrationShould.java index d4b8c39331..a896b9f090 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryComboUidsSeekerMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeekerMockIntegrationShould.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; +import org.hisp.dhis.android.core.category.internal.CategoryComboUidsSeeker; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallRealIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryEndpointCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallRealIntegrationShould.java index 0de5d3680f..66c0d65873 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallRealIntegrationShould.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import com.google.common.collect.Lists; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -56,7 +57,7 @@ public void setUp() throws IOException { //@Test public void call_categories_endpoint() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); Callable> categoryEndpointCall = getD2DIComponent(d2).internalModules().category.categoryCallFactory.create( new HashSet<>(Lists.newArrayList("cX5k9anHEHd"))); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryEndpointCallShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallShould.java similarity index 95% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryEndpointCallShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallShould.java index 9c181df687..9e2c37fcf5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryEndpointCallShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallShould.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import com.google.common.collect.Lists; +import org.hisp.dhis.android.core.category.Category; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java index 6df729ab30..93cdd5c57f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; +import org.hisp.dhis.android.core.category.CategoryOptionComboCategoryOptionLink; +import org.hisp.dhis.android.core.category.CategoryOptionComboCategoryOptionLinkTableInfo; import org.hisp.dhis.android.core.data.category.CategoryOptionComboCategoryOptionLinkSamples; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CreateCategoryComboUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CreateCategoryComboUtils.java similarity index 95% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CreateCategoryComboUtils.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CreateCategoryComboUtils.java index 2ca84de333..324f12648a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CreateCategoryComboUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CreateCategoryComboUtils.java @@ -26,10 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import android.content.ContentValues; +import org.hisp.dhis.android.core.category.CategoryComboTableInfo; + public class CreateCategoryComboUtils { public static final String TEST_CODE = "test_code"; 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 830664f536..559c91e479 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 @@ -30,18 +30,20 @@ import android.database.Cursor; import android.database.sqlite.SQLiteConstraintException; -import androidx.test.runner.AndroidJUnit4; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +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.OptionSetStore; +import org.hisp.dhis.android.core.option.internal.OptionSetStore; import org.hisp.dhis.android.core.option.OptionSetTableInfo; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.io.IOException; +import androidx.test.runner.AndroidJUnit4; + import static org.hisp.dhis.android.core.common.StoreMocks.optionSetCursorAssert; import static org.hisp.dhis.android.core.data.database.CursorAssert.assertThatCursor; 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 97a28bf33b..621efd4931 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 @@ -30,18 +30,20 @@ import android.database.Cursor; import android.database.sqlite.SQLiteConstraintException; -import androidx.test.runner.AndroidJUnit4; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +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.OptionSetStore; +import org.hisp.dhis.android.core.option.internal.OptionSetStore; import org.hisp.dhis.android.core.option.OptionSetTableInfo; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.io.IOException; +import androidx.test.runner.AndroidJUnit4; + import static org.hisp.dhis.android.core.common.StoreMocks.optionSetCursorAssert; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingModelShould.java index 5994a64e05..420ff34b83 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.common; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.ValueTypeDeviceRenderingModel.Columns; import org.hisp.dhis.android.core.utils.ColumnsArrayUtils; @@ -40,6 +39,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.DEVICE_TYPE; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.TABLE; 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 c0d211771e..cffbdcf249 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,9 +28,10 @@ package org.hisp.dhis.android.core.common; +import org.hisp.dhis.android.core.common.valuetype.devicerendering.internal.ValueTypeDeviceRenderingStore; import org.hisp.dhis.android.core.data.common.ValueTypeDeviceRenderingSamples; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/DataStatePropagatorIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.java similarity index 86% rename from core/src/androidTest/java/org/hisp/dhis/android/core/common/DataStatePropagatorIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.java index e8064686b2..11f8888319 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/DataStatePropagatorIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.java @@ -26,22 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.internal; -import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; +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.EnrollmentStore; -import org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl; import org.hisp.dhis.android.core.event.Event; import org.hisp.dhis.android.core.event.EventCreateProjection; -import org.hisp.dhis.android.core.event.EventStore; -import org.hisp.dhis.android.core.event.EventStoreImpl; +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.trackedentity.TrackedEntityDataValue; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceCreateProjection; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl; +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -114,7 +115,17 @@ public void do_not_set_parent_state_to_update_if_has_to_delete_state() throws D2 assertThatDoNotSetTeiToUpdateWhenTrackedEntityDataValuePropagation(State.TO_DELETE); } - public void assertThatSetTeiToUpdateWhenEnrollmentPropagation(State state) throws D2Error { + @Test + public void do_not_fail_with_events_without_registration() throws D2Error { + String eventUid = d2.eventModule().events.add( + EventCreateProjection.create(null, "lxAQ7Zs9VYR", "dBwrot7S420", + "DiszpKrYNg8", "bRowv6yZOF2")); + + assertThat(eventStore.selectByUid(eventUid).state(), is(State.TO_POST)); + eventStore.delete(eventUid); + } + + private void assertThatSetTeiToUpdateWhenEnrollmentPropagation(State state) throws D2Error { String teiUid = d2.trackedEntityModule().trackedEntityInstances.add( TrackedEntityInstanceCreateProjection.create("DiszpKrYNg8", "nEenWmSyUEp")); trackedEntityInstanceStore.setState(teiUid, state); @@ -125,7 +136,7 @@ public void assertThatSetTeiToUpdateWhenEnrollmentPropagation(State state) throw trackedEntityInstanceStore.delete(teiUid); } - public void assertThatDoNotSetTeiToUpdateWhenEnrollmentPropagation(State state) throws D2Error { + private void assertThatDoNotSetTeiToUpdateWhenEnrollmentPropagation(State state) throws D2Error { String teiUid = d2.trackedEntityModule().trackedEntityInstances.add( TrackedEntityInstanceCreateProjection.create("DiszpKrYNg8", "nEenWmSyUEp")); trackedEntityInstanceStore.setState(teiUid, state); @@ -136,7 +147,7 @@ public void assertThatDoNotSetTeiToUpdateWhenEnrollmentPropagation(State state) trackedEntityInstanceStore.delete(teiUid); } - public void assertThatSetTeiToUpdateWhenEventPropagation(State state) throws D2Error { + private void assertThatSetTeiToUpdateWhenEventPropagation(State state) throws D2Error { String teiUid = d2.trackedEntityModule().trackedEntityInstances.add( TrackedEntityInstanceCreateProjection.create("DiszpKrYNg8", "nEenWmSyUEp")); String enrolmentUid = d2.enrollmentModule().enrollments.add(EnrollmentCreateProjection.create( @@ -145,15 +156,14 @@ public void assertThatSetTeiToUpdateWhenEventPropagation(State state) throws D2E trackedEntityInstanceStore.setState(teiUid, state); enrollmentStore.setState(enrolmentUid, state); - propagator.propagateEventUpdate(Event.builder() - .trackedEntityInstance(teiUid).enrollment(enrolmentUid).build()); + propagator.propagateEventUpdate(Event.builder().enrollment(enrolmentUid).build()); assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(State.TO_UPDATE)); assertThat(enrollmentStore.selectByUid(enrolmentUid).state(), is(State.TO_UPDATE)); trackedEntityInstanceStore.delete(teiUid); } - public void assertThatDoNotSetTeiToUpdateWhenEventPropagation(State state) throws D2Error { + private void assertThatDoNotSetTeiToUpdateWhenEventPropagation(State state) throws D2Error { String teiUid = d2.trackedEntityModule().trackedEntityInstances.add( TrackedEntityInstanceCreateProjection.create("DiszpKrYNg8", "nEenWmSyUEp")); String enrolmentUid = d2.enrollmentModule().enrollments.add(EnrollmentCreateProjection.create( @@ -162,15 +172,14 @@ public void assertThatDoNotSetTeiToUpdateWhenEventPropagation(State state) throw trackedEntityInstanceStore.setState(teiUid, state); enrollmentStore.setState(enrolmentUid, state); - propagator.propagateEventUpdate(Event.builder() - .trackedEntityInstance(teiUid).enrollment(enrolmentUid).build()); + propagator.propagateEventUpdate(Event.builder().enrollment(enrolmentUid).build()); assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(state)); assertThat(enrollmentStore.selectByUid(enrolmentUid).state(), is(state)); trackedEntityInstanceStore.delete(teiUid); } - public void assertThatSetTeiToUpdateWhenTrackedEntityDataValuePropagation(State state) throws D2Error { + private void assertThatSetTeiToUpdateWhenTrackedEntityDataValuePropagation(State state) throws D2Error { String teiUid = d2.trackedEntityModule().trackedEntityInstances.add( TrackedEntityInstanceCreateProjection.create("DiszpKrYNg8", "nEenWmSyUEp")); String enrolmentUid = d2.enrollmentModule().enrollments.add(EnrollmentCreateProjection.create( @@ -191,7 +200,7 @@ public void assertThatSetTeiToUpdateWhenTrackedEntityDataValuePropagation(State trackedEntityInstanceStore.delete(teiUid); } - public void assertThatDoNotSetTeiToUpdateWhenTrackedEntityDataValuePropagation(State state) throws D2Error { + private void assertThatDoNotSetTeiToUpdateWhenTrackedEntityDataValuePropagation(State state) throws D2Error { String teiUid = d2.trackedEntityModule().trackedEntityInstances.add( TrackedEntityInstanceCreateProjection.create("DiszpKrYNg8", "nEenWmSyUEp")); String enrolmentUid = d2.enrollmentModule().enrollments.add(EnrollmentCreateProjection.create( diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/ConfigurationModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/ConfigurationModelShould.java index c18fca540f..da42ce22a0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/ConfigurationModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/ConfigurationModelShould.java @@ -30,12 +30,12 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.configuration.ConfigurationModel.Columns; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; import okhttp3.HttpUrl; import static com.google.common.truth.Truth.assertThat; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/ConfigurationStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/ConfigurationStoreIntegrationShould.java index 0b97bcc42b..e23456ba75 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/ConfigurationStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/ConfigurationStoreIntegrationShould.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.configuration; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.data.configuration.ConfigurationSamples; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/constant/ConstantStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/constant/ConstantStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java index 6ecd994d57..c7f0b83e70 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/constant/ConstantStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.constant; +package org.hisp.dhis.android.core.constant.internal; +import org.hisp.dhis.android.core.constant.Constant; +import org.hisp.dhis.android.core.constant.ConstantTableInfo; import org.hisp.dhis.android.core.data.constant.ConstantSamples; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/D2Factory.java b/core/src/androidTest/java/org/hisp/dhis/android/core/d2manager/D2Factory.java similarity index 81% rename from core/src/androidTest/java/org/hisp/dhis/android/core/common/D2Factory.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/d2manager/D2Factory.java index ed07979e53..113d7083bd 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/D2Factory.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/d2manager/D2Factory.java @@ -26,18 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.d2manager; import android.content.Context; import com.facebook.stetho.okhttp3.StethoInterceptor; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.arch.api.retrofit.PreventURLDecodeInterceptor; +import org.hisp.dhis.android.core.arch.api.authentication.internal.BasicAuthenticatorFactory; +import org.hisp.dhis.android.core.arch.api.internal.PreventURLDecodeInterceptor; import org.hisp.dhis.android.core.configuration.Configuration; -import org.hisp.dhis.android.core.d2manager.D2Configuration; -import org.hisp.dhis.android.core.d2manager.D2Manager; -import org.hisp.dhis.android.core.data.api.BasicAuthenticatorFactory; +import org.hisp.dhis.android.core.configuration.ServerUrlParser; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.Collections; @@ -49,13 +48,12 @@ public class D2Factory { - public static D2 create(String urlWithoutAPI, String databaseName) { + public static D2 create(String serverUrl, String databaseName) { Context context = InstrumentationRegistry.getTargetContext().getApplicationContext(); HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); D2Configuration d2Configuration = D2Configuration.builder() - .databaseName(databaseName) .appName("d2_integration_tests") .appVersion("1.0.0") .readTimeoutInSeconds(30) @@ -66,18 +64,22 @@ public static D2 create(String urlWithoutAPI, String databaseName) { .context(context) .build(); - D2Manager d2Manager = new D2Manager(d2Configuration); + D2Manager.setDatabaseName(databaseName); - if (!d2Manager.isD2Configured()) { - d2Manager.configureD2(urlWithoutAPI); - } + D2 d2 = D2Manager.setUp(d2Configuration) + .andThen(D2Manager.setServerUrl(serverUrl)) + .andThen(D2Manager.instantiateD2()) + .blockingGet(); - return d2Manager.getD2(); + D2Manager.clear(); + D2Manager.setDatabaseName(null); + + return d2; } - public static D2 create(String urlWithoutAPI, DatabaseAdapter databaseAdapter) { + public static D2 create(String url, DatabaseAdapter databaseAdapter) { return new D2.Builder() - .configuration(Configuration.forServerUrlStringWithoutAPI(urlWithoutAPI)) + .configuration(Configuration.forServerUrl(ServerUrlParser.parse(url))) .databaseAdapter(databaseAdapter) .okHttpClient(okHttpClient(databaseAdapter)) .context(InstrumentationRegistry.getTargetContext().getApplicationContext()) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/d2manager/D2ManagerRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/d2manager/D2ManagerRealIntegrationShould.java index 4f90eefdd4..e67b0a858a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/d2manager/D2ManagerRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/d2manager/D2ManagerRealIntegrationShould.java @@ -34,7 +34,7 @@ import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.user.User; import org.hisp.dhis.android.core.user.UserCredentials; -import org.hisp.dhis.android.core.user.UserCredentialsStoreImpl; +import org.hisp.dhis.android.core.user.internal.UserCredentialsStoreImpl; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -47,7 +47,6 @@ public class D2ManagerRealIntegrationShould { private static D2Configuration d2Configuration; - private D2Manager d2Manager; @BeforeClass public static void setUpClass() { @@ -60,29 +59,32 @@ public static void setUpClass() { .networkInterceptors(Lists.newArrayList(new StethoInterceptor())) .context(InstrumentationRegistry.getTargetContext().getApplicationContext()) .build(); + + D2Manager.setDatabaseName(null); } @Before public void setUp() { - d2Manager = new D2Manager(d2Configuration); + D2Manager.setUp(d2Configuration).blockingAwait(); } @After public void tearDown() { - if (d2Manager.databaseAdapter != null && d2Manager.databaseAdapter.database() != null) { - d2Manager.databaseAdapter.database().close(); + if (D2Manager.databaseAdapter != null) { + D2Manager.databaseAdapter.database().close(); } + D2Manager.clear(); } @Test public void return_false_if_not_configured() { - assertThat(d2Manager.isD2Configured()).isFalse(); + assertThat(D2Manager.isServerUrlSet()).isFalse(); } @Test public void return_true_if_configured() { configureD2(); - assertThat(d2Manager.isD2Configured()).isTrue(); + assertThat(D2Manager.isServerUrlSet()).isTrue(); } @Test @@ -90,7 +92,7 @@ public void create_a_d2_instance_which_reads_data_from_db() { configureD2(); persistCredentialsInDb(); - UserCredentials userCredentials = d2Manager.getD2().userModule().userCredentials.get(); + UserCredentials userCredentials = D2Manager.getD2().userModule().userCredentials.get(); assertThat(userCredentials.user().uid().equals("user")).isTrue(); } @@ -102,19 +104,19 @@ public void create_a_d2_instance_which_reads_data_from_db() { public void create_a_d2_instance_which_downloads_and_persists_data_from_server() throws Exception { configureD2(); - d2Manager.getD2().userModule().logIn("android", "Android123").call(); + D2Manager.getD2().userModule().logIn("android", "Android123").blockingGet(); - assertThat(d2Manager.getD2().userModule().authenticatedUser.get().user() != null).isTrue(); + assertThat(D2Manager.getD2().userModule().authenticatedUser.get().user() != null).isTrue(); } private void configureD2() { - d2Manager.configureD2(RealServerMother.url); + D2Manager.setServerUrl(RealServerMother.url).andThen(D2Manager.instantiateD2()).blockingGet(); } private void persistCredentialsInDb() { - d2Manager.getD2().databaseAdapter().database().setForeignKeyConstraintsEnabled(Boolean.FALSE); + D2Manager.getD2().databaseAdapter().database().setForeignKeyConstraintsEnabled(Boolean.FALSE); - UserCredentialsStoreImpl.create(d2Manager.getD2().databaseAdapter()).insert(UserCredentials.builder() + UserCredentialsStoreImpl.create(D2Manager.getD2().databaseAdapter()).insert(UserCredentials.builder() .user(User.builder().uid("user").build()).uid("uid").username("username").build()); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/CursorAssert.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/CursorAssert.java index 7c47ca2b24..8ac8d07d8a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/CursorAssert.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/CursorAssert.java @@ -30,6 +30,7 @@ import android.content.ContentValues; import android.database.Cursor; + import androidx.annotation.NonNull; import static com.google.common.truth.Truth.assertThat; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.java index d31e783f3d..304fb0d654 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.java @@ -96,7 +96,7 @@ private int tableCount(String tableName) { int count; try { - cursor = databaseAdapter.query("SELECT COUNT(*) from " + tableName, null); + cursor = databaseAdapter.query("SELECT COUNT(*) from " + tableName); cursor.moveToFirst(); count = cursor.getInt(0); } finally { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbOpenHelperShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbOpenHelperShould.java index b40ab201a4..1d9c920495 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbOpenHelperShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbOpenHelperShould.java @@ -29,12 +29,13 @@ package org.hisp.dhis.android.core.data.database; import android.database.sqlite.SQLiteDatabase; -import androidx.test.InstrumentationRegistry; -import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbTestUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbTestUtils.java index f509f3d77f..8c2711e682 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbTestUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbTestUtils.java @@ -28,10 +28,10 @@ package org.hisp.dhis.android.core.data.database; -import androidx.annotation.NonNull; - import java.util.Locale; +import androidx.annotation.NonNull; + public final class DbTestUtils { private DbTestUtils() { // no instances diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableDataObjectStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableDataObjectStoreAbstractIntegrationShould.java index aa1a962692..7d13e21c61 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableDataObjectStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableDataObjectStoreAbstractIntegrationShould.java @@ -28,9 +28,9 @@ package org.hisp.dhis.android.core.data.database; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.DataModel; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.ObjectWithDeleteInterface; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectStoreAbstractIntegrationShould.java index 4f98d5354f..ee738f7a71 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectStoreAbstractIntegrationShould.java @@ -28,9 +28,9 @@ package org.hisp.dhis.android.core.data.database; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.junit.Before; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/LinkModelStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/LinkModelStoreAbstractIntegrationShould.java index eb01914e52..3ab5d0da42 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/LinkModelStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/LinkModelStoreAbstractIntegrationShould.java @@ -28,8 +28,8 @@ package org.hisp.dhis.android.core.data.database; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.common.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.Model; import org.junit.Before; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectStoreAbstractIntegrationShould.java index fc60130fd7..ab57282111 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectStoreAbstractIntegrationShould.java @@ -30,9 +30,9 @@ import android.content.ContentValues; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectStore; import org.junit.Before; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectWithoutUidStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectWithoutUidStoreAbstractIntegrationShould.java index 68d6bef916..61217dbbcf 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectWithoutUidStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectWithoutUidStoreAbstractIntegrationShould.java @@ -28,10 +28,10 @@ package org.hisp.dhis.android.core.data.database; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.common.HandleAction; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; import org.junit.Before; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/migrations/DataBaseMigrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/migrations/DataBaseMigrationShould.java index 38c893f7d7..16b4ea5c38 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/migrations/DataBaseMigrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/migrations/DataBaseMigrationShould.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.data.database.migrations; import android.database.sqlite.SQLiteDatabase; -import androidx.test.InstrumentationRegistry; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.data.database.DbOpenHelper; @@ -42,6 +40,9 @@ import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + import static org.hamcrest.CoreMatchers.is; import static org.hisp.dhis.android.core.data.database.SqliteCheckerUtility.ifTableExist; import static org.junit.Assert.assertThat; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/CreateDataElementUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/CreateDataElementUtils.java index 9e0dada9bb..46a422653b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/CreateDataElementUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/CreateDataElementUtils.java @@ -29,11 +29,13 @@ package org.hisp.dhis.android.core.dataelement; import android.content.ContentValues; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import org.hisp.dhis.android.core.category.CategoryCombo; import org.hisp.dhis.android.core.common.ValueType; +import org.hisp.dhis.android.core.dataelement.internal.DataElementFields; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; public class CreateDataElementUtils { private static final long ID = 2L; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementModelShould.java index 0b9c7d1502..c27eb4467b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.ValueType; @@ -40,6 +39,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toBoolean; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallRealIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementEndpointCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallRealIntegrationShould.java index 96238029a5..817fabd177 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallRealIntegrationShould.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; +import org.hisp.dhis.android.core.d2manager.D2Factory; +import org.hisp.dhis.android.core.dataelement.DataElement; import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; @@ -67,7 +68,7 @@ private Callable> createCall() { // @Test public void download_data_elements() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); /* This test won't pass independently of DataElementEndpointCallFactory and CategoryComboEndpointCallFactory, as the foreign keys constraints won't be satisfied. diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementOperandStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementOperandStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java index 26bd3f3e14..244ae36f63 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/DataElementOperandStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataelement.DataElementOperandSamples; +import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataelement.DataElementOperandTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkModelShould.java index 3fe084bd5e..377a55f655 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.LinkModelAbstractShould; import org.hisp.dhis.android.core.dataset.DataSetDataElementLinkModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetModelShould.java index 530f28247c..4c5b304312 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.NameableModelAbstractShould; import org.hisp.dhis.android.core.dataset.DataSetModel.Columns; @@ -42,6 +41,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toInteger; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillNameableModelProperties; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkModelShould.java index f2b86f22f4..a87e4dbfe1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.LinkModelAbstractShould; import org.hisp.dhis.android.core.dataset.SectionDataElementLinkModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionModelShould.java index 1e7691560c..b675dacf73 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.IdentifiableModelAbstractShould; import org.hisp.dhis.android.core.dataset.SectionModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toInteger; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillIdentifiableModelProperties; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataInputPeriodLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataInputPeriodLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java index 3d81e68d7d..56e086f741 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataInputPeriodLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataset.DataInputPeriodSamples; +import org.hisp.dhis.android.core.dataset.DataInputPeriod; +import org.hisp.dhis.android.core.dataset.DataInputPeriodTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java similarity index 86% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPostCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java index 85cd01de90..31cf2da8aa 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java @@ -26,13 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistrationCollectionRepository; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; @@ -62,9 +64,9 @@ public void setUp() throws IOException { // commented out since it is a flaky test that works against a real server. //@Test public void upload_data_set_complete_registrations_with_to_post_state() throws Exception { - d2.userModule().logIn("android", "Android123").call(); - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.userModule().logIn("android", "Android123").blockingGet(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); DataSetCompleteRegistration dataSetCompleteRegistration = getTestDataSetCompleteRegistrationWith(State.TO_POST, "2018"); @@ -85,9 +87,9 @@ public void upload_data_set_complete_registrations_with_to_post_state() throws E // commented out since it is a flaky test that works against a real server. //@Test public void upload_data_set_complete_registrations_with_to_update_state() throws Exception { - d2.userModule().logIn("android", "Android123").call(); - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.userModule().logIn("android", "Android123").blockingGet(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); DataSetCompleteRegistration dataSetCompleteRegistration = getTestDataSetCompleteRegistrationWith(State.TO_UPDATE, "2018"); @@ -105,9 +107,9 @@ public void upload_data_set_complete_registrations_with_to_update_state() throws // commented out since it is a flaky test that works against a real server. //@Test public void update_and_delete_different_data_set_complete_registrations() throws Exception { - d2.userModule().logIn("android", "Android123").call(); - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.userModule().logIn("android", "Android123").blockingGet(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); DataSetCompleteRegistration toDeleteDataSetCompleteRegistration = getTestDataSetCompleteRegistrationWith(State.TO_UPDATE, "2019"); @@ -131,9 +133,9 @@ public void update_and_delete_different_data_set_complete_registrations() throws // commented out since it is a flaky test that works against a real server. //@Test public void delete_data_set_complete_registrations_with_to_delete_state() throws Exception { - d2.userModule().logIn("android", "Android123").call(); - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.userModule().logIn("android", "Android123").blockingGet(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); DataSetCompleteRegistration dataSetCompleteRegistration = getTestDataSetCompleteRegistrationWith(State.TO_UPDATE, "2018"); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java index 0507e87b64..52c5e5c37b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataset.DataSetCompulsoryDataElementOperandLinkSamples; +import org.hisp.dhis.android.core.dataset.DataSetCompulsoryDataElementOperandLink; +import org.hisp.dhis.android.core.dataset.DataSetCompulsoryDataElementOperandLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java index 95408fa31a..767669189d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataset.DataSetElementSamples; +import org.hisp.dhis.android.core.dataset.DataSetElement; +import org.hisp.dhis.android.core.dataset.DataSetElementLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallRealIntegrationShould.java similarity index 91% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetEndpointCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallRealIntegrationShould.java index be6e8e46c7..4589988b66 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallRealIntegrationShould.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; +import org.hisp.dhis.android.core.d2manager.D2Factory; +import org.hisp.dhis.android.core.dataset.DataSet; import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; @@ -59,8 +60,8 @@ private Callable> createCall() { // @Test public void download_data_sets() throws Exception { - if (!d2.userModule().isLogged().call()) { - d2.userModule().logIn("android", "Android123").call(); + if (!d2.userModule().isLogged().blockingGet()) { + d2.userModule().logIn("android", "Android123").blockingGet(); } /* This test won't pass independently of DataElementEndpointCallFactory and diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java index 16d5385d60..e077f1e2bb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataset.DataSetOrganisationUnitLinkSamples; +import org.hisp.dhis.android.core.dataset.DataSetOrganisationUnitLink; +import org.hisp.dhis.android.core.dataset.DataSetOrganisationUnitLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java index 0eb9a0bd35..d162963b7f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataset.DataSetSamples; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java index 0d58726469..69b288b947 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataset.SectionDataElementLinkSamples; +import org.hisp.dhis.android.core.dataset.SectionDataElementLink; +import org.hisp.dhis.android.core.dataset.SectionDataElementLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java index 12ac99ceb4..4b4ca3f267 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataset.SectionGreyedFieldsLinkSamples; +import org.hisp.dhis.android.core.dataset.SectionGreyedFieldsLink; +import org.hisp.dhis.android.core.dataset.SectionGreyedFieldsLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java index 1834003447..8df7f725fc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/SectionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.dataset.SectionSamples; +import org.hisp.dhis.android.core.dataset.Section; +import org.hisp.dhis.android.core.dataset.SectionTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/DataValueEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.java similarity index 83% rename from core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/DataValueEndpointCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.java index a268b7a7f4..2ba9f7b239 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/DataValueEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutorImpl; -import org.hisp.dhis.android.core.arch.handlers.ObjectWithoutUidSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.D2Factory; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl; +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.d2manager.D2Factory; +import org.hisp.dhis.android.core.datavalue.DataValue; import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; @@ -63,7 +64,7 @@ public void setUp() throws IOException { private Callable> createCall() { APICallExecutor apiCallExecutor = APICallExecutorImpl.create(d2.databaseAdapter()); - SyncHandler dataValueHandler = new ObjectWithoutUidSyncHandlerImpl<>( + Handler dataValueHandler = new ObjectWithoutUidHandlerImpl<>( DataValueStore.create(databaseAdapter())); return new DataValueEndpointCallFactory(getGenericCallData(d2), apiCallExecutor, dataValueHandler).create( DataValueQuery.create(getDataSetUids(), getPeriodIds(), getOrgUnitUids())); @@ -71,8 +72,8 @@ private Callable> createCall() { // @Test public void download_data_values() throws Exception { - if (!d2.userModule().isLogged().call()) { - d2.userModule().logIn("android", "Android123").call(); + if (!d2.userModule().isLogged().blockingGet()) { + d2.userModule().logIn("android", "Android123").blockingGet(); } /* This test won't pass independently of the sync of metadata, as the foreign keys diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/DataValuePostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java similarity index 90% rename from core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/DataValuePostCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java index 69b81fecc5..598a473c65 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/DataValuePostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.data.server.RealServerMother; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.datavalue.DataValue; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -60,8 +61,8 @@ public void setUp() throws IOException { //@Test public void dataValuesWithToPostState_shouldBeUploaded() throws Exception { - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); DataValue dataValue = getTestDataValueWith(State.TO_POST, 1); @@ -80,8 +81,8 @@ public void dataValuesWithToPostState_shouldBeUploaded() throws Exception { //@Test public void dataValuesWithToUpdateState_shouldBeUploaded() throws Exception { - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); DataValue dataValue = getTestDataValueWith(State.TO_UPDATE,2); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/AggregatedDataCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.java similarity index 96% rename from core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/AggregatedDataCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.java index ea6dd80357..0036acdf41 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/AggregatedDataCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.domain.aggregated.data; import org.hisp.dhis.android.core.arch.call.D2Progress; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataDispatcher; @@ -38,12 +38,13 @@ public class AggregatedDataCallMockIntegrationShould extends BaseMockIntegration @Test public void emit_progress() { - TestObserver testObserver = d2.aggregatedModule().data().download().asObservable().test(); + TestObserver testObserver = d2.aggregatedModule().data().download().test(); testObserver.assertValueCount(3); testObserver.assertValueAt(0, v -> assertDouble(v.percentage(), 33.33) && v.lastCall().equals("SystemInfo")); testObserver.assertValueAt(1, v -> assertDouble(v.percentage(), 66.66)); testObserver.assertValueAt(2, v -> assertDouble(v.percentage(), 100)); + testObserver.dispose(); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/AggregatedDataCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallRealIntegrationShould.java similarity index 84% rename from core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/AggregatedDataCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallRealIntegrationShould.java index 73a6192398..80cd9d8cc2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/AggregatedDataCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallRealIntegrationShould.java @@ -26,12 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.domain.aggregated.data; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -72,20 +72,20 @@ make a debugger break point where desired (after sync complete) //Uncomment in order to quickly test changes vs a real server, but keep it uncommented after. //@Test public void response_successful_on_sync_data_once() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); } //@Test public void response_successful_on_sync_data_value_two_times() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); - d2.syncMetaData().call(); - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.syncMetaData().blockingSubscribe(); + d2.aggregatedModule().data().download().subscribe(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/CreateEnrollmentUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/CreateEnrollmentUtils.java index f7888f40ba..e3d0d83694 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/CreateEnrollmentUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/CreateEnrollmentUtils.java @@ -29,11 +29,13 @@ package org.hisp.dhis.android.core.enrollment; import android.content.ContentValues; -import androidx.annotation.NonNull; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentFields; + +import androidx.annotation.NonNull; public class CreateEnrollmentUtils { private static final String UID = "test_enrollment"; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/EnrollmentModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/EnrollmentModelShould.java index 04d45f97e7..30f779ecc7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/EnrollmentModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/EnrollmentModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.AndroidTestUtils; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; @@ -41,6 +40,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/EnrollmentStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/EnrollmentStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java index ac345c3c52..a6a9fc64a3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/EnrollmentStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java @@ -26,12 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableDataObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.enrollment.EnrollmentSamples; +import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.enrollment.EnrollmentTableInfo; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/note/NotePostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/note/NotePostCallRealIntegrationShould.java index 3625fcacd1..36fc2bacf4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/note/NotePostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/note/NotePostCallRealIntegrationShould.java @@ -31,15 +31,16 @@ import com.google.common.collect.Lists; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.enrollment.note.internal.NoteStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl; import org.hisp.dhis.android.core.utils.CodeGeneratorImpl; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -74,9 +75,9 @@ public void download_tei_add_one_note_and_sync_in_2_30_or_more() throws Exceptio } public void downloadUpdateAndSyncTei() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); d2.trackedEntityModule().downloadTrackedEntityInstancesByUid(Lists.newArrayList("AlvUHPP2Mes")).call(); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/CreateEventUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/CreateEventUtils.java index 26eedb944f..a8b7dd761d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/CreateEventUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/CreateEventUtils.java @@ -29,11 +29,13 @@ package org.hisp.dhis.android.core.event; import android.content.ContentValues; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.event.internal.EventFields; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; public class CreateEventUtils { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventEndpointCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventEndpointCallMockIntegrationShould.java index eda4680ccd..b1b04275ae 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventEndpointCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventEndpointCallMockIntegrationShould.java @@ -29,6 +29,8 @@ package org.hisp.dhis.android.core.event; import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.event.internal.EventCallFactory; +import org.hisp.dhis.android.core.event.internal.EventStoreImpl; 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; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventModelShould.java index e9a3c0b2ca..3343004914 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.State; @@ -40,6 +39,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPI29RealShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI29RealShould.java similarity index 97% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPI29RealShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI29RealShould.java index 2e3646388e..d7151dfd4e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPI29RealShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI29RealShould.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event.api; +package org.hisp.dhis.android.core.event.internal; import org.hisp.dhis.android.core.data.server.RealServerMother; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPI30RealShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI30RealShould.java similarity index 97% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPI30RealShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI30RealShould.java index 42f7c7c3d9..43a35c6b45 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPI30RealShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI30RealShould.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event.api; +package org.hisp.dhis.android.core.event.internal; import org.hisp.dhis.android.core.data.server.RealServerMother; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPIRealShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPIRealShould.java similarity index 90% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPIRealShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPIRealShould.java index 6342eb6d65..cf0b8fe6df 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventAPIRealShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPIRealShould.java @@ -26,21 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event.api; +package org.hisp.dhis.android.core.event.internal; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutorImpl; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventFields; -import org.hisp.dhis.android.core.event.EventPayload; -import org.hisp.dhis.android.core.event.EventService; -import org.hisp.dhis.android.core.imports.EventImportSummary; -import org.hisp.dhis.android.core.imports.EventWebResponse; +import org.hisp.dhis.android.core.imports.internal.EventImportSummary; +import org.hisp.dhis.android.core.imports.internal.EventWebResponse; import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Assert; import org.junit.Before; @@ -49,13 +46,13 @@ import java.util.Collections; import static com.google.common.truth.Truth.assertThat; -import static org.hisp.dhis.android.core.event.api.EventUtils.assertEvent; -import static org.hisp.dhis.android.core.event.api.EventUtils.createEventWithFutureDate; -import static org.hisp.dhis.android.core.event.api.EventUtils.createEventWithInvalidAttributeOptionCombo; -import static org.hisp.dhis.android.core.event.api.EventUtils.createEventWithInvalidDataValues; -import static org.hisp.dhis.android.core.event.api.EventUtils.createEventWithInvalidOrgunit; -import static org.hisp.dhis.android.core.event.api.EventUtils.createEventWithInvalidProgram; -import static org.hisp.dhis.android.core.event.api.EventUtils.createValidEvent; +import static org.hisp.dhis.android.core.event.internal.EventUtils.assertEvent; +import static org.hisp.dhis.android.core.event.internal.EventUtils.createEventWithFutureDate; +import static org.hisp.dhis.android.core.event.internal.EventUtils.createEventWithInvalidAttributeOptionCombo; +import static org.hisp.dhis.android.core.event.internal.EventUtils.createEventWithInvalidDataValues; +import static org.hisp.dhis.android.core.event.internal.EventUtils.createEventWithInvalidOrgunit; +import static org.hisp.dhis.android.core.event.internal.EventUtils.createEventWithInvalidProgram; +import static org.hisp.dhis.android.core.event.internal.EventUtils.createValidEvent; import static org.hisp.dhis.android.core.imports.ImportStatus.ERROR; import static org.hisp.dhis.android.core.imports.ImportStatus.SUCCESS; import static org.hisp.dhis.android.core.imports.ImportStatus.WARNING; @@ -305,7 +302,7 @@ else if (invalidEvent.uid().equals(importSummary.reference())) { assertThat(serverInvalidEvent.trackedEntityDataValues()).isNull(); } - private void login() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + private void login() { + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventCallFactory.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/EventCallFactory.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.java index 1cd7399724..ce94ebf2da 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventCallFactory.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutorImpl; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.event.Event; import java.util.List; import java.util.concurrent.Callable; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/EventEndpointCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.java index ae26294255..d7c29c19aa 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.java @@ -26,16 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; import com.google.common.truth.Truth; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.event.Event; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValueStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValueStoreImpl; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -63,9 +64,9 @@ public void setUp() throws IOException { //Uncomment in order to quickly test changes vs a real server, but keep it uncommented after. //@Test public void download_number_of_events_according_to_default_limit() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); @@ -80,9 +81,9 @@ public void download_number_of_events_according_to_default_limit() throws Except //@Test public void download_event_with_category_combo_option() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventPostCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallMockIntegrationShould.java similarity index 98% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/EventPostCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallMockIntegrationShould.java index 9c38c2bdf6..b94e0e7ce8 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventPostCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallMockIntegrationShould.java @@ -26,13 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; import com.google.common.collect.Lists; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.common.UidsHelper; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityDataValueSamples; +import org.hisp.dhis.android.core.event.Event; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; import org.hisp.dhis.android.core.program.Program; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventPostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/EventPostCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.java index efae3dc1d2..9468c86b12 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventPostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.java @@ -26,19 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; import org.hisp.dhis.android.core.D2; import org.hisp.dhis.android.core.common.Coordinates; -import org.hisp.dhis.android.core.common.D2Factory; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.event.EventStatus; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValueStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValueStoreImpl; import org.hisp.dhis.android.core.utils.CodeGenerator; import org.hisp.dhis.android.core.utils.CodeGeneratorImpl; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -94,7 +96,7 @@ public void successful_response_after_sync_events() throws Exception { downloadMetadata(); createDummyDataToPost(orgUnitUid, programUid, programStageUid, eventUid1, - dataElementUid, attributeOptionCombo, null); + dataElementUid, attributeOptionCombo); d2.eventModule().events.upload().call(); } @@ -105,7 +107,7 @@ public void pull_event_with_correct_category_combo_after_be_pushed() throws Exce downloadMetadata(); createDummyDataToPost(orgUnitUid, programUid, programStageUid, eventUid1, dataElementUid, - attributeOptionCombo, null); + attributeOptionCombo); pushDummyEvent(); @@ -126,10 +128,10 @@ public void pull_two_events_with_correct_category_combo_after_be_pushed() throws downloadMetadata(); createDummyDataToPost(orgUnitUid, programUid, programStageUid, eventUid1, dataElementUid, - attributeOptionCombo, null); + attributeOptionCombo); createDummyDataToPost(orgUnitUid, programUid, programStageUid, eventUid2, dataElementUid, - attributeOptionCombo, null); + attributeOptionCombo); pushDummyEvent(); @@ -146,13 +148,13 @@ public void pull_two_events_with_correct_category_combo_after_be_pushed() throws private void createDummyDataToPost(String orgUnitUid, String programUid, String programStageUid, String eventUid, - String dataElementUid, String attributeOptionCombo, String trackedEntityInstance) { + String dataElementUid, String attributeOptionCombo) { eventStore.insert(Event.builder().uid(eventUid).created(new Date()).lastUpdated(new Date()) .status(EventStatus.ACTIVE).coordinate(Coordinates.create(13.21, 12.21)).program(programUid) .programStage(programStageUid).organisationUnit(orgUnitUid).eventDate(new Date()) .completedDate(new Date()).dueDate(new Date()).state(State.TO_POST) - .attributeOptionCombo(attributeOptionCombo).trackedEntityInstance(trackedEntityInstance).build()); + .attributeOptionCombo(attributeOptionCombo).build()); TrackedEntityDataValue trackedEntityDataValue = TrackedEntityDataValue.builder() .event(eventUid) @@ -202,8 +204,8 @@ private void pushDummyEvent() throws Exception { } private void downloadMetadata() throws Exception { - d2.userModule().logIn(user, password).call(); - d2.syncMetaData().call(); + d2.userModule().logIn(user, password).blockingGet(); + d2.syncMetaData().blockingSubscribe(); } private boolean verifyPushedEventIsInPullList(Event event, List eventList) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/EventStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java index d0e9f12b23..6d8f806e28 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java @@ -26,12 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableDataObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.trackedentity.EventSamples; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.event.EventStatus; +import org.hisp.dhis.android.core.event.EventTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventUtils.java similarity index 98% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventUtils.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventUtils.java index e54d41d7ec..a75ef198fb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/api/EventUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventUtils.java @@ -26,13 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event.api; +package org.hisp.dhis.android.core.event.internal; import com.google.common.collect.Lists; import org.hisp.dhis.android.core.event.Event; import org.hisp.dhis.android.core.event.EventStatus; -import org.hisp.dhis.android.core.imports.EventImportSummary; +import org.hisp.dhis.android.core.imports.internal.EventImportSummary; import org.hisp.dhis.android.core.imports.ImportStatus; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; import org.hisp.dhis.android.core.utils.CodeGenerator; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventWithLimitCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallRealIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/EventWithLimitCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallRealIntegrationShould.java index 2aece626b2..93f88096d4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/EventWithLimitCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallRealIntegrationShould.java @@ -26,12 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -52,9 +52,9 @@ public void setUp() throws IOException { //@Test public void download_tracked_entity_instances() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); d2.eventModule().downloadSingleEvents(20, false, false).call(); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/imports/TrackerImportConflictStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/imports/TrackerImportConflictStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java index e7aa32912b..593ba0cfd7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/imports/TrackerImportConflictStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.imports.TrackerImportConflictSamples; +import org.hisp.dhis.android.core.imports.TrackerImportConflict; +import org.hisp.dhis.android.core.imports.TrackerImportConflictTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkModelShould.java index 2ed9f0182a..10a68b5a7a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.LinkModelAbstractShould; import org.hisp.dhis.android.core.indicator.DataSetIndicatorLinkModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorModelShould.java index d708c607f1..bb690f4b7c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.NameableModelAbstractShould; import org.hisp.dhis.android.core.indicator.IndicatorModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toInteger; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillNameableModelProperties; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorTypeModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorTypeModelShould.java index 418652ab95..05621cb702 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorTypeModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorTypeModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.IdentifiableModelAbstractShould; import org.hisp.dhis.android.core.indicator.IndicatorTypeModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toInteger; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillIdentifiableModelProperties; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java index 7470cbaaf8..f337edb4a0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.indicator.DataSetIndicatorLinkSamples; +import org.hisp.dhis.android.core.indicator.DataSetIndicatorLink; +import org.hisp.dhis.android.core.indicator.DataSetIndicatorLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java index bd1c916903..f3e5d0224a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/IndicatorStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; 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.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendModelShould.java index 11ea68a2bd..2ce296ae68 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.IdentifiableModelAbstractShould; import org.hisp.dhis.android.core.legendset.LegendModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillIdentifiableModelProperties; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendSetModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendSetModelShould.java index 38d48402ed..54bd279f54 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendSetModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendSetModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.IdentifiableModelAbstractShould; import org.hisp.dhis.android.core.legendset.LegendSetModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillIdentifiableModelProperties; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkModelShould.java index 3a0c635071..0c73502009 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.LinkModelAbstractShould; import org.hisp.dhis.android.core.legendset.ProgramIndicatorLegendSetLinkModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) 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 691347fc3c..58b6c05546 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 @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.legendset; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.legendset.ProgramIndicatorLegendSetLinkSamples; +import org.hisp.dhis.android.core.legendset.internal.ProgramIndicatorLegendSetLinkStore; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendSetStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendSetStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java index 6dd1eb47fc..eb0611a649 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendSetStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; 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.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java index c56c27ebbc..eb2bda3eed 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/LegendStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.legendset.LegendSamples; +import org.hisp.dhis.android.core.legendset.Legend; +import org.hisp.dhis.android.core.legendset.LegendTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/D2ErrorStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/D2ErrorStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java index e01bc91612..d0436de11b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/D2ErrorStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.maintenance.D2ErrorSamples; +import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.maintenance.D2ErrorTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleanerShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.java similarity index 94% rename from core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleanerShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.java index d4f15ec897..9bcaa1ee5a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleanerShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.java @@ -26,34 +26,36 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; import android.database.Cursor; import com.google.common.truth.Truth; import org.hisp.dhis.android.core.D2; +import org.hisp.dhis.android.core.arch.call.executors.internal.D2CallExecutor; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.category.CategoryCategoryComboLink; import org.hisp.dhis.android.core.category.CategoryCategoryComboLinkTableInfo; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; -import org.hisp.dhis.android.core.common.D2CallExecutor; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.ObjectWithUid; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.Dhis2MockServer; +import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolation; import org.hisp.dhis.android.core.program.Program; import org.hisp.dhis.android.core.program.ProgramRule; import org.hisp.dhis.android.core.program.ProgramRuleAction; -import org.hisp.dhis.android.core.program.ProgramRuleActionStore; import org.hisp.dhis.android.core.program.ProgramRuleActionTableInfo; import org.hisp.dhis.android.core.program.ProgramRuleActionType; -import org.hisp.dhis.android.core.program.ProgramRuleStore; import org.hisp.dhis.android.core.program.ProgramRuleTableInfo; +import org.hisp.dhis.android.core.program.internal.ProgramRuleActionStore; +import org.hisp.dhis.android.core.program.internal.ProgramRuleStore; import org.hisp.dhis.android.core.user.User; import org.hisp.dhis.android.core.user.UserCredentials; -import org.hisp.dhis.android.core.user.UserCredentialsStoreImpl; import org.hisp.dhis.android.core.user.UserCredentialsTableInfo; import org.hisp.dhis.android.core.user.UserTableInfo; +import org.hisp.dhis.android.core.user.internal.UserCredentialsStoreImpl; import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.After; import org.junit.Before; @@ -259,7 +261,7 @@ private void syncMetadataAndAddFKViolation() throws D2Error { private void givenAMetadataInDatabase() { try { dhis2MockServer.setRequestDispatcher(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); } catch (Exception ignore) { } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStoreIntegrationShould.java index 3ecc289a2f..e1c37988be 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.maintenance.ForeignKeyViolationSamples; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolation; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolationTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionModelShould.java index a42c379a9f..961121cd94 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.option.OptionModel.Columns; @@ -39,6 +38,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetCallShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetCallShould.java index 29c54a91ec..b6021797ae 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetCallShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetCallShould.java @@ -28,11 +28,11 @@ package org.hisp.dhis.android.core.option; +import org.hisp.dhis.android.core.arch.call.executors.internal.D2CallExecutor; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; -import org.hisp.dhis.android.core.common.D2CallExecutor; import org.hisp.dhis.android.core.common.ValueType; import org.hisp.dhis.android.core.maintenance.D2Error; -import org.hisp.dhis.android.core.maintenance.ForeignKeyCleanerImpl; +import org.hisp.dhis.android.core.maintenance.internal.ForeignKeyCleanerImpl; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable; import org.junit.Before; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetModelShould.java index bdc4484ebe..9cac82d946 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.ValueType; @@ -40,6 +39,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionGroupOptionLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionGroupOptionLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkStoreIntegrationShould.java index a18517adad..d4695b480b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionGroupOptionLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.option; +package org.hisp.dhis.android.core.option.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.option.OptionGroupOptionLinkSamples; +import org.hisp.dhis.android.core.option.OptionGroupOptionLink; +import org.hisp.dhis.android.core.option.OptionGroupOptionLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionGroupStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionGroupStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupStoreIntegrationShould.java index f2769d557a..8f509f3bd6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionGroupStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.option; +package org.hisp.dhis.android.core.option.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.option.OptionGroupSamples; +import org.hisp.dhis.android.core.option.OptionGroup; +import org.hisp.dhis.android.core.option.OptionGroupTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitModelShould.java index ac887695f0..fd846a040c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitModelShould.java @@ -30,16 +30,18 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitSamples; import org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils; import org.hisp.dhis.android.core.organisationunit.OrganisationUnitTableInfo.Columns; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitFields; import org.hisp.dhis.android.core.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitProgramLinkModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitProgramLinkModelShould.java index 6d6e90a4b0..ef78143057 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitProgramLinkModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitProgramLinkModelShould.java @@ -30,12 +30,13 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.organisationunit.OrganisationUnitProgramLinkModel.Columns; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitCallMockIntegrationShould.java similarity index 89% rename from core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitCallMockIntegrationShould.java index 979e26415b..50615e2825 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitCallMockIntegrationShould.java @@ -26,29 +26,32 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.organisationunit; +package org.hisp.dhis.android.core.organisationunit.internal; import android.content.ContentValues; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutorImpl; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl; +import org.hisp.dhis.android.core.arch.cleaners.internal.CollectionCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.CollectionCleanerImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; -import org.hisp.dhis.android.core.common.CollectionCleaner; -import org.hisp.dhis.android.core.common.CollectionCleanerImpl; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitSamples; import org.hisp.dhis.android.core.dataset.DataSet; import org.hisp.dhis.android.core.dataset.DataSetTableInfo; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitGroup; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitGroupTableInfo; import org.hisp.dhis.android.core.program.Program; import org.hisp.dhis.android.core.program.ProgramTableInfo; import org.hisp.dhis.android.core.user.User; import org.hisp.dhis.android.core.user.UserOrganisationUnitLink; -import org.hisp.dhis.android.core.user.UserOrganisationUnitLinkStore; -import org.hisp.dhis.android.core.user.UserOrganisationUnitLinkStoreImpl; import org.hisp.dhis.android.core.user.UserTableInfo; +import org.hisp.dhis.android.core.user.internal.UserOrganisationUnitLinkStore; +import org.hisp.dhis.android.core.user.internal.UserOrganisationUnitLinkStoreImpl; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Before; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitGroupStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitGroupStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupStoreIntegrationShould.java index c2d2bbf25c..83254b9724 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitGroupStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.organisationunit; +package org.hisp.dhis.android.core.organisationunit.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitGroupSamples; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitGroup; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitGroupTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitLevelStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitLevelStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelStoreIntegrationShould.java index 1455f8920e..40557cd622 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitLevelStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.organisationunit; +package org.hisp.dhis.android.core.organisationunit.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitLevelSamples; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitLevel; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitLevelTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java index 364fb4b904..3d012e70b2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.organisationunit; +package org.hisp.dhis.android.core.organisationunit.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitOrganisationUnitGroupLinkSamples; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitOrganisationUnitGroupLink; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitOrganisationUnitGroupLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitProgramLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitProgramLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkStoreIntegrationShould.java index 12f27dadc8..ae8d13f187 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitProgramLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.organisationunit; +package org.hisp.dhis.android.core.organisationunit.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitProgramLinkSamples; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitProgramLink; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitProgramLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitStoreIntegrationShould.java index 563aaec304..01eb64ab41 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/OrganisationUnitStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.organisationunit; +package org.hisp.dhis.android.core.organisationunit.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitSamples; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodModelShould.java index 8a091dc116..a32a977125 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.period; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.junit.Test; @@ -38,6 +37,8 @@ import java.text.ParseException; import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/period/internal/PeriodStoreIntegrationShould.java similarity index 87% rename from core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/period/internal/PeriodStoreIntegrationShould.java index 6db71f1a34..b466799fb0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/period/internal/PeriodStoreIntegrationShould.java @@ -26,12 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.period; +package org.hisp.dhis.android.core.period.internal; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.period.PeriodSamples; +import org.hisp.dhis.android.core.period.Period; +import org.hisp.dhis.android.core.period.PeriodTableInfo; +import org.hisp.dhis.android.core.period.PeriodType; +import org.hisp.dhis.android.core.period.internal.ParentPeriodGeneratorImpl; +import org.hisp.dhis.android.core.period.internal.PeriodHandler; +import org.hisp.dhis.android.core.period.internal.PeriodStore; +import org.hisp.dhis.android.core.period.internal.PeriodStoreImpl; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramStageUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramStageUtils.java index 4614b12eee..f50848de6d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramStageUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramStageUtils.java @@ -32,6 +32,7 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.FormType; +import org.hisp.dhis.android.core.program.internal.ProgramStageFields; public class CreateProgramStageUtils { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramUtils.java index 31d1c93765..476c2feb94 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramUtils.java @@ -29,10 +29,12 @@ package org.hisp.dhis.android.core.program; import android.content.ContentValues; -import androidx.annotation.Nullable; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseNameableObjectModel; +import org.hisp.dhis.android.core.program.internal.ProgramFields; + +import androidx.annotation.Nullable; public class CreateProgramUtils { /** diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/services/ProgramIndicatorEngineIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorEngineIntegrationShould.java similarity index 95% rename from core/src/androidTest/java/org/hisp/dhis/android/core/utils/services/ProgramIndicatorEngineIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorEngineIntegrationShould.java index 1b5cb3530a..2956ef8f91 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/services/ProgramIndicatorEngineIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorEngineIntegrationShould.java @@ -26,35 +26,33 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.utils.services; +package org.hisp.dhis.android.core.program; import android.content.ContentValues; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.category.CategoryCombo; import org.hisp.dhis.android.core.category.CategoryComboTableInfo; -import org.hisp.dhis.android.core.category.CreateCategoryComboUtils; +import org.hisp.dhis.android.core.category.internal.CreateCategoryComboUtils; import org.hisp.dhis.android.core.common.Access; import org.hisp.dhis.android.core.common.AggregationType; import org.hisp.dhis.android.core.common.DataAccess; import org.hisp.dhis.android.core.common.FormType; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.common.ValueType; import org.hisp.dhis.android.core.dataelement.DataElement; -import org.hisp.dhis.android.core.dataelement.DataElementStore; +import org.hisp.dhis.android.core.dataelement.internal.DataElementStore; import org.hisp.dhis.android.core.enrollment.Enrollment; -import org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventStoreImpl; +import org.hisp.dhis.android.core.event.internal.EventStoreImpl; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; -import org.hisp.dhis.android.core.program.Program; -import org.hisp.dhis.android.core.program.ProgramIndicator; -import org.hisp.dhis.android.core.program.ProgramIndicatorStore; -import org.hisp.dhis.android.core.program.ProgramStage; -import org.hisp.dhis.android.core.program.ProgramStageStore; -import org.hisp.dhis.android.core.program.ProgramStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; +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.programindicatorengine.ProgramIndicatorEngine; import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramModelShould.java index 3d6577fe81..349ebf697c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.period.PeriodType; @@ -40,6 +39,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toBoolean; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleActionModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleActionModelShould.java index 9aeb477ff7..384250f9b4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleActionModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleActionModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.junit.Test; @@ -39,6 +38,8 @@ import java.text.ParseException; import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleModelShould.java index a432a8c767..405bc51a9d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.program.ProgramRuleModel.Columns; @@ -39,6 +38,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleVariableModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleVariableModelShould.java index d7caac442f..d596e5eeb5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleVariableModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleVariableModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.program.ProgramRuleVariableModel.Columns; @@ -40,6 +39,8 @@ import java.text.ParseException; import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionAttributeLinkModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionAttributeLinkModelShould.java index a7ccedcb4b..dc61d6ac6b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionAttributeLinkModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionAttributeLinkModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.program; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.LinkModelAbstractShould; import org.hisp.dhis.android.core.program.ProgramSectionAttributeLinkTableInfo.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionModelShould.java index 161a953357..dfbf5e3ce9 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.program; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.IdentifiableModelAbstractShould; import org.hisp.dhis.android.core.program.ProgramSectionModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.fillIdentifiableModelProperties; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageDataElementModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageDataElementModelShould.java index e22c28e3fd..97b1671777 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageDataElementModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageDataElementModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.program.ProgramStageDataElementModel.Columns; @@ -39,6 +38,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toBoolean; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageModelShould.java index 8381266c00..11fb9c4ce0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.FormType; @@ -43,6 +42,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toBoolean; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionDataElementLinkModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionDataElementLinkModelShould.java index 8173d52f46..3ecd71e566 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionDataElementLinkModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionDataElementLinkModelShould.java @@ -30,12 +30,13 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.program.ProgramStageSectionDataElementLinkModel.Columns; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionModelsShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionModelsShould.java index dbcdef18e3..829e34451e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionModelsShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionModelsShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.program.ProgramStageSectionModel.Columns; @@ -39,6 +38,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramTrackedEntityAttributeModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramTrackedEntityAttributeModelShould.java index 5511723867..f8f2f8de88 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramTrackedEntityAttributeModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramTrackedEntityAttributeModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.program.ProgramTrackedEntityAttributeModel.Columns; @@ -39,6 +38,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toInteger; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramEndpointCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallMockIntegrationShould.java similarity index 97% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramEndpointCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallMockIntegrationShould.java index 0f4df9f8b4..acb8964c2e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramEndpointCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallMockIntegrationShould.java @@ -26,17 +26,24 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; import android.content.ContentValues; import android.database.Cursor; import org.hisp.dhis.android.core.category.CategoryComboTableInfo; -import org.hisp.dhis.android.core.category.CreateCategoryComboUtils; +import org.hisp.dhis.android.core.category.internal.CreateCategoryComboUtils; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseNameableObjectModel; import org.hisp.dhis.android.core.legendset.LegendSetTableInfo; import org.hisp.dhis.android.core.legendset.LegendTableInfo; +import org.hisp.dhis.android.core.program.Program; +import org.hisp.dhis.android.core.program.ProgramIndicatorTableInfo; +import org.hisp.dhis.android.core.program.ProgramRuleActionTableInfo; +import org.hisp.dhis.android.core.program.ProgramRuleTableInfo; +import org.hisp.dhis.android.core.program.ProgramRuleVariableTableInfo; +import org.hisp.dhis.android.core.program.ProgramTableInfo; +import org.hisp.dhis.android.core.program.ProgramTrackedEntityAttributeTableInfo; import org.hisp.dhis.android.core.relationship.RelationshipTypeTableInfo; import org.hisp.dhis.android.core.trackedentity.CreateTrackedEntityUtils; import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeFields; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramIndicatorStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramIndicatorStoreIntegrationShould.java index 8e91b2cf07..5fcf1cae11 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramIndicatorStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramIndicatorSamples; +import org.hisp.dhis.android.core.program.ProgramIndicator; +import org.hisp.dhis.android.core.program.ProgramIndicatorTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleActionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleActionStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionStoreIntegrationShould.java index 84b63c112c..00cc4f025d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleActionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramRuleActionSamples; +import org.hisp.dhis.android.core.program.ProgramRuleAction; +import org.hisp.dhis.android.core.program.ProgramRuleActionTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleStoreIntegrationShould.java index 058ff51a6e..77c3704b67 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramRuleSamples; +import org.hisp.dhis.android.core.program.ProgramRule; +import org.hisp.dhis.android.core.program.ProgramRuleTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleVariableStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableStoreIntegrationShould.java similarity index 91% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleVariableStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableStoreIntegrationShould.java index cf0819fed5..7351974a14 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramRuleVariableStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableStoreIntegrationShould.java @@ -26,11 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramRuleVariableSamples; +import org.hisp.dhis.android.core.program.ProgramRuleVariable; +import org.hisp.dhis.android.core.program.ProgramRuleVariableSourceType; +import org.hisp.dhis.android.core.program.ProgramRuleVariableTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionAttributeLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionAttributeLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkStoreIntegrationShould.java index 3fd3a51fcf..823bcf4cd6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionAttributeLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramSectionAttributeLinkSamples; +import org.hisp.dhis.android.core.program.ProgramSectionAttributeLink; +import org.hisp.dhis.android.core.program.ProgramSectionAttributeLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionStoreIntegrationShould.java index e0cb3fd7c6..08c00c7ec5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramSectionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramSectionSamples; +import org.hisp.dhis.android.core.program.ProgramSection; +import org.hisp.dhis.android.core.program.ProgramSectionTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageDataElementStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementStoreIntegrationShould.java similarity index 92% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageDataElementStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementStoreIntegrationShould.java index f694f55520..e76faa40e5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageDataElementStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramStageDataElementSamples; +import org.hisp.dhis.android.core.program.ProgramStageDataElement; +import org.hisp.dhis.android.core.program.ProgramStageDataElementTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; public class ProgramStageDataElementStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionDataElementLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionDataElementLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkStoreIntegrationShould.java index ce798e37fc..158ca267e4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionDataElementLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramStageSectionDataElementLinkSamples; +import org.hisp.dhis.android.core.program.ProgramStageSectionDataElementLink; +import org.hisp.dhis.android.core.program.ProgramStageSectionDataElementLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionStoreIntegrationShould.java index 4c5a3a4c6a..feee5c0587 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageSectionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramStageSectionSamples; +import org.hisp.dhis.android.core.program.ProgramStageSection; +import org.hisp.dhis.android.core.program.ProgramStageSectionTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageStoreIntegrationShould.java index 54089f283d..254aa71616 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStageStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramStageSamples; +import org.hisp.dhis.android.core.program.ProgramStage; +import org.hisp.dhis.android.core.program.ProgramStageTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStoreIntegrationShould.java index 18d9c5506c..330037a27b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramSamples; +import org.hisp.dhis.android.core.program.Program; +import org.hisp.dhis.android.core.program.ProgramTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramTrackedEntityAttributeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramTrackedEntityAttributeStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeStoreIntegrationShould.java index b308dc9c80..ae86183f26 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramTrackedEntityAttributeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.program; +package org.hisp.dhis.android.core.program.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.program.ProgramTrackedEntityAttributeSamples; +import org.hisp.dhis.android.core.program.ProgramTrackedEntityAttribute; +import org.hisp.dhis.android.core.program.ProgramTrackedEntityAttributeTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/CreateRelationshipTypeUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/CreateRelationshipTypeUtils.java index 2a635f0d70..b8c1cadf1f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/CreateRelationshipTypeUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/CreateRelationshipTypeUtils.java @@ -32,6 +32,7 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.relationship.internal.RelationshipTypeFields; public class CreateRelationshipTypeUtils { private static final String CODE = "test_code"; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipConstraintModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipConstraintModelShould.java index fd072381e2..aa4d26df75 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipConstraintModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipConstraintModelShould.java @@ -30,14 +30,16 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.ObjectWithUid; +import org.hisp.dhis.android.core.relationship.internal.RelationshipConstraintFields; import org.hisp.dhis.android.core.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipItemModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipItemModelShould.java index 13128359f5..a0bafff871 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipItemModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipItemModelShould.java @@ -30,12 +30,13 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.relationship.RelationshipItemModel.Columns; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipModelShould.java index 3d43ade27b..e268ab8c56 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; @@ -42,6 +41,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipTypeModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipTypeModelShould.java index 72a74c195b..dfd12d361f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipTypeModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipTypeModelShould.java @@ -30,16 +30,18 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.relationship.RelationshipTypeTableInfo.Columns; +import org.hisp.dhis.android.core.relationship.internal.RelationshipTypeFields; import org.hisp.dhis.android.core.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipConstraintStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintStoreIntegrationShould.java similarity index 90% rename from core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipConstraintStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintStoreIntegrationShould.java index 895895dbbe..ce9ad04cd2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipConstraintStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintStoreIntegrationShould.java @@ -26,11 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.relationship; +package org.hisp.dhis.android.core.relationship.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.relationship.RelationshipConstraintSamples; +import org.hisp.dhis.android.core.relationship.RelationshipConstraint; +import org.hisp.dhis.android.core.relationship.RelationshipConstraintTableInfo; +import org.hisp.dhis.android.core.relationship.RelationshipEntityType; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipItemStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemStoreIntegrationShould.java similarity index 90% rename from core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipItemStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemStoreIntegrationShould.java index 1b2db5675e..f297520432 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipItemStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemStoreIntegrationShould.java @@ -26,11 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.relationship; +package org.hisp.dhis.android.core.relationship.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.relationship.RelationshipItemSamples; +import org.hisp.dhis.android.core.relationship.RelationshipItem; +import org.hisp.dhis.android.core.relationship.RelationshipItemEvent; +import org.hisp.dhis.android.core.relationship.RelationshipItemTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipStoreIntegrationShould.java index 48d8d6ffbe..91f4e5f2fb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.relationship; +package org.hisp.dhis.android.core.relationship.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.relationship.RelationshipSamples; +import org.hisp.dhis.android.core.relationship.Relationship; +import org.hisp.dhis.android.core.relationship.RelationshipTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/resource/ResourceModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceModelShould.java similarity index 96% rename from core/src/androidTest/java/org/hisp/dhis/android/core/resource/ResourceModelShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceModelShould.java index 828409bb5d..42a32db0eb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/resource/ResourceModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceModelShould.java @@ -26,19 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.resource; +package org.hisp.dhis.android.core.resource.internal; import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; -import org.hisp.dhis.android.core.resource.ResourceModel.Columns; +import org.hisp.dhis.android.core.resource.internal.ResourceModel.Columns; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/resource/ResourceStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceStoreIntegrationShould.java similarity index 98% rename from core/src/androidTest/java/org/hisp/dhis/android/core/resource/ResourceStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceStoreIntegrationShould.java index 732ba2ac02..d809b3ca96 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/resource/ResourceStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceStoreIntegrationShould.java @@ -26,12 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.resource; +package org.hisp.dhis.android.core.resource.internal; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.resource.ResourceSamples; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SystemSettingModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SystemSettingModelShould.java index 25b30c8da3..648011f1f1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SystemSettingModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SystemSettingModelShould.java @@ -30,13 +30,14 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.settings.SystemSettingModel.Columns; import org.hisp.dhis.android.core.utils.Utils; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SystemSettingStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SystemSettingStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/settings/SystemSettingStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SystemSettingStoreIntegrationShould.java index 67ef0f254d..662eb87323 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SystemSettingStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SystemSettingStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.settings; +package org.hisp.dhis.android.core.settings.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.settings.SystemSettingSamples; +import org.hisp.dhis.android.core.settings.SystemSetting; +import org.hisp.dhis.android.core.settings.SystemSettingTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/DHISVersionsManagerRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/DHISVersionsManagerRealIntegrationShould.java index 2c8553f5a2..6592d8d147 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/DHISVersionsManagerRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/DHISVersionsManagerRealIntegrationShould.java @@ -29,9 +29,9 @@ package org.hisp.dhis.android.core.systeminfo; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -54,7 +54,7 @@ public void return_2_29_version_when_connecting_to_2_29_server() throws Exceptio DHISVersionManager versionManager = d2.systemInfoModule().versionManager; - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); assertThat(versionManager.getVersion()).isEqualTo(DHISVersion.V2_29); assertThat(versionManager.is2_29()).isTrue(); assertThat(versionManager.is2_30()).isFalse(); @@ -68,7 +68,7 @@ public void return_2_30_version_when_connecting_to_2_30_server() throws Exceptio DHISVersionManager versionManager = d2.systemInfoModule().versionManager; - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); assertThat(versionManager.getVersion()).isEqualTo(DHISVersion.V2_30); assertThat(versionManager.is2_29()).isFalse(); assertThat(versionManager.is2_30()).isTrue(); @@ -82,7 +82,7 @@ public void return_2_31_version_when_connecting_to_2_31_server() throws Exceptio DHISVersionManager versionManager = d2.systemInfoModule().versionManager; - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); assertThat(versionManager.getVersion()).isEqualTo(DHISVersion.V2_31); assertThat(versionManager.is2_29()).isFalse(); assertThat(versionManager.is2_30()).isFalse(); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoCallMockIntegrationShould.java index 496aa49e7b..11ee6c8f8d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoCallMockIntegrationShould.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.systeminfo; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithDownloadObjectRepository; import org.hisp.dhis.android.core.data.systeminfo.SystemInfoSamples; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoDatabaseMappingShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoDatabaseMappingShould.java index 05b7868b3e..5d7bb089c6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoDatabaseMappingShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoDatabaseMappingShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.data.systeminfo.SystemInfoSamples; @@ -39,6 +38,8 @@ import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoStoreIntegrationShould.java index ec639f2cda..4b36e6afc3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoStoreIntegrationShould.java @@ -28,13 +28,13 @@ package org.hisp.dhis.android.core.systeminfo; -import androidx.test.runner.AndroidJUnit4; - -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.systeminfo.SystemInfoSamples; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + @RunWith(AndroidJUnit4.class) public class SystemInfoStoreIntegrationShould extends ObjectWithoutUidStoreAbstractIntegrationShould { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityInstanceUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityInstanceUtils.java index bc72af5da8..142b490c12 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityInstanceUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityInstanceUtils.java @@ -29,11 +29,12 @@ package org.hisp.dhis.android.core.trackedentity; import android.content.ContentValues; -import androidx.annotation.NonNull; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.State; +import androidx.annotation.NonNull; + public class CreateTrackedEntityInstanceUtils { private static final State STATE = State.TO_POST; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueEndpointCallRealIntegrationShould.java index 595325a3b8..5143e832c4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueEndpointCallRealIntegrationShould.java @@ -29,9 +29,9 @@ package org.hisp.dhis.android.core.trackedentity; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -76,8 +76,8 @@ public void download_and_persist_reserved_values() throws Exception { } private void login() throws Exception { - if (!d2.userModule().isLogged().call()) { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + if (!d2.userModule().isLogged().blockingGet()) { + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); } } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueManagerRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueManagerRealIntegrationShould.java index f76986e02a..9387738d10 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueManagerRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueManagerRealIntegrationShould.java @@ -29,27 +29,27 @@ package org.hisp.dhis.android.core.trackedentity; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.arch.handlers.ObjectWithoutUidSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.QueryCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCallFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +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.category.CategoryCombo; import org.hisp.dhis.android.core.category.CategoryComboTableInfo; import org.hisp.dhis.android.core.common.Access; -import org.hisp.dhis.android.core.common.D2Factory; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.common.DataAccess; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; import org.hisp.dhis.android.core.organisationunit.OrganisationUnitProgramLink; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitProgramLinkStore; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitProgramLinkStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; import org.hisp.dhis.android.core.program.Program; -import org.hisp.dhis.android.core.program.ProgramStore; +import org.hisp.dhis.android.core.program.internal.ProgramStore; import org.hisp.dhis.android.core.program.ProgramTrackedEntityAttribute; -import org.hisp.dhis.android.core.program.ProgramTrackedEntityAttributeStore; +import org.hisp.dhis.android.core.program.internal.ProgramTrackedEntityAttributeStore; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import org.mockito.ArgumentCaptor; import org.mockito.Captor; @@ -111,7 +111,7 @@ public void setUp() throws IOException { manager = d2.trackedEntityModule().reservedValueManager; - SyncHandler handler = new ObjectWithoutUidSyncHandlerImpl<>(store); + Handler handler = new ObjectWithoutUidHandlerImpl<>(store); List trackedEntityAttributeReservedValues = new ArrayList<>(); @@ -258,7 +258,7 @@ public void have_98_values_after_sync_and_take_two() throws D2Error { // @Test public void sync_all_tracked_entity_instances() throws Exception { assertThat(selectAll().size(), is(3)); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); d2.trackedEntityModule().reservedValueManager.syncReservedValues(null, null,null); /* 100 Reserved values by default * 2 TEA with generated property true on server = 200 */ @@ -325,8 +325,8 @@ private List selectAll() { private void login() { try { - if (!d2.userModule().isLogged().call()) { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + if (!d2.userModule().isLogged().blockingGet()) { + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); } } catch (Exception ignored) { } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueModelShould.java index b28efb45d4..7e1d4da1bd 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueModelShould.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.trackedentity; import android.database.Cursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.ModelAbstractShould; import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeReservedValueModel.Columns; @@ -41,6 +40,8 @@ import java.util.Arrays; import java.util.List; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.CREATED; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.CREATED_STR; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueStoreIntegrationShould.java index 502daaf133..36953a7a38 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueStoreIntegrationShould.java @@ -28,10 +28,10 @@ package org.hisp.dhis.android.core.trackedentity; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeStoreIntegrationShould.java index 8b877c740f..618fac2adf 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeStoreIntegrationShould.java @@ -28,9 +28,9 @@ package org.hisp.dhis.android.core.trackedentity; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityAttributeSamples; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueModelShould.java index b6af6c04a1..e1db4f3cdb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.State; @@ -41,6 +40,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueStoreIntegrationShould.java index 69ab32d0e9..9e6181da33 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueStoreIntegrationShould.java @@ -28,9 +28,9 @@ package org.hisp.dhis.android.core.trackedentity; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityAttributeValueSamples; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueStoreShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueStoreShould.java index 099ba49b9b..bc97ff356e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueStoreShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeValueStoreShould.java @@ -31,16 +31,15 @@ import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteConstraintException; -import androidx.test.runner.AndroidJUnit4; import com.google.common.collect.Lists; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitSamples; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; import org.hisp.dhis.android.core.organisationunit.OrganisationUnitTableInfo; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -49,6 +48,8 @@ import java.util.ArrayList; import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hamcrest.core.Is.is; import static org.hisp.dhis.android.core.data.database.CursorAssert.assertThatCursor; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueModelShould.java index 1fb44dcb81..d37db7454b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValueModel.Columns; @@ -40,6 +39,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toInteger; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueStoreIntegrationShould.java index 479838f053..d152b1c3e2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueStoreIntegrationShould.java @@ -31,15 +31,15 @@ import com.google.common.collect.Lists; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.trackedentity.EventSamples; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityDataValueSamples; import org.hisp.dhis.android.core.enrollment.Enrollment; -import org.hisp.dhis.android.core.enrollment.EnrollmentStore; -import org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl; -import org.hisp.dhis.android.core.event.EventStore; -import org.hisp.dhis.android.core.event.EventStoreImpl; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl; +import org.hisp.dhis.android.core.event.internal.EventStore; +import org.hisp.dhis.android.core.event.internal.EventStoreImpl; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueStoreShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueStoreShould.java index 9b557d3a5b..4524db6720 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueStoreShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityDataValueStoreShould.java @@ -31,11 +31,9 @@ import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteConstraintException; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitSamples; import org.hisp.dhis.android.core.dataelement.CreateDataElementUtils; import org.hisp.dhis.android.core.dataelement.DataElementTableInfo; @@ -52,6 +50,7 @@ import org.hisp.dhis.android.core.relationship.CreateRelationshipTypeUtils; import org.hisp.dhis.android.core.relationship.RelationshipTypeTableInfo; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValueTableInfo.Columns; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -63,6 +62,8 @@ import java.util.List; import java.util.Map; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.core.Is.is; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallMockIntegrationShould.java index cd37db7b63..6b186fa5af 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallMockIntegrationShould.java @@ -32,18 +32,18 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; -import org.hisp.dhis.android.core.common.Payload; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.data.file.ResourcesFileReader; import org.hisp.dhis.android.core.enrollment.Enrollment; -import org.hisp.dhis.android.core.enrollment.EnrollmentFields; -import org.hisp.dhis.android.core.enrollment.EnrollmentStore; -import org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentFields; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventStore; -import org.hisp.dhis.android.core.event.EventStoreImpl; +import org.hisp.dhis.android.core.event.internal.EventStore; +import org.hisp.dhis.android.core.event.internal.EventStoreImpl; import org.hisp.dhis.android.core.relationship.Relationship229Compatible; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallRealIntegrationShould.java index 5bbd8a77b9..0beca48517 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallRealIntegrationShould.java @@ -32,9 +32,9 @@ import com.google.common.truth.Truth; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -59,9 +59,9 @@ public void setUp() throws IOException { //@Test public void download_tei_enrollments_and_events() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); Callable> trackedEntityInstanceByUidEndPointCall = d2.trackedEntityModule().downloadTrackedEntityInstancesByUid(Lists.newArrayList("IaxoagO9899")); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceModelShould.java index b1659b696b..e733463819 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.State; @@ -41,6 +40,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstancePostCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstancePostCallMockIntegrationShould.java index 9530b8de30..f6e09cc502 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstancePostCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstancePostCallMockIntegrationShould.java @@ -30,31 +30,31 @@ import com.google.common.collect.Lists; -import org.hisp.dhis.android.core.common.D2CallExecutor; +import org.hisp.dhis.android.core.arch.call.executors.internal.D2CallExecutor; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.common.UidsHelper; import org.hisp.dhis.android.core.data.relationship.RelationshipSamples; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityDataValueSamples; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityInstanceSamples; import org.hisp.dhis.android.core.enrollment.Enrollment; -import org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventStoreImpl; +import org.hisp.dhis.android.core.event.internal.EventStoreImpl; import org.hisp.dhis.android.core.maintenance.D2Error; -import org.hisp.dhis.android.core.maintenance.ForeignKeyCleanerImpl; +import org.hisp.dhis.android.core.maintenance.internal.ForeignKeyCleanerImpl; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; import org.hisp.dhis.android.core.program.Program; import org.hisp.dhis.android.core.program.ProgramStage; -import org.hisp.dhis.android.core.program.ProgramStageStore; +import org.hisp.dhis.android.core.program.internal.ProgramStageStore; import org.hisp.dhis.android.core.relationship.Relationship; import org.hisp.dhis.android.core.relationship.RelationshipConstraintType; import org.hisp.dhis.android.core.relationship.RelationshipItem; -import org.hisp.dhis.android.core.relationship.RelationshipItemStoreImpl; +import org.hisp.dhis.android.core.relationship.internal.RelationshipItemStoreImpl; import org.hisp.dhis.android.core.relationship.RelationshipItemTrackedEntityInstance; -import org.hisp.dhis.android.core.relationship.RelationshipStoreImpl; +import org.hisp.dhis.android.core.relationship.internal.RelationshipStoreImpl; import org.hisp.dhis.android.core.relationship.RelationshipType; -import org.hisp.dhis.android.core.relationship.RelationshipTypeStore; +import org.hisp.dhis.android.core.relationship.internal.RelationshipTypeStore; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.After; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstancePostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstancePostCallRealIntegrationShould.java index ccd74058e5..f873580a3e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstancePostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstancePostCallRealIntegrationShould.java @@ -31,21 +31,20 @@ import com.google.common.collect.Lists; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; import org.hisp.dhis.android.core.common.Coordinates; -import org.hisp.dhis.android.core.common.D2Factory; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.enrollment.Enrollment; -import org.hisp.dhis.android.core.enrollment.EnrollmentFields; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentFields; import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; -import org.hisp.dhis.android.core.enrollment.EnrollmentStore; -import org.hisp.dhis.android.core.enrollment.EnrollmentStoreImpl; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl; import org.hisp.dhis.android.core.event.Event; import org.hisp.dhis.android.core.event.EventStatus; -import org.hisp.dhis.android.core.event.EventStore; -import org.hisp.dhis.android.core.event.EventStoreImpl; +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.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.maintenance.D2ErrorComponent; @@ -59,6 +58,7 @@ import org.hisp.dhis.android.core.relationship.RelationshipTypeCollectionRepository; import org.hisp.dhis.android.core.utils.CodeGenerator; import org.hisp.dhis.android.core.utils.CodeGeneratorImpl; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -201,7 +201,7 @@ public void pull_event_after_push_tracked_entity_instance_with_that_event() thro //@Test public void post_a_tei() throws Exception { downloadMetadata(); - d2.trackedEntityModule().downloadTrackedEntityInstances(4, true, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(4, true, false).subscribe(); TrackedEntityInstance tei = trackedEntityInstanceStore.selectFirst(); @@ -227,7 +227,7 @@ public void post_a_tei() throws Exception { //@Test public void post_more_than_one_tei() throws Exception { downloadMetadata(); - d2.trackedEntityModule().downloadTrackedEntityInstances(4, true, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(4, true, false).subscribe(); TrackedEntityInstance tei = trackedEntityInstanceStore.selectFirst(); @@ -250,7 +250,7 @@ public void post_more_than_one_tei() throws Exception { //@Test public void post_teis_filtering_what_to_post() throws Exception { downloadMetadata(); - d2.trackedEntityModule().downloadTrackedEntityInstances(4, true, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(4, true, false).subscribe(); TrackedEntityInstance tei = trackedEntityInstanceStore.selectFirst(); @@ -281,7 +281,7 @@ public void post_teis_filtering_what_to_post() throws Exception { //@Test public void post_one_tei_and_delete_it() throws Exception { downloadMetadata(); - d2.trackedEntityModule().downloadTrackedEntityInstances(1, true, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(1, true, false).subscribe(); TrackedEntityInstance tei = trackedEntityInstanceStore.selectFirst(); @@ -312,7 +312,7 @@ public void post_one_tei_and_delete_it() throws Exception { //@Test public void post_new_relationship_to_client_created_tei() throws Exception { downloadMetadata(); - d2.trackedEntityModule().downloadTrackedEntityInstances(5, true, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(5, true, false).subscribe(); TrackedEntityInstance teiA = trackedEntityInstanceStore.selectFirst(); RelationshipType relationshipType = d2.relationshipModule().relationshipTypes.get().iterator().next(); @@ -360,7 +360,7 @@ public void post_new_relationship_to_client_created_tei() throws Exception { public void create_tei_to_tei_relationship() throws Exception { downloadMetadata(); - d2.trackedEntityModule().downloadTrackedEntityInstances(5, false, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(5, false, false).subscribe(); List trackedEntityInstances = trackedEntityInstanceStore.selectAll(); assertThat(trackedEntityInstances.size() >= 5).isTrue(); @@ -379,7 +379,7 @@ public void create_tei_to_tei_relationship() throws Exception { public void create_and_delete_tei_to_tei_relationship() throws Exception { downloadMetadata(); - d2.trackedEntityModule().downloadTrackedEntityInstances(10, false, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(10, false, false).subscribe(); List trackedEntityInstances = trackedEntityInstanceStore.selectAll(); assertThat(trackedEntityInstances.size() == 10).isTrue(); @@ -479,7 +479,7 @@ private void createDummyDataToPost(String orgUnitUid, String programUid, String .status(EventStatus.ACTIVE).coordinate(Coordinates.create(13.21, 12.21)).program(programUid) .programStage(programStageUid).organisationUnit(orgUnitUid).eventDate(refDate).dueDate(refDate) .completedDate(refDate).state(State.TO_POST).attributeOptionCombo(categoryComboOptionUid) - .trackedEntityInstance(trackedEntityInstanceUid).build(); + .build(); eventStore.insert(event); @@ -552,9 +552,9 @@ private void postTrackedEntityInstances() throws Exception { } private void downloadMetadata() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); } private boolean verifyEventCategoryAttributes(Event event, Event downloadedEvent) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceStoreIntegrationShould.java index 12887e32b0..6d8483eeec 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceStoreIntegrationShould.java @@ -29,10 +29,10 @@ package org.hisp.dhis.android.core.trackedentity; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableDataObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityInstanceSamples; import org.hisp.dhis.android.core.period.FeatureType; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceStoreShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceStoreShould.java index 0d71c0cc1d..89a1c37a79 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceStoreShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceStoreShould.java @@ -35,12 +35,12 @@ import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.hisp.dhis.android.core.data.organisationunit.OrganisationUnitSamples; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; import org.hisp.dhis.android.core.organisationunit.OrganisationUnitTableInfo; import org.hisp.dhis.android.core.period.FeatureType; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceTableInfo.Columns; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeAttributeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeAttributeStoreIntegrationShould.java index faf433c17b..bbad12d379 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeAttributeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeAttributeStoreIntegrationShould.java @@ -29,9 +29,9 @@ package org.hisp.dhis.android.core.trackedentity; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityTypeAttributeSamples; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeModelShould.java index 95b4c5a10c..13db031161 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.trackedentity.TrackedEntityTypeModel.Columns; @@ -39,6 +38,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeStoreIntegrationShould.java index 0be3646d33..96c229502e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeStoreIntegrationShould.java @@ -28,9 +28,9 @@ package org.hisp.dhis.android.core.trackedentity; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityTypeSamples; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/BreakTheGlassAPIShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/BreakTheGlassAPIShould.java index 1e4b6844d4..8a59f67836 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/BreakTheGlassAPIShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/BreakTheGlassAPIShould.java @@ -29,23 +29,23 @@ package org.hisp.dhis.android.core.trackedentity.api; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutorImpl; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.enrollment.Enrollment; import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.imports.HttpMessageResponse; -import org.hisp.dhis.android.core.imports.TEIImportSummary; -import org.hisp.dhis.android.core.imports.TEIWebResponse; +import org.hisp.dhis.android.core.imports.internal.HttpMessageResponse; +import org.hisp.dhis.android.core.imports.internal.TEIImportSummary; +import org.hisp.dhis.android.core.imports.internal.TEIWebResponse; import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstancePayload; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceService; import org.hisp.dhis.android.core.utils.CodeGenerator; import org.hisp.dhis.android.core.utils.CodeGeneratorImpl; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -299,7 +299,7 @@ private TrackedEntityInstance teiInSearchScope() { .organisationUnit(searchOrgunit) .build(); } - private void login() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + private void login() { + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPIShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPIShould.java index 79d336e9bb..3850e522a7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPIShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPIShould.java @@ -31,21 +31,21 @@ import junit.framework.Assert; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutorImpl; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; import org.hisp.dhis.android.core.event.EventStatus; -import org.hisp.dhis.android.core.imports.TEIImportSummary; -import org.hisp.dhis.android.core.imports.TEIWebResponse; +import org.hisp.dhis.android.core.imports.internal.TEIImportSummary; +import org.hisp.dhis.android.core.imports.internal.TEIWebResponse; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceFields; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstancePayload; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceService; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -563,7 +563,7 @@ public void event_in_completed_enrollment() throws Exception { .events().get(0).status()).isEqualTo(EventStatus.COMPLETED); } - private void login() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + private void login() { + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceUtils.java index 96c8209a7c..f0a4c2b618 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceUtils.java @@ -32,11 +32,11 @@ import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; import org.hisp.dhis.android.core.event.Event; import org.hisp.dhis.android.core.event.EventStatus; -import org.hisp.dhis.android.core.imports.BaseImportSummary; -import org.hisp.dhis.android.core.imports.EnrollmentImportSummary; -import org.hisp.dhis.android.core.imports.EventImportSummary; +import org.hisp.dhis.android.core.imports.internal.BaseImportSummary; +import org.hisp.dhis.android.core.imports.internal.EnrollmentImportSummary; +import org.hisp.dhis.android.core.imports.internal.EventImportSummary; import org.hisp.dhis.android.core.imports.ImportStatus; -import org.hisp.dhis.android.core.imports.TEIImportSummary; +import org.hisp.dhis.android.core.imports.internal.TEIImportSummary; import org.hisp.dhis.android.core.period.FeatureType; import org.hisp.dhis.android.core.relationship.Relationship229Compatible; import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue; @@ -220,7 +220,7 @@ private static Enrollment createFutureEnrollment(String teiUid) { private static Enrollment createValidEnrollmentAndEvent(String teiUid) { Date refDate = getValidDate(); String enrollmentUid = codeGenerator.generate(); - Event event = createValidEvent(teiUid, enrollmentUid); + Event event = createValidEvent(enrollmentUid); return getEnrollment(enrollmentUid, teiUid, refDate).toBuilder() .events(Collections.singletonList(event)).build(); @@ -229,7 +229,7 @@ private static Enrollment createValidEnrollmentAndEvent(String teiUid) { private static Enrollment createEnrollmentAndFutureEvent(String teiUid) { Date refDate = getValidDate(); String enrollmentUid = codeGenerator.generate(); - Event event = createFutureEvent(teiUid, enrollmentUid); + Event event = createFutureEvent(enrollmentUid); return getEnrollment(enrollmentUid, teiUid, refDate).toBuilder() .events(Collections.singletonList(event)).build(); @@ -238,7 +238,7 @@ private static Enrollment createEnrollmentAndFutureEvent(String teiUid) { private static Enrollment createEnrollmentAndEventWithInvalidDataElement(String teiUid) { Date refDate = getValidDate(); String enrollmentUid = codeGenerator.generate(); - Event event = createEventWithInvalidDataElement(teiUid, enrollmentUid); + Event event = createEventWithInvalidDataElement(enrollmentUid); return getEnrollment(enrollmentUid, teiUid, refDate).toBuilder() .events(Collections.singletonList(event)).build(); @@ -247,7 +247,7 @@ private static Enrollment createEnrollmentAndEventWithInvalidDataElement(String private static Enrollment createEnrollmentAndEventWithValidAndInvalidDataValue(String teiUid) { Date refDate = getValidDate(); String enrollmentUid = codeGenerator.generate(); - Event event = createEventWithValidAndInvalidDataValue(teiUid, enrollmentUid); + Event event = createEventWithValidAndInvalidDataValue(enrollmentUid); return getEnrollment(enrollmentUid, teiUid, refDate).toBuilder() .events(Collections.singletonList(event)).build(); @@ -256,7 +256,7 @@ private static Enrollment createEnrollmentAndEventWithValidAndInvalidDataValue(S private static Enrollment createCompletedEnrollmentWithEvent(String teiUid) { Date refDate = getValidDate(); String enrollmentUid = codeGenerator.generate(); - Event event = createValidCompletedEvent(teiUid, enrollmentUid); + Event event = createValidCompletedEvent(enrollmentUid); return getEnrollment(enrollmentUid, teiUid, refDate).toBuilder() .status(EnrollmentStatus.COMPLETED) @@ -270,8 +270,8 @@ private static Enrollment getEnrollment(String enrollmentUid, String teiUid, Dat .events(Collections.emptyList()).notes(Collections.emptyList()).build(); } - private static Event createValidEvent(String teiUid, String enrollmentUid) { - return createEvent(teiUid, enrollmentUid, getValidDate(), + private static Event createValidEvent(String enrollmentUid) { + return createEvent(enrollmentUid, getValidDate(), Collections.singletonList(TrackedEntityDataValue.builder() .dataElement(validNumberDataElementUid) .value("9") @@ -279,7 +279,7 @@ private static Event createValidEvent(String teiUid, String enrollmentUid) { .build())); } - private static Event createValidCompletedEvent(String teiUid, String enrollmentUid) { + private static Event createValidCompletedEvent(String enrollmentUid) { Date refDate = getValidDate(); List values = Collections.singletonList(TrackedEntityDataValue.builder() .dataElement(validNumberDataElementUid) @@ -291,15 +291,15 @@ private static Event createValidCompletedEvent(String teiUid, String enrollmentU .created(refDate).lastUpdated(refDate).program(validProgramUid).programStage(validProgramStageUid) .organisationUnit(validOrgUnitUid).eventDate(refDate).status(EventStatus.COMPLETED).deleted(false) .trackedEntityDataValues(values).attributeOptionCombo(validCategoryComboOptionUid) - .trackedEntityInstance(teiUid).build(); + .build(); } - private static Event createFutureEvent(String teiUid, String enrollmentUid) { - return createEvent(teiUid, enrollmentUid, getFutureDate(), Collections.emptyList()); + private static Event createFutureEvent(String enrollmentUid) { + return createEvent(enrollmentUid, getFutureDate(), Collections.emptyList()); } - private static Event createEventWithInvalidDataElement(String teiUid, String enrollmentUid) { - return createEvent(teiUid, enrollmentUid, getValidDate(), + private static Event createEventWithInvalidDataElement(String enrollmentUid) { + return createEvent(enrollmentUid, getValidDate(), Collections.singletonList(TrackedEntityDataValue.builder() .dataElement("invalidUid") .value("value") @@ -307,8 +307,8 @@ private static Event createEventWithInvalidDataElement(String teiUid, String enr .build())); } - private static Event createEventWithValidAndInvalidDataValue(String teiUid, String enrollmentUid) { - return createEvent(teiUid, enrollmentUid, getValidDate(), + private static Event createEventWithValidAndInvalidDataValue(String enrollmentUid) { + return createEvent(enrollmentUid, getValidDate(), Arrays.asList( TrackedEntityDataValue.builder() .dataElement(validNumberDataElementUid) @@ -322,14 +322,14 @@ private static Event createEventWithValidAndInvalidDataValue(String teiUid, Stri .build())); } - private static Event createEvent(String teiUid, String enrollmentUid, Date refDate, + private static Event createEvent(String enrollmentUid, Date refDate, List values) { return Event.builder().uid(codeGenerator.generate()).enrollment(enrollmentUid) .created(refDate).lastUpdated(refDate).program(validProgramUid).programStage(validProgramStageUid) .organisationUnit(validOrgUnitUid).eventDate(refDate).status(EventStatus.ACTIVE).deleted(false) .trackedEntityDataValues(values).attributeOptionCombo(validCategoryComboOptionUid) - .trackedEntityInstance(teiUid).build(); + .build(); } private static Date getValidDate() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.java index e9da9ac10a..096235eba2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.java @@ -29,11 +29,11 @@ package org.hisp.dhis.android.core.trackedentity.search; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.data.api.OuMode; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitMode; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -61,14 +61,14 @@ public void setUp() throws IOException { queryBuilder = TrackedEntityInstanceQuery.builder() .paging(true).page(1).pageSize(50) - .orgUnits(orgUnits).orgUnitMode(OuMode.ACCESSIBLE); + .orgUnits(orgUnits).orgUnitMode(OrganisationUnitMode.ACCESSIBLE); } //@Test public void query_and_download_tracked_entity_instances() throws Exception { login(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); TrackedEntityInstanceQuery query = queryBuilder.build(); List queriedTeis = @@ -85,7 +85,7 @@ public void query_and_download_tracked_entity_instances() throws Exception { assertThat(queriedTeis.size()).isEqualTo(downloadedTeis.size()); } - private void login() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + private void login() { + d2.userModule().logIn("android", "Android123").blockingGet(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCallRealIntegrationShould.java index 998c962d03..9ffb35fb92 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCallRealIntegrationShould.java @@ -31,11 +31,11 @@ import com.google.common.collect.Lists; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.data.api.OuMode; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitMode; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -63,7 +63,7 @@ public void setUp() throws IOException { queryBuilder = TrackedEntityInstanceQuery.builder() .paging(true).page(1).pageSize(50) - .orgUnits(orgUnits).orgUnitMode(OuMode.ACCESSIBLE).program("IpHINAT79UW"); + .orgUnits(orgUnits).orgUnitMode(OrganisationUnitMode.ACCESSIBLE).program("IpHINAT79UW"); } //@Test @@ -528,7 +528,7 @@ public void throw_exception_for_too_long_list_of_org_units() throws Exception { } } - private void login() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + private void login() { + d2.userModule().logIn("android", "Android123").blockingGet(); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthenticatedUserModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthenticatedUserModelShould.java index bda4248de8..9053ad111d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthenticatedUserModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthenticatedUserModelShould.java @@ -30,12 +30,13 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.user.AuthenticatedUserModel.Columns; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserCredentialsModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserCredentialsModelShould.java index 110ad55f41..8576fd2678 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserCredentialsModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserCredentialsModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.junit.Test; @@ -38,6 +37,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserOrganisationUnitLinkModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserOrganisationUnitLinkModelShould.java index 06c6b1e14c..6aceac88d3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserOrganisationUnitLinkModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserOrganisationUnitLinkModelShould.java @@ -30,12 +30,13 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.user.UserOrganisationUnitLinkModel.Columns; import org.junit.Test; import org.junit.runner.RunWith; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.AndroidTestUtils.toBoolean; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserRoleModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserRoleModelShould.java index 02efc67de9..f8bc3c4da9 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserRoleModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserRoleModelShould.java @@ -30,7 +30,6 @@ import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; @@ -40,6 +39,8 @@ import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthenticatedUserStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthenticatedUserStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserStoreIntegrationShould.java index 035604b313..a997b60200 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthenticatedUserStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.user; +package org.hisp.dhis.android.core.user.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.user.AuthenticatedUserSamples; +import org.hisp.dhis.android.core.user.AuthenticatedUser; +import org.hisp.dhis.android.core.user.AuthenticatedUserTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthorityStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthorityStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthorityStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthorityStoreIntegrationShould.java index 1965c67969..4225ec8450 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/AuthorityStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthorityStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.user; +package org.hisp.dhis.android.core.user.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.user.AuthoritySamples; +import org.hisp.dhis.android.core.user.Authority; +import org.hisp.dhis.android.core.user.AuthorityTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/LogoutCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogoutCallRealIntegrationShould.java similarity index 81% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/LogoutCallRealIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogoutCallRealIntegrationShould.java index 581717ce28..1df982a59b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/LogoutCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogoutCallRealIntegrationShould.java @@ -26,16 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.user; +package org.hisp.dhis.android.core.user.internal; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventCallFactory; import org.hisp.dhis.android.core.event.EventTableInfo; +import org.hisp.dhis.android.core.event.internal.EventCallFactory; +import org.hisp.dhis.android.core.user.AuthenticatedUser; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -63,9 +64,9 @@ public void setUp() throws IOException { //@Test public void delete_credentials_when_log_out_after_sync_data() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); Callable> eventCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); @@ -73,7 +74,7 @@ public void delete_credentials_when_log_out_after_sync_data() throws Exception { assertThat(isDatabaseEmpty(databaseAdapter())).isFalse(); - d2.userModule().logOut().call(); + d2.userModule().logOut().blockingAwait(); assertThat(isDatabaseEmpty(databaseAdapter())).isFalse(); assertThat(isTableEmpty(databaseAdapter(), EventTableInfo.TABLE_INFO.name())).isFalse(); @@ -87,13 +88,13 @@ public void delete_credentials_when_log_out_after_sync_data() throws Exception { //@Test public void recreate_credentials_when_login_again() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); assertThat(isDatabaseEmpty(databaseAdapter())).isFalse(); - d2.userModule().logOut().call(); + d2.userModule().logOut().blockingAwait(); assertThat(isDatabaseEmpty(databaseAdapter())).isFalse(); @@ -102,7 +103,7 @@ public void recreate_credentials_when_login_again() assertThat(authenticatedUser).isNotNull(); assertThat(authenticatedUser.credentials()).isNull(); - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); authenticatedUser = authenticatedUserStore.selectFirst(); @@ -112,8 +113,8 @@ public void recreate_credentials_when_login_again() //@Test public void response_successful_on_login_logout_and_login() throws Exception { - d2.userModule().logIn("android", "Android123").call(); - d2.userModule().logOut().call(); - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); + d2.userModule().logOut().blockingAwait(); + d2.userModule().logIn("android", "Android123").blockingGet(); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserAuthenticateCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateCallMockIntegrationShould.java similarity index 88% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/UserAuthenticateCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateCallMockIntegrationShould.java index c4f540e9ec..1a32e7c553 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserAuthenticateCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateCallMockIntegrationShould.java @@ -26,10 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.user; +package org.hisp.dhis.android.core.user.internal; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.user.AuthenticatedUser; +import org.hisp.dhis.android.core.user.User; +import org.hisp.dhis.android.core.user.UserCredentials; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.After; @@ -37,7 +40,7 @@ import org.junit.Test; import org.junit.runner.RunWith; -import java.util.concurrent.Callable; +import io.reactivex.Single; import static com.google.common.truth.Truth.assertThat; @@ -47,14 +50,14 @@ @RunWith(D2JunitRunner.class) public class UserAuthenticateCallMockIntegrationShould extends BaseMockIntegrationTestEmptyEnqueable { - private Callable authenticateUserCall; + private Single logInSingle; @Before public void setUp() throws D2Error { dhis2MockServer.enqueueMockResponse("user/user.json"); dhis2MockServer.enqueueMockResponse("systeminfo/system_info.json"); - authenticateUserCall = d2.userModule().logIn("test_user", "test_password"); + logInSingle = d2.userModule().logIn("test_user", "test_password"); } @@ -65,8 +68,8 @@ public void tearDown() { } @Test - public void persist_user_in_data_base_when_call() throws Exception { - authenticateUserCall.call(); + public void persist_user_in_data_base_when_call() { + logInSingle.blockingGet(); User user = d2.userModule().user.get(); assertThat(user.uid()).isEqualTo("DXyJmlo9rge"); @@ -82,7 +85,7 @@ public void persist_user_in_data_base_when_call() throws Exception { @Test public void return_correct_user_when_call() throws Exception { - User user = authenticateUserCall.call(); + User user = logInSingle.blockingGet(); // verify payload which has been returned from call assertThat(user.uid()).isEqualTo("DXyJmlo9rge"); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.java similarity index 96% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/UserCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.java index 754468cd71..abfb779503 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.user; +package org.hisp.dhis.android.core.user.internal; import android.content.ContentValues; import android.database.Cursor; @@ -34,6 +34,9 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.program.CreateProgramUtils; import org.hisp.dhis.android.core.program.ProgramTableInfo; +import org.hisp.dhis.android.core.user.User; +import org.hisp.dhis.android.core.user.UserCredentialsTableInfo; +import org.hisp.dhis.android.core.user.UserTableInfo; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.BeforeClass; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserModelShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserModelShould.java similarity index 98% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/UserModelShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserModelShould.java index 9d28e33786..ef84e2092d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserModelShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserModelShould.java @@ -26,19 +26,22 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.user; +package org.hisp.dhis.android.core.user.internal; import android.content.ContentValues; import android.database.MatrixCursor; -import androidx.test.runner.AndroidJUnit4; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel.Columns; +import org.hisp.dhis.android.core.user.User; +import org.hisp.dhis.android.core.user.UserTableInfo; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Date; +import androidx.test.runner.AndroidJUnit4; + import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserOrganisationUnitLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserOrganisationUnitLinkStoreIntegrationShould.java similarity index 93% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/UserOrganisationUnitLinkStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserOrganisationUnitLinkStoreIntegrationShould.java index e01307f8fc..04528a5f61 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserOrganisationUnitLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserOrganisationUnitLinkStoreIntegrationShould.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.user; +package org.hisp.dhis.android.core.user.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.LinkModelStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.user.UserOrganisationUnitLinkSamples; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; +import org.hisp.dhis.android.core.user.UserOrganisationUnitLink; +import org.hisp.dhis.android.core.user.UserOrganisationUnitLinkTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserRoleStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserRoleStoreIntegrationShould.java similarity index 94% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/UserRoleStoreIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserRoleStoreIntegrationShould.java index 465845e085..7548db1066 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserRoleStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserRoleStoreIntegrationShould.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.user; +package org.hisp.dhis.android.core.user.internal; -import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; import org.hisp.dhis.android.core.data.user.UserRoleSamples; +import org.hisp.dhis.android.core.user.UserRole; +import org.hisp.dhis.android.core.user.UserRoleTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.DatabaseAdapterFactory; import org.junit.runner.RunWith; import androidx.test.runner.AndroidJUnit4; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestFullDispatcher.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestFullDispatcher.java index 6c8c72a2eb..b62fba9e17 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestFullDispatcher.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestFullDispatcher.java @@ -28,16 +28,16 @@ package org.hisp.dhis.android.core.utils.integration.mock; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; import org.hisp.dhis.android.core.data.imports.TrackerImportConflictSamples; import org.hisp.dhis.android.core.data.maintenance.D2ErrorSamples; import org.hisp.dhis.android.core.imports.ImportStatus; import org.hisp.dhis.android.core.imports.TrackerImportConflict; -import org.hisp.dhis.android.core.imports.TrackerImportConflictStore; +import org.hisp.dhis.android.core.imports.internal.TrackerImportConflictStore; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.maintenance.D2ErrorComponent; -import org.hisp.dhis.android.core.maintenance.D2ErrorStore; +import org.hisp.dhis.android.core.maintenance.internal.D2ErrorStore; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -70,15 +70,15 @@ public static void tearDownClass() throws IOException { } private static void login() throws Exception { - d2.userModule().logIn("android", "Android123").call(); + d2.userModule().logIn("android", "Android123").blockingGet(); } private static void downloadMetadata() throws Exception { - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); } private static void downloadTrackedEntityInstances() { - d2.trackedEntityModule().downloadTrackedEntityInstances(2, false, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(2, false, false).subscribe(); } private static void downloadEvents() throws Exception { @@ -86,7 +86,7 @@ private static void downloadEvents() throws Exception { } private static void downloadAggregatedData() { - d2.aggregatedModule().data().download().asObservable().subscribe(); + d2.aggregatedModule().data().download().subscribe(); } private static void storeSomeD2Errors() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataDispatcher.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataDispatcher.java index 2541addddc..2792309e7c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataDispatcher.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataDispatcher.java @@ -37,7 +37,7 @@ public static void setUpClass() throws Exception { boolean isNewInstance = setUpClass(MockIntegrationTestDatabaseContent.MetadataDispatcher); if (isNewInstance) { objects.dhis2MockServer.setRequestDispatcher(); - objects.d2.syncMetaData().call(); + objects.d2.syncMetaData().blockingSubscribe(); } } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataEnqueable.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataEnqueable.java index 36aef9c4a7..da981e364e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataEnqueable.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataEnqueable.java @@ -37,7 +37,7 @@ public static void setUpClass() throws Exception { boolean isNewInstance = setUpClass(MockIntegrationTestDatabaseContent.MetadataEnqueable); if (isNewInstance) { objects.dhis2MockServer.enqueueMetadataResponses(); - objects.d2.syncMetaData().call(); + objects.d2.syncMetaData().blockingSubscribe(); } } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestObjects.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestObjects.java index f3aba92dc3..291522c07a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestObjects.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestObjects.java @@ -36,11 +36,10 @@ import org.hisp.dhis.android.core.D2; import org.hisp.dhis.android.core.D2DIComponent; -import org.hisp.dhis.android.core.common.D2Factory; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.data.server.Dhis2MockServer; -import org.hisp.dhis.android.core.resource.ResourceHandler; -import org.hisp.dhis.android.core.resource.ResourceStoreImpl; +import org.hisp.dhis.android.core.resource.internal.ResourceHandler; import java.io.IOException; import java.util.Date; @@ -78,7 +77,7 @@ public class MockIntegrationTestObjects { d2DIComponent = D2DIComponent.create(context, d2.retrofit(), databaseAdapter); - resourceHandler = new ResourceHandler(ResourceStoreImpl.create(databaseAdapter)); + resourceHandler = ResourceHandler.create(databaseAdapter); resourceHandler.setServerDate(serverDate); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/real/BaseRealIntegrationTest.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/real/BaseRealIntegrationTest.java index c19637008e..28878b42d7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/real/BaseRealIntegrationTest.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/real/BaseRealIntegrationTest.java @@ -35,12 +35,11 @@ import org.hisp.dhis.android.core.D2; import org.hisp.dhis.android.core.D2DIComponent; -import org.hisp.dhis.android.core.common.GenericCallData; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.data.database.DbOpenHelper; import org.hisp.dhis.android.core.data.database.SqLiteDatabaseAdapter; -import org.hisp.dhis.android.core.resource.ResourceHandler; -import org.hisp.dhis.android.core.resource.ResourceStoreImpl; +import org.hisp.dhis.android.core.resource.internal.ResourceHandler; import org.junit.After; import org.junit.Before; @@ -66,7 +65,7 @@ public void setUp() throws IOException { , dbName); sqLiteDatabase = dbOpenHelper.getWritableDatabase(); databaseAdapter = new SqLiteDatabaseAdapter(dbOpenHelper); - resourceHandler = new ResourceHandler(ResourceStoreImpl.create(databaseAdapter)); + resourceHandler = ResourceHandler.create(databaseAdapter); resourceHandler.setServerDate(serverDate); Stetho.initializeWithDefaults(InstrumentationRegistry.getTargetContext().getApplicationContext()); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallMockIntegrationShould.java index 1c35bc0cdd..cc8e7d7e83 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallMockIntegrationShould.java @@ -53,11 +53,11 @@ public void have_empty_database_when_wipe_db_after_sync_data() throws Exception } private void givenALoginInDatabase() throws Exception { - d2.userModule().logIn("user", "password").call(); + d2.userModule().logIn("user", "password").blockingGet(); } private void givenAMetadataInDatabase() throws Exception { - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); } private void givenAEventInDatabase() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallRealIntegrationShould.java index e14211f3c9..85b4b9387c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallRealIntegrationShould.java @@ -29,14 +29,14 @@ package org.hisp.dhis.android.core.wipe; import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.common.D2Factory; -import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.d2manager.D2Factory; import org.hisp.dhis.android.core.data.database.DatabaseAssert; import org.hisp.dhis.android.core.data.server.RealServerMother; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventCallFactory; +import org.hisp.dhis.android.core.event.internal.EventCallFactory; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStoreImpl; +import org.hisp.dhis.android.core.utils.integration.real.BaseRealIntegrationTest; import org.junit.Before; import java.io.IOException; @@ -58,9 +58,9 @@ public void setUp() throws IOException { //@Test public void have_empty_database_when_wipe_db_after_sync_metadata() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); DatabaseAssert.assertThatDatabase(databaseAdapter()).isNotEmpty(); @@ -71,9 +71,9 @@ public void have_empty_database_when_wipe_db_after_sync_metadata() throws Except //@Test public void have_empty_database_when_wipe_db_after_sync_data() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); Callable> eventCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); @@ -88,9 +88,9 @@ public void have_empty_database_when_wipe_db_after_sync_data() throws Exception //@Test public void do_not_have_metadata_when_wipe_metadata_after_sync_metadata() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); DatabaseAssert.assertThatDatabase(databaseAdapter()).isNotEmpty(); @@ -101,11 +101,11 @@ public void do_not_have_metadata_when_wipe_metadata_after_sync_metadata() throws //@Test public void do_not_have_data_when_wipe_data_after_sync() throws Exception { - d2.userModule().logIn(RealServerMother.user, RealServerMother.password).call(); + d2.userModule().logIn(RealServerMother.user, RealServerMother.password).blockingGet(); - d2.syncMetaData().call(); + d2.syncMetaData().blockingSubscribe(); - d2.trackedEntityModule().downloadTrackedEntityInstances(5, false, false).asObservable().subscribe(); + d2.trackedEntityModule().downloadTrackedEntityInstances(5, false, false).subscribe(); TrackedEntityInstanceStore trackedEntityInstanceStore = TrackedEntityInstanceStoreImpl.create(databaseAdapter()); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryModuleMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryModuleMockIntegrationShould.java similarity index 96% rename from core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryModuleMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryModuleMockIntegrationShould.java index 28405e0190..a1272c7757 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/CategoryModuleMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryModuleMockIntegrationShould.java @@ -26,9 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.testapp.category; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCombo; +import org.hisp.dhis.android.core.category.CategoryOption; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetModuleMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java similarity index 96% rename from core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetModuleMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java index 9cd9ce8f66..f0f0886b02 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/DataSetModuleMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java @@ -26,10 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.testapp.dataset; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataset.DataInputPeriod; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetElement; +import org.hisp.dhis.android.core.dataset.Section; import org.hisp.dhis.android.core.indicator.Indicator; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataSetReportCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataSetReportCollectionRepositoryMockIntegrationShould.java new file mode 100644 index 0000000000..81a20dbc85 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataSetReportCollectionRepositoryMockIntegrationShould.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2004-2019, 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.datavalue; + +import org.hisp.dhis.android.core.common.BaseIdentifiableObject; +import org.hisp.dhis.android.core.datavalue.DataSetReport; +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; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.text.ParseException; +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; + +@RunWith(D2JunitRunner.class) +public class DataSetReportCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { + + @Test + public void find_all() { + List dataSetReports = d2.dataValueModule().dataSetReports + .get(); + assertThat(dataSetReports.size(), is(3)); + } + + @Test + public void filter_by_dataset() { + List dataSetReports = d2.dataValueModule().dataSetReports + .byDataSetUid().eq("lyLU2wR22tC") + .get(); + assertThat(dataSetReports.size(), is(3)); + } + + @Test + public void filter_by_period() { + List dataSetReports = d2.dataValueModule().dataSetReports + .byPeriod().eq("2018") + .get(); + assertThat(dataSetReports.size(), is(1)); + } + + @Test + public void filter_by_period_type() { + List dataSetReports = d2.dataValueModule().dataSetReports + .byPeriodType().eq(PeriodType.Yearly) + .get(); + assertThat(dataSetReports.size(), is(3)); + } + + @Test + public void filter_by_period_start_date() throws ParseException { + List dataSetReports = d2.dataValueModule().dataSetReports + .byPeriodStartDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) + .get(); + assertThat(dataSetReports.size(), is(1)); + } + + @Test + public void filter_by_period_end_date() throws ParseException { + List dataSetReports = d2.dataValueModule().dataSetReports + .byPeriodEndDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) + .get(); + assertThat(dataSetReports.size(), is(2)); + } + + @Test + public void filter_by_organisation_unit() { + List dataSetReports = d2.dataValueModule().dataSetReports + .byOrganisationUnitUid().eq("DiszpKrYNg8") + .get(); + assertThat(dataSetReports.size(), is(3)); + } + +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.java index 3a1ff98cd5..f97dd1b758 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.java @@ -71,7 +71,7 @@ public void filter_by_period() { List dataValues = d2.dataValueModule().dataValues .byPeriod() - .eq("201809") + .eq("2018") .get(); assertThat(dataValues.size(), is(1)); @@ -189,7 +189,7 @@ public void filter_by_state() { @Test public void return_data_value_object_repository() { DataValueObjectRepository objectRepository = d2.dataValueModule().dataValues - .value("201809", "DiszpKrYNg8", "g9eOBujte1U", + .value("2018", "DiszpKrYNg8", "g9eOBujte1U", "Gmbgme7z9BF", "bRowv6yZOF2"); assertThat(objectRepository.exists(), is(Boolean.TRUE)); assertThat(objectRepository.get().value(), is("10")); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueObjectRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueObjectRepositoryMockIntegrationShould.java index a5d0e44307..3e9f3008c0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueObjectRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueObjectRepositoryMockIntegrationShould.java @@ -30,7 +30,7 @@ import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.datavalue.DataValueObjectRepository; -import org.hisp.dhis.android.core.datavalue.DataValueStore; +import org.hisp.dhis.android.core.datavalue.internal.DataValueStore; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; @@ -109,7 +109,7 @@ public void return_that_a_value_exists_only_if_it_has_been_created() { .value("no_period", "no_org_unit", "no_data_element", "no_category", "no_attribute").exists(), is(Boolean.FALSE)); assertThat(d2.dataValueModule().dataValues - .value("201809", "DiszpKrYNg8", "g9eOBujte1U", + .value("2018", "DiszpKrYNg8", "g9eOBujte1U", "Gmbgme7z9BF", "bRowv6yZOF2").exists(), is(Boolean.TRUE)); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentObjectRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentObjectRepositoryMockIntegrationShould.java index fda511cba7..e8939bf2c7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentObjectRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentObjectRepositoryMockIntegrationShould.java @@ -34,7 +34,7 @@ import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventCollectionRepositoryMockIntegrationShould.java index 2294a9e825..b8fbf73264 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventCollectionRepositoryMockIntegrationShould.java @@ -41,6 +41,7 @@ import org.junit.runner.RunWith; import java.text.ParseException; +import java.util.Collections; import java.util.List; import static org.hamcrest.MatcherAssert.assertThat; @@ -232,7 +233,7 @@ public void filter_by_attribute_option_combo() { public void filter_by_tracked_entity_instance() { List events = d2.eventModule().events - .byTrackedEntityInstaceUid().eq("nWrB0TfWlvh") + .byTrackedEntityInstanceUids(Collections.singletonList("nWrB0TfWlvh")) .get(); assertThat(events.size(), is(1)); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventObjectRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventObjectRepositoryMockIntegrationShould.java index 5fbbc5c56a..d60b97dfdc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventObjectRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventObjectRepositoryMockIntegrationShould.java @@ -34,7 +34,7 @@ import org.hisp.dhis.android.core.event.EventStatus; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Test; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/trackedentity/TrackedEntityInstanceObjectRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/trackedentity/TrackedEntityInstanceObjectRepositoryMockIntegrationShould.java index 1d7a495d65..ad919ba854 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/trackedentity/TrackedEntityInstanceObjectRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/trackedentity/TrackedEntityInstanceObjectRepositoryMockIntegrationShould.java @@ -30,7 +30,7 @@ import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceCreateProjection; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceObjectRepository; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; diff --git a/core/src/main/assets/migrations/50.yaml b/core/src/main/assets/migrations/50.yaml new file mode 100644 index 0000000000..1a6148ea80 --- /dev/null +++ b/core/src/main/assets/migrations/50.yaml @@ -0,0 +1,7 @@ +up: +- BEGIN TRANSACTION; +- ALTER TABLE Event RENAME TO Event_Old; +- CREATE TABLE Event (_id INTEGER PRIMARY KEY AUTOINCREMENT, uid TEXT NOT NULL UNIQUE, enrollment TEXT, created TEXT, lastUpdated TEXT, createdAtClient TEXT, lastUpdatedAtClient TEXT, status TEXT, latitude TEXT, longitude TEXT, program TEXT NOT NULL, programStage TEXT NOT NULL, organisationUnit TEXT NOT NULL, eventDate TEXT, completedDate TEXT, dueDate TEXT, state TEXT, attributeOptionCombo TEXT, FOREIGN KEY (program) REFERENCES Program (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY (programStage) REFERENCES ProgramStage (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY (enrollment) REFERENCES Enrollment (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY (organisationUnit) REFERENCES OrganisationUnit (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY (attributeOptionCombo) REFERENCES CategoryOptionCombo (uid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED); +- INSERT INTO Event (_id, uid, enrollment, created, lastUpdated, createdAtClient, lastUpdatedAtClient, status, latitude, longitude, program, programStage, organisationUnit, eventDate, completedDate, dueDate, state, attributeOptionCombo) SELECT _id, uid, enrollment, created, lastUpdated, createdAtClient, lastUpdatedAtClient, status, latitude, longitude, program, programStage, organisationUnit, eventDate, completedDate, dueDate, state, attributeOptionCombo FROM Event_Old; +- DROP TABLE Event_Old; +- COMMIT; \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/D2.java b/core/src/main/java/org/hisp/dhis/android/core/D2.java index 04f56585cf..9f2f92901a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/D2.java +++ b/core/src/main/java/org/hisp/dhis/android/core/D2.java @@ -32,13 +32,13 @@ import android.os.StrictMode; import org.hisp.dhis.android.BuildConfig; +import org.hisp.dhis.android.core.arch.api.fields.internal.FieldsConverterFactory; +import org.hisp.dhis.android.core.arch.api.filters.internal.FilterConverterFactory; +import org.hisp.dhis.android.core.arch.api.ssl.internal.SSLContextInitializer; +import org.hisp.dhis.android.core.arch.call.D2Progress; import org.hisp.dhis.android.core.category.CategoryModule; -import org.hisp.dhis.android.core.common.SSLContextInitializer; -import org.hisp.dhis.android.core.common.Unit; import org.hisp.dhis.android.core.configuration.Configuration; import org.hisp.dhis.android.core.constant.ConstantModule; -import org.hisp.dhis.android.core.data.api.FieldsConverterFactory; -import org.hisp.dhis.android.core.data.api.FilterConverterFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataelement.DataElementModule; import org.hisp.dhis.android.core.dataset.DataSetModule; @@ -46,7 +46,7 @@ import org.hisp.dhis.android.core.domain.aggregated.AggregatedModule; import org.hisp.dhis.android.core.enrollment.EnrollmentModule; import org.hisp.dhis.android.core.event.EventModule; -import org.hisp.dhis.android.core.imports.ImportModule; +import org.hisp.dhis.android.core.imports.internal.ImportModule; import org.hisp.dhis.android.core.indicator.IndicatorModule; import org.hisp.dhis.android.core.legendset.LegendSetModule; import org.hisp.dhis.android.core.maintenance.MaintenanceModule; @@ -62,10 +62,9 @@ import org.hisp.dhis.android.core.user.UserModule; import org.hisp.dhis.android.core.wipe.WipeModule; -import java.util.concurrent.Callable; - import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; +import io.reactivex.Observable; import okhttp3.OkHttpClient; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; @@ -111,8 +110,8 @@ public DatabaseAdapter databaseAdapter() { } @NonNull - public Callable syncMetaData() { - return d2DIComponent.metadataCall(); + public Observable syncMetaData() { + return d2DIComponent.metadataCall().download(); } @NonNull diff --git a/core/src/main/java/org/hisp/dhis/android/core/D2DIComponent.java b/core/src/main/java/org/hisp/dhis/android/core/D2DIComponent.java index 03959ea295..d533a01fee 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/D2DIComponent.java +++ b/core/src/main/java/org/hisp/dhis/android/core/D2DIComponent.java @@ -30,49 +30,49 @@ import android.content.Context; -import org.hisp.dhis.android.core.arch.api.retrofit.APIClientDIModule; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.di.RepositoriesDIModule; -import org.hisp.dhis.android.core.calls.MetadataCall; -import org.hisp.dhis.android.core.calls.factories.ListCallFactory; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactory; +import org.hisp.dhis.android.core.arch.api.internal.APIClientDIModule; +import org.hisp.dhis.android.core.arch.call.factories.internal.ListCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.repositories.di.internal.RepositoriesDIModule; import org.hisp.dhis.android.core.category.CategoryOption; -import org.hisp.dhis.android.core.category.CategoryPackageDIModule; -import org.hisp.dhis.android.core.common.CommonPackageDIModule; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.constant.ConstantPackageDIModule; +import org.hisp.dhis.android.core.category.internal.CategoryPackageDIModule; +import org.hisp.dhis.android.core.common.internal.CommonPackageDIModule; +import org.hisp.dhis.android.core.constant.internal.ConstantPackageDIModule; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.data.database.DatabaseDIModule; -import org.hisp.dhis.android.core.dataapproval.DataApprovalPackageDIModule; +import org.hisp.dhis.android.core.dataapproval.internal.DataApprovalPackageDIModule; import org.hisp.dhis.android.core.dataelement.DataElement; -import org.hisp.dhis.android.core.dataelement.DataElementPackageDIModule; +import org.hisp.dhis.android.core.dataelement.internal.DataElementPackageDIModule; import org.hisp.dhis.android.core.dataset.DataSet; -import org.hisp.dhis.android.core.dataset.DataSetPackageDIModule; -import org.hisp.dhis.android.core.datavalue.DataValuePackageDIModule; +import org.hisp.dhis.android.core.dataset.internal.DataSetPackageDIModule; +import org.hisp.dhis.android.core.datavalue.internal.DataValuePackageDIModule; import org.hisp.dhis.android.core.domain.aggregated.AggregatedModule; -import org.hisp.dhis.android.core.enrollment.EnrollmentPackageDIModule; -import org.hisp.dhis.android.core.event.EventPackageDIModule; -import org.hisp.dhis.android.core.event.EventPostCall; -import org.hisp.dhis.android.core.imports.ImportPackageDIModule; -import org.hisp.dhis.android.core.indicator.IndicatorPackageDIModule; -import org.hisp.dhis.android.core.legendset.LegendPackageDIModule; -import org.hisp.dhis.android.core.maintenance.MaintenancePackageDIModule; -import org.hisp.dhis.android.core.option.OptionPackageDIModule; +import org.hisp.dhis.android.core.domain.metadata.MetadataCall; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentPackageDIModule; +import org.hisp.dhis.android.core.event.internal.EventPackageDIModule; +import org.hisp.dhis.android.core.event.internal.EventPostCall; +import org.hisp.dhis.android.core.imports.internal.ImportPackageDIModule; +import org.hisp.dhis.android.core.indicator.internal.IndicatorPackageDIModule; +import org.hisp.dhis.android.core.legendset.internal.LegendPackageDIModule; +import org.hisp.dhis.android.core.maintenance.internal.MaintenancePackageDIModule; import org.hisp.dhis.android.core.option.OptionSet; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitPackageDIModule; -import org.hisp.dhis.android.core.period.PeriodPackageDIModule; +import org.hisp.dhis.android.core.option.internal.OptionPackageDIModule; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitPackageDIModule; +import org.hisp.dhis.android.core.period.internal.PeriodPackageDIModule; import org.hisp.dhis.android.core.program.Program; -import org.hisp.dhis.android.core.program.ProgramPackageDIModule; -import org.hisp.dhis.android.core.relationship.RelationshipPackageDIModule; +import org.hisp.dhis.android.core.program.internal.ProgramPackageDIModule; import org.hisp.dhis.android.core.relationship.RelationshipType; -import org.hisp.dhis.android.core.resource.ResourcePackageDIModule; -import org.hisp.dhis.android.core.settings.SystemSettingPackageDIModule; +import org.hisp.dhis.android.core.relationship.internal.RelationshipPackageDIModule; +import org.hisp.dhis.android.core.resource.internal.ResourcePackageDIModule; +import org.hisp.dhis.android.core.settings.internal.SystemSettingPackageDIModule; import org.hisp.dhis.android.core.sms.SmsDIModule; import org.hisp.dhis.android.core.systeminfo.SystemInfoPackageDIModule; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstancePostCall; import org.hisp.dhis.android.core.trackedentity.TrackedEntityPackageDIModule; import org.hisp.dhis.android.core.trackedentity.TrackedEntityType; -import org.hisp.dhis.android.core.user.UserPackageDIModule; +import org.hisp.dhis.android.core.user.internal.UserPackageDIModule; import org.hisp.dhis.android.core.wipe.WipeDIModule; import org.hisp.dhis.android.core.wipe.WipeModule; @@ -136,7 +136,7 @@ public interface D2DIComponent { @VisibleForTesting UidsCallFactory trackedEntityTypeCallFactory(); @VisibleForTesting - SyncHandler relationshipTypeHandler(); + Handler relationshipTypeHandler(); @VisibleForTesting TrackedEntityInstancePostCall trackedEntityInstancePostCall(); @VisibleForTesting diff --git a/core/src/main/java/org/hisp/dhis/android/core/D2InternalModules.java b/core/src/main/java/org/hisp/dhis/android/core/D2InternalModules.java index df8ad7cd29..b4ad90d29d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/D2InternalModules.java +++ b/core/src/main/java/org/hisp/dhis/android/core/D2InternalModules.java @@ -28,8 +28,8 @@ package org.hisp.dhis.android.core; -import org.hisp.dhis.android.core.category.CategoryInternalModule; -import org.hisp.dhis.android.core.user.UserInternalModule; +import org.hisp.dhis.android.core.category.internal.CategoryInternalModule; +import org.hisp.dhis.android.core.user.internal.UserInternalModule; import javax.inject.Inject; diff --git a/core/src/main/java/org/hisp/dhis/android/core/D2Modules.java b/core/src/main/java/org/hisp/dhis/android/core/D2Modules.java index af982875e3..939f1d046c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/D2Modules.java +++ b/core/src/main/java/org/hisp/dhis/android/core/D2Modules.java @@ -35,7 +35,7 @@ import org.hisp.dhis.android.core.datavalue.DataValueModule; import org.hisp.dhis.android.core.enrollment.EnrollmentModule; import org.hisp.dhis.android.core.event.EventModule; -import org.hisp.dhis.android.core.imports.ImportModule; +import org.hisp.dhis.android.core.imports.internal.ImportModule; import org.hisp.dhis.android.core.indicator.IndicatorModule; import org.hisp.dhis.android.core.legendset.LegendSetModule; import org.hisp.dhis.android.core.maintenance.MaintenanceModule; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/Authenticator.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/Authenticator.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/Authenticator.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/Authenticator.java index edc9907e17..5b168a396a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/Authenticator.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/Authenticator.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; +package org.hisp.dhis.android.core.arch.api.authentication.internal; import okhttp3.Interceptor; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/BasicAuthenticator.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/BasicAuthenticator.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/BasicAuthenticator.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/BasicAuthenticator.java index 43b85b5310..a36f90ba1f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/BasicAuthenticator.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/BasicAuthenticator.java @@ -26,16 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; +package org.hisp.dhis.android.core.arch.api.authentication.internal; -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; import org.hisp.dhis.android.core.user.AuthenticatedUser; import java.io.IOException; import java.util.Locale; +import androidx.annotation.NonNull; import okhttp3.Request; import okhttp3.Response; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/BasicAuthenticatorFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/BasicAuthenticatorFactory.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/BasicAuthenticatorFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/BasicAuthenticatorFactory.java index 8f889a2101..8d1e1e526b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/BasicAuthenticatorFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/authentication/internal/BasicAuthenticatorFactory.java @@ -26,14 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; +package org.hisp.dhis.android.core.arch.api.authentication.internal; -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.user.AuthenticatedUser; -import org.hisp.dhis.android.core.user.AuthenticatedUserStore; +import org.hisp.dhis.android.core.user.internal.AuthenticatedUserStore; + +import androidx.annotation.NonNull; public final class BasicAuthenticatorFactory { private BasicAuthenticatorFactory() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallErrorCatcher.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallErrorCatcher.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallErrorCatcher.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallErrorCatcher.java index 2a4bc14dfd..d63e339197 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallErrorCatcher.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallErrorCatcher.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.executors; +package org.hisp.dhis.android.core.arch.api.executors.internal; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallExecutor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutor.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallExecutor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutor.java index 639add56de..cf8149942d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallExecutor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutor.java @@ -26,9 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.executors; +package org.hisp.dhis.android.core.arch.api.executors.internal; -import org.hisp.dhis.android.core.common.Payload; +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; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallExecutorImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutorImpl.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallExecutorImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutorImpl.java index 4cc56ed854..4127565b76 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APICallExecutorImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APICallExecutorImpl.java @@ -26,16 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.executors; +package org.hisp.dhis.android.core.arch.api.executors.internal; import org.hisp.dhis.android.core.ObjectMapperFactory; -import org.hisp.dhis.android.core.common.ObjectStore; -import org.hisp.dhis.android.core.common.Payload; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; import org.hisp.dhis.android.core.common.Unit; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; -import org.hisp.dhis.android.core.maintenance.D2ErrorStore; +import org.hisp.dhis.android.core.maintenance.internal.D2ErrorStore; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APIErrorMapper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIErrorMapper.java similarity index 99% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APIErrorMapper.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIErrorMapper.java index aef7433a0c..f3e1f678c4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APIErrorMapper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIErrorMapper.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.executors; +package org.hisp.dhis.android.core.arch.api.executors.internal; import android.util.Log; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APIExecutorsDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIExecutorsDIModule.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APIExecutorsDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIExecutorsDIModule.java index 015b91777c..4c407813ae 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/APIExecutorsDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/APIExecutorsDIModule.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.executors; +package org.hisp.dhis.android.core.arch.api.executors.internal; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/RxAPICallExecutor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/RxAPICallExecutor.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/RxAPICallExecutor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/RxAPICallExecutor.java index eb99e8fb53..ddb26f3e8f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/RxAPICallExecutor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/RxAPICallExecutor.java @@ -26,10 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.executors; - -import org.hisp.dhis.android.core.arch.call.D2CallWithProgress; -import org.hisp.dhis.android.core.arch.call.D2Progress; +package org.hisp.dhis.android.core.arch.api.executors.internal; import io.reactivex.Observable; import io.reactivex.Single; @@ -37,5 +34,5 @@ public interface RxAPICallExecutor {

Single

wrapSingle(Single

single); - D2CallWithProgress wrapObservableTransactionally(Observable observable, boolean cleanForeignKeys); +

Observable

wrapObservableTransactionally(Observable

observable, boolean cleanForeignKeys); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/RxAPICallExecutorImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/RxAPICallExecutorImpl.java similarity index 69% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/RxAPICallExecutorImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/RxAPICallExecutorImpl.java index 21766a725b..93938acd35 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/RxAPICallExecutorImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/executors/internal/RxAPICallExecutorImpl.java @@ -26,16 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.executors; +package org.hisp.dhis.android.core.arch.api.executors.internal; -import org.hisp.dhis.android.core.arch.call.D2CallWithProgress; -import org.hisp.dhis.android.core.arch.call.D2CallWithProgressImpl; -import org.hisp.dhis.android.core.arch.call.D2Progress; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import org.hisp.dhis.android.core.data.database.Transaction; import org.hisp.dhis.android.core.maintenance.D2Error; -import org.hisp.dhis.android.core.maintenance.ForeignKeyCleaner; +import org.hisp.dhis.android.core.maintenance.internal.ForeignKeyCleaner; import javax.inject.Inject; @@ -68,26 +64,24 @@ public

Single

wrapSingle(Single

single) { } @Override - public D2CallWithProgress wrapObservableTransactionally(Observable observable, + public

Observable

wrapObservableTransactionally(Observable

observable, boolean cleanForeignKeys) { - Transaction transaction = databaseAdapter.beginNewTransaction(); - return new D2CallWithProgressImpl( - observable - .doOnComplete(() -> { - if (cleanForeignKeys) { - foreignKeyCleaner.cleanForeignKeyErrors(); - } - transaction.setSuccessful(); - transaction.end(); - }).onErrorResumeNext(throwable -> { - transaction.end(); - return Observable.error(mapAndStore(throwable)); - }) - ); + return Observable.fromCallable(databaseAdapter::beginNewTransaction).flatMap(transaction -> observable + .doOnComplete(() -> { + if (cleanForeignKeys) { + foreignKeyCleaner.cleanForeignKeyErrors(); + } + transaction.setSuccessful(); + transaction.end(); + }).onErrorResumeNext(throwable -> { + transaction.end(); + return Observable.error(mapAndStore(throwable)); + })); } private D2Error mapAndStore(Throwable throwable) { - D2Error d2Error = errorMapper.mapRetrofitException(throwable, errorMapper.getRxObjectErrorBuilder()); + D2Error d2Error = throwable instanceof D2Error ? (D2Error) throwable + : errorMapper.mapRetrofitException(throwable, errorMapper.getRxObjectErrorBuilder()); errorStore.insert(d2Error); return d2Error; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/Field.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Field.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/Field.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Field.java index 390e02450f..b21e3a2abf 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/Field.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Field.java @@ -26,16 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.arch.api.fields.internal; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.common.Property; +import org.hisp.dhis.android.core.arch.api.filters.internal.Filter; +import org.hisp.dhis.android.core.arch.api.filters.internal.InFilter; +import org.hisp.dhis.android.core.arch.api.filters.internal.SingleValueFilter; import java.util.Collection; +import androidx.annotation.NonNull; + @AutoValue public abstract class Field implements Property { diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/Fields.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Fields.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/Fields.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Fields.java index 2d0a9e71ff..2f48c3593e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/Fields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Fields.java @@ -26,20 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.arch.api.fields.internal; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.common.Property; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; +import androidx.annotation.NonNull; + @AutoValue public abstract class Fields { diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/FieldsConverter.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/FieldsConverter.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/FieldsConverter.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/FieldsConverter.java index f79fd50ef0..77c71f365f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/FieldsConverter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/FieldsConverter.java @@ -26,9 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; - -import org.hisp.dhis.android.core.common.Property; +package org.hisp.dhis.android.core.arch.api.fields.internal; import java.io.IOException; import java.util.Iterator; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/FieldsConverterFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/FieldsConverterFactory.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/FieldsConverterFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/FieldsConverterFactory.java index c3c6af46dd..6d0776e85e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/FieldsConverterFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/FieldsConverterFactory.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; +package org.hisp.dhis.android.core.arch.api.fields.internal; + +import org.hisp.dhis.android.core.arch.api.filters.internal.Which; import java.lang.annotation.Annotation; import java.lang.reflect.Type; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/NestedField.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/NestedField.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/NestedField.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/NestedField.java index 872e10489f..a6f5778cd6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/NestedField.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/NestedField.java @@ -26,18 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.arch.api.fields.internal; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.common.Property; - import java.util.Arrays; import java.util.Collections; import java.util.List; +import androidx.annotation.NonNull; + @AutoValue public abstract class NestedField implements Property { public abstract List> children(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/Property.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Property.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/Property.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Property.java index 1777a7051a..a0157c4f5d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/Property.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/fields/internal/Property.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.api.fields.internal; public interface Property { String name(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/Filter.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Filter.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/Filter.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Filter.java index d3022a146b..da64c6c327 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/Filter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Filter.java @@ -25,7 +25,9 @@ * (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.data.api; +package org.hisp.dhis.android.core.arch.api.filters.internal; + +import org.hisp.dhis.android.core.arch.api.fields.internal.Field; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/FilterConverter.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/FilterConverter.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/FilterConverter.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/FilterConverter.java index bb9f04024d..59585b7c04 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/FilterConverter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/FilterConverter.java @@ -25,7 +25,7 @@ * (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.data.api; +package org.hisp.dhis.android.core.arch.api.filters.internal; import java.io.IOException; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/FilterConverterFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/FilterConverterFactory.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/FilterConverterFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/FilterConverterFactory.java index dcfbdf69cd..816c28b6e8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/FilterConverterFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/FilterConverterFactory.java @@ -25,7 +25,7 @@ * (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.data.api; +package org.hisp.dhis.android.core.arch.api.filters.internal; import java.lang.annotation.Annotation; import java.lang.reflect.Type; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/InFilter.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/InFilter.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/InFilter.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/InFilter.java index 2ed9faaf33..83831b45d3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/InFilter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/InFilter.java @@ -26,17 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.arch.api.filters.internal; import com.google.auto.value.AutoValue; +import org.hisp.dhis.android.core.arch.api.fields.internal.Field; + import java.util.Collection; import java.util.Collections; import java.util.Iterator; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue public abstract class InFilter implements Filter { diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/SingleValueFilter.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/SingleValueFilter.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/SingleValueFilter.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/SingleValueFilter.java index b0be3374c1..eb2bda871a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/SingleValueFilter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/SingleValueFilter.java @@ -26,16 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.arch.api.filters.internal; import com.google.auto.value.AutoValue; +import org.hisp.dhis.android.core.arch.api.fields.internal.Field; + import java.util.Collections; import java.util.Iterator; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue public abstract class SingleValueFilter implements Filter { diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/Where.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Where.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/Where.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Where.java index 77d7661f8e..c738290799 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/Where.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Where.java @@ -25,7 +25,7 @@ * (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.data.api; +package org.hisp.dhis.android.core.arch.api.filters.internal; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/api/Which.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Which.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/data/api/Which.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Which.java index 2f49db897f..391650e732 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/api/Which.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/filters/internal/Which.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.data.api; +package org.hisp.dhis.android.core.arch.api.filters.internal; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/APIClientDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/APIClientDIModule.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/APIClientDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/APIClientDIModule.java index 98bd31dfc8..1468d705cf 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/APIClientDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/APIClientDIModule.java @@ -26,9 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.retrofit; +package org.hisp.dhis.android.core.arch.api.internal; -import org.hisp.dhis.android.core.arch.api.executors.APIExecutorsDIModule; +import org.hisp.dhis.android.core.arch.api.executors.internal.APIExecutorsDIModule; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/APIUrlProvider.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/APIUrlProvider.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/APIUrlProvider.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/APIUrlProvider.java index 6bae693256..37bcb9faef 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/APIUrlProvider.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/APIUrlProvider.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.retrofit; +package org.hisp.dhis.android.core.arch.api.internal; import javax.inject.Inject; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/PreventURLDecodeInterceptor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/PreventURLDecodeInterceptor.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/PreventURLDecodeInterceptor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/PreventURLDecodeInterceptor.java index 08bd0b5a0c..088dc5fc52 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/api/retrofit/PreventURLDecodeInterceptor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/internal/PreventURLDecodeInterceptor.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.api.retrofit; +package org.hisp.dhis.android.core.arch.api.internal; import java.io.IOException; diff --git a/core/src/main/java/org/hisp/dhis/android/core/utils/services/ApiPagingEngine.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/paging/internal/ApiPagingEngine.java similarity index 98% rename from core/src/main/java/org/hisp/dhis/android/core/utils/services/ApiPagingEngine.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/paging/internal/ApiPagingEngine.java index 0cde47ca17..a1b002f228 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/utils/services/ApiPagingEngine.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/paging/internal/ApiPagingEngine.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.utils.services; +package org.hisp.dhis.android.core.arch.api.paging.internal; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/utils/services/Paging.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/paging/internal/Paging.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/utils/services/Paging.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/paging/internal/Paging.java index f7326e418c..78d70c1fbd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/utils/services/Paging.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/paging/internal/Paging.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.utils.services; +package org.hisp.dhis.android.core.arch.api.paging.internal; import com.google.auto.value.AutoValue; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/Pager.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/payload/internal/Pager.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/common/Pager.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/payload/internal/Pager.java index a441411bec..fbbd9d10d3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/Pager.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/payload/internal/Pager.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.api.payload.internal; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/Payload.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/payload/internal/Payload.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/common/Payload.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/payload/internal/Payload.java index aa100e7380..236d3e026e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/Payload.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/payload/internal/Payload.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.api.payload.internal; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/SSLContextInitializer.java b/core/src/main/java/org/hisp/dhis/android/core/arch/api/ssl/internal/SSLContextInitializer.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/common/SSLContextInitializer.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/api/ssl/internal/SSLContextInitializer.java index 7f9b2667f4..6ceb07312b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/SSLContextInitializer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/api/ssl/internal/SSLContextInitializer.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.api.ssl.internal; import android.content.Context; import android.util.Log; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/call/D2CallWithProgress.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/D2CallWithProgress.java deleted file mode 100644 index 16e06c7166..0000000000 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/call/D2CallWithProgress.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.call; - -import io.reactivex.Observable; - -public interface D2CallWithProgress { - Observable asObservable(); -} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/D2CallExecutor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/executors/internal/D2CallExecutor.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/common/D2CallExecutor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/executors/internal/D2CallExecutor.java index 1bbc78acd2..b7f206e538 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/D2CallExecutor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/executors/internal/D2CallExecutor.java @@ -26,16 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.call.executors.internal; import android.util.Log; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.data.database.Transaction; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.maintenance.D2ErrorComponent; -import org.hisp.dhis.android.core.maintenance.D2ErrorStore; +import org.hisp.dhis.android.core.maintenance.internal.D2ErrorStore; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/ListCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/ListCallFactory.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/calls/factories/ListCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/ListCallFactory.java index c07fffd361..0761f91253 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/ListCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/ListCallFactory.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.factories; +package org.hisp.dhis.android.core.arch.call.factories.internal; import java.util.List; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/ListCallFactoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/ListCallFactoryImpl.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/calls/factories/ListCallFactoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/ListCallFactoryImpl.java index 7a82013870..8e4086145c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/ListCallFactoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/ListCallFactoryImpl.java @@ -26,13 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.factories; +package org.hisp.dhis.android.core.arch.call.factories.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.calls.EndpointCall; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.EndpointCall; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; import java.util.List; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/QueryCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCallFactory.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/calls/factories/QueryCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCallFactory.java index c65a52cf42..54941c40f9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/QueryCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCallFactory.java @@ -26,9 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.factories; +package org.hisp.dhis.android.core.arch.call.factories.internal; -import org.hisp.dhis.android.core.common.BaseQuery; +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; import java.util.List; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/QueryCallFactoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCallFactoryImpl.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/calls/factories/QueryCallFactoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCallFactoryImpl.java index 5de97ec914..cd0c2a0e45 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/QueryCallFactoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/QueryCallFactoryImpl.java @@ -26,14 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.factories; - -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.calls.EndpointCall; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.common.BaseQuery; -import org.hisp.dhis.android.core.common.GenericCallData; +package org.hisp.dhis.android.core.arch.call.factories.internal; + +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.EndpointCall; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; import java.util.List; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/UidsCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/UidsCallFactory.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/calls/factories/UidsCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/UidsCallFactory.java index d08648463b..b8081f5cb3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/UidsCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/UidsCallFactory.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.factories; +package org.hisp.dhis.android.core.arch.call.factories.internal; import java.util.List; import java.util.Set; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/UidsCallFactoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/UidsCallFactoryImpl.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/calls/factories/UidsCallFactoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/UidsCallFactoryImpl.java index abeff9266f..1b32dd256f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/factories/UidsCallFactoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/factories/internal/UidsCallFactoryImpl.java @@ -26,13 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.factories; +package org.hisp.dhis.android.core.arch.call.factories.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.calls.EndpointCall; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.EndpointCall; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; import java.util.List; import java.util.Set; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/CallFetcher.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/CallFetcher.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/CallFetcher.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/CallFetcher.java index f3756645bf..b8a155e721 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/CallFetcher.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/CallFetcher.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.fetchers; +package org.hisp.dhis.android.core.arch.call.fetchers.internal; import org.hisp.dhis.android.core.maintenance.D2Error; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/ListNoResourceCallFetcher.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/ListNoResourceCallFetcher.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/ListNoResourceCallFetcher.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/ListNoResourceCallFetcher.java index 884753c389..75f2b2ee3f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/ListNoResourceCallFetcher.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/ListNoResourceCallFetcher.java @@ -26,9 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.fetchers; +package org.hisp.dhis.android.core.arch.call.fetchers.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/ListNoResourceWithErrorCatcherCallFetcher.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/ListNoResourceWithErrorCatcherCallFetcher.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/ListNoResourceWithErrorCatcherCallFetcher.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/ListNoResourceWithErrorCatcherCallFetcher.java index 822e47e9d9..57af3ab901 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/ListNoResourceWithErrorCatcherCallFetcher.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/ListNoResourceWithErrorCatcherCallFetcher.java @@ -26,10 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.fetchers; +package org.hisp.dhis.android.core.arch.call.fetchers.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallErrorCatcher; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallErrorCatcher; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/PayloadNoResourceCallFetcher.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/PayloadNoResourceCallFetcher.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/PayloadNoResourceCallFetcher.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/PayloadNoResourceCallFetcher.java index 3982d100ae..3ee54a3af1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/PayloadNoResourceCallFetcher.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/PayloadNoResourceCallFetcher.java @@ -26,10 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.fetchers; +package org.hisp.dhis.android.core.arch.call.fetchers.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.common.Payload; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/PayloadResourceCallFetcher.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/PayloadResourceCallFetcher.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/PayloadResourceCallFetcher.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/PayloadResourceCallFetcher.java index f640985d9a..5bfe65f2e3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/PayloadResourceCallFetcher.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/PayloadResourceCallFetcher.java @@ -26,13 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.fetchers; +package org.hisp.dhis.android.core.arch.call.fetchers.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.common.Payload; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; import org.hisp.dhis.android.core.maintenance.D2Error; -import org.hisp.dhis.android.core.resource.Resource; -import org.hisp.dhis.android.core.resource.ResourceHandler; +import org.hisp.dhis.android.core.resource.internal.Resource; +import org.hisp.dhis.android.core.resource.internal.ResourceHandler; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/UidsNoResourceCallFetcher.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/UidsNoResourceCallFetcher.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/UidsNoResourceCallFetcher.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/UidsNoResourceCallFetcher.java index 7319ae9931..2e0e2d7412 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/fetchers/UidsNoResourceCallFetcher.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/fetchers/internal/UidsNoResourceCallFetcher.java @@ -26,11 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.fetchers; +package org.hisp.dhis.android.core.arch.call.fetchers.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.common.UidsQuery; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.queries.internal.UidsQuery; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.utils.Utils; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/call/CompletableProvider.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/CompletableProvider.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/call/CompletableProvider.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/CompletableProvider.java index eba364199c..eceffc637e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/call/CompletableProvider.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/CompletableProvider.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.call; +package org.hisp.dhis.android.core.arch.call.internal; import io.reactivex.Completable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/call/D2ProgressManager.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/D2ProgressManager.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/arch/call/D2ProgressManager.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/D2ProgressManager.java index 92880b4f0d..11f8cf704e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/call/D2ProgressManager.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/D2ProgressManager.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.call; +package org.hisp.dhis.android.core.arch.call.internal; + +import org.hisp.dhis.android.core.arch.call.D2Progress; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/EndpointCall.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/EndpointCall.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/calls/EndpointCall.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/EndpointCall.java index 521428c2fe..500a851764 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/EndpointCall.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/EndpointCall.java @@ -26,16 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls; +package org.hisp.dhis.android.core.arch.call.internal; -import androidx.annotation.VisibleForTesting; - -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; import java.util.List; import java.util.concurrent.Callable; +import androidx.annotation.VisibleForTesting; + public final class EndpointCall

implements Callable> { private final CallFetcher

fetcher; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/GenericCallData.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/GenericCallData.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/common/GenericCallData.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/GenericCallData.java index 25d3494c1c..ef11b45521 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/GenericCallData.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/internal/GenericCallData.java @@ -26,13 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.call.internal; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import org.hisp.dhis.android.core.resource.Resource; -import org.hisp.dhis.android.core.resource.ResourceHandler; +import org.hisp.dhis.android.core.resource.internal.Resource; +import org.hisp.dhis.android.core.resource.internal.ResourceHandler; import org.hisp.dhis.android.core.systeminfo.DHISVersionManager; import retrofit2.Retrofit; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/processors/CallProcessor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/CallProcessor.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/calls/processors/CallProcessor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/CallProcessor.java index 3fda027c77..90ee0e39f4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/processors/CallProcessor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/CallProcessor.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.processors; +package org.hisp.dhis.android.core.arch.call.processors.internal; import org.hisp.dhis.android.core.maintenance.D2Error; diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/processors/TransactionalNoResourceSyncCallProcessor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/TransactionalNoResourceSyncCallProcessor.java similarity index 87% rename from core/src/main/java/org/hisp/dhis/android/core/calls/processors/TransactionalNoResourceSyncCallProcessor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/TransactionalNoResourceSyncCallProcessor.java index 8214751d7f..d30f5418c0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/processors/TransactionalNoResourceSyncCallProcessor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/TransactionalNoResourceSyncCallProcessor.java @@ -26,10 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.processors; +package org.hisp.dhis.android.core.arch.call.processors.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.D2CallExecutor; +import org.hisp.dhis.android.core.arch.call.executors.internal.D2CallExecutor; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.maintenance.D2Error; @@ -37,10 +37,10 @@ public class TransactionalNoResourceSyncCallProcessor implements CallProcessor { private final DatabaseAdapter databaseAdapter; - private final SyncHandler handler; + private final Handler handler; public TransactionalNoResourceSyncCallProcessor(DatabaseAdapter databaseAdapter, - SyncHandler handler) { + Handler handler) { this.databaseAdapter = databaseAdapter; this.handler = handler; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/processors/TransactionalResourceSyncCallProcessor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/TransactionalResourceSyncCallProcessor.java similarity index 84% rename from core/src/main/java/org/hisp/dhis/android/core/calls/processors/TransactionalResourceSyncCallProcessor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/TransactionalResourceSyncCallProcessor.java index 78fd7be261..6783b8b6b7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/processors/TransactionalResourceSyncCallProcessor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/processors/internal/TransactionalResourceSyncCallProcessor.java @@ -26,23 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.calls.processors; +package org.hisp.dhis.android.core.arch.call.processors.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.D2CallExecutor; -import org.hisp.dhis.android.core.common.GenericCallData; +import org.hisp.dhis.android.core.arch.call.executors.internal.D2CallExecutor; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; import org.hisp.dhis.android.core.maintenance.D2Error; -import org.hisp.dhis.android.core.resource.Resource; +import org.hisp.dhis.android.core.resource.internal.Resource; import java.util.List; public class TransactionalResourceSyncCallProcessor implements CallProcessor { private final GenericCallData data; - private final SyncHandler handler; + private final Handler handler; private final Resource.Type resourceType; public TransactionalResourceSyncCallProcessor(GenericCallData data, - SyncHandler handler, + Handler handler, Resource.Type resourceType) { this.data = data; this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/BaseQuery.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/BaseQuery.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/BaseQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/BaseQuery.java index f1b08348b2..260ea75e44 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/BaseQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/BaseQuery.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.call.queries.internal; public abstract class BaseQuery { public static final int DEFAULT_PAGE_SIZE = 50; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/EmptyQuery.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/EmptyQuery.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/EmptyQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/EmptyQuery.java index dfa3024063..b6e94e73c4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/EmptyQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/EmptyQuery.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.call.queries.internal; import com.google.auto.value.AutoValue; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/UidsQuery.java b/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/UidsQuery.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/UidsQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/UidsQuery.java index 580633b604..160bb238bd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/UidsQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/call/queries/internal/UidsQuery.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.call.queries.internal; import com.google.auto.value.AutoValue; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/CollectionCleaner.java b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/CollectionCleaner.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/common/CollectionCleaner.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/CollectionCleaner.java index e6348c5128..b4880d6199 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/CollectionCleaner.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/CollectionCleaner.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.cleaners.internal; + +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/CollectionCleanerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/CollectionCleanerImpl.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/common/CollectionCleanerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/CollectionCleanerImpl.java index 1d53dbfd12..57c35cdd61 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/CollectionCleanerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/CollectionCleanerImpl.java @@ -26,8 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.cleaners.internal; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; +import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/DataOrphanCleanerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/DataOrphanCleanerImpl.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/common/DataOrphanCleanerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/DataOrphanCleanerImpl.java index ce79d3ee4a..764c765e9d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/DataOrphanCleanerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/DataOrphanCleanerImpl.java @@ -26,8 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.cleaners.internal; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; +import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; +import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/OrphanCleaner.java b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/OrphanCleaner.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/common/OrphanCleaner.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/OrphanCleaner.java index 6994021ed2..4cb8e38c13 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/OrphanCleaner.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/OrphanCleaner.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.cleaners.internal; + +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/OrphanCleanerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/OrphanCleanerImpl.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/common/OrphanCleanerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/OrphanCleanerImpl.java index b5fd703ffb..05b964b829 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/OrphanCleanerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/OrphanCleanerImpl.java @@ -26,8 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.cleaners.internal; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; +import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ParentOrphanCleaner.java b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/ParentOrphanCleaner.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/common/ParentOrphanCleaner.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/ParentOrphanCleaner.java index a50c73316e..5eca605a45 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ParentOrphanCleaner.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/cleaners/internal/ParentOrphanCleaner.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.cleaners.internal; + +import org.hisp.dhis.android.core.common.IdentifiableObject; public interface ParentOrphanCleaner

{ void deleteOrphan(P parent); diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/SafeDateFormat.java b/core/src/main/java/org/hisp/dhis/android/core/arch/dateformat/internal/SafeDateFormat.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/common/SafeDateFormat.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/dateformat/internal/SafeDateFormat.java index c5418bc021..72ba520658 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/SafeDateFormat.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/dateformat/internal/SafeDateFormat.java @@ -26,9 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.arch.dateformat.internal; import java.text.DateFormat; import java.text.ParseException; @@ -36,6 +34,8 @@ import java.util.Date; import java.util.Locale; +import androidx.annotation.NonNull; + public class SafeDateFormat { @NonNull diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/executors/CursorExecutor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorExecutor.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/executors/CursorExecutor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorExecutor.java index 7daec47480..629614c94b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/executors/CursorExecutor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorExecutor.java @@ -25,7 +25,7 @@ * (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.db.executors; +package org.hisp.dhis.android.core.arch.db.cursors.internal; import android.database.Cursor; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/executors/CursorExecutorImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorExecutorImpl.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/executors/CursorExecutorImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorExecutorImpl.java index a9a2d7ff6c..e236d9c07f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/executors/CursorExecutorImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorExecutorImpl.java @@ -25,12 +25,10 @@ * (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.db.executors; +package org.hisp.dhis.android.core.arch.db.cursors.internal; import android.database.Cursor; -import org.hisp.dhis.android.core.common.CursorModelFactory; - import java.util.ArrayList; import java.util.Collection; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/CursorModelFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorModelFactory.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/CursorModelFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorModelFactory.java index 3bd30c7c1f..c5bd60c877 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/CursorModelFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/cursors/internal/CursorModelFactory.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.cursors.internal; import android.database.Cursor; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/MultipleTableQueryBuilder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/MultipleTableQueryBuilder.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/MultipleTableQueryBuilder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/MultipleTableQueryBuilder.java index b4e481f8d4..d467638a62 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/MultipleTableQueryBuilder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/MultipleTableQueryBuilder.java @@ -25,7 +25,7 @@ * (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.db; +package org.hisp.dhis.android.core.arch.db.querybuilders.internal; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/OrderByClauseBuilder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/OrderByClauseBuilder.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/OrderByClauseBuilder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/OrderByClauseBuilder.java index 5a46ffeaa0..77c2eade54 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/OrderByClauseBuilder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/OrderByClauseBuilder.java @@ -25,34 +25,32 @@ * (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.db; +package org.hisp.dhis.android.core.arch.db.querybuilders.internal; import android.content.ContentValues; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeOrderByItem; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeOrderByItem; import org.hisp.dhis.android.core.utils.Utils; import java.util.ArrayList; import java.util.List; -import static org.hisp.dhis.android.core.arch.repositories.paging.RepositoryPagingConfig.PAGING_KEY; - public final class OrderByClauseBuilder { - public static String orderByFromItems(List orderByItems) { + public static String orderByFromItems(List orderByItems, String pagingKey) { List stringList = new ArrayList<>(orderByItems.size()); boolean hasPagingKey = false; for (RepositoryScopeOrderByItem item: orderByItems) { stringList.add(item.toSQLString()); - if (item.column().equals(PAGING_KEY)) { + if (item.column().equals(pagingKey)) { hasPagingKey = true; } } if (!hasPagingKey) { stringList.add(RepositoryScopeOrderByItem.builder() - .column(PAGING_KEY) + .column(pagingKey) .direction(RepositoryScope.OrderByDirection.ASC) .build() .toSQLString()); @@ -64,18 +62,19 @@ public static String orderByFromItems(List orderByIt public static void addSortingClauses(WhereClauseBuilder whereClauseBuilder, List orderByItems, ContentValues object, - boolean reversed) { + boolean reversed, + String pagingKey) { boolean hasPagingKey = false; List items = new ArrayList<>(); for (RepositoryScopeOrderByItem item: orderByItems) { items.add(item); - if (item.column().equals(PAGING_KEY)) { + if (item.column().equals(pagingKey)) { hasPagingKey = true; } } if (!hasPagingKey) { - items.add(RepositoryScopeOrderByItem.builder().column(PAGING_KEY) + items.add(RepositoryScopeOrderByItem.builder().column(pagingKey) .direction(RepositoryScope.OrderByDirection.ASC).build()); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUploadCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/ReadOnlySQLStatementBuilder.java similarity index 72% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUploadCollectionRepository.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/ReadOnlySQLStatementBuilder.java index 6c1c1dc84b..53a9a1c5d1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUploadCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/ReadOnlySQLStatementBuilder.java @@ -25,14 +25,25 @@ * (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.repositories.collection; -import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; -import org.hisp.dhis.android.core.maintenance.D2Error; +package org.hisp.dhis.android.core.arch.db.querybuilders.internal; -import java.util.concurrent.Callable; +import org.hisp.dhis.android.core.arch.db.sqlorder.internal.SQLOrderType; -public interface ReadWriteWithUploadCollectionRepository extends ReadWriteCollectionRepository { - Callable upload() throws D2Error; -} \ No newline at end of file +public interface ReadOnlySQLStatementBuilder { + String selectWhere(String whereClause); + + String selectWhere(String whereClause, int limit); + + String selectWhere(String whereClause, String orderByClause); + + String selectWhere(String whereClause, String orderByClause, int limit); + + String selectOneOrderedBy(String orderingColumName, SQLOrderType orderingType); + + String selectAll(); + + String count(); + + String countWhere(String whereClause); +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelHandlerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/SQLStatementBuilder.java similarity index 69% rename from core/src/main/java/org/hisp/dhis/android/core/common/LinkModelHandlerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/SQLStatementBuilder.java index d4da2f7e7b..aa19be6a8d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelHandlerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/SQLStatementBuilder.java @@ -25,25 +25,34 @@ * (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.common; -import java.util.Collection; +package org.hisp.dhis.android.core.arch.db.querybuilders.internal; -public final class LinkModelHandlerImpl implements LinkModelHandler { +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; - private final LinkModelStore store; +public interface SQLStatementBuilder extends ReadOnlySQLStatementBuilder { - public LinkModelHandlerImpl(LinkModelStore store) { - this.store = store; - } + String getTableName(); - @Override - public void handleMany(String masterUid, Collection slaves, Transformer transformer) { - store.deleteLinksForMasterUid(masterUid); - if (slaves != null) { - for (S slave : slaves) { - store.insert(transformer.transform(slave)); - } - } - } + String[] getColumns(); + + String selectUids(); + + String selectUidsWhere(String whereClause); + + String selectColumnWhere(String column, String whereClause); + + String selectChildrenWithLinkTable(LinkTableChildProjection projection, String parentUid, String whereClause); + + String selectByUid(); + + String insert(); + + String update(); + + String updateWhere(); + + String deleteById(); + + String deleteWhere(); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/SQLStatementBuilder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/SQLStatementBuilderImpl.java similarity index 67% rename from core/src/main/java/org/hisp/dhis/android/core/common/SQLStatementBuilder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/SQLStatementBuilderImpl.java index 6d45b06b45..42c0e38816 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/SQLStatementBuilder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/SQLStatementBuilderImpl.java @@ -26,24 +26,24 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.querybuilders.internal; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; -import org.hisp.dhis.android.core.utils.Utils; +import org.hisp.dhis.android.core.arch.db.sqlorder.internal.SQLOrderType; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; +import org.hisp.dhis.android.core.common.BaseModel; -import static org.hisp.dhis.android.core.arch.db.TableInfo.SORT_ORDER; +import static org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo.SORT_ORDER; import static org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel.Columns.UID; import static org.hisp.dhis.android.core.utils.Utils.commaAndSpaceSeparatedArrayValues; -public class SQLStatementBuilder { +public class SQLStatementBuilderImpl implements SQLStatementBuilder { // TODO save TableInfo instead of separate files when architecture 1.0 is ready - final String tableName; - public final String[] columns; + private final String tableName; + private final String[] columns; private final String[] whereColumns; private final boolean hasSortOrder; - private final static String TEXT = " TEXT"; private final static String WHERE = " WHERE "; private final static String LIMIT = " LIMIT "; private final static String FROM = " FROM "; @@ -52,7 +52,7 @@ public class SQLStatementBuilder { private final static String ORDER_BY = " ORDER BY "; @SuppressWarnings("PMD.UseVarargs") - SQLStatementBuilder(String tableName, String[] columns, String[] updateWhereColumns, boolean hasSortOrder) { + SQLStatementBuilderImpl(String tableName, String[] columns, String[] updateWhereColumns, boolean hasSortOrder) { this.tableName = tableName; this.columns = columns.clone(); this.whereColumns = updateWhereColumns.clone(); @@ -60,15 +60,15 @@ public class SQLStatementBuilder { } @SuppressWarnings("PMD.UseVarargs") - SQLStatementBuilder(String tableName, String[] columns, String[] updateWhereColumns) { + public SQLStatementBuilderImpl(String tableName, String[] columns, String[] updateWhereColumns) { this(tableName, columns, updateWhereColumns, false); } - public SQLStatementBuilder(String tableName, BaseModel.Columns columns) { + public SQLStatementBuilderImpl(String tableName, BaseModel.Columns columns) { this(tableName, columns.all().clone(), columns.whereUpdate().clone(), false); } - public SQLStatementBuilder(TableInfo tableInfo) { + public SQLStatementBuilderImpl(TableInfo tableInfo) { this(tableInfo.name(), tableInfo.columns().all().clone(), tableInfo.columns().whereUpdate().clone(), tableInfo.hasSortOrder()); } @@ -98,24 +98,39 @@ private String andSeparatedColumnEqualInterrogationMark(String... cols) { .replace(",", " AND"); } + @Override + public String getTableName() { + return tableName; + } + + @Override + public String[] getColumns() { + return columns.clone(); + } + + @Override public String insert() { return "INSERT INTO " + tableName + " (" + commaSeparatedColumns() + ") " + "VALUES (" + commaSeparatedInterrogationMarks() + ");"; } - String deleteById() { + @Override + public String deleteById() { return "DELETE" + FROM + tableName + WHERE + UID + "=?;"; } - String selectUids() { + @Override + public String selectUids() { return SELECT + UID + FROM + tableName; } - String selectUidsWhere(String whereClause) { + @Override + public String selectUidsWhere(String whereClause) { return SELECT + UID + FROM + tableName + WHERE + whereClause + ";"; } - String selectColumnWhere(String column, String whereClause) { + @Override + public String selectColumnWhere(String column, String whereClause) { return SELECT + column + FROM + tableName + WHERE + whereClause + ";"; } @@ -143,35 +158,43 @@ private String orderBySortOrderClause() { return hasSortOrder ? ORDER_BY + SORT_ORDER : ""; } - String selectByUid() { + @Override + public String selectByUid() { return selectWhere(andSeparatedColumnEqualInterrogationMark(UID)); } + @Override public String selectWhere(String whereClause) { return SELECT + "*" + FROM + tableName + WHERE + whereClause + ";"; } - String selectWhere(String whereClause, int limit) { + @Override + public String selectWhere(String whereClause, int limit) { return selectWhere(whereClause + LIMIT + limit); } - String selectWhere(String whereClause, String orderByClause) { + @Override + public String selectWhere(String whereClause, String orderByClause) { return selectWhere(whereClause + ORDER_BY + orderByClause); } - String selectWhere(String whereClause, String orderByClause, int limit) { + @Override + public String selectWhere(String whereClause, String orderByClause, int limit) { return selectWhere(whereClause + ORDER_BY + orderByClause + LIMIT + limit); } - String selectAll() { + @Override + public String selectAll() { return SELECT + "*" + FROM + tableName; } - String count() { + @Override + public String count() { return SELECT + "COUNT(*)" + FROM + tableName + ";"; } - String countWhere(String whereClause) { + @Override + public String countWhere(String whereClause) { return SELECT + "COUNT(*)" + FROM + tableName + WHERE + whereClause + ";"; } @@ -193,46 +216,4 @@ public String deleteWhere() { andSeparatedColumnEqualInterrogationMark(whereColumns); return "DELETE" + FROM + tableName + WHERE + whereClause + ";"; } - - @SuppressWarnings("PMD.UseVarargs") - private static String createTableWrapper(String tableName, String[] columnsWithAttributes) { - return "CREATE TABLE " + tableName + " (" + - commaAndSpaceSeparatedArrayValues(columnsWithAttributes) + ");"; - } - - private static String[] idColumn() { - return new String[]{BaseModel.Columns.ID + " INTEGER PRIMARY KEY AUTOINCREMENT"}; - } - - private static String[] identifiableColumns() { - return Utils.appendInNewArray(idColumn(), - UID + TEXT + " NOT NULL UNIQUE", - BaseIdentifiableObjectModel.Columns.CODE + TEXT, - BaseIdentifiableObjectModel.Columns.NAME + TEXT, - BaseIdentifiableObjectModel.Columns.DISPLAY_NAME + TEXT, - BaseIdentifiableObjectModel.Columns.CREATED + TEXT, - BaseIdentifiableObjectModel.Columns.LAST_UPDATED + TEXT - ); - } - - private static String[] nameableColumns() { - return Utils.appendInNewArray(identifiableColumns(), - BaseNameableObjectModel.Columns.SHORT_NAME + TEXT, - BaseNameableObjectModel.Columns.DISPLAY_SHORT_NAME + TEXT, - BaseNameableObjectModel.Columns.DESCRIPTION + TEXT, - BaseNameableObjectModel.Columns.DISPLAY_DESCRIPTION + TEXT - ); - } - - public static String createModelTable(String tableName, String... columnsWithAttributes) { - return createTableWrapper(tableName, Utils.appendInNewArray(idColumn(), columnsWithAttributes)); - } - - public static String createIdentifiableModelTable(String tableName, String... columnsWithAttributes) { - return createTableWrapper(tableName, Utils.appendInNewArray(identifiableColumns(), columnsWithAttributes)); - } - - public static String createNameableModelTable(String tableName, String... columnsWithAttributes) { - return createTableWrapper(tableName, Utils.appendInNewArray(nameableColumns(), columnsWithAttributes)); - } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/WhereClauseBuilder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/WhereClauseBuilder.java similarity index 98% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/WhereClauseBuilder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/WhereClauseBuilder.java index 1be83df984..a4de1de0e7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/WhereClauseBuilder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/querybuilders/internal/WhereClauseBuilder.java @@ -25,7 +25,7 @@ * (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.db; +package org.hisp.dhis.android.core.arch.db.querybuilders.internal; import org.hisp.dhis.android.core.utils.Utils; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/SQLOrderType.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/sqlorder/internal/SQLOrderType.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/SQLOrderType.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/sqlorder/internal/SQLOrderType.java index 8c6cfbdbc9..f0d8104d48 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/SQLOrderType.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/sqlorder/internal/SQLOrderType.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.sqlorder.internal; public enum SQLOrderType { ASC, DESC diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/SQLStatementWrapper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/statementwrapper/internal/SQLStatementWrapper.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/common/SQLStatementWrapper.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/statementwrapper/internal/SQLStatementWrapper.java index db69d73811..a888c31457 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/SQLStatementWrapper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/statementwrapper/internal/SQLStatementWrapper.java @@ -26,17 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.statementwrapper.internal; import android.database.sqlite.SQLiteStatement; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; public class SQLStatementWrapper { public final SQLiteStatement insert; public final SQLiteStatement update; - final SQLiteStatement deleteById; - final String selectUids; + public final SQLiteStatement deleteById; + public final String selectUids; public SQLStatementWrapper(SQLStatementBuilder builder, DatabaseAdapter databaseAdapter) { this.insert = databaseAdapter.compileStatement(builder.insert()); diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/IdentifiableStatementBinder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/IdentifiableStatementBinder.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/IdentifiableStatementBinder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/IdentifiableStatementBinder.java index 8c8860735a..610de0d383 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/IdentifiableStatementBinder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/IdentifiableStatementBinder.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.db.binders; +package org.hisp.dhis.android.core.arch.db.stores.binders.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; import org.hisp.dhis.android.core.common.IdentifiableObject; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import androidx.annotation.NonNull; + +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public abstract class IdentifiableStatementBinder implements StatementBinder { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/NameableStatementBinder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/NameableStatementBinder.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/NameableStatementBinder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/NameableStatementBinder.java index 8471e6c173..251acc50db 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/NameableStatementBinder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/NameableStatementBinder.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.db.binders; +package org.hisp.dhis.android.core.arch.db.stores.binders.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; import org.hisp.dhis.android.core.common.NameableObject; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import androidx.annotation.NonNull; + +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public abstract class NameableStatementBinder extends IdentifiableStatementBinder { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/StatementBinder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/StatementBinder.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/StatementBinder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/StatementBinder.java index 83c478af88..63fa536f7e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/StatementBinder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/StatementBinder.java @@ -26,9 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.db.binders; +package org.hisp.dhis.android.core.arch.db.stores.binders.internal; import android.database.sqlite.SQLiteStatement; + import androidx.annotation.NonNull; public interface StatementBinder { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/WhereStatementBinder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/WhereStatementBinder.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/WhereStatementBinder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/WhereStatementBinder.java index bba472a264..0a3e24d494 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/binders/WhereStatementBinder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/binders/internal/WhereStatementBinder.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.db.binders; +package org.hisp.dhis.android.core.arch.db.stores.binders.internal; import android.database.sqlite.SQLiteStatement; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectStore.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectStore.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectStore.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectStore.java index 6106fe304a..f04cb69f7e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectStore.java @@ -26,12 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; -import androidx.annotation.NonNull; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import java.util.List; +import androidx.annotation.NonNull; + public interface IdentifiableObjectStore extends ObjectStore { void delete(@NonNull String uid) throws RuntimeException; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectStoreImpl.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectStoreImpl.java index 011c409231..3cb891201b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectStoreImpl.java @@ -26,17 +26,24 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; import android.database.Cursor; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.statementwrapper.internal.SQLStatementWrapper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.common.Model; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.List; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import androidx.annotation.NonNull; + +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; import static org.hisp.dhis.android.core.utils.Utils.isNull; public class IdentifiableObjectStoreImpl @@ -81,7 +88,7 @@ public final void deleteIfExists(@NonNull String uid) throws RuntimeException { public final void update(@NonNull M m) throws RuntimeException { isNull(m); binder.bindToStatement(m, statements.update); - sqLiteBind(statements.update, builder.columns.length + 1, m.uid()); + sqLiteBind(statements.update, builder.getColumns().length + 1, m.uid()); executeUpdateDelete(statements.update); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectWithStateStore.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectWithStateStore.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectWithStateStore.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectWithStateStore.java index c1f8db68e3..4c4b5d7e3b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectWithStateStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectWithStateStore.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; + +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; public interface IdentifiableObjectWithStateStore extends IdentifiableObjectStore, StoreWithState { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectWithStateStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectWithStateStoreImpl.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectWithStateStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectWithStateStoreImpl.java index 9144387abd..a2b336b6cc 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/IdentifiableObjectWithStateStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/IdentifiableObjectWithStateStoreImpl.java @@ -26,20 +26,27 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; import android.database.Cursor; import android.database.sqlite.SQLiteStatement; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.statementwrapper.internal.SQLStatementWrapper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.common.Model; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; +import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import androidx.annotation.NonNull; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; import static org.hisp.dhis.android.core.common.BaseDataModel.Columns.STATE; import static org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel.Columns.UID; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; public class IdentifiableObjectWithStateStoreImpl extends IdentifiableObjectStoreImpl implements IdentifiableObjectWithStateStore { @@ -56,7 +63,7 @@ public IdentifiableObjectWithStateStoreImpl(DatabaseAdapter databaseAdapter, SQLStatementBuilder builder, StatementBinder binder, CursorModelFactory modelFactory) { super(databaseAdapter, statements, builder, binder, modelFactory); - this.tableName = builder.tableName; + this.tableName = builder.getTableName(); String whereUid = " WHERE " + UID + " =?;"; String setState = "UPDATE " + tableName + " SET " + diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/LinkModelChildStore.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelChildStore.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/LinkModelChildStore.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelChildStore.java index c6c1e44b64..3619a137b3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/LinkModelChildStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelChildStore.java @@ -25,7 +25,7 @@ * (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.db.stores; +package org.hisp.dhis.android.core.arch.db.stores.internal; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/LinkModelChildStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelChildStoreImpl.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/LinkModelChildStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelChildStoreImpl.java index a27bbcd6c2..5e29d58a00 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/LinkModelChildStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelChildStoreImpl.java @@ -25,17 +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.arch.db.stores; +package org.hisp.dhis.android.core.arch.db.stores.internal; -import org.hisp.dhis.android.core.arch.db.executors.CursorExecutor; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorExecutor; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.List; -public class LinkModelChildStoreImpl

+class LinkModelChildStoreImpl

implements LinkModelChildStore { private final LinkTableChildProjection linkTableChildProjection; @@ -45,7 +45,7 @@ public class LinkModelChildStoreImpl

cursorExecutor; - public LinkModelChildStoreImpl(LinkTableChildProjection linkTableChildProjection, + LinkModelChildStoreImpl(LinkTableChildProjection linkTableChildProjection, DatabaseAdapter databaseAdapter, SQLStatementBuilder statementBuilder, CursorExecutor cursorExecutor) { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelStore.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelStore.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/common/LinkModelStore.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelStore.java index 5806060061..d55a1edfe5 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelStore.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; + +import org.hisp.dhis.android.core.common.Model; import androidx.annotation.NonNull; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelStoreImpl.java similarity index 87% rename from core/src/main/java/org/hisp/dhis/android/core/common/LinkModelStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelStoreImpl.java index 428c02f4f7..05f9918684 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/LinkModelStoreImpl.java @@ -26,12 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; import android.database.sqlite.SQLiteStatement; + import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; public class LinkModelStoreImpl diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStore.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectStore.java similarity index 76% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStore.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectStore.java index 0136f0d974..740f8883a9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectStore.java @@ -26,41 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; - -import java.util.List; +package org.hisp.dhis.android.core.arch.db.stores.internal; import androidx.annotation.NonNull; -public interface ObjectStore extends DeletableStore { - - long insert(@NonNull M m) throws RuntimeException; - - List selectAll(); - - List selectWhere(String whereClause); - - List selectWhere(String filterWhereClause, String orderByClause); - - List selectWhere(String filterWhereClause, String orderByClause, int limit); +import java.util.List; - List selectRawQuery(String sqlRawQuery); +public interface ObjectStore extends ReadableStore { - M selectOneWhere(String whereClause); + List selectStringColumnsWhereClause(String column, String clause) throws RuntimeException; - M selectOneOrderedBy(String orderingColumName, SQLOrderType orderingType); + long insert(@NonNull M m) throws RuntimeException; - M selectFirst(); - - List selectStringColumnsWhereClause(String column, String clause) throws RuntimeException; + int delete(); boolean deleteById(@NonNull M m); boolean deleteWhere(String whereClause); void deleteWhereIfExists(@NonNull String whereClause) throws RuntimeException; - - int count(); - - int countWhere(String whereClause); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectStoreImpl.java new file mode 100644 index 0000000000..53dce02563 --- /dev/null +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectStoreImpl.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2004-2019, 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.db.stores.internal; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import androidx.annotation.NonNull; + +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.common.Model; +import org.hisp.dhis.android.core.data.database.DatabaseAdapter; + +import java.util.List; + +import static org.hisp.dhis.android.core.utils.Utils.isNull; + +public class ObjectStoreImpl extends ReadableStoreImpl implements ObjectStore { + private final SQLiteStatement insertStatement; + protected final SQLStatementBuilder builder; + protected final StatementBinder binder; + + public ObjectStoreImpl(DatabaseAdapter databaseAdapter, SQLiteStatement insertStatement, + SQLStatementBuilder builder, StatementBinder binder, CursorModelFactory modelFactory) { + super(databaseAdapter, builder, modelFactory); + this.insertStatement = insertStatement; + this.builder = builder; + this.binder = binder; + } + + @Override + public long insert(@NonNull M m) throws RuntimeException { + isNull(m); + binder.bindToStatement(m, insertStatement); + Long insertedRowId = databaseAdapter.executeInsert(builder.getTableName(), insertStatement); + insertStatement.clearBindings(); + if (insertedRowId == -1) { + throw new RuntimeException("Nothing was inserted."); + } + return insertedRowId; + } + + @Override + public List selectStringColumnsWhereClause(String column, String clause) { + Cursor cursor = databaseAdapter.query(builder.selectColumnWhere(column, clause)); + return mapStringColumnSetFromCursor(cursor); + } + + @Override + public final int delete() { + return databaseAdapter.delete(builder.getTableName()); + } + + void executeUpdateDelete(SQLiteStatement statement) throws RuntimeException { + int numberOfAffectedRows = databaseAdapter.executeUpdateDelete(builder.getTableName(), statement); + statement.clearBindings(); + + if (numberOfAffectedRows == 0) { + throw new RuntimeException("No rows affected"); + } else if (numberOfAffectedRows > 1) { + throw new RuntimeException("Unexpected number of affected rows: " + numberOfAffectedRows); + } + } + + + @Override + public boolean deleteById(@NonNull M m) { + return deleteWhere(BaseModel.Columns.ID + "='" + m.id() + "';"); + } + + protected M popOneWhere(@NonNull String whereClause) { + M m = selectOneWhere(whereClause); + if (m != null) { + deleteById(m); + } + return m; + } + + @Override + public boolean deleteWhere(String clause) { + return databaseAdapter.database().delete(builder.getTableName(), clause, null) > 0; + } + + @Override + public void deleteWhereIfExists(@NonNull String whereClause) throws RuntimeException { + try { + deleteWhere(whereClause); + } catch(RuntimeException e) { + if (!e.getMessage().equals("No rows affected")) { + throw e; + } + } + } +} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/ObjectWithUidChildStore.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithUidChildStore.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/ObjectWithUidChildStore.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithUidChildStore.java index f782039be1..b76a31c5ab 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/ObjectWithUidChildStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithUidChildStore.java @@ -25,7 +25,7 @@ * (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.db.stores; +package org.hisp.dhis.android.core.arch.db.stores.internal; import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/ObjectWithUidChildStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithUidChildStoreImpl.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/ObjectWithUidChildStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithUidChildStoreImpl.java index 2a9085336a..dd47203429 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/ObjectWithUidChildStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithUidChildStoreImpl.java @@ -25,26 +25,26 @@ * (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.db.stores; +package org.hisp.dhis.android.core.arch.db.stores.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.executors.CursorExecutorImpl; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorExecutorImpl; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.List; -public class ObjectWithUidChildStoreImpl

implements ObjectWithUidChildStore

{ +class ObjectWithUidChildStoreImpl

implements ObjectWithUidChildStore

{ private final LinkTableChildProjection linkTableChildProjection; private final DatabaseAdapter databaseAdapter; private final SQLStatementBuilder statementBuilder; - public ObjectWithUidChildStoreImpl(LinkTableChildProjection linkTableChildProjection, + ObjectWithUidChildStoreImpl(LinkTableChildProjection linkTableChildProjection, DatabaseAdapter databaseAdapter, SQLStatementBuilder statementBuilder) { this.linkTableChildProjection = linkTableChildProjection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithoutUidStore.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithoutUidStore.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithoutUidStore.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithoutUidStore.java index 28a8bfda63..5cc724228c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithoutUidStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithoutUidStore.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; + +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; import androidx.annotation.NonNull; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithoutUidStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithoutUidStoreImpl.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithoutUidStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithoutUidStoreImpl.java index 8e662791b8..4ce3d0ab8e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithoutUidStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ObjectWithoutUidStoreImpl.java @@ -26,16 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; import android.database.sqlite.SQLiteStatement; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.WhereStatementBinder; -import org.hisp.dhis.android.core.data.database.DatabaseAdapter; - import androidx.annotation.NonNull; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.common.Model; +import org.hisp.dhis.android.core.data.database.DatabaseAdapter; + import static org.hisp.dhis.android.core.utils.Utils.isNull; public class ObjectWithoutUidStoreImpl diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ListPersistor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ReadableStore.java similarity index 70% rename from core/src/main/java/org/hisp/dhis/android/core/common/ListPersistor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ReadableStore.java index 35da15d558..78c3152ecf 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ListPersistor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ReadableStore.java @@ -26,12 +26,31 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; -import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.arch.db.sqlorder.internal.SQLOrderType; import java.util.List; -public interface ListPersistor

{ - void persist(List

objectList) throws D2Error; -} \ No newline at end of file +public interface ReadableStore { + + List selectAll(); + + List selectWhere(String whereClause); + + List selectWhere(String filterWhereClause, String orderByClause); + + List selectWhere(String filterWhereClause, String orderByClause, int limit); + + M selectOneOrderedBy(String orderingColumName, SQLOrderType orderingType); + + List selectRawQuery(String sqlRawQuery); + + M selectOneWhere(String whereClause); + + M selectFirst(); + + int count(); + + int countWhere(String whereClause); +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ReadableStoreImpl.java similarity index 64% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ReadableStoreImpl.java index 5895a94ba5..9be8f1a6c8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/ReadableStoreImpl.java @@ -26,66 +26,35 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; import android.database.Cursor; -import android.database.sqlite.SQLiteStatement; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; +import androidx.annotation.NonNull; + +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.ReadOnlySQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.sqlorder.internal.SQLOrderType; +import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import androidx.annotation.NonNull; - -import static org.hisp.dhis.android.core.utils.Utils.isNull; - -public class ObjectStoreImpl implements ObjectStore { +public class ReadableStoreImpl implements ReadableStore { protected final DatabaseAdapter databaseAdapter; - protected final SQLiteStatement insertStatement; - protected final SQLStatementBuilder builder; - final StatementBinder binder; + protected final ReadOnlySQLStatementBuilder builder; final CursorModelFactory modelFactory; - public ObjectStoreImpl(DatabaseAdapter databaseAdapter, SQLiteStatement insertStatement, - SQLStatementBuilder builder, StatementBinder binder, CursorModelFactory modelFactory) { + public ReadableStoreImpl(DatabaseAdapter databaseAdapter, + ReadOnlySQLStatementBuilder builder, + CursorModelFactory modelFactory) { this.databaseAdapter = databaseAdapter; - this.insertStatement = insertStatement; this.builder = builder; - this.binder = binder; this.modelFactory = modelFactory; } - @Override - public long insert(@NonNull M m) throws RuntimeException { - isNull(m); - binder.bindToStatement(m, insertStatement); - Long insertedRowId = databaseAdapter.executeInsert(builder.tableName, insertStatement); - insertStatement.clearBindings(); - if (insertedRowId == -1) { - throw new RuntimeException("Nothing was inserted."); - } - return insertedRowId; - } - - @Override - public final int delete() { - return databaseAdapter.delete(builder.tableName); - } - - protected void executeUpdateDelete(SQLiteStatement statement) throws RuntimeException { - int numberOfAffectedRows = databaseAdapter.executeUpdateDelete(builder.tableName, statement); - statement.clearBindings(); - - if (numberOfAffectedRows == 0) { - throw new RuntimeException("No rows affected"); - } else if (numberOfAffectedRows > 1) { - throw new RuntimeException("Unexpected number of affected rows: " + numberOfAffectedRows); - } - } - @Override public List selectAll() { String query = builder.selectAll(); @@ -110,6 +79,14 @@ public List selectWhere(String filterWhereClause, String orderByClause, int l return selectRawQuery(query); } + @Override + public M selectOneOrderedBy(String orderingColumName, SQLOrderType orderingType) { + Cursor cursor = databaseAdapter.query(builder.selectOneOrderedBy(orderingColumName, orderingType)); + return getFirstFromCursor(cursor); + } + + + @Override public List selectRawQuery(String sqlRawQuery) { Cursor cursor = databaseAdapter.query(sqlRawQuery); @@ -124,24 +101,13 @@ public M selectOneWhere(@NonNull String whereClause) { return getFirstFromCursor(cursor); } - @Override - public M selectOneOrderedBy(String orderingColumName, SQLOrderType orderingType) { - Cursor cursor = databaseAdapter.query(builder.selectOneOrderedBy(orderingColumName, orderingType)); - return getFirstFromCursor(cursor); - } - @Override public M selectFirst() { Cursor cursor = databaseAdapter.query(builder.selectAll()); return getFirstFromCursor(cursor); } - @Override - public boolean deleteById(@NonNull M m) { - return deleteWhere(BaseModel.Columns.ID + "='" + m.id() + "';"); - } - - private M getFirstFromCursor(@NonNull Cursor cursor) { + M getFirstFromCursor(@NonNull Cursor cursor) { try { if (cursor.getCount() >= 1) { cursor.moveToFirst(); @@ -154,14 +120,6 @@ private M getFirstFromCursor(@NonNull Cursor cursor) { } } - protected M popOneWhere(@NonNull String whereClause) { - M m = selectOneWhere(whereClause); - if (m != null) { - deleteById(m); - } - return m; - } - @Override public int count() { return processCount(databaseAdapter.query(builder.count())); @@ -195,28 +153,6 @@ protected void addObjectsToCollection(Cursor cursor, Collection collection) { } } - @Override - public boolean deleteWhere(String clause) { - return databaseAdapter.database().delete(builder.tableName, clause, null) > 0; - } - - @Override - public void deleteWhereIfExists(@NonNull String whereClause) throws RuntimeException { - try { - deleteWhere(whereClause); - } catch(RuntimeException e) { - if (!e.getMessage().equals("No rows affected")) { - throw e; - } - } - } - - @Override - public List selectStringColumnsWhereClause(String column, String clause) { - Cursor cursor = databaseAdapter.query(builder.selectColumnWhere(column, clause)); - return mapStringColumnSetFromCursor(cursor); - } - List mapStringColumnSetFromCursor(Cursor cursor) { List columns = new ArrayList<>(cursor.getCount()); diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/SingleParentChildStore.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/SingleParentChildStore.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/SingleParentChildStore.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/SingleParentChildStore.java index 16f7671362..4089faacc2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/SingleParentChildStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/SingleParentChildStore.java @@ -25,7 +25,7 @@ * (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.db.stores; +package org.hisp.dhis.android.core.arch.db.stores.internal; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/SingleParentChildStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/SingleParentChildStoreImpl.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/SingleParentChildStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/SingleParentChildStoreImpl.java index 3fea0d1586..8142ac80f9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/SingleParentChildStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/SingleParentChildStoreImpl.java @@ -25,18 +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.arch.db.stores; +package org.hisp.dhis.android.core.arch.db.stores.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.executors.CursorExecutor; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorExecutor; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.List; -public class SingleParentChildStoreImpl

implements SingleParentChildStore { +class SingleParentChildStoreImpl

implements SingleParentChildStore { private final SingleParentChildProjection childProjection; @@ -45,7 +45,7 @@ public class SingleParentChildStoreImpl

imp private final CursorExecutor cursorExecutor; - public SingleParentChildStoreImpl(SingleParentChildProjection childProjection, + SingleParentChildStoreImpl(SingleParentChildProjection childProjection, DatabaseAdapter databaseAdapter, SQLStatementBuilder statementBuilder, CursorExecutor cursorExecutor) { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/StoreFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreFactory.java similarity index 72% rename from core/src/main/java/org/hisp/dhis/android/core/common/StoreFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreFactory.java index c8f7836938..50019d942c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/StoreFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreFactory.java @@ -26,20 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.WhereStatementBinder; -import org.hisp.dhis.android.core.arch.db.executors.CursorExecutorImpl; -import org.hisp.dhis.android.core.arch.db.stores.LinkModelChildStore; -import org.hisp.dhis.android.core.arch.db.stores.LinkModelChildStoreImpl; -import org.hisp.dhis.android.core.arch.db.stores.ObjectWithUidChildStore; -import org.hisp.dhis.android.core.arch.db.stores.ObjectWithUidChildStoreImpl; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStore; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStoreImpl; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorExecutorImpl; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilderImpl; +import org.hisp.dhis.android.core.arch.db.statementwrapper.internal.SQLStatementWrapper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; +import org.hisp.dhis.android.core.common.Model; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; public final class StoreFactory { @@ -50,17 +50,17 @@ public static IdentifiableObjectStore DatabaseAdapter databaseAdapter, TableInfo tableInfo, StatementBinder binder, CursorModelFactory modelFactory) { SQLStatementBuilder statementBuilder = - new SQLStatementBuilder(tableInfo.name(), tableInfo.columns().all(), new String[]{}); + new SQLStatementBuilderImpl(tableInfo.name(), tableInfo.columns().all(), new String[]{}); SQLStatementWrapper statements = new SQLStatementWrapper(statementBuilder, databaseAdapter); return new IdentifiableObjectStoreImpl<>(databaseAdapter, statements, statementBuilder, binder, modelFactory); } public static ObjectStore objectStore(DatabaseAdapter databaseAdapter, - TableInfo tableInfo, - StatementBinder binder, - CursorModelFactory modelFactory) { + TableInfo tableInfo, + StatementBinder binder, + CursorModelFactory modelFactory) { SQLStatementBuilder statementBuilder = - new SQLStatementBuilder(tableInfo.name(), tableInfo.columns().all(), new String[]{}); + new SQLStatementBuilderImpl(tableInfo.name(), tableInfo.columns().all(), new String[]{}); return new ObjectStoreImpl<>(databaseAdapter, databaseAdapter.compileStatement(statementBuilder.insert()), statementBuilder, binder, modelFactory); } @@ -70,7 +70,8 @@ public static ObjectWithoutUidStore objectWithoutUidStore( WhereStatementBinder whereUpdateBinder, WhereStatementBinder whereDeleteBinder, CursorModelFactory modelFactory) { SQLStatementBuilder statementBuilder = - new SQLStatementBuilder(tableInfo.name(), tableInfo.columns().all(), tableInfo.columns().whereUpdate()); + new SQLStatementBuilderImpl(tableInfo.name(), tableInfo.columns().all(), + tableInfo.columns().whereUpdate()); return new ObjectWithoutUidStoreImpl<>(databaseAdapter, statementBuilder, binder, whereUpdateBinder, whereDeleteBinder, modelFactory); } @@ -78,7 +79,7 @@ public static ObjectWithoutUidStore objectWithoutUidStore( public static LinkModelStore linkModelStore( DatabaseAdapter databaseAdapter, TableInfo tableInfo, String masterColumn, StatementBinder binder, CursorModelFactory modelFactory) { - SQLStatementBuilder statementBuilder = new SQLStatementBuilder(tableInfo.name(), tableInfo.columns().all(), + SQLStatementBuilder statementBuilder = new SQLStatementBuilderImpl(tableInfo.name(), tableInfo.columns().all(), tableInfo.columns().whereUpdate()); return new LinkModelStoreImpl<>(databaseAdapter, databaseAdapter.compileStatement(statementBuilder.insert()), statementBuilder, masterColumn, binder, modelFactory); @@ -93,7 +94,7 @@ C extends ObjectWithUidInterface> LinkModelChildStore linkModelChildStore( return new LinkModelChildStoreImpl<>( linkTableChildProjection, databaseAdapter, - new SQLStatementBuilder(linkTableInfo), + new SQLStatementBuilderImpl(linkTableInfo), new CursorExecutorImpl<>(childFactory)); } @@ -104,7 +105,7 @@ public static

SingleParentChildStore return new SingleParentChildStoreImpl<>( childProjection, databaseAdapter, - new SQLStatementBuilder(childProjection.childTableInfo), + new SQLStatementBuilderImpl(childProjection.childTableInfo), new CursorExecutorImpl<>(childFactory)); } @@ -115,6 +116,6 @@ public static

ObjectWithUidChildStore

obje return new ObjectWithUidChildStoreImpl<>( childProjection, databaseAdapter, - new SQLStatementBuilder(linkTableInfo)); + new SQLStatementBuilderImpl(linkTableInfo)); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/utils/StoreUtils.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreUtils.java similarity index 99% rename from core/src/main/java/org/hisp/dhis/android/core/utils/StoreUtils.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreUtils.java index a921c5d023..2da6fcee64 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/utils/StoreUtils.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreUtils.java @@ -26,10 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.utils; +package org.hisp.dhis.android.core.arch.db.stores.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.State; @@ -38,6 +37,8 @@ import java.text.ParseException; import java.util.Date; +import androidx.annotation.NonNull; + /** * Provides helper functions to handle null checks and type conversions. */ diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/StoreWithState.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreWithState.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/common/StoreWithState.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreWithState.java index bd5be0be44..24e8788d5f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/StoreWithState.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/internal/StoreWithState.java @@ -26,7 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.db.stores.internal; + +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.common.State; import androidx.annotation.NonNull; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/LinkTableChildProjection.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/projections/internal/LinkTableChildProjection.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/LinkTableChildProjection.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/projections/internal/LinkTableChildProjection.java index 7f4f5f2b75..5202ecbe48 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/LinkTableChildProjection.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/projections/internal/LinkTableChildProjection.java @@ -25,9 +25,9 @@ * (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.db.tableinfos; +package org.hisp.dhis.android.core.arch.db.stores.projections.internal; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; public class LinkTableChildProjection { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/SingleParentChildProjection.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/projections/internal/SingleParentChildProjection.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/SingleParentChildProjection.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/projections/internal/SingleParentChildProjection.java index 4d13bd8993..b69daf8fbf 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/SingleParentChildProjection.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/stores/projections/internal/SingleParentChildProjection.java @@ -25,9 +25,9 @@ * (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.db.tableinfos; +package org.hisp.dhis.android.core.arch.db.stores.projections.internal; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; public class SingleParentChildProjection { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/db/TableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/TableInfo.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/arch/db/TableInfo.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/TableInfo.java index 8f0ae660ef..95e6605ed8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/db/TableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/db/tableinfos/TableInfo.java @@ -25,7 +25,7 @@ * (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.db; +package org.hisp.dhis.android.core.arch.db.tableinfos; import org.hisp.dhis.android.core.common.BaseModel; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableEntityFromDatabaseAdapterDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableEntityFromDatabaseAdapterDIModule.java deleted file mode 100644 index 0b83330c0d..0000000000 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableEntityFromDatabaseAdapterDIModule.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.di; - -import org.hisp.dhis.android.core.common.ObjectWithUidInterface; - -public interface IdentifiableEntityFromDatabaseAdapterDIModule - extends IdentifiableStoreProvider, SyncHandlerFromDatabaseAdapterProvider { -} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/IdentifiableEntityDIModule.java similarity index 87% rename from core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/IdentifiableEntityDIModule.java index 50925d41ae..1993dc41bb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/IdentifiableEntityDIModule.java @@ -26,12 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.di; +package org.hisp.dhis.android.core.arch.di.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; public interface IdentifiableEntityDIModule extends IdentifiableStoreProvider { - SyncHandler handler(IdentifiableObjectStore store); + Handler handler(IdentifiableObjectStore store); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableStoreProvider.java b/core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/IdentifiableStoreProvider.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableStoreProvider.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/IdentifiableStoreProvider.java index 2770e2d828..1b6a3bb323 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/di/IdentifiableStoreProvider.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/IdentifiableStoreProvider.java @@ -26,9 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.di; +package org.hisp.dhis.android.core.arch.di.internal; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/di/ObjectWithoutUidEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/ObjectWithoutUidEntityDIModule.java similarity index 86% rename from core/src/main/java/org/hisp/dhis/android/core/arch/di/ObjectWithoutUidEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/ObjectWithoutUidEntityDIModule.java index 178891df5c..e7bfb4de03 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/di/ObjectWithoutUidEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/ObjectWithoutUidEntityDIModule.java @@ -26,11 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.di; +package org.hisp.dhis.android.core.arch.di.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; public interface ObjectWithoutUidEntityDIModule extends ObjectWithoutUidStoreProvider { - SyncHandler handler(ObjectWithoutUidStore store); + Handler handler(ObjectWithoutUidStore store); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/di/ObjectWithoutUidStoreProvider.java b/core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/ObjectWithoutUidStoreProvider.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/arch/di/ObjectWithoutUidStoreProvider.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/ObjectWithoutUidStoreProvider.java index f3865ddb9f..b3ec136d02 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/di/ObjectWithoutUidStoreProvider.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/di/internal/ObjectWithoutUidStoreProvider.java @@ -26,9 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.di; +package org.hisp.dhis.android.core.arch.di.internal; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; public interface ObjectWithoutUidStoreProvider { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/fields/FieldsHelper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/fields/internal/FieldsHelper.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/fields/FieldsHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/fields/internal/FieldsHelper.java index 4c16f08168..a6af0e63a1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/fields/FieldsHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/fields/internal/FieldsHelper.java @@ -26,14 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.fields; +package org.hisp.dhis.android.core.arch.fields.internal; +import org.hisp.dhis.android.core.arch.api.fields.internal.Field; +import org.hisp.dhis.android.core.arch.api.fields.internal.NestedField; +import org.hisp.dhis.android.core.arch.api.fields.internal.Property; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.BaseNameableObject; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.common.Property; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.NestedField; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/DictionaryTableHandler.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/DictionaryTableHandler.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/DictionaryTableHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/DictionaryTableHandler.java index 190818997e..091513c752 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/DictionaryTableHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/DictionaryTableHandler.java @@ -25,7 +25,7 @@ * (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.common; +package org.hisp.dhis.android.core.arch.handlers.internal; public interface DictionaryTableHandler

{ void handle(P pojo, String uid, String objectTable); diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/HandleAction.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandleAction.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/HandleAction.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandleAction.java index 1953a98106..ed953cb09d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/HandleAction.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandleAction.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.handlers.internal; public enum HandleAction { Insert, Update, Delete diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandler.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/Handler.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/Handler.java index 582c44068a..9073a731b8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/Handler.java @@ -25,11 +25,11 @@ * (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.handlers; +package org.hisp.dhis.android.core.arch.handlers.internal; import java.util.Collection; -public interface SyncHandler { +public interface Handler { void handle(O o); diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandlerBaseImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandlerBaseImpl.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandlerBaseImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandlerBaseImpl.java index b2a45362be..b1f1fe18c9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandlerBaseImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandlerBaseImpl.java @@ -25,16 +25,13 @@ * (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.handlers; - -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.Transformer; +package org.hisp.dhis.android.core.arch.handlers.internal; import java.util.ArrayList; import java.util.Collection; import java.util.List; -abstract class SyncHandlerBaseImpl implements SyncHandlerWithTransformer { +abstract class HandlerBaseImpl implements HandlerWithTransformer { @Override public final void handle(O o) { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandlerWithTransformer.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandlerWithTransformer.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandlerWithTransformer.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandlerWithTransformer.java index 8ff4f6918b..760307eed4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/SyncHandlerWithTransformer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/HandlerWithTransformer.java @@ -25,13 +25,11 @@ * (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.handlers; - -import org.hisp.dhis.android.core.common.Transformer; +package org.hisp.dhis.android.core.arch.handlers.internal; import java.util.Collection; -public interface SyncHandlerWithTransformer extends SyncHandler { +public interface HandlerWithTransformer extends Handler { void handle(O o, Transformer transformer); diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/IdentifiableDataSyncHandlerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/IdentifiableDataHandlerImpl.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/arch/handlers/IdentifiableDataSyncHandlerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/IdentifiableDataHandlerImpl.java index 342d67842a..bf8a3227e7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/IdentifiableDataSyncHandlerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/IdentifiableDataHandlerImpl.java @@ -26,13 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.handlers; +package org.hisp.dhis.android.core.arch.handlers.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.DataModel; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.ObjectWithDeleteInterface; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.common.State; @@ -44,10 +44,10 @@ import static org.hisp.dhis.android.core.utils.Utils.isDeleted; -public class IdentifiableDataSyncHandlerImpl - extends IdentifiableSyncHandlerImpl { +public class IdentifiableDataHandlerImpl + extends IdentifiableHandlerImpl { - public IdentifiableDataSyncHandlerImpl(IdentifiableObjectStore store) { + public IdentifiableDataHandlerImpl(IdentifiableObjectStore store) { super(store); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/IdentifiableSyncHandlerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/IdentifiableHandlerImpl.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/arch/handlers/IdentifiableSyncHandlerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/IdentifiableHandlerImpl.java index 72644882df..08c3495814 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/IdentifiableSyncHandlerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/IdentifiableHandlerImpl.java @@ -25,21 +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.arch.handlers; +package org.hisp.dhis.android.core.arch.handlers.internal; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.ObjectWithDeleteInterface; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import static org.hisp.dhis.android.core.utils.Utils.isDeleted; -public class IdentifiableSyncHandlerImpl - extends SyncHandlerBaseImpl { +public class IdentifiableHandlerImpl + extends HandlerBaseImpl { final IdentifiableObjectStore store; - public IdentifiableSyncHandlerImpl(IdentifiableObjectStore store) { + public IdentifiableHandlerImpl(IdentifiableObjectStore store) { this.store = store; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/LinkSyncHandler.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/LinkHandler.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/arch/handlers/LinkSyncHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/LinkHandler.java index 6db59b02cb..f0d92942f2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/LinkSyncHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/LinkHandler.java @@ -25,13 +25,12 @@ * (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.handlers; +package org.hisp.dhis.android.core.arch.handlers.internal; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.Transformer; import java.util.Collection; -public interface LinkSyncHandler { +public interface LinkHandler { void handleMany(String masterUid, Collection slaves, Transformer transformer); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/LinkSyncHandlerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/LinkHandlerImpl.java similarity index 87% rename from core/src/main/java/org/hisp/dhis/android/core/arch/handlers/LinkSyncHandlerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/LinkHandlerImpl.java index 13cc9eff55..ca7d8c9ec4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/LinkSyncHandlerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/LinkHandlerImpl.java @@ -25,19 +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.arch.handlers; +package org.hisp.dhis.android.core.arch.handlers.internal; -import org.hisp.dhis.android.core.common.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.Transformer; import java.util.Collection; -public class LinkSyncHandlerImpl implements LinkSyncHandler { +public class LinkHandlerImpl implements LinkHandler { private final LinkModelStore store; - public LinkSyncHandlerImpl(LinkModelStore store) { + public LinkHandlerImpl(LinkModelStore store) { this.store = store; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/ObjectWithoutUidSyncHandlerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/ObjectWithoutUidHandlerImpl.java similarity index 84% rename from core/src/main/java/org/hisp/dhis/android/core/arch/handlers/ObjectWithoutUidSyncHandlerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/ObjectWithoutUidHandlerImpl.java index c8e69968f5..a600252de2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/ObjectWithoutUidSyncHandlerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/ObjectWithoutUidHandlerImpl.java @@ -25,17 +25,16 @@ * (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.handlers; +package org.hisp.dhis.android.core.arch.handlers.internal; -import org.hisp.dhis.android.core.common.HandleAction; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; -public class ObjectWithoutUidSyncHandlerImpl extends SyncHandlerBaseImpl { +public class ObjectWithoutUidHandlerImpl extends HandlerBaseImpl { private final ObjectWithoutUidStore store; - public ObjectWithoutUidSyncHandlerImpl(ObjectWithoutUidStore store) { + public ObjectWithoutUidHandlerImpl(ObjectWithoutUidStore store) { this.store = store; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkSyncHandler.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkHandler.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkSyncHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkHandler.java index 6cf024b63c..9be6ab1c37 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkSyncHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkHandler.java @@ -25,10 +25,12 @@ * (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.common; +package org.hisp.dhis.android.core.arch.handlers.internal; + +import org.hisp.dhis.android.core.common.Model; import java.util.List; -public interface OrderedLinkSyncHandler { +public interface OrderedLinkHandler { void handleMany(String masterUid, List slaveCollection, OrderedLinkTransformer transformer); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkSyncHandlerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkHandlerImpl.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkSyncHandlerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkHandlerImpl.java index d24834c92d..63b32a3ef6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkSyncHandlerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkHandlerImpl.java @@ -25,15 +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.common; +package org.hisp.dhis.android.core.arch.handlers.internal; + +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.common.Model; import java.util.List; -public class OrderedLinkSyncHandlerImpl implements OrderedLinkSyncHandler { +public class OrderedLinkHandlerImpl implements OrderedLinkHandler { private final LinkModelStore store; - public OrderedLinkSyncHandlerImpl(LinkModelStore store) { + public OrderedLinkHandlerImpl(LinkModelStore store) { this.store = store; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkTransformer.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkTransformer.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkTransformer.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkTransformer.java index f4cfa3fd7a..e66b1de1be 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/OrderedLinkTransformer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/OrderedLinkTransformer.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.handlers.internal; public interface OrderedLinkTransformer { M transform(S object, Integer sortOrder); diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/Transformer.java b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/Transformer.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/common/Transformer.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/Transformer.java index b198331591..de9cb00be8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/Transformer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/handlers/internal/Transformer.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.arch.handlers.internal; public interface Transformer { T transform(O object); diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/AccessHelper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/helpers/AccessHelper.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/common/AccessHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/helpers/AccessHelper.java index 8692623305..24ca805aab 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/AccessHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/helpers/AccessHelper.java @@ -25,7 +25,9 @@ * (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.common; +package org.hisp.dhis.android.core.arch.helpers; + +import org.hisp.dhis.android.core.common.Access; public final class AccessHelper { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/CoordinateHelper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/helpers/CoordinateHelper.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/common/CoordinateHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/helpers/CoordinateHelper.java index 3a6c511ddf..8bda011c9e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/CoordinateHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/helpers/CoordinateHelper.java @@ -25,7 +25,9 @@ * (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.common; +package org.hisp.dhis.android.core.arch.helpers; + +import org.hisp.dhis.android.core.common.Coordinates; public final class CoordinateHelper { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/UidsHelper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/helpers/UidsHelper.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/common/UidsHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/helpers/UidsHelper.java index 6a4c858dc8..49b7d867ac 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/UidsHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/helpers/UidsHelper.java @@ -25,8 +25,10 @@ * (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.common; +package org.hisp.dhis.android.core.arch.helpers; +import org.hisp.dhis.android.core.common.IdentifiableObject; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.utils.Utils; import java.util.ArrayList; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/modules/MetadataModuleDownloader.java b/core/src/main/java/org/hisp/dhis/android/core/arch/modules/internal/MetadataModuleDownloader.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/modules/MetadataModuleDownloader.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/modules/internal/MetadataModuleDownloader.java index 29b5bdcbd3..54ef87a51f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/modules/MetadataModuleDownloader.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/modules/internal/MetadataModuleDownloader.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.modules; +package org.hisp.dhis.android.core.arch.modules.internal; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/modules/RxMetadataModuleDownloader.java b/core/src/main/java/org/hisp/dhis/android/core/arch/modules/internal/RxMetadataModuleDownloader.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/modules/RxMetadataModuleDownloader.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/modules/internal/RxMetadataModuleDownloader.java index ed7c98fd97..5568c36af4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/modules/RxMetadataModuleDownloader.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/modules/internal/RxMetadataModuleDownloader.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.modules; +package org.hisp.dhis.android.core.arch.modules.internal; import io.reactivex.Completable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenAppender.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenAppender.java index 6689ef0cb7..c684cbfa05 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenAppender.java @@ -25,7 +25,7 @@ * (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.repositories.children; +package org.hisp.dhis.android.core.arch.repositories.children.internal; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenAppenderExecutor.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenAppenderExecutor.java similarity index 98% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenAppenderExecutor.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenAppenderExecutor.java index c543f238e6..2939b81ed7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenAppenderExecutor.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenAppenderExecutor.java @@ -25,7 +25,7 @@ * (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.repositories.children; +package org.hisp.dhis.android.core.arch.repositories.children.internal; import org.hisp.dhis.android.core.common.Model; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenSelection.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenSelection.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenSelection.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenSelection.java index b628a6b316..c699aa8378 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/ChildrenSelection.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/children/internal/ChildrenSelection.java @@ -25,7 +25,7 @@ * (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.repositories.children; +package org.hisp.dhis.android.core.arch.repositories.children.internal; import java.util.Collections; import java.util.HashSet; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepository.java index 3b227be936..582af82e9c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepository.java @@ -34,10 +34,47 @@ import androidx.lifecycle.LiveData; import androidx.paging.PagedList; +import io.reactivex.Single; public interface ReadOnlyCollectionRepository { + + /** + * Query returning a Single object. As querying might be a + * time-consuming task, this method facilitates dealing with asynchronous behavior. + * + * @return A Single object emitting a list of elements. + */ + Single> getAsync(); + + /** + * Get the list of elements. Important: this is blocking method and it should be executed in a + * separated thread. + * + * @return List of elements + */ List get(); + + /** + * Handy method to use in conjunction with PagedListAdapter to build + * paged lists. + * + * @param pageSize Length of the page + * @return A LiveData object of PagedList of elements + */ LiveData> getPaged(int pageSize); + + /** + * Get a count of elements. Important: this is a blocking method and it should be executed in + * a separated thread. + * + * @return Element count + */ int count(); + + /** + * Get a {@link ReadOnlyObjectRepository} pointing to the first element in the list. + * + * @return Object repository + */ ReadOnlyObjectRepository one(); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepository.java index f38aceacad..bb04588d54 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepository.java @@ -27,7 +27,7 @@ */ package org.hisp.dhis.android.core.arch.repositories.collection; -import org.hisp.dhis.android.core.arch.repositories.filters.IdentifiableFilters; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.IdentifiableFilters; import org.hisp.dhis.android.core.common.IdentifiableObject; import org.hisp.dhis.android.core.common.Model; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyNameableCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyNameableCollectionRepository.java index 1e4f1b6cb3..428606c5d7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyNameableCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyNameableCollectionRepository.java @@ -27,7 +27,7 @@ */ package org.hisp.dhis.android.core.arch.repositories.collection; -import org.hisp.dhis.android.core.arch.repositories.filters.NameableFilters; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.NameableFilters; import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.NameableObject; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyWithUploadCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyWithUploadCollectionRepository.java index 2bffb32ae2..c167a656ea 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyWithUploadCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyWithUploadCollectionRepository.java @@ -29,7 +29,7 @@ package org.hisp.dhis.android.core.arch.repositories.collection; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUploadWithUidCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUploadWithUidCollectionRepository.java index 2907c7aa85..a7727c044c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUploadWithUidCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUploadWithUidCollectionRepository.java @@ -29,7 +29,7 @@ import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; -import org.hisp.dhis.android.core.imports.WebResponse; +import org.hisp.dhis.android.core.imports.internal.WebResponse; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/CollectionRepositoryFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/CollectionRepositoryFactory.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/CollectionRepositoryFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/CollectionRepositoryFactory.java index 5c816fcd38..25e4d57409 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/CollectionRepositoryFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/CollectionRepositoryFactory.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.collection; +package org.hisp.dhis.android.core.arch.repositories.collection.internal; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; public interface CollectionRepositoryFactory> { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyCollectionRepositoryImpl.java similarity index 75% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyCollectionRepositoryImpl.java index 19df092ed1..3cc804a469 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyCollectionRepositoryImpl.java @@ -25,38 +25,40 @@ * (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.repositories.collection; +package org.hisp.dhis.android.core.arch.repositories.collection.internal; -import org.hisp.dhis.android.core.arch.db.OrderByClauseBuilder; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppenderExecutor; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; +import androidx.lifecycle.LiveData; +import androidx.paging.DataSource; +import androidx.paging.LivePagedListBuilder; +import androidx.paging.PagedList; +import io.reactivex.Single; + +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.OrderByClauseBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppenderExecutor; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyOneObjectRepositoryFinalImpl; -import org.hisp.dhis.android.core.arch.repositories.paging.RepositoryDataSource; +import org.hisp.dhis.android.core.arch.repositories.paging.internal.RepositoryDataSource; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeHelper; -import org.hisp.dhis.android.core.arch.repositories.scope.WhereClauseFromScopeBuilder; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeHelper; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.WhereClauseFromScopeBuilder; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ReadableStore; import java.util.List; import java.util.Map; -import androidx.lifecycle.LiveData; -import androidx.paging.DataSource; -import androidx.paging.LivePagedListBuilder; -import androidx.paging.PagedList; - public class ReadOnlyCollectionRepositoryImpl> implements ReadOnlyCollectionRepository { - private final ObjectStore store; + private final ReadableStore store; protected final Map> childrenAppenders; protected final RepositoryScope scope; protected final FilterConnectorFactory cf; - public ReadOnlyCollectionRepositoryImpl(ObjectStore store, + public ReadOnlyCollectionRepositoryImpl(ReadableStore store, Map> childrenAppenders, RepositoryScope scope, FilterConnectorFactory cf) { @@ -67,7 +69,8 @@ public ReadOnlyCollectionRepositoryImpl(ObjectStore store, } protected List getWithoutChildren() { - return store.selectWhere(getWhereClause(), OrderByClauseBuilder.orderByFromItems(scope.orderBy())); + return store.selectWhere(getWhereClause(), OrderByClauseBuilder.orderByFromItems(scope.orderBy(), + scope.pagingKey())); } @Override @@ -81,6 +84,11 @@ public List get() { childrenAppenders, scope.children()); } + @Override + public Single> getAsync() { + return Single.fromCallable(this::get); + } + @Override public LiveData> getPaged(int pageSize) { DataSource.Factory factory = new DataSource.Factory() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyIdentifiableCollectionRepositoryImpl.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyIdentifiableCollectionRepositoryImpl.java index 68e34b3548..2c21aa3942 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyIdentifiableCollectionRepositoryImpl.java @@ -25,16 +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.arch.repositories.collection; - -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.filters.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +package org.hisp.dhis.android.core.arch.repositories.collection.internal; + +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyIdentifiableCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.DateFilterConnector; +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.BaseIdentifiableObjectModel.Columns; import org.hisp.dhis.android.core.common.IdentifiableObject; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.Model; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyNameableCollectionRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyNameableCollectionRepositoryImpl.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyNameableCollectionRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyNameableCollectionRepositoryImpl.java index 3900034cdd..7a225b76d4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyNameableCollectionRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyNameableCollectionRepositoryImpl.java @@ -25,14 +25,16 @@ * (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.repositories.collection; +package org.hisp.dhis.android.core.arch.repositories.collection.internal; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyNameableCollectionRepository; +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.BaseNameableObjectModel.Columns; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.NameableObject; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyWithUidCollectionRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyWithUidCollectionRepositoryImpl.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyWithUidCollectionRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyWithUidCollectionRepositoryImpl.java index 45695506bc..ddceee6971 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyWithUidCollectionRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadOnlyWithUidCollectionRepositoryImpl.java @@ -25,14 +25,16 @@ * (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.repositories.collection; +package org.hisp.dhis.android.core.arch.repositories.collection.internal; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithUidCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyOneObjectRepositoryFinalImpl; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeHelper; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeHelper; import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUidCollectionRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadWriteWithUidCollectionRepositoryImpl.java similarity index 87% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUidCollectionRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadWriteWithUidCollectionRepositoryImpl.java index 1c3b195e23..0f3fa0a4eb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadWriteWithUidCollectionRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/collection/internal/ReadWriteWithUidCollectionRepositoryImpl.java @@ -25,18 +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.arch.repositories.collection; +package org.hisp.dhis.android.core.arch.repositories.collection.internal; import android.database.sqlite.SQLiteConstraintException; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.ReadWriteWithUidCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; import org.hisp.dhis.android.core.arch.repositories.object.ReadWriteObjectRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; -import org.hisp.dhis.android.core.common.Transformer; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.maintenance.D2ErrorComponent; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/di/RepositoriesDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/di/internal/RepositoriesDIModule.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/di/RepositoriesDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/di/internal/RepositoriesDIModule.java index d376ce9f66..b71f76c22a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/di/RepositoriesDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/di/internal/RepositoriesDIModule.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.di; +package org.hisp.dhis.android.core.arch.repositories.di.internal; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/BaseFilterConnector.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/BaseFilterConnector.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/BaseFilterConnector.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/BaseFilterConnector.java index 21933c665d..b60b046aaa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/BaseFilterConnector.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/BaseFilterConnector.java @@ -26,14 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeComplexFilterItem; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeFilterItem; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeHelper; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeComplexFilterItem; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeFilterItem; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeHelper; import org.hisp.dhis.android.core.utils.Utils; import java.util.ArrayList; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/BooleanFilterConnector.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/BooleanFilterConnector.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/BooleanFilterConnector.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/BooleanFilterConnector.java index 8194d36953..223674da33 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/BooleanFilterConnector.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/BooleanFilterConnector.java @@ -26,10 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; public final class BooleanFilterConnector> diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/DateFilterConnector.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/DateFilterConnector.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/DateFilterConnector.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/DateFilterConnector.java index 0f2ee93457..11b4dc586f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/DateFilterConnector.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/DateFilterConnector.java @@ -26,14 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.period.DatePeriod; -import org.hisp.dhis.android.core.period.InPeriodQueryHelper; +import org.hisp.dhis.android.core.period.internal.InPeriodQueryHelper; import org.hisp.dhis.android.core.period.Period; import java.util.ArrayList; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/DoubleFilterConnector.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/DoubleFilterConnector.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/DoubleFilterConnector.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/DoubleFilterConnector.java index d76309d33e..799a49633d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/DoubleFilterConnector.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/DoubleFilterConnector.java @@ -26,10 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; public final class DoubleFilterConnector> diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/EnumFilterConnector.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/EnumFilterConnector.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/EnumFilterConnector.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/EnumFilterConnector.java index 0ed02d92cc..a95aef61ff 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/EnumFilterConnector.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/EnumFilterConnector.java @@ -26,10 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; public final class EnumFilterConnector, E extends Enum> diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/FilterConnectorFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/FilterConnectorFactory.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/FilterConnectorFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/FilterConnectorFactory.java index 9a080a34cb..d147cb7c5f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/FilterConnectorFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/FilterConnectorFactory.java @@ -26,13 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeHelper; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeOrderByItem; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeHelper; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeOrderByItem; public class FilterConnectorFactory> { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/IdentifiableFilters.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/IdentifiableFilters.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/IdentifiableFilters.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/IdentifiableFilters.java index 57a4fd132b..7252a13a39 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/IdentifiableFilters.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/IdentifiableFilters.java @@ -25,7 +25,7 @@ * (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.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/IntegerFilterConnector.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/IntegerFilterConnector.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/IntegerFilterConnector.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/IntegerFilterConnector.java index d76c98a4a6..6ecc2727fd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/IntegerFilterConnector.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/IntegerFilterConnector.java @@ -26,10 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; public final class IntegerFilterConnector> diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/NameableFilters.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/NameableFilters.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/NameableFilters.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/NameableFilters.java index 1d88c9e3b9..8a4f484d59 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/NameableFilters.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/NameableFilters.java @@ -25,7 +25,7 @@ * (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.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/StringFilterConnector.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/StringFilterConnector.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/StringFilterConnector.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/StringFilterConnector.java index 57e1fa1c58..190b283521 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/StringFilterConnector.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/StringFilterConnector.java @@ -26,10 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; public final class StringFilterConnector> diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/SubQueryFilterConnector.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/SubQueryFilterConnector.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/SubQueryFilterConnector.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/SubQueryFilterConnector.java index 868d16c9cc..19bec95465 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/SubQueryFilterConnector.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/filters/internal/SubQueryFilterConnector.java @@ -26,11 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.filters; +package org.hisp.dhis.android.core.arch.repositories.filters.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.repositories.collection.CollectionRepositoryFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepository; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.CollectionRepositoryFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyObjectRepository.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyObjectRepository.java index f23fda2ae7..67538e1511 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyObjectRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyObjectRepository.java @@ -29,7 +29,10 @@ import org.hisp.dhis.android.core.common.Model; +import io.reactivex.Single; + public interface ReadOnlyObjectRepository { M get(); + Single getAsync(); boolean exists(); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyOneObjectRepositoryFinalImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyOneObjectRepositoryFinalImpl.java index f4d30fab59..e4432b3fde 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyOneObjectRepositoryFinalImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyOneObjectRepositoryFinalImpl.java @@ -27,17 +27,18 @@ */ package org.hisp.dhis.android.core.arch.repositories.object; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.object.internal.ReadOnlyOneObjectRepositoryImpl; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ReadableStore; import java.util.Map; public final class ReadOnlyOneObjectRepositoryFinalImpl extends ReadOnlyOneObjectRepositoryImpl> { - public ReadOnlyOneObjectRepositoryFinalImpl(ObjectStore store, + public ReadOnlyOneObjectRepositoryFinalImpl(ReadableStore store, Map> childrenAppenders, RepositoryScope scope) { super(store, childrenAppenders, scope, diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ObjectRepositoryFactory.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ObjectRepositoryFactory.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ObjectRepositoryFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ObjectRepositoryFactory.java index 6c252cf8e5..1bd650ddec 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ObjectRepositoryFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ObjectRepositoryFactory.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.object; +package org.hisp.dhis.android.core.arch.repositories.object.internal; +import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyObjectRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; public interface ObjectRepositoryFactory> { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyFirstObjectWithDownloadRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyFirstObjectWithDownloadRepositoryImpl.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyFirstObjectWithDownloadRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyFirstObjectWithDownloadRepositoryImpl.java index e802bc0fdf..18f24856ca 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyFirstObjectWithDownloadRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyFirstObjectWithDownloadRepositoryImpl.java @@ -25,14 +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.arch.repositories.object; +package org.hisp.dhis.android.core.arch.repositories.object.internal; -import org.hisp.dhis.android.core.arch.call.CompletableProvider; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.call.internal.CompletableProvider; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithDownloadObjectRepository; +import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyObjectRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectStore; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyObjectRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyObjectRepositoryImpl.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyObjectRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyObjectRepositoryImpl.java index ac4c8db363..b244eba11c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyObjectRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyObjectRepositoryImpl.java @@ -25,16 +25,19 @@ * (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.repositories.object; +package org.hisp.dhis.android.core.arch.repositories.object.internal; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppenderExecutor; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppenderExecutor; +import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyObjectRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeHelper; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeHelper; import org.hisp.dhis.android.core.common.Model; import java.util.Map; +import io.reactivex.Single; + public abstract class ReadOnlyObjectRepositoryImpl> implements ReadOnlyObjectRepository { @@ -57,6 +60,11 @@ public final M get() { return ChildrenAppenderExecutor.appendInObject(getWithoutChildren(), childrenAppenders, scope.children()); } + @Override + public final Single getAsync() { + return Single.fromCallable(this::get); + } + @Override public boolean exists() { return getWithoutChildren() != null; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyOneObjectRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyOneObjectRepositoryImpl.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyOneObjectRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyOneObjectRepositoryImpl.java index 65fc90c980..46bf64f8c6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadOnlyOneObjectRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadOnlyOneObjectRepositoryImpl.java @@ -25,23 +25,24 @@ * (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.repositories.object; +package org.hisp.dhis.android.core.arch.repositories.object.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyObjectRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.arch.repositories.scope.WhereClauseFromScopeBuilder; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.WhereClauseFromScopeBuilder; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ReadableStore; import java.util.Map; public class ReadOnlyOneObjectRepositoryImpl> extends ReadOnlyObjectRepositoryImpl { - private final ObjectStore store; + private final ReadableStore store; - public ReadOnlyOneObjectRepositoryImpl(ObjectStore store, + public ReadOnlyOneObjectRepositoryImpl(ReadableStore store, Map> childrenAppenders, RepositoryScope scope, ObjectRepositoryFactory repositoryFactory) { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithUidDataObjectRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithUidDataObjectRepositoryImpl.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithUidDataObjectRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithUidDataObjectRepositoryImpl.java index e865e338b7..6ad7b54411 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithUidDataObjectRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithUidDataObjectRepositoryImpl.java @@ -25,12 +25,13 @@ * (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.repositories.object; +package org.hisp.dhis.android.core.arch.repositories.object.internal; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectWithStateStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyObjectRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.common.DataModel; -import org.hisp.dhis.android.core.common.IdentifiableObjectWithStateStore; import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.common.State; @@ -69,6 +70,7 @@ public void delete() throws D2Error { store.delete(object.uid()); } else { store.setState(object.uid(), State.TO_DELETE); + propagateState(); } } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithUidObjectRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithUidObjectRepositoryImpl.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithUidObjectRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithUidObjectRepositoryImpl.java index d6031121b3..71de04cbf2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithUidObjectRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithUidObjectRepositoryImpl.java @@ -25,13 +25,14 @@ * (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.repositories.object; +package org.hisp.dhis.android.core.arch.repositories.object.internal; import android.database.sqlite.SQLiteConstraintException; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyObjectRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.Model; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.common.Unit; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithValueObjectRepositoryImpl.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithValueObjectRepositoryImpl.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithValueObjectRepositoryImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithValueObjectRepositoryImpl.java index 11bb41689d..3b69f5dee1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/ReadWriteWithValueObjectRepositoryImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/object/internal/ReadWriteWithValueObjectRepositoryImpl.java @@ -25,14 +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.arch.repositories.object; +package org.hisp.dhis.android.core.arch.repositories.object.internal; import android.database.sqlite.SQLiteConstraintException; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.object.ReadOnlyObjectRepository; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; import org.hisp.dhis.android.core.common.Unit; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/RepositoryDataSource.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/internal/RepositoryDataSource.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/RepositoryDataSource.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/internal/RepositoryDataSource.java index fa6c1bca82..f6afc79862 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/RepositoryDataSource.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/internal/RepositoryDataSource.java @@ -25,30 +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.arch.repositories.paging; +package org.hisp.dhis.android.core.arch.repositories.paging.internal; -import org.hisp.dhis.android.core.arch.db.OrderByClauseBuilder; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppenderExecutor; +import androidx.annotation.NonNull; +import androidx.paging.ItemKeyedDataSource; + +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.OrderByClauseBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppenderExecutor; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.arch.repositories.scope.WhereClauseFromScopeBuilder; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.WhereClauseFromScopeBuilder; import org.hisp.dhis.android.core.common.Model; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ReadableStore; import java.util.List; import java.util.Map; -import androidx.annotation.NonNull; -import androidx.paging.ItemKeyedDataSource; - public final class RepositoryDataSource extends ItemKeyedDataSource { - private final ObjectStore store; + private final ReadableStore store; private final RepositoryScope scope; private final Map> childrenAppenders; - public RepositoryDataSource(ObjectStore store, + public RepositoryDataSource(ReadableStore store, RepositoryScope scope, Map> childrenAppenders) { this.store = store; @@ -60,7 +60,7 @@ public RepositoryDataSource(ObjectStore store, public void loadInitial(@NonNull LoadInitialParams params, @NonNull LoadInitialCallback callback) { String whereClause = new WhereClauseFromScopeBuilder(new WhereClauseBuilder()).getWhereClause(scope); List withoutChildren = store.selectWhere(whereClause, - OrderByClauseBuilder.orderByFromItems(scope.orderBy()), params.requestedLoadSize); + OrderByClauseBuilder.orderByFromItems(scope.orderBy(), scope.pagingKey()), params.requestedLoadSize); callback.onResult(appendChildren(withoutChildren)); } @@ -77,9 +77,10 @@ public void loadBefore(@NonNull LoadParams params, @NonNull LoadCallback c private void loadPages(@NonNull LoadParams params, @NonNull LoadCallback callback, boolean reversed) { WhereClauseBuilder whereClauseBuilder = new WhereClauseBuilder(); OrderByClauseBuilder.addSortingClauses(whereClauseBuilder, scope.orderBy(), - params.key.toContentValues(), reversed); + params.key.toContentValues(), reversed, scope.pagingKey()); String whereClause = new WhereClauseFromScopeBuilder(whereClauseBuilder).getWhereClause(scope); - List withoutChildren = store.selectWhere(whereClause, OrderByClauseBuilder.orderByFromItems(scope.orderBy()), + List withoutChildren = store.selectWhere(whereClause, + OrderByClauseBuilder.orderByFromItems(scope.orderBy(), scope.pagingKey()), params.requestedLoadSize); callback.onResult(appendChildren(withoutChildren)); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/RepositoryPagingConfig.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/internal/RepositoryPagingConfig.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/RepositoryPagingConfig.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/internal/RepositoryPagingConfig.java index b2544eda93..8727394463 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/RepositoryPagingConfig.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/paging/internal/RepositoryPagingConfig.java @@ -25,7 +25,7 @@ * (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.repositories.paging; +package org.hisp.dhis.android.core.arch.repositories.paging.internal; import org.hisp.dhis.android.core.common.BaseModel; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScope.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScope.java index c68ac2efe5..34409d3d9d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScope.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScope.java @@ -30,7 +30,11 @@ import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenSelection; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenSelection; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeComplexFilterItem; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeFilterItem; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeOrderByItem; +import org.hisp.dhis.android.core.common.BaseModel; import java.util.Collections; import java.util.List; @@ -53,6 +57,9 @@ public enum OrderByDirection { @NonNull public abstract List orderBy(); + @NonNull + public abstract String pagingKey(); + @NonNull public abstract ChildrenSelection children(); @@ -66,6 +73,7 @@ public static RepositoryScope empty() { .filters(Collections.emptyList()) .complexFilters(Collections.emptyList()) .orderBy(Collections.emptyList()) + .pagingKey(BaseModel.Columns.ID) .build(); } @@ -86,6 +94,8 @@ public abstract static class Builder { public abstract Builder orderBy(List orderBy); + public abstract Builder pagingKey(String pagingKey); + public abstract RepositoryScope build(); } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryMode.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryMode.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryMode.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryMode.java index 095630b18d..15db7f2089 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryMode.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryMode.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.scope; +package org.hisp.dhis.android.core.arch.repositories.scope.internal; public enum RepositoryMode { ONLINE_ONLY, OFFLINE_ONLY, ONLINE_FIRST, OFFLINE_FIRST diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeComplexFilterItem.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeComplexFilterItem.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeComplexFilterItem.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeComplexFilterItem.java index aa813d1746..5511aca8ab 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeComplexFilterItem.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeComplexFilterItem.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.scope; +package org.hisp.dhis.android.core.arch.repositories.scope.internal; import com.google.auto.value.AutoValue; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeFilterItem.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeFilterItem.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeFilterItem.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeFilterItem.java index 03adbfbad9..91b9e7bac8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeFilterItem.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeFilterItem.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.scope; +package org.hisp.dhis.android.core.arch.repositories.scope.internal; import com.google.auto.value.AutoValue; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeHelper.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeHelper.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeHelper.java index 0b304499aa..6fa1de765d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeHelper.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.scope; +package org.hisp.dhis.android.core.arch.repositories.scope.internal; +import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import java.util.ArrayList; diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeOrderByItem.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeOrderByItem.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeOrderByItem.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeOrderByItem.java index 964c74b1af..42afef7891 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/RepositoryScopeOrderByItem.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/RepositoryScopeOrderByItem.java @@ -26,10 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.scope; +package org.hisp.dhis.android.core.arch.repositories.scope.internal; import com.google.auto.value.AutoValue; +import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; + @AutoValue public abstract class RepositoryScopeOrderByItem { diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/WhereClauseFromScopeBuilder.java b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/WhereClauseFromScopeBuilder.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/WhereClauseFromScopeBuilder.java rename to core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/WhereClauseFromScopeBuilder.java index ebbbed4f6d..22dea72354 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/WhereClauseFromScopeBuilder.java +++ b/core/src/main/java/org/hisp/dhis/android/core/arch/repositories/scope/internal/WhereClauseFromScopeBuilder.java @@ -26,9 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.repositories.scope; +package org.hisp.dhis.android.core.arch.repositories.scope.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; public class WhereClauseFromScopeBuilder { diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/Category.java b/core/src/main/java/org/hisp/dhis/android/core/category/Category.java index f23f3385b4..81a720ab7c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/Category.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/Category.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.category; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -43,6 +42,8 @@ import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_Category.Builder.class) public abstract class Category extends BaseIdentifiableObject implements Model { @@ -75,6 +76,6 @@ public static abstract class Builder extends BaseIdentifiableObject.Builder { + private static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( + CategoryTableInfo.TABLE_INFO, + CategoryCategoryComboLinkTableInfo.Columns.CATEGORY_COMBO, + CategoryCategoryComboLinkTableInfo.Columns.CATEGORY); + private final LinkModelChildStore linkModelChildStore; private CategoryCategoryComboChildrenAppender(LinkModelChildStore linkModelChildStore) { @@ -53,7 +63,7 @@ static ChildrenAppender create(DatabaseAdapter databaseAdapter) { StoreFactory.linkModelChildStore( databaseAdapter, CategoryCategoryComboLinkTableInfo.TABLE_INFO, - CategoryCategoryComboLinkTableInfo.CHILD_PROJECTION, + CHILD_PROJECTION, Category::create ) ); diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryComboEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryComboEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboEntityDIModule.java index 21c0c2c33f..a9b9c040ca 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryComboEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboEntityDIModule.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandler; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandlerImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandlerImpl; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCategoryComboLink; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import dagger.Module; @@ -48,8 +50,8 @@ LinkModelStore store(DatabaseAdapter databaseAdapter) @Provides @Reusable - OrderedLinkSyncHandler handler( + OrderedLinkHandler handler( LinkModelStore store) { - return new OrderedLinkSyncHandlerImpl<>(store); + return new OrderedLinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStore.java index d6ceb01f5d..15e08a9a61 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryComboLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStore.java @@ -26,15 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.category.CategoryCategoryComboLink; +import org.hisp.dhis.android.core.category.CategoryCategoryComboLinkTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class CategoryCategoryComboLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionChildrenAppender.java similarity index 72% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionChildrenAppender.java index c0e2733679..d9b47044b0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionChildrenAppender.java @@ -25,16 +25,26 @@ * (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.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.db.stores.LinkModelChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLinkTableInfo; +import org.hisp.dhis.android.core.category.CategoryOption; +import org.hisp.dhis.android.core.category.CategoryOptionTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; final class CategoryCategoryOptionChildrenAppender extends ChildrenAppender { + private static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( + CategoryOptionTableInfo.TABLE_INFO, + CategoryCategoryOptionLinkTableInfo.Columns.CATEGORY, + CategoryCategoryOptionLinkTableInfo.Columns.CATEGORY_OPTION); + private final LinkModelChildStore linkModelChildStore; private CategoryCategoryOptionChildrenAppender(LinkModelChildStore linkModelChildStore) { @@ -53,7 +63,7 @@ static ChildrenAppender create(DatabaseAdapter databaseAdapter) { StoreFactory.linkModelChildStore( databaseAdapter, CategoryCategoryOptionLinkTableInfo.TABLE_INFO, - CategoryCategoryOptionLinkTableInfo.CHILD_PROJECTION, + CHILD_PROJECTION, CategoryOption::create) ); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionEntityDIModule.java index 0c39d37062..4a78afa892 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionEntityDIModule.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandler; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandlerImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandlerImpl; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLink; +import org.hisp.dhis.android.core.category.CategoryOption; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import dagger.Module; @@ -48,8 +50,8 @@ LinkModelStore store(DatabaseAdapter databaseAdapter @Provides @Reusable - OrderedLinkSyncHandler handler( + OrderedLinkHandler handler( LinkModelStore store) { - return new OrderedLinkSyncHandlerImpl<>(store); + return new OrderedLinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStore.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStore.java index 8b09fabb9c..e6461c340b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryCategoryOptionLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLink; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLinkTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class CategoryCategoryOptionLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboEndpointCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallFactory.java similarity index 73% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboEndpointCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallFactory.java index 5d4fcd323a..578397bc7a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboEndpointCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallFactory.java @@ -26,19 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.UidsNoResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.common.UidsQuery; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.UidsNoResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.call.queries.internal.UidsQuery; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.category.CategoryCombo; import java.util.Set; @@ -52,13 +53,13 @@ final class CategoryComboEndpointCallFactory extends UidsCallFactoryImpl handler; + private final Handler handler; @Inject CategoryComboEndpointCallFactory(GenericCallData data, APICallExecutor apiCallExecutor, CategoryComboService service, - SyncHandler handler) { + Handler handler) { super(data, apiCallExecutor); this.service = service; this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboEntityDIModule.java index b91c8b7cbb..6a2666e1aa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboEntityDIModule.java @@ -26,14 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.di.IdentifiableStoreProvider; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.OrphanCleaner; -import org.hisp.dhis.android.core.common.OrphanCleanerImpl; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleanerImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.di.internal.IdentifiableStoreProvider; +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.category.CategoryCombo; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; +import org.hisp.dhis.android.core.category.CategoryOptionComboTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.HashMap; @@ -55,7 +58,7 @@ public IdentifiableObjectStore store(DatabaseAdapter databaseAdap @Provides @Reusable - public SyncHandler handler(CategoryComboHandler impl) { + public Handler handler(CategoryComboHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboFields.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboFields.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboFields.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboFields.java index d494683370..96178774fe 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboFields.java @@ -26,17 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +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.category.CategoryCombo; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; -final class CategoryComboFields { +public final class CategoryComboFields { - static final String IS_DEFAULT = "isDefault"; - static final String CATEGORIES = "categories"; - static final String CATEGORY_OPTION_COMBOS = "categoryOptionCombos"; + public static final String IS_DEFAULT = "isDefault"; + public static final String CATEGORIES = "categories"; + public static final String CATEGORY_OPTION_COMBOS = "categoryOptionCombos"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboHandler.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboHandler.java similarity index 70% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboHandler.java index 25939f4c0e..3273c2b317 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboHandler.java @@ -26,33 +26,36 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandler; -import org.hisp.dhis.android.core.common.OrphanCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleaner; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandler; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCategoryComboLink; +import org.hisp.dhis.android.core.category.CategoryCombo; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; import javax.inject.Inject; +import androidx.annotation.NonNull; import dagger.Reusable; @Reusable -final class CategoryComboHandler extends IdentifiableSyncHandlerImpl { +final class CategoryComboHandler extends IdentifiableHandlerImpl { - private final SyncHandlerWithTransformer optionComboHandler; - private final OrderedLinkSyncHandler categoryCategoryComboLinkHandler; + private final HandlerWithTransformer optionComboHandler; + private final OrderedLinkHandler categoryCategoryComboLinkHandler; private final OrphanCleaner categoryOptionCleaner; @Inject CategoryComboHandler( @NonNull IdentifiableObjectStore store, - @NonNull SyncHandlerWithTransformer optionComboHandler, - @NonNull OrderedLinkSyncHandler categoryCategoryComboLinkHandler, + @NonNull HandlerWithTransformer optionComboHandler, + @NonNull OrderedLinkHandler categoryCategoryComboLinkHandler, OrphanCleaner categoryOptionCleaner) { super(store); this.optionComboHandler = optionComboHandler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboService.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboService.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboService.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboService.java index 617f7a408f..2f8d849054 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboService.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Filter; -import org.hisp.dhis.android.core.data.api.Where; -import org.hisp.dhis.android.core.data.api.Which; +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; +import org.hisp.dhis.android.core.arch.api.filters.internal.Filter; +import org.hisp.dhis.android.core.arch.api.filters.internal.Where; +import org.hisp.dhis.android.core.arch.api.filters.internal.Which; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.category.CategoryCombo; import retrofit2.Call; import retrofit2.http.GET; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboStore.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboStore.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboStore.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboStore.java index f96f6f0600..a6a59df95a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboStore.java @@ -26,19 +26,22 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.IdentifiableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.category.CategoryCombo; +import org.hisp.dhis.android.core.category.CategoryComboTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import androidx.annotation.NonNull; + +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class CategoryComboStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboUidsSeeker.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeeker.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboUidsSeeker.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeeker.java index 28c41ffcd0..d6f59a3fbb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryComboUidsSeeker.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeeker.java @@ -26,15 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import android.database.Cursor; -import org.hisp.dhis.android.core.arch.db.MultipleTableQueryBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.MultipleTableQueryBuilder; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataelement.DataElementTableInfo; import org.hisp.dhis.android.core.dataset.DataSetElementLinkTableInfo; -import org.hisp.dhis.android.core.dataset.DataSetFields; +import org.hisp.dhis.android.core.dataset.internal.DataSetFields; import org.hisp.dhis.android.core.dataset.DataSetTableInfo; import org.hisp.dhis.android.core.program.ProgramTableInfo; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryEndpointCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallFactory.java similarity index 73% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryEndpointCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallFactory.java index 0500b72133..6bed8c3f56 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryEndpointCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallFactory.java @@ -26,19 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.UidsNoResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.common.UidsQuery; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.UidsNoResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.call.queries.internal.UidsQuery; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.category.Category; import java.util.Set; @@ -51,13 +52,13 @@ final class CategoryEndpointCallFactory extends UidsCallFactoryImpl { private static final int MAX_UID_LIST_SIZE = 90; - private final SyncHandler handler; + private final Handler handler; private final CategoryService service; @Inject CategoryEndpointCallFactory(GenericCallData data, APICallExecutor apiCallExecutor, - SyncHandler handler, + Handler handler, CategoryService service) { super(data, apiCallExecutor); this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryEntityDIModule.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryEntityDIModule.java index 9786ae5cde..5661eac329 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryEntityDIModule.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.di.IdentifiableStoreProvider; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.di.internal.IdentifiableStoreProvider; +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.category.Category; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.Collections; @@ -53,7 +54,7 @@ public IdentifiableObjectStore store(DatabaseAdapter databaseAdapter) @Provides @Reusable - public SyncHandler handler(CategoryHandler impl) { + public Handler handler(CategoryHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryFields.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryFields.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryFields.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryFields.java index 764cfbc984..13708a889b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryFields.java @@ -26,16 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +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.category.Category; +import org.hisp.dhis.android.core.category.CategoryOption; -final class CategoryFields { +public final class CategoryFields { - static final String CATEGORY_OPTIONS = "categoryOptions"; - static final String DATA_DIMENSION_TYPE = "dataDimensionType"; + public static final String CATEGORY_OPTIONS = "categoryOptions"; + public static final String DATA_DIMENSION_TYPE = "dataDimensionType"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryHandler.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryHandler.java similarity index 75% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryHandler.java index 224acf493c..967801f2d4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryHandler.java @@ -26,34 +26,36 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandler; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandler; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLink; +import org.hisp.dhis.android.core.category.CategoryOption; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; +import androidx.annotation.NonNull; import dagger.Reusable; @Reusable -final class CategoryHandler extends IdentifiableSyncHandlerImpl { +final class CategoryHandler extends IdentifiableHandlerImpl { - private final SyncHandler categoryOptionHandler; - private final OrderedLinkSyncHandler categoryCategoryOptionLinkHandler; + private final Handler categoryOptionHandler; + private final OrderedLinkHandler categoryCategoryOptionLinkHandler; @Inject CategoryHandler( @NonNull IdentifiableObjectStore categoryStore, - @NonNull SyncHandler categoryOptionHandler, - @NonNull OrderedLinkSyncHandler + @NonNull Handler categoryOptionHandler, + @NonNull OrderedLinkHandler categoryCategoryOptionLinkHandler) { super(categoryStore); this.categoryOptionHandler = categoryOptionHandler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryInternalModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryInternalModule.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryInternalModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryInternalModule.java index e9a193ea51..8185d58e17 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryInternalModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryInternalModule.java @@ -25,14 +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.category; +package org.hisp.dhis.android.core.category.internal; -import androidx.annotation.VisibleForTesting; - -import org.hisp.dhis.android.core.calls.factories.UidsCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactory; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCombo; import javax.inject.Inject; +import androidx.annotation.VisibleForTesting; import dagger.Reusable; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryModuleDownloader.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryModuleDownloader.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryModuleDownloader.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryModuleDownloader.java index a6ad956edb..72cfdf942a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryModuleDownloader.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryModuleDownloader.java @@ -25,10 +25,12 @@ * (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.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.modules.MetadataModuleDownloader; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactory; +import org.hisp.dhis.android.core.arch.modules.internal.MetadataModuleDownloader; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCombo; import org.hisp.dhis.android.core.common.Unit; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryModuleWiper.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryModuleWiper.java index bc27b6e1ca..f99022fff3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryModuleWiper.java @@ -25,8 +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.category; +package org.hisp.dhis.android.core.category.internal; +import org.hisp.dhis.android.core.category.CategoryCategoryComboLinkTableInfo; +import org.hisp.dhis.android.core.category.CategoryCategoryOptionLinkTableInfo; +import org.hisp.dhis.android.core.category.CategoryComboTableInfo; +import org.hisp.dhis.android.core.category.CategoryOptionComboCategoryOptionLinkTableInfo; +import org.hisp.dhis.android.core.category.CategoryOptionComboTableInfo; +import org.hisp.dhis.android.core.category.CategoryOptionTableInfo; +import org.hisp.dhis.android.core.category.CategoryTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionChildrenAppender.java similarity index 72% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionChildrenAppender.java index 05382c8666..9fe20ae499 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionChildrenAppender.java @@ -25,15 +25,24 @@ * (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.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.db.stores.LinkModelChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.category.CategoryOption; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; +import org.hisp.dhis.android.core.category.CategoryOptionComboCategoryOptionLinkTableInfo; +import org.hisp.dhis.android.core.category.CategoryOptionTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; final class CategoryOptionComboCategoryOptionChildrenAppender extends ChildrenAppender { + private static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( + CategoryOptionTableInfo.TABLE_INFO, + CategoryOptionComboCategoryOptionLinkTableInfo.Columns.CATEGORY_OPTION_COMBO, + CategoryOptionComboCategoryOptionLinkTableInfo.Columns.CATEGORY_OPTION); private final LinkModelChildStore linkModelChildStore; @@ -54,7 +63,7 @@ static ChildrenAppender create(DatabaseAdapter databaseAdap StoreFactory.linkModelChildStore( databaseAdapter, CategoryOptionComboCategoryOptionLinkTableInfo.TABLE_INFO, - CategoryOptionComboCategoryOptionLinkTableInfo.CHILD_PROJECTION, + CHILD_PROJECTION, CategoryOption::create) ); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionEntityDIModule.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionEntityDIModule.java index e9b3e45514..56f409664f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionEntityDIModule.java @@ -26,11 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandlerImpl; -import org.hisp.dhis.android.core.common.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandlerImpl; +import org.hisp.dhis.android.core.category.CategoryOption; +import org.hisp.dhis.android.core.category.CategoryOptionComboCategoryOptionLink; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import dagger.Module; @@ -48,8 +50,8 @@ LinkModelStore store(DatabaseAdapter data @Provides @Reusable - LinkSyncHandler + LinkHandler categoryOptionComboCategoryOptionLinkHandler(LinkModelStore store) { - return new LinkSyncHandlerImpl<>(store); + return new LinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStore.java index 071a9124ba..398d361fb8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboCategoryOptionLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStore.java @@ -26,15 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.category.CategoryOptionComboCategoryOptionLink; +import org.hisp.dhis.android.core.category.CategoryOptionComboCategoryOptionLinkTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class CategoryOptionComboCategoryOptionLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboChildrenAppender.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboChildrenAppender.java index 7e548475e1..2de4b9f71d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboChildrenAppender.java @@ -25,9 +25,11 @@ * (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.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.category.CategoryCombo; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboEntityDIModule.java similarity index 86% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboEntityDIModule.java index 5741fae0af..319a559683 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboEntityDIModule.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.Collections; @@ -50,7 +51,7 @@ public CategoryOptionComboStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - public SyncHandlerWithTransformer handler(CategoryOptionComboHandler impl) { + public HandlerWithTransformer handler(CategoryOptionComboHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboFields.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboFields.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboFields.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboFields.java index fa7a27f934..f45996e760 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboFields.java @@ -26,15 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.category.CategoryOptionCombo; -final class CategoryOptionComboFields { +public final class CategoryOptionComboFields { - static final String CATEGORY_COMBO = "categoryCombo"; - static final String CATEGORY_OPTIONS = "categoryOptions"; + public static final String CATEGORY_COMBO = "categoryCombo"; + public static final String CATEGORY_OPTIONS = "categoryOptions"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboHandler.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboHandler.java similarity index 76% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboHandler.java index 1515e86b2c..28c8d50cfb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboHandler.java @@ -26,26 +26,29 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.common.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; +import org.hisp.dhis.android.core.category.CategoryOption; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; +import org.hisp.dhis.android.core.category.CategoryOptionComboCategoryOptionLink; import javax.inject.Inject; import dagger.Reusable; @Reusable -final class CategoryOptionComboHandler extends IdentifiableSyncHandlerImpl { +final class CategoryOptionComboHandler extends IdentifiableHandlerImpl { - private final LinkSyncHandler + private final LinkHandler categoryOptionComboCategoryOptionLinkHandler; @Inject CategoryOptionComboHandler(CategoryOptionComboStore store, - LinkSyncHandler + LinkHandler categoryOptionComboCategoryOptionLinkHandler) { super(store); this.categoryOptionComboCategoryOptionLinkHandler = categoryOptionComboCategoryOptionLinkHandler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboStore.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboStore.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboStore.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboStore.java index 5b27cf6178..a4da9b5715 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboStore.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboStoreImpl.java similarity index 75% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboStoreImpl.java index 2f61c5d9a9..730451f67f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionComboStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboStoreImpl.java @@ -26,30 +26,33 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStoreImpl; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; -import org.hisp.dhis.android.core.common.SQLStatementWrapper; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilderImpl; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.statementwrapper.internal.SQLStatementWrapper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.IdentifiableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStoreImpl; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; +import org.hisp.dhis.android.core.category.CategoryOptionCombo; +import org.hisp.dhis.android.core.category.CategoryOptionComboTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.List; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import androidx.annotation.NonNull; + +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class CategoryOptionComboStoreImpl extends IdentifiableObjectStoreImpl implements CategoryOptionComboStore { private CategoryOptionComboStoreImpl(DatabaseAdapter databaseAdapter, SQLStatementWrapper statementWrapper, - SQLStatementBuilder statementBuilder) { + SQLStatementBuilderImpl statementBuilder) { super(databaseAdapter, statementWrapper, statementBuilder, BINDER, CategoryOptionCombo::create); } @@ -72,7 +75,7 @@ public void bindToStatement(@NonNull CategoryOptionCombo o, @NonNull SQLiteState }; static CategoryOptionComboStore create(DatabaseAdapter databaseAdapter) { - SQLStatementBuilder statementBuilder = new SQLStatementBuilder(CategoryOptionComboTableInfo.TABLE_INFO); + SQLStatementBuilderImpl statementBuilder = new SQLStatementBuilderImpl(CategoryOptionComboTableInfo.TABLE_INFO); SQLStatementWrapper statementWrapper = new SQLStatementWrapper(statementBuilder, databaseAdapter); return new CategoryOptionComboStoreImpl(databaseAdapter, statementWrapper, statementBuilder); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionEntityDIModule.java similarity index 77% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionEntityDIModule.java index 899b44338d..80cfebeb1b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionEntityDIModule.java @@ -26,13 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.di.IdentifiableEntityDIModule; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.di.internal.IdentifiableEntityDIModule; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.category.CategoryOption; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.Collections; @@ -55,8 +56,8 @@ public IdentifiableObjectStore store(DatabaseAdapter databaseAda @Override @Provides @Reusable - public SyncHandler handler(IdentifiableObjectStore store) { - return new IdentifiableSyncHandlerImpl<>(store); + public Handler handler(IdentifiableObjectStore store) { + return new IdentifiableHandlerImpl<>(store); } @Provides diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionFields.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionFields.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionFields.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionFields.java index d078018de9..03965c6a88 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionFields.java @@ -26,19 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; +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.category.CategoryOption; import org.hisp.dhis.android.core.common.Access; import org.hisp.dhis.android.core.common.DataAccess; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; -final class CategoryOptionFields { +public final class CategoryOptionFields { - static final String START_DATE = "startDate"; - static final String END_DATE = "endDate"; - private static final String ACCESS = "access"; + public static final String START_DATE = "startDate"; + public static final String END_DATE = "endDate"; + public static final String ACCESS = "access"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionStore.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionStore.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionStore.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionStore.java index b17ec799d0..170cb02fb4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryOptionStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryOptionStore.java @@ -26,19 +26,22 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.NameableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.AccessHelper; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.NameableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.helpers.AccessHelper; +import org.hisp.dhis.android.core.category.CategoryOption; +import org.hisp.dhis.android.core.category.CategoryOptionTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import androidx.annotation.NonNull; + +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class CategoryOptionStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryPackageDIModule.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryPackageDIModule.java index e054036959..6d53a3da3e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryPackageDIModule.java @@ -26,9 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactory; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCombo; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryParentUidsHelper.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryParentUidsHelper.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryParentUidsHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryParentUidsHelper.java index 8cffa6abde..90f13d12f4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryParentUidsHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryParentUidsHelper.java @@ -25,7 +25,10 @@ * (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.category; +package org.hisp.dhis.android.core.category.internal; + +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryCombo; import java.util.HashSet; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryService.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryService.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryService.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryService.java index b097334071..d376215fd7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryService.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Filter; -import org.hisp.dhis.android.core.data.api.Where; -import org.hisp.dhis.android.core.data.api.Which; +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; +import org.hisp.dhis.android.core.arch.api.filters.internal.Filter; +import org.hisp.dhis.android.core.arch.api.filters.internal.Where; +import org.hisp.dhis.android.core.arch.api.filters.internal.Which; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.category.Category; import retrofit2.Call; import retrofit2.http.GET; diff --git a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryStore.java b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryStore.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/category/CategoryStore.java rename to core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryStore.java index 1a7d6b72a1..20b428e3eb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/category/CategoryStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/category/internal/CategoryStore.java @@ -26,18 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.category; +package org.hisp.dhis.android.core.category.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.IdentifiableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.category.Category; +import org.hisp.dhis.android.core.category.CategoryTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import androidx.annotation.NonNull; + +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class CategoryStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/Access.java b/core/src/main/java/org/hisp/dhis/android/core/common/Access.java index 3a6a3a7c7d..38126dc2f4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/Access.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/Access.java @@ -28,14 +28,14 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.NestedField; +import org.hisp.dhis.android.core.arch.api.fields.internal.Field; +import org.hisp.dhis.android.core.arch.api.fields.internal.NestedField; + +import androidx.annotation.Nullable; @AutoValue public abstract class Access { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/BaseDataModel.java b/core/src/main/java/org/hisp/dhis/android/core/common/BaseDataModel.java index 779ca331e1..3b86fe7881 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/BaseDataModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/BaseDataModel.java @@ -28,13 +28,13 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; import org.hisp.dhis.android.core.data.database.DbStateColumnAdapter; +import androidx.annotation.Nullable; + public abstract class BaseDataModel extends BaseModel implements DataModel { public static class Columns extends BaseModel.Columns { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableDataModel.java b/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableDataModel.java index 3f1ec31067..05b3433640 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableDataModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableDataModel.java @@ -28,8 +28,6 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -37,6 +35,8 @@ import java.util.Date; +import androidx.annotation.Nullable; + public abstract class BaseIdentifiableDataModel extends BaseDataModel { public static class Columns extends BaseDataModel.Columns { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableObject.java b/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableObject.java index beebe60197..80308d53dd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableObject.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableObject.java @@ -32,6 +32,7 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.gabrielittner.auto.value.cursor.ColumnAdapter; +import org.hisp.dhis.android.core.arch.dateformat.internal.SafeDateFormat; import org.hisp.dhis.android.core.data.database.DbDateColumnAdapter; import org.hisp.dhis.android.core.data.database.IgnoreBooleanColumnAdapter; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableObjectModel.java b/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableObjectModel.java index d8709114d8..34a1bff064 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableObjectModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/BaseIdentifiableObjectModel.java @@ -28,8 +28,6 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -38,6 +36,8 @@ import java.util.Date; +import androidx.annotation.Nullable; + public abstract class BaseIdentifiableObjectModel extends BaseModel implements IdentifiableObject { public abstract static class Columns extends BaseModel.Columns { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/BaseNameableObject.java b/core/src/main/java/org/hisp/dhis/android/core/common/BaseNameableObject.java index 44e3ca0718..55dc453a8c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/BaseNameableObject.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/BaseNameableObject.java @@ -28,10 +28,10 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import androidx.annotation.Nullable; + public abstract class BaseNameableObject extends BaseIdentifiableObject implements NameableObject { public static final String SHORT_NAME = "shortName"; public static final String DISPLAY_SHORT_NAME = "displayShortName"; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/BaseNameableObjectModel.java b/core/src/main/java/org/hisp/dhis/android/core/common/BaseNameableObjectModel.java index 34ee49842b..bbbefc3914 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/BaseNameableObjectModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/BaseNameableObjectModel.java @@ -28,12 +28,12 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.gabrielittner.auto.value.cursor.ColumnName; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + public abstract class BaseNameableObjectModel extends BaseIdentifiableObjectModel implements NameableObject { public abstract static class Columns extends BaseIdentifiableObjectModel.Columns { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/Coordinates.java b/core/src/main/java/org/hisp/dhis/android/core/common/Coordinates.java index 0e1267e593..a0911f6933 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/Coordinates.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/Coordinates.java @@ -28,12 +28,12 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.auto.value.AutoValue; +import androidx.annotation.Nullable; + @AutoValue public abstract class Coordinates { private final static String LATITUDE = "latitude"; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/DataAccess.java b/core/src/main/java/org/hisp/dhis/android/core/common/DataAccess.java index de0d2c25e6..a69a6b5fc6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/DataAccess.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/DataAccess.java @@ -28,14 +28,14 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +import org.hisp.dhis.android.core.arch.api.fields.internal.Field; +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; + +import androidx.annotation.Nullable; @AutoValue public abstract class DataAccess { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/DeletableStore.java b/core/src/main/java/org/hisp/dhis/android/core/common/DeletableStore.java deleted file mode 100644 index 1cc3ca291b..0000000000 --- a/core/src/main/java/org/hisp/dhis/android/core/common/DeletableStore.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.common; - -public interface DeletableStore { - int delete(); -} diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelHandler.java b/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelHandler.java deleted file mode 100644 index 228b7c41dd..0000000000 --- a/core/src/main/java/org/hisp/dhis/android/core/common/LinkModelHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.common; - -import java.util.Collection; - -public interface LinkModelHandler { - void handleMany(String masterUid, Collection slaveCollection, Transformer transformer); -} diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/Model.java b/core/src/main/java/org/hisp/dhis/android/core/common/Model.java index ecf85067f4..8c66758183 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/Model.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/Model.java @@ -29,11 +29,12 @@ package org.hisp.dhis.android.core.common; import android.content.ContentValues; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonIgnore; import com.gabrielittner.auto.value.cursor.ColumnName; +import androidx.annotation.Nullable; + public interface Model { @Nullable @ColumnName(BaseModel.Columns.ID) diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleModel.java b/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleModel.java index d86ed9f3cb..2753c76e0d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleModel.java @@ -28,13 +28,14 @@ package org.hisp.dhis.android.core.common; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class ObjectStyleModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleTableInfo.java index cb094f20ec..1d92329cce 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleTableInfo.java @@ -28,7 +28,8 @@ package org.hisp.dhis.android.core.common; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleFields; import org.hisp.dhis.android.core.utils.Utils; public final class ObjectStyleTableInfo { @@ -49,10 +50,10 @@ public BaseModel.Columns columns() { } }; - static class Columns extends BaseModel.Columns { + public static class Columns extends BaseModel.Columns { - static final String UID = BaseIdentifiableObjectModel.Columns.UID; - static final String OBJECT_TABLE = "objectTable"; + public static final String UID = BaseIdentifiableObjectModel.Columns.UID; + public static final String OBJECT_TABLE = "objectTable"; @Override public String[] all() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithStyle.java b/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithStyle.java index 096d39612a..97aa5cfdf7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithStyle.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithStyle.java @@ -28,13 +28,13 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import org.hisp.dhis.android.core.data.database.IgnoreObjectStyleAdapter; +import androidx.annotation.Nullable; + public interface ObjectWithStyle> { @Nullable diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithUid.java b/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithUid.java index 77fd33a752..7e7ae77dc0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithUid.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/ObjectWithUid.java @@ -28,13 +28,13 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.NonNull; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.data.api.Field; +import org.hisp.dhis.android.core.arch.api.fields.internal.Field; + +import androidx.annotation.NonNull; import static org.hisp.dhis.android.core.common.BaseIdentifiableObject.UID; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/PojoBuilder.java b/core/src/main/java/org/hisp/dhis/android/core/common/PojoBuilder.java deleted file mode 100644 index d80f9cd4eb..0000000000 --- a/core/src/main/java/org/hisp/dhis/android/core/common/PojoBuilder.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.common; - -public abstract class PojoBuilder { - public abstract P buildPojo(M model); -} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRendering.java b/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRendering.java index 1fc2f14d4d..f31bcb4608 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRendering.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRendering.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.common; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -37,6 +36,10 @@ import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.google.auto.value.AutoValue; +import org.hisp.dhis.android.core.common.valuetype.renderingtype.internal.ValueTypeRenderingTypeColumnAdapter; + +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_ValueTypeDeviceRendering.Builder.class) public abstract class ValueTypeDeviceRendering implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingModel.java b/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingModel.java index 03855e1996..afe2e62664 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingModel.java @@ -28,14 +28,16 @@ package org.hisp.dhis.android.core.common; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; +import org.hisp.dhis.android.core.common.valuetype.renderingtype.internal.ValueTypeRenderingTypeColumnAdapter; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class ValueTypeDeviceRenderingModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingTableInfo.java index d5a622c22b..ef21673300 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingTableInfo.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.common; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.utils.Utils; public final class ValueTypeDeviceRenderingTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRendering.java b/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRendering.java index 865907a0d1..9eb0482961 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRendering.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRendering.java @@ -28,14 +28,14 @@ package org.hisp.dhis.android.core.common; -import androidx.annotation.Nullable; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +import org.hisp.dhis.android.core.arch.api.fields.internal.Field; +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; + +import androidx.annotation.Nullable; @AutoValue public abstract class ValueTypeRendering { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/AggregationTypeColumnAdapter.java b/core/src/main/java/org/hisp/dhis/android/core/common/internal/AggregationTypeColumnAdapter.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/common/AggregationTypeColumnAdapter.java rename to core/src/main/java/org/hisp/dhis/android/core/common/internal/AggregationTypeColumnAdapter.java index 2e64d5ab99..838646d614 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/AggregationTypeColumnAdapter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/internal/AggregationTypeColumnAdapter.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.common.internal; +import org.hisp.dhis.android.core.common.AggregationType; import org.hisp.dhis.android.core.data.database.EnumColumnAdapter; +import androidx.annotation.NonNull; + public class AggregationTypeColumnAdapter extends EnumColumnAdapter { @Override diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/CommonModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/common/internal/CommonModuleWiper.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/common/CommonModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/common/internal/CommonModuleWiper.java index c851aca0ac..99696cba01 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/CommonModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/internal/CommonModuleWiper.java @@ -26,8 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.internal; +import org.hisp.dhis.android.core.common.ObjectStyleTableInfo; +import org.hisp.dhis.android.core.common.ValueTypeDeviceRenderingTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/CommonPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/common/internal/CommonPackageDIModule.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/common/CommonPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/common/internal/CommonPackageDIModule.java index d84a26bbf8..da6ff325cb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/CommonPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/internal/CommonPackageDIModule.java @@ -26,10 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.internal; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleEntityDIModule; +import org.hisp.dhis.android.core.common.valuetype.devicerendering.internal.ValueTypeDeviceRenderingEntityDIModule; +import org.hisp.dhis.android.core.common.valuetype.rendering.internal.ValueTypeRenderingEntityDIModule; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import org.hisp.dhis.android.core.resource.ResourceHandler; +import org.hisp.dhis.android.core.resource.internal.ResourceHandler; import org.hisp.dhis.android.core.systeminfo.DHISVersionManager; import dagger.Module; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/DataStatePropagator.java b/core/src/main/java/org/hisp/dhis/android/core/common/internal/DataStatePropagator.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/common/DataStatePropagator.java rename to core/src/main/java/org/hisp/dhis/android/core/common/internal/DataStatePropagator.java index e7e27a79f2..7d626b0f88 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/DataStatePropagator.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/internal/DataStatePropagator.java @@ -26,12 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.internal; import org.hisp.dhis.android.core.enrollment.Enrollment; -import org.hisp.dhis.android.core.enrollment.EnrollmentStore; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventStore; +import org.hisp.dhis.android.core.event.internal.EventStore; import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStore; @@ -61,9 +61,11 @@ public void propagateEnrollmentUpdate(Enrollment enrollment) { } public void propagateEventUpdate(Event event) { - Enrollment enrollment = enrollmentStore.selectByUid(event.enrollment()); - enrollmentStore.setStateForUpdate(enrollment.uid()); - trackedEntityInstanceStore.setStateForUpdate(enrollment.trackedEntityInstance()); + if (event.enrollment() != null) { + Enrollment enrollment = enrollmentStore.selectByUid(event.enrollment()); + enrollmentStore.setStateForUpdate(enrollment.uid()); + setTeiStateForUpdate(enrollment.trackedEntityInstance()); + } } public void propagateTrackedEntityDataValueUpdate(TrackedEntityDataValue dataValue) { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleChildrenAppender.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleChildrenAppender.java index 689fbad90d..31b3fbe7d6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleChildrenAppender.java @@ -25,10 +25,13 @@ * (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.common; +package org.hisp.dhis.android.core.common.objectstyle.internal; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.common.ObjectStyle; +import org.hisp.dhis.android.core.common.ObjectWithStyle; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; public final class ObjectStyleChildrenAppender, B extends ObjectWithStyle.Builder> extends ChildrenAppender { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleEntityDIModule.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleEntityDIModule.java index 9338b9db76..6649f32262 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleEntityDIModule.java @@ -26,9 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.objectstyle.internal; -import org.hisp.dhis.android.core.arch.di.ObjectWithoutUidStoreProvider; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.di.internal.ObjectWithoutUidStoreProvider; +import org.hisp.dhis.android.core.common.ObjectStyle; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import dagger.Module; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleFields.java b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleFields.java similarity index 84% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleFields.java rename to core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleFields.java index 367583924f..71b68ae5be 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleFields.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.objectstyle.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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; public final class ObjectStyleFields { - static final String COLOR = "color"; - static final String ICON = "icon"; + public static final String COLOR = "color"; + public static final String ICON = "icon"; private static FieldsHelper fh = new FieldsHelper<>(); public static final Fields allFields = Fields.builder().fields( diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleHandler.java b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleHandler.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleHandler.java index f7472adc82..ba4506ed2b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleHandler.java @@ -26,11 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.objectstyle.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.common.ObjectStyle; -public interface ObjectStyleHandler extends SyncHandlerWithTransformer { +public interface ObjectStyleHandler extends HandlerWithTransformer { void handle(ObjectStyle objectStyle, String uid, String objectTable); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleHandlerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleHandlerImpl.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleHandlerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleHandlerImpl.java index 8586530d72..e884032f7d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleHandlerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleHandlerImpl.java @@ -26,12 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.objectstyle.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.handlers.ObjectWithoutUidSyncHandlerImpl; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.handlers.internal.ObjectWithoutUidHandlerImpl; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; +import org.hisp.dhis.android.core.common.ObjectStyle; +import org.hisp.dhis.android.core.common.ObjectStyleTableInfo; -public class ObjectStyleHandlerImpl extends ObjectWithoutUidSyncHandlerImpl implements ObjectStyleHandler { +public class ObjectStyleHandlerImpl extends ObjectWithoutUidHandlerImpl implements ObjectStyleHandler { private final ObjectWithoutUidStore store; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleStore.java b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleStore.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleStore.java rename to core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleStore.java index 3a244ab857..96f43ec520 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleStore.java @@ -26,9 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.objectstyle.internal; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; +import org.hisp.dhis.android.core.common.ObjectStyle; +import org.hisp.dhis.android.core.common.ObjectWithStyle; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; interface ObjectStyleStore extends ObjectWithoutUidStore { & ObjectWithUidInterface> ObjectStyle getStyle(O objectWithStyle, diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleStoreImpl.java similarity index 76% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleStoreImpl.java index 265a8130c0..847d636046 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleStoreImpl.java @@ -26,15 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.objectstyle.internal; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilderImpl; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStoreImpl; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; +import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.common.ObjectStyle; +import org.hisp.dhis.android.core.common.ObjectStyleTableInfo; +import org.hisp.dhis.android.core.common.ObjectWithStyle; +import org.hisp.dhis.android.core.common.ObjectWithUidInterface; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class ObjectStyleStoreImpl extends ObjectWithoutUidStoreImpl implements ObjectStyleStore { @@ -53,7 +61,7 @@ public final class ObjectStyleStoreImpl extends ObjectWithoutUidStoreImpl sqLiteBind(sqLiteStatement, 1, o.uid()); private ObjectStyleStoreImpl(DatabaseAdapter databaseAdapter, - SQLStatementBuilder builder, + SQLStatementBuilderImpl builder, StatementBinder binder, WhereStatementBinder whereUpdateBinder, WhereStatementBinder whereDeleteBinder, @@ -75,7 +83,7 @@ public static ObjectStyleStore create(DatabaseAdapter databaseAdapter) { BaseModel.Columns columns = ObjectStyleTableInfo.TABLE_INFO.columns(); - SQLStatementBuilder statementBuilder = new SQLStatementBuilder( + SQLStatementBuilderImpl statementBuilder = new SQLStatementBuilderImpl( ObjectStyleTableInfo.TABLE_INFO.name(), columns); return new ObjectStyleStoreImpl(databaseAdapter, statementBuilder, BINDER, WHERE_UPDATE_BINDER, diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleTransformer.java b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleTransformer.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleTransformer.java rename to core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleTransformer.java index c272d83fd7..24ca427008 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ObjectStyleTransformer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/objectstyle/internal/ObjectStyleTransformer.java @@ -26,7 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.objectstyle.internal; + +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; +import org.hisp.dhis.android.core.common.ObjectStyle; public class ObjectStyleTransformer implements Transformer { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingEntityDIModule.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingEntityDIModule.java index 81ce698d41..98373f3f57 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingEntityDIModule.java @@ -26,10 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.valuetype.devicerendering.internal; -import org.hisp.dhis.android.core.arch.handlers.ObjectWithoutUidSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.ObjectWithoutUidHandlerImpl; +import org.hisp.dhis.android.core.common.ValueTypeDeviceRendering; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import dagger.Module; @@ -47,8 +49,8 @@ ObjectWithoutUidStore store(DatabaseAdapter databaseAd @Provides @Reusable - SyncHandlerWithTransformer handler( + HandlerWithTransformer handler( ObjectWithoutUidStore store) { - return new ObjectWithoutUidSyncHandlerImpl<>(store); + return new ObjectWithoutUidHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStore.java b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingStore.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStore.java rename to core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingStore.java index 2f1320ee48..f9c20eef7a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/devicerendering/internal/ValueTypeDeviceRenderingStore.java @@ -26,13 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.valuetype.devicerendering.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.common.ValueTypeDeviceRendering; +import org.hisp.dhis.android.core.common.ValueTypeDeviceRenderingTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class ValueTypeDeviceRenderingStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/rendering/internal/ValueTypeRenderingEntityDIModule.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/common/valuetype/rendering/internal/ValueTypeRenderingEntityDIModule.java index 9de954c20e..44a0bb81e4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/rendering/internal/ValueTypeRenderingEntityDIModule.java @@ -26,7 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.valuetype.rendering.internal; + +import org.hisp.dhis.android.core.arch.handlers.internal.DictionaryTableHandler; +import org.hisp.dhis.android.core.common.ValueTypeRendering; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingHandler.java b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/rendering/internal/ValueTypeRenderingHandler.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/common/valuetype/rendering/internal/ValueTypeRenderingHandler.java index e50af5a7e7..74fd91114f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/rendering/internal/ValueTypeRenderingHandler.java @@ -25,9 +25,12 @@ * (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.common; +package org.hisp.dhis.android.core.common.valuetype.rendering.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.DictionaryTableHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.common.ValueTypeDeviceRendering; +import org.hisp.dhis.android.core.common.ValueTypeRendering; import javax.inject.Inject; @@ -36,10 +39,10 @@ @Reusable final class ValueTypeRenderingHandler implements DictionaryTableHandler { - private final SyncHandlerWithTransformer valueTypeDeviceRenderingHandler; + private final HandlerWithTransformer valueTypeDeviceRenderingHandler; @Inject - ValueTypeRenderingHandler(SyncHandlerWithTransformer valueTypeDeviceRenderingHandler) { + ValueTypeRenderingHandler(HandlerWithTransformer valueTypeDeviceRenderingHandler) { this.valueTypeDeviceRenderingHandler = valueTypeDeviceRenderingHandler; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingTypeColumnAdapter.java b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/renderingtype/internal/ValueTypeRenderingTypeColumnAdapter.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingTypeColumnAdapter.java rename to core/src/main/java/org/hisp/dhis/android/core/common/valuetype/renderingtype/internal/ValueTypeRenderingTypeColumnAdapter.java index 8eff04ccb7..5f23174327 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/common/ValueTypeRenderingTypeColumnAdapter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/common/valuetype/renderingtype/internal/ValueTypeRenderingTypeColumnAdapter.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.common; +package org.hisp.dhis.android.core.common.valuetype.renderingtype.internal; +import org.hisp.dhis.android.core.common.ValueTypeRenderingType; import org.hisp.dhis.android.core.data.database.EnumColumnAdapter; public class ValueTypeRenderingTypeColumnAdapter extends EnumColumnAdapter { diff --git a/core/src/main/java/org/hisp/dhis/android/core/configuration/Configuration.java b/core/src/main/java/org/hisp/dhis/android/core/configuration/Configuration.java index 8f3e8fc69d..282e9ab786 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/configuration/Configuration.java +++ b/core/src/main/java/org/hisp/dhis/android/core/configuration/Configuration.java @@ -65,7 +65,7 @@ public abstract static class Builder extends BaseModel.Builder { public abstract Configuration build(); } - public static Configuration forServerUrlStringWithoutAPI(String urlWithoutAPI) { - return Configuration.builder().serverUrl(ConfigurationHelper.getCanonicalServerUrl(urlWithoutAPI)).build(); + public static Configuration forServerUrl(HttpUrl url) { + return Configuration.builder().serverUrl(url).build(); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationManagerFactory.java b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationManagerFactory.java index 02b60faaa7..160f0821eb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationManagerFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationManagerFactory.java @@ -28,10 +28,10 @@ package org.hisp.dhis.android.core.configuration; -import androidx.annotation.NonNull; - import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import androidx.annotation.NonNull; + public final class ConfigurationManagerFactory { private ConfigurationManagerFactory() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationModel.java b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationModel.java index 6bf53508aa..eba8709afa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.configuration; import android.database.Cursor; -import androidx.annotation.NonNull; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -37,6 +36,7 @@ import org.hisp.dhis.android.core.common.BaseModel; +import androidx.annotation.NonNull; import okhttp3.HttpUrl; @Deprecated diff --git a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationStore.java b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationStore.java index 8fba21a292..c43c2228a8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationStore.java @@ -27,7 +27,7 @@ */ package org.hisp.dhis.android.core.configuration; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; public interface ConfigurationStore extends ObjectStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationStoreImpl.java index 46d43086ff..07b0a3ec67 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationStoreImpl.java @@ -27,12 +27,12 @@ */ package org.hisp.dhis.android.core.configuration; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.ObjectStoreImpl; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilderImpl; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStoreImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class ConfigurationStoreImpl extends ObjectStoreImpl implements ConfigurationStore { @@ -40,7 +40,7 @@ public final class ConfigurationStoreImpl extends ObjectStoreImpl sqLiteBind(sqLiteStatement, 1, configuration.serverUrl().toString()); private ConfigurationStoreImpl(DatabaseAdapter databaseAdapter, - SQLStatementBuilder builder) { + SQLStatementBuilderImpl builder) { super(databaseAdapter, databaseAdapter.compileStatement(builder.insert()), builder, BINDER, Configuration::create); } @@ -53,7 +53,7 @@ public void save(Configuration configuration) { public static ConfigurationStore create(DatabaseAdapter databaseAdapter) { - SQLStatementBuilder statementBuilder = new SQLStatementBuilder(ConfigurationTableInfo.TABLE_INFO.name(), + SQLStatementBuilderImpl statementBuilder = new SQLStatementBuilderImpl(ConfigurationTableInfo.TABLE_INFO.name(), ConfigurationTableInfo.TABLE_INFO.columns()); return new ConfigurationStoreImpl(databaseAdapter, statementBuilder); diff --git a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationTableInfo.java index 3d8e62050c..409cf1b8b4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationTableInfo.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.configuration; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; diff --git a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationHelper.java b/core/src/main/java/org/hisp/dhis/android/core/configuration/ServerUrlParser.java similarity index 66% rename from core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/configuration/ServerUrlParser.java index 9b2d3ca4ad..f3a344ce60 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/configuration/ConfigurationHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/configuration/ServerUrlParser.java @@ -27,24 +27,32 @@ */ package org.hisp.dhis.android.core.configuration; -import java.util.Locale; - import androidx.annotation.NonNull; import okhttp3.HttpUrl; -public final class ConfigurationHelper { +public final class ServerUrlParser { - private ConfigurationHelper() {} + private ServerUrlParser() { + } - public static void validateServerUrl(@NonNull String serverUrl) { - if (serverUrl.endsWith("api/")) { - throw new IllegalArgumentException("Server URL must not end with 'api/'"); - } else if (!serverUrl.endsWith("/")) { - throw new IllegalArgumentException("Server URL must end with '/'"); - } + private static String appendSlashAndAPI(@NonNull String url) { + String trimmedUrl = url.trim(); + trimmedUrl = trimmedUrl.replace(" ", ""); + + String withSlash = trimmedUrl.endsWith("/") ? trimmedUrl : trimmedUrl + "/"; + return withSlash.endsWith("api/") ? withSlash : withSlash + "api/"; } - static HttpUrl getCanonicalServerUrl(String serverUrl) { - return HttpUrl.parse(String.format(Locale.US, "%sapi/", serverUrl)); + public static HttpUrl parse(@NonNull String url) { + if (url == null) { + throw new IllegalArgumentException("URL is null"); + } + String urlWithSlashAndAPI = appendSlashAndAPI(url); + HttpUrl httpUrl = HttpUrl.parse(ServerUrlParser.appendSlashAndAPI(urlWithSlashAndAPI)); + if (httpUrl == null) { + throw new IllegalArgumentException("Malformed HTTP or HTTPS URL"); + } else { + return httpUrl; + } } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/Constant.java b/core/src/main/java/org/hisp/dhis/android/core/constant/Constant.java index 81943ee7b8..d7ccb1855a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/Constant.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/Constant.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.constant; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -39,6 +38,8 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.Model; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = $$AutoValue_Constant.Builder.class) public abstract class Constant extends BaseIdentifiableObject implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantCollectionRepository.java index b7d4870754..50fb85ce65 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantCollectionRepository.java @@ -27,12 +27,13 @@ */ package org.hisp.dhis.android.core.constant; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyIdentifiableCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.DoubleFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyIdentifiableCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.DoubleFilterConnector; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.constant.internal.ConstantFields; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantTableInfo.java index 8d09a78eb1..dba4ea00f6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantTableInfo.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.constant; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.constant.internal.ConstantFields; import org.hisp.dhis.android.core.utils.Utils; public final class ConstantTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantCallFactory.java similarity index 73% rename from core/src/main/java/org/hisp/dhis/android/core/constant/ConstantCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantCallFactory.java index 24f82a8ed4..6502563939 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantCallFactory.java @@ -26,17 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.constant; +package org.hisp.dhis.android.core.constant.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.ListCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.PayloadNoResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; -import org.hisp.dhis.android.core.common.Payload; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.factories.internal.ListCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.PayloadNoResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.constant.Constant; import javax.inject.Inject; @@ -46,13 +47,13 @@ final class ConstantCallFactory extends ListCallFactoryImpl { private final ConstantService service; - private final SyncHandler handler; + private final Handler handler; @Inject ConstantCallFactory(GenericCallData data, APICallExecutor apiCallExecutor, ConstantService service, - SyncHandler handler) { + Handler handler) { super(data, apiCallExecutor); this.service = service; this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantFields.java b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantFields.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/constant/ConstantFields.java rename to core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantFields.java index 0ea67e9f8e..c2de55a20d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantFields.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.constant; +package org.hisp.dhis.android.core.constant.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.constant.Constant; -final class ConstantFields { +public final class ConstantFields { - static final String VALUE = "value"; + public static final String VALUE = "value"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantHandler.java b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantHandler.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/constant/ConstantHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantHandler.java index 19b5bb2be8..4dd415cd6d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantHandler.java @@ -25,11 +25,12 @@ * (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.constant; +package org.hisp.dhis.android.core.constant.internal; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.common.CollectionCleaner; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.cleaners.internal.CollectionCleaner; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.constant.Constant; import java.util.Collection; @@ -38,7 +39,7 @@ import dagger.Reusable; @Reusable -final class ConstantHandler extends IdentifiableSyncHandlerImpl { +final class ConstantHandler extends IdentifiableHandlerImpl { private final CollectionCleaner collectionCleaner; diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantModuleDownloader.java b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantModuleDownloader.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/constant/ConstantModuleDownloader.java rename to core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantModuleDownloader.java index c918e23528..f44ebdb5bd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantModuleDownloader.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantModuleDownloader.java @@ -25,9 +25,10 @@ * (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.constant; +package org.hisp.dhis.android.core.constant.internal; -import org.hisp.dhis.android.core.arch.modules.MetadataModuleDownloader; +import org.hisp.dhis.android.core.arch.modules.internal.MetadataModuleDownloader; +import org.hisp.dhis.android.core.constant.Constant; import java.util.List; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantModuleWiper.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/constant/ConstantModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantModuleWiper.java index 99a36ab50c..b64f7ffcaa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantModuleWiper.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.constant; +package org.hisp.dhis.android.core.constant.internal; +import org.hisp.dhis.android.core.constant.ConstantTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantPackageDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/constant/ConstantPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantPackageDIModule.java index 63466fe18e..67d9f2611b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantPackageDIModule.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.constant; +package org.hisp.dhis.android.core.constant.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.calls.factories.ListCallFactory; -import org.hisp.dhis.android.core.common.CollectionCleaner; -import org.hisp.dhis.android.core.common.CollectionCleanerImpl; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.call.factories.internal.ListCallFactory; +import org.hisp.dhis.android.core.arch.cleaners.internal.CollectionCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.CollectionCleanerImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +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.constant.Constant; +import org.hisp.dhis.android.core.constant.ConstantTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.util.Collections; @@ -55,7 +57,7 @@ IdentifiableObjectStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - SyncHandler handler(ConstantHandler impl) { + Handler handler(ConstantHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantService.java b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantService.java similarity index 84% rename from core/src/main/java/org/hisp/dhis/android/core/constant/ConstantService.java rename to core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantService.java index efc03f1dfc..3a078bcafa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantService.java @@ -26,17 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.constant; +package org.hisp.dhis.android.core.constant.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Which; +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.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.constant.Constant; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; -public interface ConstantService { +interface ConstantService { @GET("constants") Call> constants(@Query("fields") @Which Fields fields, diff --git a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantStore.java b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantStore.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/constant/ConstantStore.java rename to core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantStore.java index 170fa91eea..0f0c3e706c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/constant/ConstantStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/constant/internal/ConstantStore.java @@ -26,20 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.constant; +package org.hisp.dhis.android.core.constant.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.IdentifiableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.constant.Constant; +import org.hisp.dhis.android.core.constant.ConstantTableInfo; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import androidx.annotation.NonNull; + +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; -public final class ConstantStore { +final class ConstantStore { private ConstantStore() { } diff --git a/core/src/main/java/org/hisp/dhis/android/core/d2manager/D2Configuration.java b/core/src/main/java/org/hisp/dhis/android/core/d2manager/D2Configuration.java index da38b1be7f..1f2f59c0e1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/d2manager/D2Configuration.java +++ b/core/src/main/java/org/hisp/dhis/android/core/d2manager/D2Configuration.java @@ -40,9 +40,6 @@ @AutoValue public abstract class D2Configuration { - @Nullable - public abstract String databaseName(); - public abstract String appName(); public abstract String appVersion(); @@ -70,8 +67,6 @@ public static Builder builder() { @AutoValue.Builder public abstract static class Builder { - public abstract Builder databaseName(String databaseName); - public abstract Builder appName(String appName); public abstract Builder appVersion(String appVersion); diff --git a/core/src/main/java/org/hisp/dhis/android/core/d2manager/D2Manager.java b/core/src/main/java/org/hisp/dhis/android/core/d2manager/D2Manager.java index ead1330c9f..9073b64df7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/d2manager/D2Manager.java +++ b/core/src/main/java/org/hisp/dhis/android/core/d2manager/D2Manager.java @@ -28,67 +28,125 @@ package org.hisp.dhis.android.core.d2manager; +import android.util.Log; + import org.hisp.dhis.android.core.D2; import org.hisp.dhis.android.core.configuration.Configuration; -import org.hisp.dhis.android.core.configuration.ConfigurationHelper; import org.hisp.dhis.android.core.configuration.ConfigurationManager; import org.hisp.dhis.android.core.configuration.ConfigurationManagerFactory; +import org.hisp.dhis.android.core.configuration.ServerUrlParser; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.data.database.DbOpenHelper; import org.hisp.dhis.android.core.data.database.SqLiteDatabaseAdapter; +import androidx.annotation.VisibleForTesting; +import io.reactivex.Completable; +import io.reactivex.Single; import io.reactivex.annotations.NonNull; import io.reactivex.annotations.Nullable; +import okhttp3.HttpUrl; public final class D2Manager { - private D2 d2; - private final D2Configuration d2Configuration; - final DatabaseAdapter databaseAdapter; - private final ConfigurationManager configurationManager; + private static String databaseName = "dhis.db"; + + private static D2 d2; + private static D2Configuration d2Configuration; + static DatabaseAdapter databaseAdapter; + private static ConfigurationManager configurationManager; + private static Configuration configuration; - public D2Manager(@Nullable D2Configuration d2Configuration) { - this.d2Configuration = d2Configuration; - this.databaseAdapter = newDatabaseAdapter(); - this.configurationManager = ConfigurationManagerFactory.create(databaseAdapter); + private D2Manager() { } - public boolean isD2Configured() { - return configurationManager.get() != null; + public static Completable setUp(@Nullable D2Configuration d2Config) { + return Completable.fromAction(() -> { + long startTime = System.currentTimeMillis(); + d2Configuration = d2Config; + databaseAdapter = newDatabaseAdapter(); + configurationManager = ConfigurationManagerFactory.create(databaseAdapter); + configuration = configurationManager.get(); + + long setUpTime = System.currentTimeMillis() - startTime; + Log.i(D2Manager.class.getName(), "Set up took " + setUpTime + "ms"); + }); } - public void configureD2(@NonNull String urlWithoutAPI) { - ConfigurationHelper.validateServerUrl(urlWithoutAPI); - Configuration configuration = Configuration.forServerUrlStringWithoutAPI(urlWithoutAPI); - configurationManager.configure(configuration); - instantiate(configuration); + public static boolean isServerUrlSet() { + return configuration != null; } - private void instantiate(Configuration configuration) { - d2 = new D2.Builder() - .configuration(configuration) - .databaseAdapter(databaseAdapter) - .okHttpClient(OkHttpClientFactory.okHttpClient(d2Configuration, databaseAdapter)) - .context(d2Configuration.context()) - .build(); + public static Completable setServerUrl(@NonNull String url) { + return Completable.fromAction(() -> { + ensureSetUp(); + HttpUrl httpUrl = ServerUrlParser.parse(url); + configuration = Configuration.forServerUrl(httpUrl); + configurationManager.configure(configuration); + }); } - public D2 getD2() throws IllegalStateException { + public static D2 getD2() throws IllegalStateException { if (d2 == null) { - Configuration configuration = configurationManager.get(); - if (configuration == null) { - throw new IllegalStateException("D2 is not configured"); - } else { - instantiate(configuration); - return d2; - } + throw new IllegalStateException("D2 is not instantiated yet"); } else { return d2; } } - private DatabaseAdapter newDatabaseAdapter() { - DbOpenHelper dbOpenHelper = new DbOpenHelper(d2Configuration.context(), d2Configuration.databaseName()); + private static void ensureSetUp() { + if (d2Configuration == null) { + throw new IllegalStateException("You have to setUp first"); + } + } + + private static void ensureServerUrl() { + if (configuration == null) { + throw new IllegalStateException("You have to configure server URL first"); + } + } + + public static boolean isD2Instantiated() { + return d2 != null; + } + + public static Single instantiateD2() { + return Single.fromCallable(() -> { + ensureSetUp(); + ensureServerUrl(); + + long startTime = System.currentTimeMillis(); + + d2 = new D2.Builder() + .configuration(configuration) + .databaseAdapter(databaseAdapter) + .okHttpClient(OkHttpClientFactory.okHttpClient(d2Configuration, databaseAdapter)) + .context(d2Configuration.context()) + .build(); + + + long setUpTime = System.currentTimeMillis() - startTime; + Log.i(D2Manager.class.getName(), "D2 instantiation took " + setUpTime + "ms"); + + return d2; + }); + } + + private static DatabaseAdapter newDatabaseAdapter() { + DbOpenHelper dbOpenHelper = new DbOpenHelper(d2Configuration.context(), databaseName); return new SqLiteDatabaseAdapter(dbOpenHelper); } + + @VisibleForTesting + static void setDatabaseName(String dbName) { + databaseName = dbName; + } + + @VisibleForTesting + static void clear() { + d2Configuration = null; + d2 = null; + databaseAdapter = null; + configurationManager = null; + configuration = null; + } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/d2manager/OkHttpClientFactory.java b/core/src/main/java/org/hisp/dhis/android/core/d2manager/OkHttpClientFactory.java index bf1c3fa517..fa8499a0fb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/d2manager/OkHttpClientFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/d2manager/OkHttpClientFactory.java @@ -32,8 +32,8 @@ import android.util.Log; import org.hisp.dhis.android.BuildConfig; -import org.hisp.dhis.android.core.arch.api.retrofit.PreventURLDecodeInterceptor; -import org.hisp.dhis.android.core.data.api.BasicAuthenticatorFactory; +import org.hisp.dhis.android.core.arch.api.authentication.internal.BasicAuthenticatorFactory; +import org.hisp.dhis.android.core.arch.api.internal.PreventURLDecodeInterceptor; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import java.security.KeyStore; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/database/AccessColumnAdapter.java b/core/src/main/java/org/hisp/dhis/android/core/data/database/AccessColumnAdapter.java index 00a1f64168..259f77a860 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/database/AccessColumnAdapter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/data/database/AccessColumnAdapter.java @@ -33,8 +33,8 @@ import com.gabrielittner.auto.value.cursor.ColumnTypeAdapter; +import org.hisp.dhis.android.core.arch.helpers.AccessHelper; import org.hisp.dhis.android.core.common.Access; -import org.hisp.dhis.android.core.common.AccessHelper; public class AccessColumnAdapter implements ColumnTypeAdapter { diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/database/DbOpenHelper.java b/core/src/main/java/org/hisp/dhis/android/core/data/database/DbOpenHelper.java index c39c2529ac..22427acf30 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/database/DbOpenHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/data/database/DbOpenHelper.java @@ -44,7 +44,7 @@ public class DbOpenHelper extends SQLBriteOpenHelper { - public static final int VERSION = 49; + public static final int VERSION = 50; public DbOpenHelper(@NonNull Context context, @Nullable String databaseName) { super(context, databaseName, null, VERSION); diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectColumnAdapter.java b/core/src/main/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectColumnAdapter.java index bd44ad93a0..2a2743e642 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectColumnAdapter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectColumnAdapter.java @@ -33,8 +33,8 @@ import com.gabrielittner.auto.value.cursor.ColumnTypeAdapter; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; -import org.hisp.dhis.android.core.common.UidsHelper; import io.reactivex.annotations.NonNull; diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/database/ResourceTypeColumnAdapter.java b/core/src/main/java/org/hisp/dhis/android/core/data/database/ResourceTypeColumnAdapter.java index f772a48727..15ada0362a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/database/ResourceTypeColumnAdapter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/data/database/ResourceTypeColumnAdapter.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.data.database; -import org.hisp.dhis.android.core.resource.Resource; +import org.hisp.dhis.android.core.resource.internal.Resource; public class ResourceTypeColumnAdapter extends EnumColumnAdapter { @Override diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/database/SqLiteDatabaseAdapter.java b/core/src/main/java/org/hisp/dhis/android/core/data/database/SqLiteDatabaseAdapter.java index 77f92eb85b..541e7f9e53 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/database/SqLiteDatabaseAdapter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/data/database/SqLiteDatabaseAdapter.java @@ -31,6 +31,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteStatement; + import androidx.annotation.NonNull; public class SqLiteDatabaseAdapter implements DatabaseAdapter { diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/database/SqLiteTransaction.java b/core/src/main/java/org/hisp/dhis/android/core/data/database/SqLiteTransaction.java index a9d22e1a59..074efcc9e2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/database/SqLiteTransaction.java +++ b/core/src/main/java/org/hisp/dhis/android/core/data/database/SqLiteTransaction.java @@ -29,6 +29,7 @@ package org.hisp.dhis.android.core.data.database; import android.database.sqlite.SQLiteDatabase; + import androidx.annotation.NonNull; public class SqLiteTransaction implements Transaction { diff --git a/core/src/main/java/org/hisp/dhis/android/core/data/database/SqliteCheckerUtility.java b/core/src/main/java/org/hisp/dhis/android/core/data/database/SqliteCheckerUtility.java index 4de46e47e4..f0fa2f38bb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/data/database/SqliteCheckerUtility.java +++ b/core/src/main/java/org/hisp/dhis/android/core/data/database/SqliteCheckerUtility.java @@ -54,8 +54,7 @@ public static boolean isDatabaseEmpty(DatabaseAdapter databaseAdapter) { if (value != -1) { while (cursor.moveToNext()){ String tableName = cursor.getString(value); - Cursor resTable = databaseAdapter.query( - "SELECT * from " + tableName, null); + Cursor resTable = databaseAdapter.query("SELECT * from " + tableName); if (resTable.getCount() > 0) { isDatabaseEmpty = false; break; @@ -66,36 +65,6 @@ public static boolean isDatabaseEmpty(DatabaseAdapter databaseAdapter) { return isDatabaseEmpty; } - public static Boolean ifValueExist(String tableName, String fieldName, String fieldValue, - DatabaseAdapter db) { - boolean isExist = false; - Cursor cursor = db.query( - "SELECT " + fieldName + " from " + tableName + " where " + fieldName + " = '" - + fieldValue + "'", null); - int value = cursor.getCount(); - if (value == 1) { - isExist = true; - } - cursor.close(); - return isExist; - } - - public static boolean isFieldExist(String tableName, String fieldName, DatabaseAdapter db) { - boolean isExist = false; - Cursor cursor = db.query("PRAGMA table_info(" + tableName + ")", null); - int value = cursor.getColumnIndex("name"); - if (value != -1) { - while (cursor.moveToNext()) { - if (cursor.getString(value).equals(fieldName)) { - isExist = true; - break; - } - } - } - cursor.close(); - return isExist; - } - public static boolean ifTableExist(String table, DatabaseAdapter db) { boolean isExist = false; Cursor cursor = db.query("PRAGMA table_info(" + table + ")"); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApproval.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApproval.java index a73feaf73c..ac430b6a29 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApproval.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApproval.java @@ -38,6 +38,7 @@ import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.data.database.DbDataApprovalStateColumnAdapter; +import org.hisp.dhis.android.core.dataapproval.internal.DataApprovalFields; import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalTableInfo.java index 785df18085..975cbca21d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalTableInfo.java @@ -28,8 +28,9 @@ package org.hisp.dhis.android.core.dataapproval; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.dataapproval.internal.DataApprovalFields; import org.hisp.dhis.android.core.utils.Utils; public class DataApprovalTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCallFactory.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCallFactory.java index e3cb9d955a..dfcb9eff68 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalCallFactory.java @@ -26,16 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataapproval; +package org.hisp.dhis.android.core.dataapproval.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.QueryCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.ListNoResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.ListNoResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.dataapproval.DataApproval; import java.text.SimpleDateFormat; import java.util.List; @@ -51,7 +52,7 @@ final class DataApprovalCallFactory extends QueryCallFactoryImpl { - private final SyncHandler handler; + private final Handler handler; private final DataApprovalService service; private final SimpleDateFormat simpleDateFormat = @@ -60,7 +61,7 @@ final class DataApprovalCallFactory extends QueryCallFactoryImpl handler, + Handler handler, DataApprovalService service) { super(genericCallData, apiCallExecutor); this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalEntityDIModule.java similarity index 77% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalEntityDIModule.java index e68d9abecf..61cec7f271 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalEntityDIModule.java @@ -26,13 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataapproval; +package org.hisp.dhis.android.core.dataapproval.internal; -import org.hisp.dhis.android.core.arch.di.ObjectWithoutUidStoreProvider; -import org.hisp.dhis.android.core.arch.handlers.ObjectWithoutUidSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.di.internal.ObjectWithoutUidStoreProvider; +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.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataapproval.DataApproval; import dagger.Module; import dagger.Provides; @@ -50,8 +51,8 @@ public ObjectWithoutUidStore store(DatabaseAdapter databaseAdapter @Provides @Reusable - public SyncHandler handler(ObjectWithoutUidStore dataApprovalStore) { - return new ObjectWithoutUidSyncHandlerImpl<>(dataApprovalStore); + public Handler handler(ObjectWithoutUidStore dataApprovalStore) { + return new ObjectWithoutUidHandlerImpl<>(dataApprovalStore); } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalFields.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalFields.java similarity index 75% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalFields.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalFields.java index ede9078c69..07f0863878 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalFields.java @@ -26,19 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataapproval; +package org.hisp.dhis.android.core.dataapproval.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +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.dataapproval.DataApproval; +import org.hisp.dhis.android.core.dataapproval.DataApprovalState; -final class DataApprovalFields { +public final class DataApprovalFields { - static final String WORKFLOW = "wf"; - static final String ORGANISATION_UNIT = "ou"; - static final String PERIOD = "pe"; - static final String ATTRIBUTE_OPTION_COMBO = "aoc"; - static final String STATE = "state"; + public static final String WORKFLOW = "wf"; + public static final String ORGANISATION_UNIT = "ou"; + public static final String PERIOD = "pe"; + public static final String ATTRIBUTE_OPTION_COMBO = "aoc"; + public static final String STATE = "state"; private static FieldsHelper fieldsHelper = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalPackageDIModule.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalPackageDIModule.java index 4a942a8484..6ab70c5503 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalPackageDIModule.java @@ -26,9 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataapproval; +package org.hisp.dhis.android.core.dataapproval.internal; -import org.hisp.dhis.android.core.calls.factories.QueryCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCallFactory; +import org.hisp.dhis.android.core.dataapproval.DataApproval; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalQuery.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.java index 44d1ba4816..acd9240ed4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalQuery.java @@ -26,11 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataapproval; +package org.hisp.dhis.android.core.dataapproval.internal; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.common.BaseQuery; +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; import java.util.Collection; import java.util.Date; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalService.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalService.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.java index 5d079e61b3..1e12eb39d0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalService.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataapproval; +package org.hisp.dhis.android.core.dataapproval.internal; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Which; +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; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalStore.java similarity index 84% rename from core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalStore.java index 8850645087..b5de690624 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataapproval/DataApprovalStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataapproval/internal/DataApprovalStore.java @@ -26,16 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataapproval; +package org.hisp.dhis.android.core.dataapproval.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.WhereStatementBinder; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataapproval.DataApproval; +import org.hisp.dhis.android.core.dataapproval.DataApprovalTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class DataApprovalStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElement.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElement.java index 3dbf4042a4..be7684cfb9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElement.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElement.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataelement; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; @@ -47,6 +46,8 @@ import org.hisp.dhis.android.core.data.database.IgnoreAccessAdapter; import org.hisp.dhis.android.core.data.database.ObjectWithUidColumnAdapter; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = $$AutoValue_DataElement.Builder.class) public abstract class DataElement extends BaseNameableObject @@ -84,7 +85,7 @@ public String optionSetUid() { @ColumnAdapter(ObjectWithUidColumnAdapter.class) public abstract ObjectWithUid categoryCombo(); - String categoryComboUid() { + public String categoryComboUid() { ObjectWithUid combo = categoryCombo(); return combo == null ? CategoryCombo.DEFAULT_UID : combo.uid(); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementCollectionRepository.java index 3288e510e1..c0b950c634 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementCollectionRepository.java @@ -27,15 +27,16 @@ */ package org.hisp.dhis.android.core.dataelement; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyIdentifiableCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyIdentifiableCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.BooleanFilterConnector; +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.IdentifiableObjectStore; import org.hisp.dhis.android.core.common.ValueType; +import org.hisp.dhis.android.core.dataelement.internal.DataElementFields; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementModel.java index 5318c786cc..7a6fdacb31 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataelement; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -40,6 +39,8 @@ import org.hisp.dhis.android.core.data.database.DbValueTypeColumnAdapter; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + /** * @deprecated replaced by {@link org.hisp.dhis.android.core.dataelement.DataElement} */ diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandTableInfo.java index 53fd1638ac..dd20ec1aea 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandTableInfo.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.dataelement; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.dataelement.internal.DataElementOperandFields; import org.hisp.dhis.android.core.utils.Utils; public final class DataElementOperandTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementTableInfo.java index 7871cd0d94..d22bc69063 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementTableInfo.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.dataelement; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.BaseNameableObjectModel; +import org.hisp.dhis.android.core.dataelement.internal.DataElementFields; import org.hisp.dhis.android.core.utils.Utils; public final class DataElementTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementEndpointCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallFactory.java similarity index 75% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementEndpointCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallFactory.java index 4f5ef559c8..6a13d51427 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementEndpointCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallFactory.java @@ -26,19 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.UidsNoResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.UidsNoResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.call.queries.internal.UidsQuery; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; import org.hisp.dhis.android.core.common.Access; -import org.hisp.dhis.android.core.common.GenericCallData; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.common.UidsQuery; +import org.hisp.dhis.android.core.dataelement.DataElement; import java.util.Set; @@ -52,13 +53,13 @@ final class DataElementEndpointCallFactory extends UidsCallFactoryImpl handler; + private final Handler handler; @Inject DataElementEndpointCallFactory(GenericCallData data, APICallExecutor apiCallExecutor, DataElementService service, - SyncHandler handler) { + Handler handler) { super(data, apiCallExecutor); this.service = service; this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEntityDIModule.java index 594c394ea2..f9e7a6a94a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEntityDIModule.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.ObjectStyleChildrenAppender; -import org.hisp.dhis.android.core.common.ObjectStyleStoreImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +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.common.objectstyle.internal.ObjectStyleChildrenAppender; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleStoreImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataelement.DataElement; +import org.hisp.dhis.android.core.dataelement.DataElementTableInfo; import java.util.Collections; import java.util.Map; @@ -53,7 +55,7 @@ IdentifiableObjectStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - SyncHandler handler(DataElementHandler impl) { + Handler handler(DataElementHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementFields.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementFields.java similarity index 73% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementFields.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementFields.java index d6663070df..d906997168 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementFields.java @@ -26,31 +26,32 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; +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.Access; import org.hisp.dhis.android.core.common.ObjectStyle; -import org.hisp.dhis.android.core.common.ObjectStyleFields; import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.common.ValueType; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleFields; +import org.hisp.dhis.android.core.dataelement.DataElement; public final class DataElementFields { - final static String VALUE_TYPE = "valueType"; - final static String ZERO_IS_SIGNIFICANT = "zeroIsSignificant"; - final static String AGGREGATION_TYPE = "aggregationType"; - final static String FORM_NAME = "formName"; - final static String NUMBER_TYPE = "numberType"; - final static String DOMAIN_TYPE = "domainType"; - final static String DIMENSION = "dimension"; - final static String DISPLAY_FORM_NAME = "displayFormName"; - final static String OPTION_SET = "optionSet"; - final static String CATEGORY_COMBO = "categoryCombo"; - final static String STYLE = "style"; - final static String ACCESS = "access"; + public final static String VALUE_TYPE = "valueType"; + public final static String ZERO_IS_SIGNIFICANT = "zeroIsSignificant"; + public final static String AGGREGATION_TYPE = "aggregationType"; + public final static String FORM_NAME = "formName"; + public final static String NUMBER_TYPE = "numberType"; + public final static String DOMAIN_TYPE = "domainType"; + public final static String DIMENSION = "dimension"; + public final static String DISPLAY_FORM_NAME = "displayFormName"; + public final static String OPTION_SET = "optionSet"; + public final static String CATEGORY_COMBO = "categoryCombo"; + public final static String STYLE = "style"; + public final static String ACCESS = "access"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementHandler.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementHandler.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementHandler.java index 7192c336a8..f1f58e94a6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementHandler.java @@ -26,19 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.ObjectStyleHandler; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleHandler; +import org.hisp.dhis.android.core.dataelement.DataElement; +import org.hisp.dhis.android.core.dataelement.DataElementTableInfo; import javax.inject.Inject; import dagger.Reusable; @Reusable -final class DataElementHandler extends IdentifiableSyncHandlerImpl { +final class DataElementHandler extends IdentifiableHandlerImpl { private final ObjectStyleHandler styleHandler; @Inject diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementModuleWiper.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementModuleWiper.java index 5aded3599f..8cb07ac2b5 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementModuleWiper.java @@ -25,8 +25,10 @@ * (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.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; +import org.hisp.dhis.android.core.dataelement.DataElementOperandTableInfo; +import org.hisp.dhis.android.core.dataelement.DataElementTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandEntityDIModule.java index 8db23139a1..f23f116b4e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandEntityDIModule.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataelement.DataElementOperand; import dagger.Module; import dagger.Provides; @@ -48,7 +49,7 @@ IdentifiableObjectStore store(DatabaseAdapter databaseAdapte @Provides @Reusable - SyncHandler handler(IdentifiableObjectStore store) { - return new IdentifiableSyncHandlerImpl<>(store); + Handler handler(IdentifiableObjectStore store) { + return new IdentifiableHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandFields.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandFields.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandFields.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandFields.java index 1735805ae7..f657de45cd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandFields.java @@ -26,15 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.dataelement.DataElementOperand; public final class DataElementOperandFields { - static final String DATA_ELEMENT = "dataElement"; - static final String CATEGORY_OPTION_COMBO = "categoryOptionCombo"; + public static final String DATA_ELEMENT = "dataElement"; + public static final String CATEGORY_OPTION_COMBO = "categoryOptionCombo"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStore.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStore.java index 8c5a304ac9..e1e838cdbd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementOperandStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStore.java @@ -26,15 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataelement.DataElementOperandTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class DataElementOperandStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementPackageDIModule.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementPackageDIModule.java index ae7a9a008b..b2ccb88de5 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementPackageDIModule.java @@ -26,9 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactory; +import org.hisp.dhis.android.core.dataelement.DataElement; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementService.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementService.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementService.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementService.java index cd38c6af4b..13b6835ae5 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementService.java @@ -25,13 +25,14 @@ * (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.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Filter; -import org.hisp.dhis.android.core.data.api.Where; -import org.hisp.dhis.android.core.data.api.Which; +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; +import org.hisp.dhis.android.core.arch.api.filters.internal.Filter; +import org.hisp.dhis.android.core.arch.api.filters.internal.Where; +import org.hisp.dhis.android.core.arch.api.filters.internal.Which; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.dataelement.DataElement; import retrofit2.Call; import retrofit2.http.GET; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStore.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStore.java index ffb669f447..282a578421 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataelement/DataElementStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStore.java @@ -26,18 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataelement; +package org.hisp.dhis.android.core.dataelement.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.NameableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.NameableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataelement.DataElement; +import org.hisp.dhis.android.core.dataelement.DataElementTableInfo; + +import androidx.annotation.NonNull; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class DataElementStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriod.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriod.java index 580914b12c..ca5600c191 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriod.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriod.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -46,6 +44,9 @@ import java.util.Date; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_DataInputPeriod.Builder.class) public abstract class DataInputPeriod extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodModel.java index e3847f071b..3dc1632201 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -41,6 +40,8 @@ import java.util.Date; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class DataInputPeriodModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodTableInfo.java index 86e695396d..58921d2474 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodTableInfo.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.dataset.internal.DataInputPeriodFields; import org.hisp.dhis.android.core.utils.Utils; public class DataInputPeriodTableInfo { @@ -50,9 +51,9 @@ public BaseModel.Columns columns() { } }; - static class Columns extends BaseDataModel.Columns { + public static class Columns extends BaseDataModel.Columns { - static final String DATA_SET = "dataSet"; + public static final String DATA_SET = "dataSet"; @Override public String[] all() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSet.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSet.java index 0620c98e36..be80dbc3f1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSet.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSet.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -56,6 +55,8 @@ import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_DataSet.Builder.class) @SuppressWarnings({"PMD.GodClass", "PMD.ExcessivePublicCount"}) diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCollectionRepository.java index 9a5cce421c..e09867de1e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCollectionRepository.java @@ -27,15 +27,16 @@ */ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyIdentifiableCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.IntegerFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyIdentifiableCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.BooleanFilterConnector; +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.IntegerFilterConnector; +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.IdentifiableObjectStore; +import org.hisp.dhis.android.core.dataset.internal.DataSetFields; import org.hisp.dhis.android.core.period.PeriodType; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistration.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistration.java index b8eba6f263..ec17315655 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistration.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistration.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; @@ -45,6 +43,9 @@ import java.util.Date; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = $$AutoValue_DataSetCompleteRegistration.Builder.class) public abstract class DataSetCompleteRegistration extends BaseDataModel { 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 index 01bf3f5199..31c0e01a8f 100644 --- 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 @@ -28,17 +28,20 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepositoryImpl; +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.ReadWriteCollectionRepository; -import org.hisp.dhis.android.core.arch.repositories.filters.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.DateFilterConnector; +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.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationFields; +import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationPostCall; +import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationStore; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; import java.util.Map; import java.util.concurrent.Callable; @@ -54,7 +57,7 @@ public final class DataSetCompleteRegistrationCollectionRepository implements ReadWriteCollectionRepository, ReadOnlyWithUploadCollectionRepository { - private final SyncHandler handler; + private final Handler handler; private final DataSetCompleteRegistrationPostCall postCall; @Inject @@ -62,7 +65,7 @@ public final class DataSetCompleteRegistrationCollectionRepository final DataSetCompleteRegistrationStore store, final Map> childrenAppenders, final RepositoryScope scope, - final SyncHandler handler, + final Handler handler, final DataSetCompleteRegistrationPostCall postCall) { super(store, childrenAppenders, scope, new FilterConnectorFactory<>(scope, s -> new DataSetCompleteRegistrationCollectionRepository(store, childrenAppenders, diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationTableInfo.java index 07a24514f7..8733af5d0d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationTableInfo.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationFields; import org.hisp.dhis.android.core.utils.Utils; public final class DataSetCompleteRegistrationTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLink.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLink.java index 87cce8aae9..f60cc2ee08 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLink.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLink.java @@ -29,13 +29,14 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.Model; +import androidx.annotation.Nullable; + @AutoValue public abstract class DataSetCompulsoryDataElementOperandLink implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkModel.java index b72e6d0ffe..7f1e48f534 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -37,6 +36,8 @@ import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class DataSetCompulsoryDataElementOperandLinkModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkTableInfo.java index 4f66f695ef..6bb3a6fd71 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkTableInfo.java @@ -28,10 +28,8 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; -import org.hisp.dhis.android.core.dataelement.DataElementOperandTableInfo; import org.hisp.dhis.android.core.utils.Utils; public final class DataSetCompulsoryDataElementOperandLinkTableInfo { @@ -49,15 +47,10 @@ public Columns columns() { } }; - static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( - DataElementOperandTableInfo.TABLE_INFO, - Columns.DATA_SET, - Columns.DATA_ELEMENT_OPERAND); - private DataSetCompulsoryDataElementOperandLinkTableInfo() { } - static class Columns extends BaseModel.Columns { + public static class Columns extends BaseModel.Columns { public static final String DATA_SET = "dataSet"; public static final String DATA_ELEMENT_OPERAND = "dataElementOperand"; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkModel.java index 80e81a92d7..7a971ea19a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkModel.java @@ -28,7 +28,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -36,6 +35,8 @@ import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class DataSetDataElementLinkModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkTableInfo.java index 239e1aa1d0..c25d817b3d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkTableInfo.java @@ -28,12 +28,12 @@ package org.hisp.dhis.android.core.dataset; -import androidx.annotation.VisibleForTesting; - -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.VisibleForTesting; + public final class DataSetDataElementLinkTableInfo { public static final TableInfo TABLE_INFO = new TableInfo() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElement.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElement.java index 9b5d7a2a34..e887f1e2c7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElement.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElement.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -43,6 +41,9 @@ import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.data.database.ObjectWithUidColumnAdapter; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_DataSetElement.Builder.class) public abstract class DataSetElement implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementLinkTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementLinkTableInfo.java index ad3a8e370d..85c6c43db0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementLinkTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementLinkTableInfo.java @@ -28,9 +28,9 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.dataset.internal.DataSetElementFields; import org.hisp.dhis.android.core.utils.Utils; public final class DataSetElementLinkTableInfo { @@ -48,10 +48,6 @@ public BaseModel.Columns columns() { } }; - static final SingleParentChildProjection CHILD_PROJECTION = new SingleParentChildProjection( - DataSetElementLinkTableInfo.TABLE_INFO, - DataSetElementFields.DATA_SET); - private DataSetElementLinkTableInfo() { } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModel.java index af6b8b1995..9a50a95a1a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -40,6 +39,8 @@ import org.hisp.dhis.android.core.period.PeriodType; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class DataSetModel extends BaseNameableObjectModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLink.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLink.java index ba941a2f3c..d32d271781 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLink.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLink.java @@ -28,13 +28,14 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.Model; +import androidx.annotation.Nullable; + @AutoValue public abstract class DataSetOrganisationUnitLink implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkModel.java index 6573071e33..6156e38409 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkModel.java @@ -28,7 +28,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -36,6 +35,8 @@ import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class DataSetOrganisationUnitLinkModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkTableInfo.java index c02f8a017c..004f1a0963 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkTableInfo.java @@ -28,8 +28,7 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; @@ -50,11 +49,6 @@ public BaseModel.Columns columns() { } }; - public static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( - DataSetTableInfo.TABLE_INFO, - Columns.ORGANISATION_UNIT, - Columns.DATA_SET); - private DataSetOrganisationUnitLinkTableInfo() { } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetTableInfo.java index 74665ed6c3..6025d1814f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetTableInfo.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.BaseNameableObjectModel; +import org.hisp.dhis.android.core.dataset.internal.DataSetFields; import org.hisp.dhis.android.core.utils.Utils; public final class DataSetTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/Section.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/Section.java index 8485d864d8..88224e28ad 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/Section.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/Section.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -48,6 +47,8 @@ import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_Section.Builder.class) public abstract class Section extends BaseIdentifiableObject implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionCollectionRepository.java index d1b91787f7..fc89008ccc 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionCollectionRepository.java @@ -27,14 +27,14 @@ */ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyIdentifiableCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.IntegerFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyIdentifiableCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.BooleanFilterConnector; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.IntegerFilterConnector; +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.IdentifiableObjectStore; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLink.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLink.java index b0aa1e81ab..6b73f05f08 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLink.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLink.java @@ -28,13 +28,14 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.Model; +import androidx.annotation.Nullable; + @AutoValue public abstract class SectionDataElementLink implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkModel.java index beb5f3d1d7..4002ae9b92 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkModel.java @@ -28,13 +28,14 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class SectionDataElementLinkModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkTableInfo.java index dfe82af996..ca97da4571 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkTableInfo.java @@ -28,10 +28,8 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; -import org.hisp.dhis.android.core.dataelement.DataElementTableInfo; import org.hisp.dhis.android.core.utils.Utils; public final class SectionDataElementLinkTableInfo { @@ -49,19 +47,14 @@ public Columns columns() { } }; - static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( - DataElementTableInfo.TABLE_INFO, - Columns.SECTION, - Columns.DATA_ELEMENT); - private SectionDataElementLinkTableInfo() { } - static class Columns extends BaseModel.Columns { + public static class Columns extends BaseModel.Columns { - static final String SECTION = "section"; - static final String DATA_ELEMENT = "dataElement"; - static final String SORT_ORDER = "sortOrder"; + public static final String SECTION = "section"; + public static final String DATA_ELEMENT = "dataElement"; + public static final String SORT_ORDER = "sortOrder"; @Override public String[] all() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionFields.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionFields.java index d95bfb4b8f..efec35a533 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionFields.java @@ -28,20 +28,20 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.dataelement.DataElementOperand; -import org.hisp.dhis.android.core.dataelement.DataElementOperandFields; +import org.hisp.dhis.android.core.dataelement.internal.DataElementOperandFields; public final class SectionFields { - final static String DESCRIPTION = "description"; - final static String SORT_ORDER = "sortOrder"; - final static String DATA_SET = "dataSet"; - final static String SHOW_ROW_TOTALS = "showRowTotals"; - final static String SHOW_COLUMN_TOTALS = "showColumnTotals"; - final static String DATA_ELEMENTS = "dataElements"; - final static String GREYED_FIELDS = "greyedFields"; + public final static String DESCRIPTION = "description"; + public final static String SORT_ORDER = "sortOrder"; + public final static String DATA_SET = "dataSet"; + public final static String SHOW_ROW_TOTALS = "showRowTotals"; + public final static String SHOW_COLUMN_TOTALS = "showColumnTotals"; + public final static String DATA_ELEMENTS = "dataElements"; + public final static String GREYED_FIELDS = "greyedFields"; private static final FieldsHelper
fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLink.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLink.java index aa12b78d12..5c389c152a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLink.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLink.java @@ -29,13 +29,14 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.Model; +import androidx.annotation.Nullable; + @AutoValue public abstract class SectionGreyedFieldsLink implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkModel.java index d0c477be93..718f0b29eb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -37,6 +36,8 @@ import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class SectionGreyedFieldsLinkModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkTableInfo.java index ee4599bd9e..8ca9d7aacd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkTableInfo.java @@ -28,10 +28,8 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; -import org.hisp.dhis.android.core.dataelement.DataElementOperandTableInfo; import org.hisp.dhis.android.core.utils.Utils; public final class SectionGreyedFieldsLinkTableInfo { @@ -49,18 +47,13 @@ public Columns columns() { } }; - static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( - DataElementOperandTableInfo.TABLE_INFO, - Columns.SECTION, - Columns.DATA_ELEMENT_OPERAND); - private SectionGreyedFieldsLinkTableInfo() { } - static class Columns extends BaseModel.Columns { + public static class Columns extends BaseModel.Columns { - static final String SECTION = "section"; - static final String DATA_ELEMENT_OPERAND = "dataElementOperand"; + public static final String SECTION = "section"; + public static final String DATA_ELEMENT_OPERAND = "dataElementOperand"; @Override public String[] all() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionModel.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionModel.java index 411fc7cba3..9172c88127 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.dataset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -37,6 +36,8 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class SectionModel extends BaseIdentifiableObjectModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionTableInfo.java index 3e77aa08a4..b438103264 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionTableInfo.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.dataset; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodChildrenAppender.java similarity index 86% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodChildrenAppender.java index 02043ca4b5..291f019f42 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodChildrenAppender.java @@ -25,12 +25,14 @@ * (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; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.SingleParentChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataInputPeriod; +import org.hisp.dhis.android.core.dataset.DataSet; final class DataInputPeriodChildrenAppender extends ChildrenAppender { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodEntityDIModule.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodEntityDIModule.java index a20ee12499..2cc2e53f16 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodEntityDIModule.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandlerImpl; -import org.hisp.dhis.android.core.common.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandlerImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataInputPeriod; import dagger.Module; import dagger.Provides; @@ -48,7 +49,7 @@ LinkModelStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - LinkSyncHandler handler(LinkModelStore store) { - return new LinkSyncHandlerImpl<>(store); + LinkHandler handler(LinkModelStore store) { + return new LinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodFields.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodFields.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodFields.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodFields.java index 65595ebfc3..1554efb716 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodFields.java @@ -26,16 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.dataset.DataInputPeriod; -final class DataInputPeriodFields { +public final class DataInputPeriodFields { - static final String PERIOD = "period"; - static final String OPENING_DATE = "openingDate"; - static final String CLOSING_DATE = "closingDate"; + public static final String PERIOD = "period"; + public static final String OPENING_DATE = "openingDate"; + public static final String CLOSING_DATE = "closingDate"; private static FieldsHelper fieldsHelper = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStore.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStore.java index 9dc8d5b4df..43df2d304e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataInputPeriodLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStore.java @@ -26,16 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataInputPeriod; +import org.hisp.dhis.android.core.dataset.DataInputPeriodTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class DataInputPeriodLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallFactory.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallFactory.java index 9eaa657e58..ee4449b69c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallFactory.java @@ -26,15 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.QueryCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; import javax.inject.Inject; @@ -47,13 +48,13 @@ final class DataSetCompleteRegistrationCallFactory extends QueryCallFactoryImpl { - private final SyncHandler handler; + private final Handler handler; private final DataSetCompleteRegistrationService service; @Inject DataSetCompleteRegistrationCallFactory(GenericCallData genericCallData, APICallExecutor apiCallExecutor, - SyncHandler handler, + Handler handler, DataSetCompleteRegistrationService service) { super(genericCallData, apiCallExecutor); this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCallFetcher.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallFetcher.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCallFetcher.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallFetcher.java index f7b83755a7..b727daea92 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationCallFetcher.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallFetcher.java @@ -26,12 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.maintenance.D2ErrorComponent; @@ -43,6 +42,8 @@ import java.util.List; import java.util.Set; +import androidx.annotation.NonNull; + abstract class DataSetCompleteRegistrationCallFetcher implements CallFetcher { private final static int MAX_ALLOWED_QUERY_LENGTH = 2500; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationEntityDIModule.java index 0d11ec9c15..97991ccafe 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationEntityDIModule.java @@ -26,13 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.di.ObjectWithoutUidStoreProvider; -import org.hisp.dhis.android.core.arch.handlers.ObjectWithoutUidSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.di.internal.ObjectWithoutUidStoreProvider; +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.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; import java.util.Collections; import java.util.Map; @@ -54,8 +55,8 @@ public DataSetCompleteRegistrationStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - public SyncHandler handler(DataSetCompleteRegistrationStore store) { - return new ObjectWithoutUidSyncHandlerImpl<>(store); + public Handler handler(DataSetCompleteRegistrationStore store) { + return new ObjectWithoutUidHandlerImpl<>(store); } @Provides diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationFields.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationFields.java similarity index 76% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationFields.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationFields.java index 487da54482..830bf1934f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationFields.java @@ -26,19 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.dataset.DataSetCompleteRegistration; -final class DataSetCompleteRegistrationFields { +public final class DataSetCompleteRegistrationFields { - static final String PERIOD = "period"; - static final String DATA_SET = "dataSet"; - static final String ORGANISATION_UNIT = "organisationUnit"; - static final String ATTRIBUTE_OPTION_COMBO = "attributeOptionCombo"; - static final String DATE = "date"; - static final String STORED_BY = "storedBy"; + public static final String PERIOD = "period"; + public static final String DATA_SET = "dataSet"; + public static final String ORGANISATION_UNIT = "organisationUnit"; + public static final String ATTRIBUTE_OPTION_COMBO = "attributeOptionCombo"; + public static final String DATE = "date"; + public static final String STORED_BY = "storedBy"; private static FieldsHelper fieldsHelper = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationImportHandler.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationImportHandler.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationImportHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationImportHandler.java index 8c9df9380f..4f9cf6885c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationImportHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationImportHandler.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; -import org.hisp.dhis.android.core.imports.ImportConflict; -import org.hisp.dhis.android.core.imports.ImportCount; +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.ImportConflict; +import org.hisp.dhis.android.core.imports.internal.ImportCount; import org.hisp.dhis.android.core.imports.ImportStatus; import java.util.ArrayList; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPayload.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPayload.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPayload.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPayload.java index f72aed7d49..34e55ea51d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPayload.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPayload.java @@ -26,10 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import com.fasterxml.jackson.annotation.JsonProperty; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; + import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPostCall.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPostCall.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.java index 6b6b094041..b3c842b806 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationPostCall.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCall.java @@ -26,11 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.ArrayList; @@ -44,7 +45,7 @@ import dagger.Reusable; @Reusable -final class DataSetCompleteRegistrationPostCall implements Callable { +public final class DataSetCompleteRegistrationPostCall implements Callable { private final DataSetCompleteRegistrationService dataSetCompleteRegistrationService; private final DataSetCompleteRegistrationStore dataSetCompleteRegistrationStore; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationQuery.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.java index e552cc9e85..b044a15989 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationQuery.java @@ -26,11 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.common.BaseQuery; +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationService.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationService.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.java index ad406bb1e0..031105d6fe 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationService.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.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.common.Unit; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Which; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; import retrofit2.Call; import retrofit2.http.Body; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationStore.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationStore.java index 29039a9fc3..7d3a609424 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationStore.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; import java.util.Collection; -interface DataSetCompleteRegistrationStore extends ObjectWithoutUidStore { +public interface DataSetCompleteRegistrationStore extends ObjectWithoutUidStore { Collection getDataSetCompleteRegistrationsWithState(State state); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationStoreImpl.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationStoreImpl.java index 2787fb3d5b..325b99e43a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompleteRegistrationStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationStoreImpl.java @@ -26,19 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.WhereStatementBinder; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStoreImpl; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilderImpl; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStoreImpl; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistrationTableInfo; import java.util.Collection; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class DataSetCompleteRegistrationStoreImpl extends ObjectWithoutUidStoreImpl implements DataSetCompleteRegistrationStore { @@ -71,15 +73,15 @@ final class DataSetCompleteRegistrationStoreImpl extends }; private DataSetCompleteRegistrationStoreImpl(DatabaseAdapter databaseAdapter, - SQLStatementBuilder builder) { + SQLStatementBuilderImpl builder) { super(databaseAdapter, builder, BINDER, WHERE_UPDATE_BINDER, WHERE_DELETE_BINDER, DataSetCompleteRegistration::create); } public static DataSetCompleteRegistrationStoreImpl create(DatabaseAdapter databaseAdapter) { - SQLStatementBuilder sqlStatementBuilder = - new SQLStatementBuilder(DataSetCompleteRegistrationTableInfo.TABLE_INFO.name(), + SQLStatementBuilderImpl sqlStatementBuilder = + new SQLStatementBuilderImpl(DataSetCompleteRegistrationTableInfo.TABLE_INFO.name(), DataSetCompleteRegistrationTableInfo.TABLE_INFO.columns()); return new DataSetCompleteRegistrationStoreImpl(databaseAdapter, sqlStatementBuilder); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandChildrenAppender.java similarity index 73% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandChildrenAppender.java index c9f45d428e..971672f50c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandChildrenAppender.java @@ -25,16 +25,25 @@ * (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; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.stores.LinkModelChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataelement.DataElementOperandTableInfo; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetCompulsoryDataElementOperandLinkTableInfo; final class DataSetCompulsoryDataElementOperandChildrenAppender extends ChildrenAppender { + private static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( + DataElementOperandTableInfo.TABLE_INFO, + DataSetCompulsoryDataElementOperandLinkTableInfo.Columns.DATA_SET, + DataSetCompulsoryDataElementOperandLinkTableInfo.Columns.DATA_ELEMENT_OPERAND); + private final LinkModelChildStore linkModelChildStore; private DataSetCompulsoryDataElementOperandChildrenAppender( @@ -54,7 +63,7 @@ static ChildrenAppender create(DatabaseAdapter databaseAdapter) { StoreFactory.linkModelChildStore( databaseAdapter, DataSetCompulsoryDataElementOperandLinkTableInfo.TABLE_INFO, - DataSetCompulsoryDataElementOperandLinkTableInfo.CHILD_PROJECTION, + CHILD_PROJECTION, DataElementOperand::create) ); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandEntityDIModule.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandEntityDIModule.java index 89cb1db00a..35caf7a7a2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandEntityDIModule.java @@ -26,13 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandlerImpl; -import org.hisp.dhis.android.core.common.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandlerImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataset.DataSetCompulsoryDataElementOperandLink; import dagger.Module; import dagger.Provides; @@ -49,8 +50,8 @@ LinkModelStore store(DatabaseAdapter da @Provides @Reusable - LinkSyncHandler handler( + LinkHandler handler( LinkModelStore store) { - return new LinkSyncHandlerImpl<>(store); + return new LinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStore.java index 5a62387798..41d584fd28 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetCompulsoryDataElementOperandLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSetCompulsoryDataElementOperandLink; +import org.hisp.dhis.android.core.dataset.DataSetCompulsoryDataElementOperandLinkTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class DataSetCompulsoryDataElementOperandLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStore.java index b892f6c353..7ea8b00731 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetDataElementLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStore.java @@ -26,15 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSetElement; +import org.hisp.dhis.android.core.dataset.DataSetElementLinkTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class DataSetDataElementLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementChildrenAppender.java similarity index 74% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementChildrenAppender.java index 3650a85084..bb50ee3ae9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementChildrenAppender.java @@ -25,15 +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.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.SingleParentChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetElement; +import org.hisp.dhis.android.core.dataset.DataSetElementLinkTableInfo; final class DataSetElementChildrenAppender extends ChildrenAppender { + private static final SingleParentChildProjection CHILD_PROJECTION = new SingleParentChildProjection( + DataSetElementLinkTableInfo.TABLE_INFO, + DataSetElementFields.DATA_SET); + private final SingleParentChildStore childStore; private DataSetElementChildrenAppender(SingleParentChildStore childStore) { @@ -51,7 +59,7 @@ static ChildrenAppender create(DatabaseAdapter databaseAdapter) { return new DataSetElementChildrenAppender( StoreFactory.singleParentChildStore( databaseAdapter, - DataSetElementLinkTableInfo.CHILD_PROJECTION, + CHILD_PROJECTION, DataSetElement::create) ); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementEntityDIModule.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementEntityDIModule.java index e485e07994..124a5580fd 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementEntityDIModule.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandlerImpl; -import org.hisp.dhis.android.core.common.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandlerImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSetElement; import dagger.Module; import dagger.Provides; @@ -48,7 +49,7 @@ LinkModelStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - LinkSyncHandler handler(LinkModelStore store) { - return new LinkSyncHandlerImpl<>(store); + LinkHandler handler(LinkModelStore store) { + return new LinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementFields.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementFields.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementFields.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementFields.java index 442ec63bb9..2f46433681 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetElementFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetElementFields.java @@ -26,16 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.dataset.DataSetElement; -final class DataSetElementFields { +public final class DataSetElementFields { - static final String DATA_SET = "dataSet"; - static final String DATA_ELEMENT = "dataElement"; - static final String CATEGORY_COMBO = "categoryCombo"; + public static final String DATA_SET = "dataSet"; + public static final String DATA_ELEMENT = "dataElement"; + public static final String CATEGORY_COMBO = "categoryCombo"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetEndpointCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallFactory.java similarity index 74% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetEndpointCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallFactory.java index f1bd5069ce..26fd5222a7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetEndpointCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallFactory.java @@ -26,19 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.ListCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.PayloadResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.factories.internal.ListCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.PayloadResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; import org.hisp.dhis.android.core.common.DataAccess; -import org.hisp.dhis.android.core.common.GenericCallData; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.resource.Resource; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.resource.internal.Resource; import javax.inject.Inject; @@ -49,14 +50,14 @@ final class DataSetEndpointCallFactory extends ListCallFactoryImpl { private final DataSetService dataSetService; - private final SyncHandler dataSetHandler; + private final Handler dataSetHandler; private final Resource.Type resourceType = Resource.Type.DATA_SET; @Inject DataSetEndpointCallFactory(GenericCallData data, APICallExecutor apiCallExecutor, DataSetService dataSetService, - SyncHandler dataSetHandler) { + Handler dataSetHandler) { super(data, apiCallExecutor); this.dataSetService = dataSetService; this.dataSetHandler = dataSetHandler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetEntityDIModule.java similarity index 75% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetEntityDIModule.java index ac9676a264..c69653577d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetEntityDIModule.java @@ -26,19 +26,24 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.CollectionCleaner; -import org.hisp.dhis.android.core.common.CollectionCleanerImpl; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.ObjectStyleChildrenAppender; -import org.hisp.dhis.android.core.common.ObjectStyleStoreImpl; -import org.hisp.dhis.android.core.common.OrphanCleaner; -import org.hisp.dhis.android.core.common.OrphanCleanerImpl; +import org.hisp.dhis.android.core.arch.cleaners.internal.CollectionCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.CollectionCleanerImpl; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleanerImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +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.common.objectstyle.internal.ObjectStyleChildrenAppender; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleStoreImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import org.hisp.dhis.android.core.indicator.DataSetIndicatorChildrenAppender; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetTableInfo; +import org.hisp.dhis.android.core.dataset.Section; +import org.hisp.dhis.android.core.dataset.SectionFields; +import org.hisp.dhis.android.core.dataset.SectionTableInfo; +import org.hisp.dhis.android.core.indicator.internal.DataSetIndicatorChildrenAppender; import java.util.HashMap; import java.util.Map; @@ -58,7 +63,7 @@ IdentifiableObjectStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - SyncHandler handler(DataSetHandler impl) { + Handler handler(DataSetHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetFields.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetFields.java similarity index 64% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetFields.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetFields.java index 99258e327e..3f2342f304 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetFields.java @@ -26,46 +26,51 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; +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.Access; import org.hisp.dhis.android.core.common.DataAccess; import org.hisp.dhis.android.core.common.ObjectStyle; -import org.hisp.dhis.android.core.common.ObjectStyleFields; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleFields; import org.hisp.dhis.android.core.dataelement.DataElementOperand; -import org.hisp.dhis.android.core.dataelement.DataElementOperandFields; +import org.hisp.dhis.android.core.dataelement.internal.DataElementOperandFields; +import org.hisp.dhis.android.core.dataset.DataInputPeriod; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetElement; +import org.hisp.dhis.android.core.dataset.Section; +import org.hisp.dhis.android.core.dataset.SectionFields; import org.hisp.dhis.android.core.period.PeriodType; public final class DataSetFields { - static final String PERIOD_TYPE = "periodType"; + public static final String PERIOD_TYPE = "periodType"; public static final String CATEGORY_COMBO = "categoryCombo"; - static final String MOBILE = "mobile"; - static final String VERSION = "version"; - static final String EXPIRY_DAYS = "expiryDays"; - static final String TIMELY_DAYS = "timelyDays"; - static final String NOTIFY_COMPLETING_USER = "notifyCompletingUser"; - static final String OPEN_FUTURE_PERIODS = "openFuturePeriods"; - static final String FIELD_COMBINATION_REQUIRED = "fieldCombinationRequired"; - static final String VALID_COMPLETE_ONLY = "validCompleteOnly"; - static final String NO_VALUE_REQUIRES_COMMENT = "noValueRequiresComment"; - static final String SKIP_OFFLINE = "skipOffline"; - static final String DATA_ELEMENT_DECORATION = "dataElementDecoration"; - static final String RENDER_AS_TABS = "renderAsTabs"; - static final String RENDER_HORIZONTALLY = "renderHorizontally"; + public static final String MOBILE = "mobile"; + public static final String VERSION = "version"; + public static final String EXPIRY_DAYS = "expiryDays"; + public static final String TIMELY_DAYS = "timelyDays"; + public static final String NOTIFY_COMPLETING_USER = "notifyCompletingUser"; + public static final String OPEN_FUTURE_PERIODS = "openFuturePeriods"; + public static final String FIELD_COMBINATION_REQUIRED = "fieldCombinationRequired"; + public static final String VALID_COMPLETE_ONLY = "validCompleteOnly"; + public static final String NO_VALUE_REQUIRES_COMMENT = "noValueRequiresComment"; + public static final String SKIP_OFFLINE = "skipOffline"; + public static final String DATA_ELEMENT_DECORATION = "dataElementDecoration"; + public static final String RENDER_AS_TABS = "renderAsTabs"; + public static final String RENDER_HORIZONTALLY = "renderHorizontally"; public static final String WORKFLOW = "workflow"; - static final String DATA_SET_ELEMENTS = "dataSetElements"; - static final String INDICATORS = "indicators"; - static final String SECTIONS = "sections"; - static final String COMPULSORY_DATA_ELEMENT_OPERANDS = "compulsoryDataElementOperands"; - static final String DATA_INPUT_PERIODS = "dataInputPeriods"; - private static final String ACCESS = "access"; - static final String STYLE = "style"; + public static final String DATA_SET_ELEMENTS = "dataSetElements"; + public static final String INDICATORS = "indicators"; + public static final String SECTIONS = "sections"; + public static final String COMPULSORY_DATA_ELEMENT_OPERANDS = "compulsoryDataElementOperands"; + public static final String DATA_INPUT_PERIODS = "dataInputPeriods"; + public static final String ACCESS = "access"; + public static final String STYLE = "style"; - static final String ACCESS_DATA_WRITE = "accessDataWrite"; + public static final String ACCESS_DATA_WRITE = "accessDataWrite"; private static FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetHandler.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetHandler.java similarity index 69% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetHandler.java index 3f5ead722c..4fe721e022 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetHandler.java @@ -25,18 +25,24 @@ * (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.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.CollectionCleaner; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.ObjectStyleHandler; +package org.hisp.dhis.android.core.dataset.internal; + +import org.hisp.dhis.android.core.arch.cleaners.internal.CollectionCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleaner; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.common.OrphanCleaner; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleHandler; import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataset.DataInputPeriod; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetCompulsoryDataElementOperandLink; +import org.hisp.dhis.android.core.dataset.DataSetElement; +import org.hisp.dhis.android.core.dataset.DataSetTableInfo; +import org.hisp.dhis.android.core.dataset.Section; import org.hisp.dhis.android.core.indicator.DataSetIndicatorLink; import org.hisp.dhis.android.core.indicator.Indicator; @@ -47,33 +53,33 @@ import dagger.Reusable; @Reusable -final class DataSetHandler extends IdentifiableSyncHandlerImpl { +final class DataSetHandler extends IdentifiableHandlerImpl { private final ObjectStyleHandler styleHandler; - private final SyncHandler
sectionHandler; + private final Handler
sectionHandler; private final OrphanCleaner sectionOrphanCleaner; - private final SyncHandler compulsoryDataElementOperandHandler; - private final LinkSyncHandler + private final Handler compulsoryDataElementOperandHandler; + private final LinkHandler dataSetCompulsoryDataElementOperandLinkHandler; - private final LinkSyncHandler dataInputPeriodHandler; - private final LinkSyncHandler dataSetElementLinkHandler; - private final LinkSyncHandler dataSetIndicatorLinkHandler; + private final LinkHandler dataInputPeriodHandler; + private final LinkHandler dataSetElementLinkHandler; + private final LinkHandler dataSetIndicatorLinkHandler; private final CollectionCleaner collectionCleaner; @Inject DataSetHandler(IdentifiableObjectStore dataSetStore, ObjectStyleHandler styleHandler, - SyncHandler
sectionHandler, + Handler
sectionHandler, OrphanCleaner sectionOrphanCleaner, - SyncHandler compulsoryDataElementOperandHandler, - LinkSyncHandler + Handler compulsoryDataElementOperandHandler, + LinkHandler dataSetCompulsoryDataElementOperandLinkHandler, - LinkSyncHandler dataInputPeriodHandler, - LinkSyncHandler dataSetElementLinkHandler, - LinkSyncHandler dataSetIndicatorLinkHandler, + LinkHandler dataInputPeriodHandler, + LinkHandler dataSetElementLinkHandler, + LinkHandler dataSetIndicatorLinkHandler, CollectionCleaner collectionCleaner) { super(dataSetStore); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModuleDownloader.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetModuleDownloader.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModuleDownloader.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetModuleDownloader.java index 080b91e187..bfd691a0f0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModuleDownloader.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetModuleDownloader.java @@ -25,16 +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.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.modules.MetadataModuleDownloader; -import org.hisp.dhis.android.core.calls.factories.ListCallFactory; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.ListCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactory; +import org.hisp.dhis.android.core.arch.modules.internal.MetadataModuleDownloader; import org.hisp.dhis.android.core.dataelement.DataElement; +import org.hisp.dhis.android.core.dataset.DataSet; import org.hisp.dhis.android.core.indicator.Indicator; import org.hisp.dhis.android.core.indicator.IndicatorType; import org.hisp.dhis.android.core.option.OptionSet; -import org.hisp.dhis.android.core.period.PeriodHandler; +import org.hisp.dhis.android.core.period.internal.PeriodHandler; import java.util.List; import java.util.Set; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetModuleWiper.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetModuleWiper.java index 284bbc4a74..633d3cb152 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetModuleWiper.java @@ -25,8 +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.dataset; +package org.hisp.dhis.android.core.dataset.internal; +import org.hisp.dhis.android.core.dataset.DataInputPeriodTableInfo; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistrationTableInfo; +import org.hisp.dhis.android.core.dataset.DataSetCompulsoryDataElementOperandLinkTableInfo; +import org.hisp.dhis.android.core.dataset.DataSetDataElementLinkTableInfo; +import org.hisp.dhis.android.core.dataset.DataSetOrganisationUnitLinkTableInfo; +import org.hisp.dhis.android.core.dataset.DataSetTableInfo; +import org.hisp.dhis.android.core.dataset.SectionDataElementLinkTableInfo; +import org.hisp.dhis.android.core.dataset.SectionGreyedFieldsLinkTableInfo; +import org.hisp.dhis.android.core.dataset.SectionTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStore.java index 3a36cae900..c1bf66d060 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetOrganisationUnitLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSetOrganisationUnitLink; +import org.hisp.dhis.android.core.dataset.DataSetOrganisationUnitLinkTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class DataSetOrganisationUnitLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetPackageDIModule.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetPackageDIModule.java index fe81edbd48..928668dc39 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetPackageDIModule.java @@ -26,10 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.calls.factories.ListCallFactory; -import org.hisp.dhis.android.core.calls.factories.QueryCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.ListCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCallFactory; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetParentUidsHelper.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetParentUidsHelper.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetParentUidsHelper.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetParentUidsHelper.java index d81edf4d26..c80bf20d6b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetParentUidsHelper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetParentUidsHelper.java @@ -25,10 +25,12 @@ * (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; +package org.hisp.dhis.android.core.dataset.internal; import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.dataelement.DataElement; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetElement; import org.hisp.dhis.android.core.indicator.Indicator; import java.util.HashSet; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetService.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetService.java similarity index 86% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetService.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetService.java index 026ddff132..0fe23e1e61 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetService.java @@ -25,11 +25,12 @@ * (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; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Which; +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.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.dataset.DataSet; import retrofit2.Call; import retrofit2.http.GET; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetStore.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetStore.java index f35d9939ac..eb8e3813f9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/DataSetStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/DataSetStore.java @@ -26,20 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.NameableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.AccessHelper; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.NameableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.helpers.AccessHelper; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.DataSetTableInfo; + +import androidx.annotation.NonNull; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class DataSetStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionChildrenAppender.java similarity index 86% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionChildrenAppender.java index c66bb0a2b4..0729d1ca23 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionChildrenAppender.java @@ -25,12 +25,14 @@ * (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; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.SingleParentChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.dataset.Section; final class SectionChildrenAppender extends ChildrenAppender { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementChildrenAppender.java similarity index 74% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementChildrenAppender.java index 0cb852d4c3..d4f538f470 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementChildrenAppender.java @@ -25,16 +25,25 @@ * (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; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.stores.LinkModelChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataelement.DataElement; +import org.hisp.dhis.android.core.dataelement.DataElementTableInfo; +import org.hisp.dhis.android.core.dataset.Section; +import org.hisp.dhis.android.core.dataset.SectionDataElementLinkTableInfo; final class SectionDataElementChildrenAppender extends ChildrenAppender
{ + private static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( + DataElementTableInfo.TABLE_INFO, + SectionDataElementLinkTableInfo.Columns.SECTION, + SectionDataElementLinkTableInfo.Columns.DATA_ELEMENT); + private final LinkModelChildStore linkModelChildStore; private SectionDataElementChildrenAppender(LinkModelChildStore linkModelChildStore) { @@ -53,7 +62,7 @@ static ChildrenAppender
create(DatabaseAdapter databaseAdapter) { StoreFactory.linkModelChildStore( databaseAdapter, SectionDataElementLinkTableInfo.TABLE_INFO, - SectionDataElementLinkTableInfo.CHILD_PROJECTION, + CHILD_PROJECTION, DataElement::create ) ); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementEntityDIModule.java index 90b4c120fa..a1f3434bb8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementEntityDIModule.java @@ -26,13 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandler; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandlerImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandlerImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataelement.DataElement; +import org.hisp.dhis.android.core.dataset.SectionDataElementLink; import dagger.Module; import dagger.Provides; @@ -49,7 +50,7 @@ LinkModelStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - OrderedLinkSyncHandler handler(LinkModelStore store) { - return new OrderedLinkSyncHandlerImpl<>(store); + OrderedLinkHandler handler(LinkModelStore store) { + return new OrderedLinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStore.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStore.java index e43445a2b6..f7e26b20ce 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionDataElementLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.SectionDataElementLink; +import org.hisp.dhis.android.core.dataset.SectionDataElementLinkTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class SectionDataElementLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionEntityDIModule.java similarity index 84% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionEntityDIModule.java index 252b57ee33..aca7883fa4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionEntityDIModule.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +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.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.Section; +import org.hisp.dhis.android.core.dataset.SectionFields; import java.util.HashMap; import java.util.Map; @@ -51,7 +53,7 @@ IdentifiableObjectStore
store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - SyncHandler
handler(SectionHandler impl) { + Handler
handler(SectionHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsChildrenAppender.java similarity index 74% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsChildrenAppender.java index 5a65258620..1644b94014 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsChildrenAppender.java @@ -25,16 +25,25 @@ * (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; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.stores.LinkModelChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataelement.DataElementOperandTableInfo; +import org.hisp.dhis.android.core.dataset.Section; +import org.hisp.dhis.android.core.dataset.SectionGreyedFieldsLinkTableInfo; final class SectionGreyedFieldsChildrenAppender extends ChildrenAppender
{ + private static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( + DataElementOperandTableInfo.TABLE_INFO, + SectionGreyedFieldsLinkTableInfo.Columns.SECTION, + SectionGreyedFieldsLinkTableInfo.Columns.DATA_ELEMENT_OPERAND); + private final LinkModelChildStore linkModelChildStore; private SectionGreyedFieldsChildrenAppender(LinkModelChildStore linkModelChildStore) { @@ -53,7 +62,7 @@ static ChildrenAppender
create(DatabaseAdapter databaseAdapter) { StoreFactory.linkModelChildStore( databaseAdapter, SectionGreyedFieldsLinkTableInfo.TABLE_INFO, - SectionGreyedFieldsLinkTableInfo.CHILD_PROJECTION, + CHILD_PROJECTION, DataElementOperand::create ) ); diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsEntityDIModule.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsEntityDIModule.java index a32db3159c..3734d4cffa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsEntityDIModule.java @@ -26,13 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandlerImpl; -import org.hisp.dhis.android.core.common.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandlerImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataset.SectionGreyedFieldsLink; import dagger.Module; import dagger.Provides; @@ -49,8 +50,8 @@ LinkModelStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - LinkSyncHandler handler( + LinkHandler handler( LinkModelStore store) { - return new LinkSyncHandlerImpl<>(store); + return new LinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStore.java index 0cc61bf3e9..7be9b3df3d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionGreyedFieldsLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.SectionGreyedFieldsLink; +import org.hisp.dhis.android.core.dataset.SectionGreyedFieldsLinkTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class SectionGreyedFieldsLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionHandler.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionHandler.java similarity index 68% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionHandler.java index 1c2b690895..72051f0693 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionHandler.java @@ -25,33 +25,36 @@ * (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; +package org.hisp.dhis.android.core.dataset.internal; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.OrderedLinkSyncHandler; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.OrderedLinkHandler; import org.hisp.dhis.android.core.dataelement.DataElement; import org.hisp.dhis.android.core.dataelement.DataElementOperand; +import org.hisp.dhis.android.core.dataset.Section; +import org.hisp.dhis.android.core.dataset.SectionDataElementLink; +import org.hisp.dhis.android.core.dataset.SectionGreyedFieldsLink; import javax.inject.Inject; import dagger.Reusable; @Reusable -final class SectionHandler extends IdentifiableSyncHandlerImpl
{ +final class SectionHandler extends IdentifiableHandlerImpl
{ - private final OrderedLinkSyncHandler sectionDataElementLinkHandler; - private final SyncHandler greyedFieldsHandler; - private final LinkSyncHandler sectionGreyedFieldsLinkHandler; + private final OrderedLinkHandler sectionDataElementLinkHandler; + private final Handler greyedFieldsHandler; + private final LinkHandler sectionGreyedFieldsLinkHandler; @Inject SectionHandler(IdentifiableObjectStore
sectionStore, - OrderedLinkSyncHandler sectionDataElementLinkHandler, - SyncHandler greyedFieldsHandler, - LinkSyncHandler sectionGreyedFieldsLinkHandler) { + OrderedLinkHandler sectionDataElementLinkHandler, + Handler greyedFieldsHandler, + LinkHandler sectionGreyedFieldsLinkHandler) { super(sectionStore); this.sectionDataElementLinkHandler = sectionDataElementLinkHandler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionStore.java b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionStore.java similarity index 77% rename from core/src/main/java/org/hisp/dhis/android/core/dataset/SectionStore.java rename to core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionStore.java index 20c17b018b..9773079c03 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/dataset/SectionStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/dataset/internal/SectionStore.java @@ -26,20 +26,24 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.dataset; +package org.hisp.dhis.android.core.dataset.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.IdentifiableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.dataset.Section; +import org.hisp.dhis.android.core.dataset.SectionFields; +import org.hisp.dhis.android.core.dataset.SectionTableInfo; + +import androidx.annotation.NonNull; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; final class SectionStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataSetReport.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataSetReport.java new file mode 100644 index 0000000000..651d925240 --- /dev/null +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataSetReport.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2004-2019, 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.datavalue; + +import android.database.Cursor; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.gabrielittner.auto.value.cursor.ColumnAdapter; +import com.gabrielittner.auto.value.cursor.ColumnName; +import com.google.auto.value.AutoValue; + +import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.common.Model; +import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.data.database.DbPeriodTypeColumnAdapter; +import org.hisp.dhis.android.core.data.database.DbStateColumnAdapter; +import org.hisp.dhis.android.core.datavalue.internal.DataSetReportSQLStatementBuilder; +import org.hisp.dhis.android.core.period.PeriodType; + +@AutoValue +public abstract class DataSetReport implements Model { + + /* ColumnName set explicitly because it is used in paging as the PAGING_KEY */ + @Override + @Nullable + @ColumnName(DataSetReportSQLStatementBuilder.DATAVALUE_ID) + public abstract Long id(); + + @NonNull + public abstract String dataSetUid(); + + @NonNull + public abstract String dataSetDisplayName(); + + @NonNull + public abstract String period(); + + @NonNull + @ColumnAdapter(DbPeriodTypeColumnAdapter.class) + public abstract PeriodType periodType(); + + @NonNull + public abstract String organisationUnitUid(); + + @NonNull + public abstract String organisationUnitDisplayName(); + + @NonNull + public abstract String attributeOptionComboUid(); + + @NonNull + public abstract String attributeOptionComboDisplayName(); + + @NonNull + public abstract Integer valueCount(); + + @Nullable + @ColumnAdapter(DbStateColumnAdapter.class) + public abstract State state(); + + @NonNull + public static DataSetReport create(Cursor cursor) { + return AutoValue_DataSetReport.createFromCursor(cursor); + } + + public abstract DataSetReport.Builder toBuilder(); + + public static DataSetReport.Builder builder() { + return new $AutoValue_DataSetReport.Builder(); + } + + @AutoValue.Builder + public abstract static class Builder extends BaseModel.Builder { + public abstract Builder id(Long id); + + public abstract Builder dataSetUid(String dataSetUid); + + public abstract Builder dataSetDisplayName(String dataSetDisplayName); + + public abstract Builder period(String period); + + public abstract Builder periodType(PeriodType periodType); + + public abstract Builder organisationUnitUid(String organisationUnitUid); + + public abstract Builder organisationUnitDisplayName(String organisationUnitDisplayName); + + public abstract Builder attributeOptionComboUid(String attributeOptionComboUid); + + public abstract Builder attributeOptionComboDisplayName(String attributeOptionComboDisplayName); + + public abstract Builder valueCount(Integer valueCount); + + public abstract Builder state(State state); + + public abstract DataSetReport build(); + } +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataSetReportCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataSetReportCollectionRepository.java new file mode 100644 index 0000000000..eef5b4a892 --- /dev/null +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataSetReportCollectionRepository.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2004-2019, 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.datavalue; + +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl; +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.datavalue.internal.DataSetReportSQLStatementBuilder; +import org.hisp.dhis.android.core.datavalue.internal.DataSetReportStore; +import org.hisp.dhis.android.core.period.PeriodType; + +import java.util.Collections; + +import javax.inject.Inject; + +import dagger.Reusable; + +@Reusable +public final class DataSetReportCollectionRepository + extends ReadOnlyCollectionRepositoryImpl { + + @Inject + public DataSetReportCollectionRepository(final DataSetReportStore store, + final RepositoryScope scope) { + super(store, Collections.emptyMap(), scope, new FilterConnectorFactory<>(scope, + s -> new DataSetReportCollectionRepository(store, s))); + } + + public StringFilterConnector byDataSetUid() { + return cf.string(DataSetReportSQLStatementBuilder.DATASET_UID); + } + + public StringFilterConnector byPeriod() { + return cf.string(DataSetReportSQLStatementBuilder.PERIOD); + } + + public EnumFilterConnector byPeriodType() { + return cf.enumC(DataSetReportSQLStatementBuilder.PERIOD_TYPE); + } + + public DateFilterConnector byPeriodStartDate() { + return cf.date(DataSetReportSQLStatementBuilder.PERIOD_START_DATE); + } + + public DateFilterConnector byPeriodEndDate() { + return cf.date(DataSetReportSQLStatementBuilder.PERIOD_END_DATE); + } + + public StringFilterConnector byOrganisationUnitUid() { + return cf.string(DataSetReportSQLStatementBuilder.ORGANISATION_UNIT_UID); + } + + public StringFilterConnector byAttributeOptionComboUid() { + return cf.string(DataSetReportSQLStatementBuilder.ATTRIBUTE_OPTION_COMBO_UID); + } + +} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValue.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValue.java index 067da48963..43c895de72 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValue.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValue.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.datavalue; import android.database.Cursor; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -41,9 +39,13 @@ import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.data.database.DbDateColumnAdapter; +import org.hisp.dhis.android.core.datavalue.internal.DataValueFields; import java.util.Date; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = $$AutoValue_DataValue.Builder.class) public abstract class DataValue extends BaseDataModel { 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.java index 1f9e2be564..f4330804d3 100644 --- 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.java @@ -28,18 +28,21 @@ package org.hisp.dhis.android.core.datavalue; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepositoryImpl; +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.filters.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +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.BaseDataModel; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.datavalue.internal.DataValueFields; +import org.hisp.dhis.android.core.datavalue.internal.DataValuePostCall; +import org.hisp.dhis.android.core.datavalue.internal.DataValueStore; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; import java.util.Map; import java.util.concurrent.Callable; diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModel.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModel.java index 05add2df95..a079d2e0e8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.datavalue; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -41,6 +40,8 @@ import java.util.Date; +import androidx.annotation.Nullable; + @AutoValue @Deprecated public abstract class DataValueModel extends BaseDataModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModule.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModule.java index dd48dde313..01ba8fdc58 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModule.java @@ -39,8 +39,12 @@ public final class DataValueModule { public final DataValueCollectionRepository dataValues; + public final DataSetReportCollectionRepository dataSetReports; + @Inject - DataValueModule(DataValueCollectionRepository dataValueCollectionRepository) { + DataValueModule(DataValueCollectionRepository dataValueCollectionRepository, + DataSetReportCollectionRepository dataSetReportCollectionRepository) { this.dataValues = dataValueCollectionRepository; + this.dataSetReports = dataSetReportCollectionRepository; } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueObjectRepository.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueObjectRepository.java index da9557b6e3..7da2683faa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueObjectRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueObjectRepository.java @@ -28,12 +28,13 @@ package org.hisp.dhis.android.core.datavalue; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.arch.repositories.object.ReadWriteValueObjectRepository; -import org.hisp.dhis.android.core.arch.repositories.object.ReadWriteWithValueObjectRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.object.internal.ReadWriteWithValueObjectRepositoryImpl; 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.Unit; +import org.hisp.dhis.android.core.datavalue.internal.DataValueStore; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.Date; diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueTableInfo.java index f76a30bc3e..6d451dcf60 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueTableInfo.java @@ -28,15 +28,16 @@ package org.hisp.dhis.android.core.datavalue; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.datavalue.internal.DataValueFields; import org.hisp.dhis.android.core.utils.Utils; public class DataValueTableInfo { // Different BD column names than API fields. - static final String ORGANISATION_UNIT = "organisationUnit"; + public static final String ORGANISATION_UNIT = "organisationUnit"; private static final String FOLLOW_UP = "followUp"; private DataValueTableInfo() {} diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/di/SyncHandlerFromDatabaseAdapterProvider.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportEntityDIModule.java similarity index 66% rename from core/src/main/java/org/hisp/dhis/android/core/arch/di/SyncHandlerFromDatabaseAdapterProvider.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportEntityDIModule.java index 726876c7cc..97428c438a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/di/SyncHandlerFromDatabaseAdapterProvider.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportEntityDIModule.java @@ -26,11 +26,32 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.di; +package org.hisp.dhis.android.core.datavalue.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; +import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.datavalue.DataSetReportCollectionRepository; + +import dagger.Module; +import dagger.Provides; +import dagger.Reusable; + +@Module +public final class DataSetReportEntityDIModule { + + @Provides + @Reusable + DataSetReportStore store(DatabaseAdapter databaseAdapter) { + return DataSetReportStore.create(databaseAdapter); + } + + @Provides + @Reusable + DataSetReportCollectionRepository repository(DataSetReportStore store) { + return new DataSetReportCollectionRepository(store, + RepositoryScope.empty().toBuilder() + .pagingKey(DataSetReportSQLStatementBuilder.DATAVALUE_ID) + .build()); + } -interface SyncHandlerFromDatabaseAdapterProvider { - SyncHandler handler(DatabaseAdapter databaseAdapter); } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportSQLStatementBuilder.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportSQLStatementBuilder.java new file mode 100644 index 0000000000..0267307f16 --- /dev/null +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportSQLStatementBuilder.java @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2004-2019, 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.datavalue.internal; + +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.ReadOnlySQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.sqlorder.internal.SQLOrderType; +import org.hisp.dhis.android.core.category.CategoryOptionComboTableInfo; +import org.hisp.dhis.android.core.common.BaseDataModel; +import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; +import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.dataset.DataSetDataElementLinkTableInfo; +import org.hisp.dhis.android.core.dataset.DataSetTableInfo; +import org.hisp.dhis.android.core.datavalue.DataValueTableInfo; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitTableInfo; +import org.hisp.dhis.android.core.period.PeriodTableInfo; + +public class DataSetReportSQLStatementBuilder implements ReadOnlySQLStatementBuilder { + + private static final String AS = " AS "; + private static final String INNER_JOIN = " INNER JOIN "; + private static final String ON = " ON "; + private static final String EQ = " = "; + + private static final String DATAVALUE_TABLE_ALIAS = "dv"; + private static final String PERIOD_TABLE_ALIAS = "pe"; + private static final String DATASETELEMENT_TABLE_ALIAS = "dse"; + private static final String ORGUNIT_TABLE_ALIAS = "ou"; + private static final String DATASET_TABLE_ALIAS = "ds"; + private static final String AOC_TABLE_ALIAS = "aoc"; + + private static final String VALUE_COUNT_ALIAS = "valueCount"; + private static final String DATASET_UID_ALIAS = "dataSetUid"; + private static final String DATASET_NAME_ALIAS = "dataSetDisplayName"; + private static final String PERIOD_ALIAS = "period"; + private static final String PERIOD_TYPE_ALIAS = "periodType"; + private static final String ORGANISATION_UNIT_UID_ALIAS = "organisationUnitUid"; + private static final String ORGANISATION_UNIT_NAME_ALIAS = "organisationUnitDisplayName"; + private static final String ATTRIBUTE_OPTION_COMBO_UID_ALIAS = "attributeOptionComboUid"; + private static final String ATTRIBUTE_OPTION_COMBO_NAME_ALIAS = "attributeOptionComboDisplayName"; + + public static final String DATAVALUE_ID = DATAVALUE_TABLE_ALIAS + "." + BaseDataModel.Columns.ID; + public static final String DATASET_UID = DATASET_TABLE_ALIAS + "." + BaseIdentifiableObjectModel.Columns.UID; + static final String DATASET_NAME = DATASET_TABLE_ALIAS + "." + BaseIdentifiableObjectModel.Columns.DISPLAY_NAME; + public static final String PERIOD = DATAVALUE_TABLE_ALIAS + "." + DataValueFields.PERIOD; + public static final String PERIOD_TYPE = PERIOD_TABLE_ALIAS + "." + PeriodTableInfo.Columns.PERIOD_TYPE; + public static final String ORGANISATION_UNIT_UID = ORGUNIT_TABLE_ALIAS + "." + + BaseIdentifiableObjectModel.Columns.UID; + static final String ORGANISATION_UNIT_NAME = + ORGUNIT_TABLE_ALIAS + "." + BaseIdentifiableObjectModel.Columns.DISPLAY_NAME; + public static final String ATTRIBUTE_OPTION_COMBO_UID = AOC_TABLE_ALIAS + "." + + BaseIdentifiableObjectModel.Columns.UID; + static final String ATTRIBUTE_OPTION_COMBO_NAME = + AOC_TABLE_ALIAS + "." + BaseIdentifiableObjectModel.Columns.DISPLAY_NAME; + + public static final String PERIOD_START_DATE = PERIOD_TABLE_ALIAS + "." + PeriodTableInfo.Columns.START_DATE; + public static final String PERIOD_END_DATE = PERIOD_TABLE_ALIAS + "." + PeriodTableInfo.Columns.END_DATE; + + + private static final String STATE = DATAVALUE_TABLE_ALIAS + "." + BaseDataModel.Columns.STATE; + + private static final String SELECT_STATE_ORDERING = " MAX(CASE " + + "WHEN " + STATE + " = '" + State.SYNCED + "' THEN 1 " + + "WHEN " + STATE + " = '" + State.TO_DELETE + "' THEN 2 " + + "WHEN " + STATE + " IN ('" + State.TO_POST + "','" + State.TO_UPDATE + "') THEN 3 " + + "ELSE 4 END)"; + + private static final String FROM_CLAUSE = + " FROM " + DataValueTableInfo.TABLE_INFO.name() + AS + DATAVALUE_TABLE_ALIAS + + getJoinPeriod() + + getJoinDataSetElement() + + getJoinDataSet() + + getJoinOrganisationUnit() + + getJoinAttributeOptionCombo(); + + private static final String SELECT_CLAUSE = "SELECT " + + DATAVALUE_ID + ", " + + DATASET_UID + AS + DATASET_UID_ALIAS + "," + + DATASET_NAME + AS + DATASET_NAME_ALIAS + "," + + PERIOD + AS + PERIOD_ALIAS + "," + + PERIOD_TYPE + AS + PERIOD_TYPE_ALIAS + "," + + ORGANISATION_UNIT_UID + AS + ORGANISATION_UNIT_UID_ALIAS + "," + + ORGANISATION_UNIT_NAME + AS + ORGANISATION_UNIT_NAME_ALIAS + "," + + ATTRIBUTE_OPTION_COMBO_UID + AS + ATTRIBUTE_OPTION_COMBO_UID_ALIAS + "," + + ATTRIBUTE_OPTION_COMBO_NAME + AS + ATTRIBUTE_OPTION_COMBO_NAME_ALIAS + "," + + "COUNT(*)" + AS + VALUE_COUNT_ALIAS + ", " + + STATE + ", " + + // Auxiliary field to order the 'state' column and to prioritize TO_POST and TO_UPDATE + SELECT_STATE_ORDERING + + FROM_CLAUSE; + + private static final String GROUP_BY_CLAUSE = " GROUP BY " + + DATASET_UID + "," + + PERIOD + "," + + ORGANISATION_UNIT_UID + "," + + ATTRIBUTE_OPTION_COMBO_UID; + + @Override + public String selectWhere(String whereClause) { + return SELECT_CLAUSE + " WHERE " + whereClause + GROUP_BY_CLAUSE; + } + + @Override + public String selectWhere(String whereClause, int limit) { + return selectWhere(whereClause) + " LIMIT " + limit; + } + + @Override + public String selectAll() { + return SELECT_CLAUSE + GROUP_BY_CLAUSE; + } + + @Override + public String count() { + return "SELECT count(*) FROM (" + selectAll() + ")"; + } + + @Override + public String countWhere(String whereClause) { + return "SELECT count(*) FROM (" + selectWhere(whereClause) + ")"; + } + + @Override + public String selectWhere(String whereClause, String orderByClause) { + return selectWhere(whereClause) + " ORDER BY " + orderByClause; + } + + @Override + public String selectWhere(String whereClause, String orderByClause, int limit) { + return selectWhere(whereClause, orderByClause) + " LIMIT " + limit; + } + + @Override + public String selectOneOrderedBy(String orderingColumName, SQLOrderType orderingType) { + return selectWhere("1", orderingColumName + " " + orderingType, 1); + } + + private static String getJoinPeriod() { + return INNER_JOIN + PeriodTableInfo.TABLE_INFO.name() + AS + PERIOD_TABLE_ALIAS + + ON + PERIOD + EQ + PERIOD_TABLE_ALIAS + "." + PeriodTableInfo.Columns.PERIOD_ID; + } + + private static String getJoinDataSetElement() { + return INNER_JOIN + DataSetDataElementLinkTableInfo.TABLE_INFO.name() + AS + DATASETELEMENT_TABLE_ALIAS + + ON + DATAVALUE_TABLE_ALIAS + "." + DataValueFields.DATA_ELEMENT + EQ + + DATASETELEMENT_TABLE_ALIAS + "." + DataSetDataElementLinkTableInfo.Columns.DATA_ELEMENT; + } + + private static String getJoinOrganisationUnit() { + return INNER_JOIN + OrganisationUnitTableInfo.TABLE_INFO.name() + AS + ORGUNIT_TABLE_ALIAS + + ON + DATAVALUE_TABLE_ALIAS + "." + DataValueTableInfo.ORGANISATION_UNIT + EQ + + ORGUNIT_TABLE_ALIAS + "." + BaseIdentifiableObjectModel.Columns.UID; + } + + private static String getJoinDataSet() { + return INNER_JOIN + DataSetTableInfo.TABLE_INFO.name() + AS + DATASET_TABLE_ALIAS + + ON + DATASETELEMENT_TABLE_ALIAS + "." + DataSetDataElementLinkTableInfo.Columns.DATA_SET + EQ + + DATASET_TABLE_ALIAS + "." + BaseIdentifiableObjectModel.Columns.UID; + } + + private static String getJoinAttributeOptionCombo() { + return INNER_JOIN + CategoryOptionComboTableInfo.TABLE_INFO.name() + AS + AOC_TABLE_ALIAS + + ON + DATAVALUE_TABLE_ALIAS + "." + DataValueFields.ATTRIBUTE_OPTION_COMBO + EQ + + AOC_TABLE_ALIAS + "." + BaseIdentifiableObjectModel.Columns.UID; + } +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/arch/call/D2CallWithProgressImpl.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportStore.java similarity index 60% rename from core/src/main/java/org/hisp/dhis/android/core/arch/call/D2CallWithProgressImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportStore.java index 7ae735f998..69e494fd8c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/arch/call/D2CallWithProgressImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataSetReportStore.java @@ -26,20 +26,26 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.arch.call; +package org.hisp.dhis.android.core.datavalue.internal; -import io.reactivex.Observable; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.ReadOnlySQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ReadableStoreImpl; +import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.datavalue.DataSetReport; -public class D2CallWithProgressImpl implements D2CallWithProgress { +public final class DataSetReportStore extends ReadableStoreImpl { - private final Observable observable; - - public D2CallWithProgressImpl(Observable observable) { - this.observable = observable; + private DataSetReportStore(DatabaseAdapter databaseAdapter, + ReadOnlySQLStatementBuilder builder, + CursorModelFactory modelFactory) { + super(databaseAdapter, builder, modelFactory); } - @Override - public Observable asObservable() { - return observable; + static DataSetReportStore create(DatabaseAdapter databaseAdapter) { + return new DataSetReportStore( + databaseAdapter, + new DataSetReportSQLStatementBuilder(), + DataSetReport::create); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueEndpointCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallFactory.java similarity index 76% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueEndpointCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallFactory.java index 4c84010f86..7a1865caf7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueEndpointCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallFactory.java @@ -26,18 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.QueryCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.PayloadResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.resource.Resource; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.PayloadResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.datavalue.DataValue; +import org.hisp.dhis.android.core.resource.internal.Resource; import javax.inject.Inject; @@ -49,12 +50,12 @@ final class DataValueEndpointCallFactory extends QueryCallFactoryImpl { private final Resource.Type resourceType = Resource.Type.DATA_VALUE; - private final SyncHandler dataValueHandler; + private final Handler dataValueHandler; @Inject DataValueEndpointCallFactory(GenericCallData data, APICallExecutor apiCallExecutor, - SyncHandler dataValueHandler) { + Handler dataValueHandler) { super(data, apiCallExecutor); this.dataValueHandler = dataValueHandler; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEntityDIModule.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEntityDIModule.java index bba40226d3..efaf641582 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEntityDIModule.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; -import org.hisp.dhis.android.core.arch.handlers.ObjectWithoutUidSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +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.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.datavalue.DataValue; import java.util.Collections; import java.util.Map; @@ -51,8 +52,8 @@ DataValueStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - SyncHandler handler(DataValueStore dataValueStore) { - return new ObjectWithoutUidSyncHandlerImpl<>(dataValueStore); + Handler handler(DataValueStore dataValueStore) { + return new ObjectWithoutUidHandlerImpl<>(dataValueStore); } @Provides diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueFields.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueFields.java similarity index 70% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueFields.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueFields.java index 9c9702e0ea..52de0edde8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueFields.java @@ -26,26 +26,27 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +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.datavalue.DataValue; -final class DataValueFields { +public final class DataValueFields { - static final String DATA_ELEMENT = "dataElement"; - static final String PERIOD = "period"; - static final String ORGANISATION_UNIT = "orgUnit"; - static final String CATEGORY_OPTION_COMBO = "categoryOptionCombo"; - static final String ATTRIBUTE_OPTION_COMBO = "attributeOptionCombo"; - static final String VALUE = "value"; - static final String STORED_BY = "storedBy"; - static final String CREATED = "created"; - static final String LAST_UPDATED = "lastUpdated"; - static final String COMMENT = "comment"; - static final String FOLLOW_UP = "followup"; - static final String DELETED = "deleted"; + public static final String DATA_ELEMENT = "dataElement"; + public static final String PERIOD = "period"; + public static final String ORGANISATION_UNIT = "orgUnit"; + public static final String CATEGORY_OPTION_COMBO = "categoryOptionCombo"; + public static final String ATTRIBUTE_OPTION_COMBO = "attributeOptionCombo"; + public static final String VALUE = "value"; + public static final String STORED_BY = "storedBy"; + public static final String CREATED = "created"; + public static final String LAST_UPDATED = "lastUpdated"; + public static final String COMMENT = "comment"; + public static final String FOLLOW_UP = "followup"; + public static final String DELETED = "deleted"; private static FieldsHelper fieldsHelper = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueImportHandler.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueImportHandler.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueImportHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueImportHandler.java index 08459457e2..adffc96b97 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueImportHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueImportHandler.java @@ -26,13 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.datavalue.internal; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.datavalue.DataValue; import org.hisp.dhis.android.core.imports.ImportStatus; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; + +import androidx.annotation.NonNull; final class DataValueImportHandler { diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueModuleWiper.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueModuleWiper.java index be3c3b9ef8..277b4a2070 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueModuleWiper.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; +import org.hisp.dhis.android.core.datavalue.DataValueTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValuePackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePackageDIModule.java similarity index 87% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValuePackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePackageDIModule.java index 15494dd8b7..2ed29e27e4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValuePackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePackageDIModule.java @@ -26,16 +26,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; -import org.hisp.dhis.android.core.calls.factories.QueryCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCallFactory; +import org.hisp.dhis.android.core.datavalue.DataValue; import dagger.Module; import dagger.Provides; import dagger.Reusable; import retrofit2.Retrofit; -@Module(includes = {DataValueEntityDIModule.class}) +@Module(includes = { + DataValueEntityDIModule.class, + DataSetReportEntityDIModule.class +}) public final class DataValuePackageDIModule { @Provides diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValuePostCall.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValuePostCall.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.java index 83e8bbbc1b..a9cbb2f413 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValuePostCall.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCall.java @@ -26,13 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.datavalue.DataValue; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; import java.util.ArrayList; import java.util.Collection; @@ -40,10 +39,11 @@ import javax.inject.Inject; +import androidx.annotation.NonNull; import dagger.Reusable; @Reusable -final class DataValuePostCall implements Callable { +public final class DataValuePostCall implements Callable { private final DataValueService dataValueService; private final DataValueStore dataValueStore; diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueQuery.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.java index 053d3070ae..1cc8107113 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueQuery.java @@ -26,11 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.common.BaseQuery; +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueService.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueService.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.java index 6b31804682..4767345a08 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueService.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Filter; -import org.hisp.dhis.android.core.data.api.Where; -import org.hisp.dhis.android.core.data.api.Which; -import org.hisp.dhis.android.core.imports.DataValueImportSummary; +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; +import org.hisp.dhis.android.core.arch.api.filters.internal.Filter; +import org.hisp.dhis.android.core.arch.api.filters.internal.Where; +import org.hisp.dhis.android.core.arch.api.filters.internal.Which; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.datavalue.DataValue; +import org.hisp.dhis.android.core.imports.internal.DataValueImportSummary; import retrofit2.Call; import retrofit2.http.Body; diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueSet.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueSet.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueSet.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueSet.java index c7ae0be854..a708954953 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueSet.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueSet.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; + +import org.hisp.dhis.android.core.datavalue.DataValue; import java.util.Collection; diff --git a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueStore.java b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueStore.java similarity index 86% rename from core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueStore.java rename to core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueStore.java index 9fa779dc27..7740511dda 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/datavalue/DataValueStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/datavalue/internal/DataValueStore.java @@ -26,19 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.datavalue; +package org.hisp.dhis.android.core.datavalue.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.WhereStatementBinder; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStoreImpl; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilderImpl; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStoreImpl; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.datavalue.DataValue; +import org.hisp.dhis.android.core.datavalue.DataValueTableInfo; import java.util.Collection; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; @SuppressWarnings("PMD.ClassWithOnlyPrivateConstructorsShouldBeFinal") public class DataValueStore extends ObjectWithoutUidStoreImpl { @@ -76,14 +78,14 @@ public class DataValueStore extends ObjectWithoutUidStoreImpl { sqLiteBind(sqLiteStatement, 5, dataValue.attributeOptionCombo()); }; - private DataValueStore(DatabaseAdapter databaseAdapter, SQLStatementBuilder builder) { + private DataValueStore(DatabaseAdapter databaseAdapter, SQLStatementBuilderImpl builder) { super(databaseAdapter, builder, BINDER, WHERE_UPDATE_BINDER, WHERE_DELETE_BINDER, DataValue::create); } public static DataValueStore create(DatabaseAdapter databaseAdapter) { - SQLStatementBuilder sqlStatementBuilder = - new SQLStatementBuilder(DataValueTableInfo.TABLE_INFO.name(), + SQLStatementBuilderImpl sqlStatementBuilder = + new SQLStatementBuilderImpl(DataValueTableInfo.TABLE_INFO.name(), DataValueTableInfo.TABLE_INFO.columns()); return new DataValueStore(databaseAdapter, sqlStatementBuilder); diff --git a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/AggregatedInternalModule.java b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/AggregatedInternalModule.java deleted file mode 100644 index ce276833ac..0000000000 --- a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/AggregatedInternalModule.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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; - -import javax.inject.Inject; - -import dagger.Reusable; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - -@Reusable -@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") -public final class AggregatedInternalModule { - - public final AggregatedModule publicModule; - - @Inject - AggregatedInternalModule(AggregatedModule publicModule) { - this.publicModule = publicModule; - } -} \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCall.java b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCall.java index d35aca88e7..97e06c721c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCall.java +++ b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCall.java @@ -27,22 +27,21 @@ */ package org.hisp.dhis.android.core.domain.aggregated.data; -import org.hisp.dhis.android.core.arch.api.executors.RxAPICallExecutor; -import org.hisp.dhis.android.core.arch.call.D2CallWithProgress; +import org.hisp.dhis.android.core.arch.api.executors.internal.RxAPICallExecutor; import org.hisp.dhis.android.core.arch.call.D2Progress; -import org.hisp.dhis.android.core.arch.call.D2ProgressManager; +import org.hisp.dhis.android.core.arch.call.factories.internal.QueryCallFactory; +import org.hisp.dhis.android.core.arch.call.internal.D2ProgressManager; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithDownloadObjectRepository; -import org.hisp.dhis.android.core.calls.factories.QueryCallFactory; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; import org.hisp.dhis.android.core.dataset.DataSet; import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistration; -import org.hisp.dhis.android.core.dataset.DataSetCompleteRegistrationQuery; +import org.hisp.dhis.android.core.dataset.internal.DataSetCompleteRegistrationQuery; import org.hisp.dhis.android.core.datavalue.DataValue; -import org.hisp.dhis.android.core.datavalue.DataValueQuery; +import org.hisp.dhis.android.core.datavalue.internal.DataValueQuery; import org.hisp.dhis.android.core.period.Period; -import org.hisp.dhis.android.core.period.PeriodStore; +import org.hisp.dhis.android.core.period.internal.PeriodStore; import org.hisp.dhis.android.core.systeminfo.SystemInfo; -import org.hisp.dhis.android.core.user.UserOrganisationUnitLinkStore; +import org.hisp.dhis.android.core.user.internal.UserOrganisationUnitLinkStore; import java.util.ArrayList; import java.util.Collection; @@ -87,7 +86,7 @@ final class AggregatedDataCall { this.rxCallExecutor = rxCallExecutor; } - D2CallWithProgress asCompletable() { + Observable download() { D2ProgressManager progressManager = new D2ProgressManager(3); Observable observable = systemInfoRepository.download() diff --git a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataModule.java b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataModule.java index 072010e487..edb192935f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataModule.java @@ -27,11 +27,12 @@ */ package org.hisp.dhis.android.core.domain.aggregated.data; -import org.hisp.dhis.android.core.arch.call.D2CallWithProgress; +import org.hisp.dhis.android.core.arch.call.D2Progress; import javax.inject.Inject; import dagger.Reusable; +import io.reactivex.Observable; @Reusable public final class AggregatedDataModule { @@ -43,7 +44,7 @@ public final class AggregatedDataModule { this.aggregatedDataCall = aggregatedDataCall; } - public D2CallWithProgress download() { - return aggregatedDataCall.asCompletable(); + public Observable download() { + return aggregatedDataCall.download(); } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/calls/MetadataCall.java b/core/src/main/java/org/hisp/dhis/android/core/domain/metadata/MetadataCall.java similarity index 54% rename from core/src/main/java/org/hisp/dhis/android/core/calls/MetadataCall.java rename to core/src/main/java/org/hisp/dhis/android/core/domain/metadata/MetadataCall.java index fbb159082d..0fa818c665 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/calls/MetadataCall.java +++ b/core/src/main/java/org/hisp/dhis/android/core/domain/metadata/MetadataCall.java @@ -25,37 +25,41 @@ * (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.calls; - -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.category.CategoryModuleDownloader; -import org.hisp.dhis.android.core.common.D2CallExecutor; -import org.hisp.dhis.android.core.common.Unit; -import org.hisp.dhis.android.core.constant.ConstantModuleDownloader; +package org.hisp.dhis.android.core.domain.metadata; + +import org.hisp.dhis.android.core.arch.api.executors.internal.RxAPICallExecutor; +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.category.Category; +import org.hisp.dhis.android.core.category.internal.CategoryModuleDownloader; +import org.hisp.dhis.android.core.constant.Constant; +import org.hisp.dhis.android.core.constant.internal.ConstantModuleDownloader; import org.hisp.dhis.android.core.dataset.DataSet; -import org.hisp.dhis.android.core.dataset.DataSetModuleDownloader; -import org.hisp.dhis.android.core.maintenance.ForeignKeyCleaner; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitModuleDownloader; +import org.hisp.dhis.android.core.dataset.internal.DataSetModuleDownloader; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitModuleDownloader; import org.hisp.dhis.android.core.program.Program; -import org.hisp.dhis.android.core.program.ProgramModuleDownloader; -import org.hisp.dhis.android.core.settings.SystemSettingModuleDownloader; +import org.hisp.dhis.android.core.program.internal.ProgramModuleDownloader; +import org.hisp.dhis.android.core.settings.SystemSetting; +import org.hisp.dhis.android.core.settings.internal.SystemSettingModuleDownloader; import org.hisp.dhis.android.core.sms.SmsModule; -import org.hisp.dhis.android.core.systeminfo.SystemInfoModuleDownloader; +import org.hisp.dhis.android.core.systeminfo.SystemInfo; +import org.hisp.dhis.android.core.systeminfo.internal.SystemInfoModuleDownloader; import org.hisp.dhis.android.core.user.User; -import org.hisp.dhis.android.core.user.UserModuleDownloader; +import org.hisp.dhis.android.core.user.internal.UserModuleDownloader; import java.util.List; -import java.util.concurrent.Callable; import javax.inject.Inject; +import androidx.annotation.NonNull; import dagger.Reusable; +import io.reactivex.Observable; @Reusable -public class MetadataCall implements Callable { +public class MetadataCall { - private final D2CallExecutor d2CallExecutor; + private final RxAPICallExecutor rxCallExecutor; private final SystemInfoModuleDownloader systemInfoDownloader; private final SystemSettingModuleDownloader systemSettingDownloader; @@ -65,11 +69,10 @@ public class MetadataCall implements Callable { private final OrganisationUnitModuleDownloader organisationUnitDownloadModule; private final DataSetModuleDownloader dataSetDownloader; private final ConstantModuleDownloader constantModuleDownloader; - private final ForeignKeyCleaner foreignKeyCleaner; private final SmsModule smsModule; @Inject - public MetadataCall(@NonNull D2CallExecutor d2CallExecutor, + public MetadataCall(@NonNull RxAPICallExecutor rxCallExecutor, @NonNull SystemInfoModuleDownloader systemInfoDownloader, @NonNull SystemSettingModuleDownloader systemSettingDownloader, @NonNull UserModuleDownloader userModuleDownloader, @@ -78,9 +81,8 @@ public MetadataCall(@NonNull D2CallExecutor d2CallExecutor, @NonNull OrganisationUnitModuleDownloader organisationUnitDownloadModule, @NonNull DataSetModuleDownloader dataSetDownloader, @NonNull ConstantModuleDownloader constantModuleDownloader, - @NonNull ForeignKeyCleaner foreignKeyCleaner, @NonNull SmsModule smsModule) { - this.d2CallExecutor = d2CallExecutor; + this.rxCallExecutor = rxCallExecutor; this.systemInfoDownloader = systemInfoDownloader; this.systemSettingDownloader = systemSettingDownloader; this.userModuleDownloader = userModuleDownloader; @@ -89,35 +91,50 @@ public MetadataCall(@NonNull D2CallExecutor d2CallExecutor, this.organisationUnitDownloadModule = organisationUnitDownloadModule; this.dataSetDownloader = dataSetDownloader; this.constantModuleDownloader = constantModuleDownloader; - this.foreignKeyCleaner = foreignKeyCleaner; this.smsModule = smsModule; } - @Override - public Unit call() throws Exception { + public Observable download() { + + return rxCallExecutor.wrapObservableTransactionally(Observable.create(emitter -> { + D2ProgressManager progressManager = new D2ProgressManager(9); + + systemInfoDownloader.downloadMetadata().blockingAwait(); + emitter.onNext(progressManager.increaseProgress(SystemInfo.class, false)); + + systemSettingDownloader.downloadMetadata().call(); + emitter.onNext(progressManager.increaseProgress(SystemSetting.class, false)); + + + User user = userModuleDownloader.downloadMetadata().call(); + emitter.onNext(progressManager.increaseProgress(User.class, false)); + + + List programs = programDownloader.downloadMetadata().call(); + emitter.onNext(progressManager.increaseProgress(Program.class, false)); - return d2CallExecutor.executeD2CallTransactionally(() -> { - systemInfoDownloader.downloadMetadata().blockingAwait(); - systemSettingDownloader.downloadMetadata().call(); + List dataSets = dataSetDownloader.downloadMetadata().call(); + emitter.onNext(progressManager.increaseProgress(DataSet.class, false)); - User user = userModuleDownloader.downloadMetadata().call(); - List programs = programDownloader.downloadMetadata().call(); + categoryDownloader.downloadMetadata().call(); + emitter.onNext(progressManager.increaseProgress(Category.class, false)); - List dataSets = dataSetDownloader.downloadMetadata().call(); - categoryDownloader.downloadMetadata().call(); + organisationUnitDownloadModule.downloadMetadata(user, programs, dataSets).call(); + emitter.onNext(progressManager.increaseProgress(OrganisationUnit.class, false)); - organisationUnitDownloadModule.downloadMetadata(user, programs, dataSets).call(); - constantModuleDownloader.downloadMetadata().call(); + constantModuleDownloader.downloadMetadata().call(); + emitter.onNext(progressManager.increaseProgress(Constant.class, false)); - smsModule.configCase().refreshMetadataIdsCallable().call(); - foreignKeyCleaner.cleanForeignKeyErrors(); + smsModule.configCase().refreshMetadataIdsCallable().call(); + emitter.onNext(progressManager.increaseProgress(SmsModule.class, false)); - return new Unit(); - }); + emitter.onComplete(); + } + ), true); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/Enrollment.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/Enrollment.java index ab9d4a139c..fe43df337f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/Enrollment.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/Enrollment.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.enrollment; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -49,12 +48,15 @@ import org.hisp.dhis.android.core.data.database.DbEnrollmentStatusColumnAdapter; import org.hisp.dhis.android.core.data.database.IgnoreEventListColumnAdapter; import org.hisp.dhis.android.core.data.database.IgnoreNoteListColumnAdapter; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentFields; import org.hisp.dhis.android.core.enrollment.note.Note; import org.hisp.dhis.android.core.event.Event; import java.util.Date; import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_Enrollment.Builder.class) public abstract class Enrollment extends BaseDataModel implements ObjectWithDeleteInterface, ObjectWithUidInterface { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentCollectionRepository.java index 1c747f0fec..17d8cd63e3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentCollectionRepository.java @@ -28,20 +28,22 @@ package org.hisp.dhis.android.core.enrollment; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadWriteWithUidCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.DoubleFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadWriteWithUidCollectionRepositoryImpl; +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.DoubleFilterConnector; +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.arch.repositories.scope.RepositoryScopeHelper; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeHelper; import org.hisp.dhis.android.core.common.BaseDataModel; -import org.hisp.dhis.android.core.common.DataStatePropagator; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.common.Transformer; +import org.hisp.dhis.android.core.common.internal.DataStatePropagator; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentFields; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentModel.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentModel.java index fd8f2acc9b..b2eb3b4698 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentModel.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.enrollment; import android.database.Cursor; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -41,6 +39,9 @@ import java.util.Date; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class EnrollmentModel extends BaseDataModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentObjectRepository.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentObjectRepository.java index 39f364915a..c47749c4aa 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentObjectRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentObjectRepository.java @@ -28,15 +28,16 @@ package org.hisp.dhis.android.core.enrollment; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.arch.repositories.object.ReadWriteObjectRepository; -import org.hisp.dhis.android.core.arch.repositories.object.ReadWriteWithUidDataObjectRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.object.internal.ReadWriteWithUidDataObjectRepositoryImpl; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.Coordinates; -import org.hisp.dhis.android.core.common.DataStatePropagator; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.common.Unit; +import org.hisp.dhis.android.core.common.internal.DataStatePropagator; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.Date; diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStatusColumnAdapter.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStatusColumnAdapter.java index ee282f6b47..bb2f684c98 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStatusColumnAdapter.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStatusColumnAdapter.java @@ -28,10 +28,10 @@ package org.hisp.dhis.android.core.enrollment; -import androidx.annotation.NonNull; - import org.hisp.dhis.android.core.data.database.EnumColumnAdapter; +import androidx.annotation.NonNull; + class EnrollmentStatusColumnAdapter extends EnumColumnAdapter { @Override diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentTableInfo.java index a42dbfe18b..48faa31c63 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentTableInfo.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.enrollment; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentFields; import org.hisp.dhis.android.core.utils.Utils; public final class EnrollmentTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentChildrenAppender.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentChildrenAppender.java index b73e09ec7c..2d1334c2bf 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentChildrenAppender.java @@ -25,12 +25,13 @@ * (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.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.SingleParentChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.enrollment.Enrollment; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; public final class EnrollmentChildrenAppender extends ChildrenAppender { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentEntityDIModule.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentEntityDIModule.java index b4f86465a9..03baeff47e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentEntityDIModule.java @@ -26,19 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.cleaners.internal.DataOrphanCleanerImpl; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleaner; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.common.BaseDataModel; -import org.hisp.dhis.android.core.common.DataOrphanCleanerImpl; -import org.hisp.dhis.android.core.common.OrphanCleaner; -import org.hisp.dhis.android.core.common.Transformer; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import org.hisp.dhis.android.core.enrollment.note.NoteChildrenAppender; +import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.enrollment.EnrollmentCreateProjection; +import org.hisp.dhis.android.core.enrollment.note.internal.NoteChildrenAppender; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventChildrenAppender; -import org.hisp.dhis.android.core.event.EventFields; +import org.hisp.dhis.android.core.event.internal.EventChildrenAppender; +import org.hisp.dhis.android.core.event.internal.EventFields; import org.hisp.dhis.android.core.event.EventTableInfo; import java.util.HashMap; @@ -59,7 +61,7 @@ public EnrollmentStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - public SyncHandlerWithTransformer handler(EnrollmentHandler impl) { + public HandlerWithTransformer handler(EnrollmentHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentFields.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentFields.java similarity index 74% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentFields.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentFields.java index deac075190..78283c2741 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentFields.java @@ -26,32 +26,34 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; +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.Coordinates; -import org.hisp.dhis.android.core.data.api.Fields; +import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; import org.hisp.dhis.android.core.enrollment.note.Note; -import org.hisp.dhis.android.core.enrollment.note.NoteFields; +import org.hisp.dhis.android.core.enrollment.note.internal.NoteFields; import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventFields; +import org.hisp.dhis.android.core.event.internal.EventFields; public final class EnrollmentFields { - static final String UID = "enrollment"; - static final String CREATED = "created"; - static final String LAST_UPDATED = "lastUpdated"; - static final String ORGANISATION_UNIT = "orgUnit"; + public static final String UID = "enrollment"; + public static final String CREATED = "created"; + public static final String LAST_UPDATED = "lastUpdated"; + public static final String ORGANISATION_UNIT = "orgUnit"; public static final String PROGRAM = "program"; public static final String ENROLLMENT_DATE = "enrollmentDate"; - static final String INCIDENT_DATE = "incidentDate"; - static final String FOLLOW_UP = "followup"; + public static final String INCIDENT_DATE = "incidentDate"; + public static final String FOLLOW_UP = "followup"; public static final String STATUS = "status"; public static final String TRACKED_ENTITY_INSTANCE = "trackedEntityInstance"; - private static final String COORDINATE = "coordinate"; - static final String DELETED = "deleted"; - static final String EVENTS = "events"; - static final String NOTES = "notes"; + public static final String COORDINATE = "coordinate"; + public static final String DELETED = "deleted"; + public static final String EVENTS = "events"; + public static final String NOTES = "notes"; private static FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentHandler.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentHandler.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentHandler.java index 9d3c6f9ea3..9417512783 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentHandler.java @@ -26,17 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableDataSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.OrphanCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleaner; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableDataHandlerImpl; import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.enrollment.Enrollment; import org.hisp.dhis.android.core.enrollment.note.Note; -import org.hisp.dhis.android.core.enrollment.note.NoteDHISVersionManager; -import org.hisp.dhis.android.core.enrollment.note.NoteUniquenessManager; +import org.hisp.dhis.android.core.enrollment.note.internal.NoteDHISVersionManager; +import org.hisp.dhis.android.core.enrollment.note.internal.NoteUniquenessManager; import org.hisp.dhis.android.core.event.Event; import java.util.ArrayList; @@ -49,19 +50,19 @@ import dagger.Reusable; @Reusable -final class EnrollmentHandler extends IdentifiableDataSyncHandlerImpl { +final class EnrollmentHandler extends IdentifiableDataHandlerImpl { private final NoteDHISVersionManager noteVersionManager; - private final SyncHandlerWithTransformer eventHandler; - private final SyncHandler noteHandler; + private final HandlerWithTransformer eventHandler; + private final Handler noteHandler; private final NoteUniquenessManager noteUniquenessManager; private final OrphanCleaner eventOrphanCleaner; @Inject EnrollmentHandler(@NonNull NoteDHISVersionManager noteVersionManager, @NonNull EnrollmentStore enrollmentStore, - @NonNull SyncHandlerWithTransformer eventHandler, + @NonNull HandlerWithTransformer eventHandler, @NonNull OrphanCleaner eventOrphanCleaner, - @NonNull SyncHandler noteHandler, + @NonNull Handler noteHandler, @NonNull NoteUniquenessManager noteUniquenessManager) { super(enrollmentStore); this.noteVersionManager = noteVersionManager; diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentImportHandler.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentImportHandler.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentImportHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentImportHandler.java index c9a4f97b5a..58715fd9df 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentImportHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentImportHandler.java @@ -26,22 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; import org.hisp.dhis.android.core.common.BaseDataModel; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.ObjectStore; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.enrollment.EnrollmentTableInfo; import org.hisp.dhis.android.core.enrollment.note.Note; import org.hisp.dhis.android.core.enrollment.note.NoteTableInfo; -import org.hisp.dhis.android.core.event.EventImportHandler; -import org.hisp.dhis.android.core.imports.EnrollmentImportSummary; -import org.hisp.dhis.android.core.imports.EventImportSummaries; -import org.hisp.dhis.android.core.imports.ImportConflict; +import org.hisp.dhis.android.core.event.internal.EventImportHandler; import org.hisp.dhis.android.core.imports.TrackerImportConflict; import org.hisp.dhis.android.core.imports.TrackerImportConflictTableInfo; +import org.hisp.dhis.android.core.imports.internal.EnrollmentImportSummary; +import org.hisp.dhis.android.core.imports.internal.EventImportSummaries; +import org.hisp.dhis.android.core.imports.internal.ImportConflict; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStore; import java.util.ArrayList; @@ -53,7 +54,7 @@ import androidx.annotation.NonNull; import dagger.Reusable; -import static org.hisp.dhis.android.core.utils.StoreUtils.getState; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.getState; @Reusable public class EnrollmentImportHandler { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentModuleWiper.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentModuleWiper.java index addd4b672d..73f7f05f5f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentModuleWiper.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; +import org.hisp.dhis.android.core.enrollment.EnrollmentTableInfo; import org.hisp.dhis.android.core.enrollment.note.NoteTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentPackageDIModule.java similarity index 92% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentPackageDIModule.java index 382d1f5a02..1a26d3e51b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentPackageDIModule.java @@ -26,9 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; -import org.hisp.dhis.android.core.enrollment.note.NoteEntityDIModule; +import org.hisp.dhis.android.core.enrollment.note.internal.NoteEntityDIModule; import dagger.Module; diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentProjectionTransformer.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentProjectionTransformer.java similarity index 87% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentProjectionTransformer.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentProjectionTransformer.java index 786ef170bd..c655c57637 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentProjectionTransformer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentProjectionTransformer.java @@ -26,11 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.common.Transformer; +import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.enrollment.EnrollmentCreateProjection; +import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; import org.hisp.dhis.android.core.utils.CodeGeneratorImpl; import java.util.Date; @@ -52,6 +55,7 @@ public Enrollment transform(EnrollmentCreateProjection projection) { .organisationUnit(projection.organisationUnit()) .program(projection.program()) .trackedEntityInstance(projection.trackedEntityInstance()) + .status(EnrollmentStatus.ACTIVE) .build(); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStore.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStore.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStore.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStore.java index ccad9e271f..d1660542fb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStore.java @@ -26,9 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; +package org.hisp.dhis.android.core.enrollment.internal; -import org.hisp.dhis.android.core.common.IdentifiableObjectWithStateStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectWithStateStore; +import org.hisp.dhis.android.core.enrollment.Enrollment; import java.util.List; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreImpl.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreImpl.java index cede60107f..46c4956b03 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/EnrollmentStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreImpl.java @@ -26,19 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment; - -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; +package org.hisp.dhis.android.core.enrollment.internal; + +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilderImpl; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.statementwrapper.internal.SQLStatementWrapper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectWithStateStoreImpl; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.helpers.CoordinateHelper; import org.hisp.dhis.android.core.common.BaseDataModel; -import org.hisp.dhis.android.core.common.CoordinateHelper; -import org.hisp.dhis.android.core.common.CursorModelFactory; -import org.hisp.dhis.android.core.common.IdentifiableObjectWithStateStoreImpl; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; -import org.hisp.dhis.android.core.common.SQLStatementWrapper; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.enrollment.EnrollmentTableInfo; import java.util.ArrayList; import java.util.Arrays; @@ -46,7 +48,7 @@ import java.util.List; import java.util.Map; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class EnrollmentStoreImpl extends IdentifiableObjectWithStateStoreImpl implements EnrollmentStore { @@ -75,7 +77,7 @@ public final class EnrollmentStoreImpl private EnrollmentStoreImpl(DatabaseAdapter databaseAdapter, SQLStatementWrapper statementWrapper, - SQLStatementBuilder builder, + SQLStatementBuilderImpl builder, StatementBinder binder, CursorModelFactory modelFactory) { super(databaseAdapter, statementWrapper, builder, binder, modelFactory); @@ -108,7 +110,7 @@ private void addEnrollmentToMap(Map> enrollmentMap, Enr } public static EnrollmentStore create(DatabaseAdapter databaseAdapter) { - SQLStatementBuilder statementBuilder = new SQLStatementBuilder( + SQLStatementBuilderImpl statementBuilder = new SQLStatementBuilderImpl( EnrollmentTableInfo.TABLE_INFO.name(), EnrollmentTableInfo.TABLE_INFO.columns()); SQLStatementWrapper statementWrapper = new SQLStatementWrapper(statementBuilder, databaseAdapter); diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/Note.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/Note.java index fff3015ada..d5a79e2e52 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/Note.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/Note.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.enrollment.note; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -39,6 +38,9 @@ import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.ObjectWithUidInterface; +import org.hisp.dhis.android.core.enrollment.note.internal.NoteFields; + +import androidx.annotation.Nullable; @AutoValue @JsonDeserialize(builder = AutoValue_Note.Builder.class) diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteModel.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteModel.java index 3fbdc6cc7b..11f92ea638 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.enrollment.note; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -41,6 +40,8 @@ import java.util.Date; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class NoteModel extends BaseDataModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteTableInfo.java index 12662006d9..0d2328c68a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteTableInfo.java @@ -28,10 +28,11 @@ package org.hisp.dhis.android.core.enrollment.note; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.enrollment.note.internal.NoteFields; import org.hisp.dhis.android.core.utils.Utils; public final class NoteTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteChildrenAppender.java similarity index 87% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteChildrenAppender.java index 2ab60fc183..70da6e7d3a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteChildrenAppender.java @@ -25,13 +25,14 @@ * (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.enrollment.note; +package org.hisp.dhis.android.core.enrollment.note.internal; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.SingleParentChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.enrollment.note.Note; public final class NoteChildrenAppender extends ChildrenAppender { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteDHISVersionManager.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteDHISVersionManager.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteDHISVersionManager.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteDHISVersionManager.java index 2734257716..4a39e23890 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteDHISVersionManager.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteDHISVersionManager.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment.note; +package org.hisp.dhis.android.core.enrollment.note.internal; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.enrollment.note.Note; import org.hisp.dhis.android.core.systeminfo.DHISVersionManager; import java.text.ParseException; diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteEntityDIModule.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteEntityDIModule.java index 5b660f8f4c..5547116dd7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteEntityDIModule.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment.note; +package org.hisp.dhis.android.core.enrollment.note.internal; -import org.hisp.dhis.android.core.arch.handlers.ObjectWithoutUidSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +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.database.DatabaseAdapter; +import org.hisp.dhis.android.core.enrollment.note.Note; import dagger.Module; import dagger.Provides; @@ -48,7 +49,7 @@ public ObjectWithoutUidStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - public SyncHandler handler(ObjectWithoutUidStore store) { - return new ObjectWithoutUidSyncHandlerImpl<>(store); + public Handler handler(ObjectWithoutUidStore store) { + return new ObjectWithoutUidHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteFields.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteFields.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteFields.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteFields.java index 36e75fb36e..3bc6adba1c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteFields.java @@ -26,18 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment.note; +package org.hisp.dhis.android.core.enrollment.note.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +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.enrollment.note.Note; public final class NoteFields { - final static String UID = "note"; - final static String VALUE = "value"; - final static String STORED_BY = "storedBy"; - final static String STORED_DATE = "storedDate"; + public final static String UID = "note"; + public final static String VALUE = "value"; + public final static String STORED_BY = "storedBy"; + public final static String STORED_DATE = "storedDate"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteStore.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteStore.java similarity index 82% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteStore.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteStore.java index 657310e613..68773c7dd7 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteStore.java @@ -26,16 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment.note; +package org.hisp.dhis.android.core.enrollment.note.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.WhereStatementBinder; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.WhereStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.enrollment.note.Note; +import org.hisp.dhis.android.core.enrollment.note.NoteTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class NoteStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteToPostTransformer.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteToPostTransformer.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteToPostTransformer.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteToPostTransformer.java index c8a00154ed..8d4fbd1551 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteToPostTransformer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteToPostTransformer.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment.note; +package org.hisp.dhis.android.core.enrollment.note.internal; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; -import org.hisp.dhis.android.core.common.Transformer; +import org.hisp.dhis.android.core.enrollment.note.Note; import org.hisp.dhis.android.core.systeminfo.DHISVersionManager; import java.text.ParseException; diff --git a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteUniquenessManager.java b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteUniquenessManager.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteUniquenessManager.java rename to core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteUniquenessManager.java index c7c5d8fece..9ad1e9174e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/NoteUniquenessManager.java +++ b/core/src/main/java/org/hisp/dhis/android/core/enrollment/note/internal/NoteUniquenessManager.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.enrollment.note; +package org.hisp.dhis.android.core.enrollment.note.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectWithoutUidStore; import org.hisp.dhis.android.core.common.BaseDataModel; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; import org.hisp.dhis.android.core.common.State; +import org.hisp.dhis.android.core.enrollment.note.Note; +import org.hisp.dhis.android.core.enrollment.note.NoteTableInfo; import java.util.Collection; import java.util.HashSet; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/Event.java b/core/src/main/java/org/hisp/dhis/android/core/event/Event.java index b6fd8d8725..6e37796c2e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/Event.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/Event.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.event; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -47,11 +46,14 @@ import org.hisp.dhis.android.core.data.database.DbDateColumnAdapter; import org.hisp.dhis.android.core.data.database.DbEventStatusColumnAdapter; import org.hisp.dhis.android.core.data.database.IgnoreTrackedEntityDataValueListColumnAdapter; +import org.hisp.dhis.android.core.event.internal.EventFields; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; import java.util.Date; import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_Event.Builder.class) public abstract class Event extends BaseDataModel implements ObjectWithDeleteInterface, ObjectWithUidInterface { @@ -129,10 +131,6 @@ public abstract class Event extends BaseDataModel implements ObjectWithDeleteInt @JsonProperty() public abstract String attributeOptionCombo(); - @Nullable - @JsonIgnore() - public abstract String trackedEntityInstance(); - @Nullable @JsonProperty(EventFields.TRACKED_ENTITY_DATA_VALUES) @ColumnAdapter(IgnoreTrackedEntityDataValueListColumnAdapter.class) @@ -187,8 +185,6 @@ public abstract static class Builder extends BaseDataModel.Builder { public abstract Builder attributeOptionCombo(String attributeOptionCombo); - public abstract Builder trackedEntityInstance(String trackedEntityInstance); - @JsonProperty(EventFields.TRACKED_ENTITY_DATA_VALUES) public abstract Builder trackedEntityDataValues(List trackedEntityDataValues); diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/event/EventCollectionRepository.java index 9a4b6761d7..244104ec4a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/EventCollectionRepository.java @@ -27,21 +27,28 @@ */ package org.hisp.dhis.android.core.event; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadWriteWithUidCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.arch.repositories.collection.ReadWriteWithUploadWithUidCollectionRepository; -import org.hisp.dhis.android.core.arch.repositories.filters.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadWriteWithUidCollectionRepositoryImpl; +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.arch.repositories.scope.RepositoryScopeHelper; +import org.hisp.dhis.android.core.arch.repositories.scope.internal.RepositoryScopeHelper; import org.hisp.dhis.android.core.common.BaseDataModel; -import org.hisp.dhis.android.core.common.DataStatePropagator; +import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.common.Transformer; -import org.hisp.dhis.android.core.imports.WebResponse; - +import org.hisp.dhis.android.core.common.internal.DataStatePropagator; +import org.hisp.dhis.android.core.enrollment.EnrollmentTableInfo; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentFields; +import org.hisp.dhis.android.core.event.internal.EventFields; +import org.hisp.dhis.android.core.event.internal.EventPostCall; +import org.hisp.dhis.android.core.event.internal.EventStore; +import org.hisp.dhis.android.core.imports.internal.WebResponse; + +import java.util.List; import java.util.Map; import java.util.concurrent.Callable; @@ -156,8 +163,13 @@ public StringFilterConnector byAttributeOptionComboUi return cf.string(EventFields.ATTRIBUTE_OPTION_COMBO); } - public StringFilterConnector byTrackedEntityInstaceUid() { - return cf.string(EventTableInfo.Columns.TRACKED_ENTITY_INSTANCE); + public EventCollectionRepository byTrackedEntityInstanceUids(List uids) { + return cf.subQuery(EventFields.ENROLLMENT).inLinkTable( + EnrollmentTableInfo.TABLE_INFO.name(), + BaseIdentifiableObjectModel.Columns.UID, + EnrollmentFields.TRACKED_ENTITY_INSTANCE, + uids + ); } public EventCollectionRepository withTrackedEntityDataValues() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventCreateProjection.java b/core/src/main/java/org/hisp/dhis/android/core/event/EventCreateProjection.java index eed0c75bb7..b3d6e2e72e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventCreateProjection.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/EventCreateProjection.java @@ -31,11 +31,12 @@ import com.google.auto.value.AutoValue; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; @AutoValue public abstract class EventCreateProjection { - @NonNull + @Nullable public abstract String enrollment(); @NonNull diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventModel.java b/core/src/main/java/org/hisp/dhis/android/core/event/EventModel.java index 0d6c5eeb62..70fee3fa47 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/EventModel.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.event; import android.database.Cursor; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.gabrielittner.auto.value.cursor.ColumnName; @@ -42,6 +40,9 @@ import java.util.Date; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class EventModel extends BaseDataModel { @@ -65,7 +66,6 @@ public static class Columns extends BaseDataModel.Columns { public static final String COMPLETE_DATE = "completedDate"; public static final String DUE_DATE = "dueDate"; public static final String ATTRIBUTE_OPTION_COMBO = "attributeOptionCombo"; - public static final String TRACKED_ENTITY_INSTANCE = "trackedEntityInstance"; } public static EventModel create(Cursor cursor) { @@ -147,10 +147,6 @@ public static Builder builder() { @ColumnName(Columns.ATTRIBUTE_OPTION_COMBO) public abstract String attributeOptionCombo(); - @Nullable - @ColumnName(Columns.TRACKED_ENTITY_INSTANCE) - public abstract String trackedEntityInstance(); - @AutoValue.Builder public static abstract class Builder extends BaseDataModel.Builder { public abstract Builder uid(@NonNull String uid); @@ -185,8 +181,6 @@ public static abstract class Builder extends BaseDataModel.Builder { public abstract Builder attributeOptionCombo(@Nullable String attributeOptionCombo); - public abstract Builder trackedEntityInstance(@Nullable String trackedEntityInstance); - public abstract EventModel build(); } } diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventModule.java b/core/src/main/java/org/hisp/dhis/android/core/event/EventModule.java index 75c9dc859f..7229a61ced 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/EventModule.java @@ -31,6 +31,8 @@ import androidx.annotation.VisibleForTesting; import org.hisp.dhis.android.core.common.Unit; +import org.hisp.dhis.android.core.event.internal.EventPersistenceCallFactory; +import org.hisp.dhis.android.core.event.internal.EventWithLimitCallFactory; import java.util.concurrent.Callable; @@ -59,6 +61,18 @@ public final class EventModule { this.eventPersistenceCallFactory = eventPersistenceCallFactory; } + /** + * Downloads and persists Events from the server. Only instances in capture scope are downloaded. + * This method keeps track of the latest successful download in order to void downloading unmodified data. + * + * It makes use of paging with a best effort strategy: in case a page fails to be downloaded or persisted, it is + * skipped and the rest of pages are persisted. + * + * @param eventLimit Max number of events to download + * @param limitByOrgUnit If true, the limit of Events is considered per organisation unit. + * @param limitByProgram If true, the limit of Events is considered per program. + * @return - + */ public Callable downloadSingleEvents(int eventLimit, boolean limitByOrgUnit, boolean limitByProgram) { return eventWithLimitCallFactory.getCall(eventLimit, limitByOrgUnit, limitByProgram); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventObjectRepository.java b/core/src/main/java/org/hisp/dhis/android/core/event/EventObjectRepository.java index 5e67b03af5..4651f93ec0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventObjectRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/EventObjectRepository.java @@ -28,15 +28,16 @@ package org.hisp.dhis.android.core.event; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.arch.repositories.object.ReadWriteObjectRepository; -import org.hisp.dhis.android.core.arch.repositories.object.ReadWriteWithUidDataObjectRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.object.internal.ReadWriteWithUidDataObjectRepositoryImpl; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.Coordinates; -import org.hisp.dhis.android.core.common.DataStatePropagator; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.common.Unit; +import org.hisp.dhis.android.core.common.internal.DataStatePropagator; +import org.hisp.dhis.android.core.event.internal.EventStore; import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.Date; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/event/EventTableInfo.java index c19756207f..5bf08a6bab 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/EventTableInfo.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.event; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.event.internal.EventFields; import org.hisp.dhis.android.core.utils.Utils; public final class EventTableInfo { @@ -58,7 +59,6 @@ public static class Columns extends BaseModel.Columns { public static final String LATITUDE = "latitude"; public static final String LONGITUDE = "longitude"; public static final String ORGANISATION_UNIT = "organisationUnit"; - public static final String TRACKED_ENTITY_INSTANCE = "trackedEntityInstance"; @Override public String[] all() { @@ -79,8 +79,7 @@ public String[] all() { EventFields.COMPLETE_DATE, EventFields.DUE_DATE, BaseDataModel.Columns.STATE, - EventFields.ATTRIBUTE_OPTION_COMBO, - TRACKED_ENTITY_INSTANCE + EventFields.ATTRIBUTE_OPTION_COMBO ); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventChildrenAppender.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventChildrenAppender.java index 67c15058bd..3a8f8efd17 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventChildrenAppender.java @@ -25,13 +25,14 @@ * (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.event; +package org.hisp.dhis.android.core.event.internal; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.SingleParentChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.event.Event; public final class EventChildrenAppender extends ChildrenAppender { diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventEndpointCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallFactory.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventEndpointCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallFactory.java index 515e59a6b3..55eada6edc 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventEndpointCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallFactory.java @@ -26,18 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.common.Payload; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.event.Event; import java.util.List; import java.util.concurrent.Callable; import javax.inject.Inject; +import androidx.annotation.NonNull; import dagger.Reusable; import retrofit2.Call; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventEntityDIModule.java similarity index 84% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventEntityDIModule.java index 945a59377e..900ced09b8 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventEntityDIModule.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.Transformer; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.event.EventCreateProjection; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValueChildrenAppender; import java.util.Collections; @@ -52,7 +54,7 @@ public EventStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - public SyncHandlerWithTransformer handler(EventHandler impl) { + public HandlerWithTransformer handler(EventHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventFields.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventFields.java similarity index 73% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventFields.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventFields.java index ec2bb202d1..92f631dca1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventFields.java @@ -26,31 +26,33 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; +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.Coordinates; -import org.hisp.dhis.android.core.data.api.Fields; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.event.EventStatus; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValueFields; public final class EventFields { - static final String UID = "event"; + public static final String UID = "event"; public static final String ENROLLMENT = "enrollment"; - static final String CREATED = "created"; - static final String LAST_UPDATED = "lastUpdated"; - static final String STATUS = "status"; + public static final String CREATED = "created"; + public static final String LAST_UPDATED = "lastUpdated"; + public static final String STATUS = "status"; private static final String COORDINATE = "coordinate"; - static final String PROGRAM = "program"; - static final String PROGRAM_STAGE = "programStage"; - static final String ORGANISATION_UNIT = "orgUnit"; - static final String EVENT_DATE = "eventDate"; - static final String COMPLETE_DATE = "completedDate"; - static final String DUE_DATE = "dueDate"; - private static final String DELETED = "deleted"; - static final String TRACKED_ENTITY_DATA_VALUES = "dataValues"; - static final String ATTRIBUTE_OPTION_COMBO = "attributeOptionCombo"; + public static final String PROGRAM = "program"; + public static final String PROGRAM_STAGE = "programStage"; + public static final String ORGANISATION_UNIT = "orgUnit"; + public static final String EVENT_DATE = "eventDate"; + public static final String COMPLETE_DATE = "completedDate"; + public static final String DUE_DATE = "dueDate"; + public static final String DELETED = "deleted"; + public static final String TRACKED_ENTITY_DATA_VALUES = "dataValues"; + public static final String ATTRIBUTE_OPTION_COMBO = "attributeOptionCombo"; private static FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventHandler.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventHandler.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventHandler.java index 5c7d874669..a50fed18e1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventHandler.java @@ -26,13 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; import android.util.Log; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableDataSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.common.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableDataHandlerImpl; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.event.EventStatus; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; import javax.inject.Inject; @@ -40,12 +42,12 @@ import dagger.Reusable; @Reusable -final class EventHandler extends IdentifiableDataSyncHandlerImpl { - private final SyncHandlerWithTransformer trackedEntityDataValueHandler; +final class EventHandler extends IdentifiableDataHandlerImpl { + private final HandlerWithTransformer trackedEntityDataValueHandler; @Inject EventHandler(EventStore eventStore, - SyncHandlerWithTransformer trackedEntityDataValueHandler) { + HandlerWithTransformer trackedEntityDataValueHandler) { super(eventStore); this.trackedEntityDataValueHandler = trackedEntityDataValueHandler; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventImportHandler.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventImportHandler.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventImportHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventImportHandler.java index 3c7c14336a..4ab49c759c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventImportHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventImportHandler.java @@ -26,17 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.enrollment.EnrollmentStore; -import org.hisp.dhis.android.core.imports.EventImportSummary; -import org.hisp.dhis.android.core.imports.ImportConflict; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; +import org.hisp.dhis.android.core.event.EventTableInfo; import org.hisp.dhis.android.core.imports.TrackerImportConflict; import org.hisp.dhis.android.core.imports.TrackerImportConflictTableInfo; +import org.hisp.dhis.android.core.imports.internal.EventImportSummary; +import org.hisp.dhis.android.core.imports.internal.ImportConflict; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceStore; import java.util.ArrayList; @@ -48,7 +49,7 @@ import androidx.annotation.NonNull; import dagger.Reusable; -import static org.hisp.dhis.android.core.utils.StoreUtils.getState; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.getState; @Reusable public class EventImportHandler { diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventModuleWiper.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventModuleWiper.java index 5f9fd2c586..0fe404e428 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventModuleWiper.java @@ -26,8 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; +import org.hisp.dhis.android.core.event.EventTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPackageDIModule.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPackageDIModule.java index c0da422319..0e171182b3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPackageDIModule.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventPayload.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPayload.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventPayload.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPayload.java index 2e19ae138f..48247334f3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventPayload.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPayload.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; + +import org.hisp.dhis.android.core.event.Event; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventPersistenceCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPersistenceCallFactory.java similarity index 86% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventPersistenceCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPersistenceCallFactory.java index 4049c23ea0..882433bec0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventPersistenceCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPersistenceCallFactory.java @@ -26,17 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import androidx.annotation.NonNull; - -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.ObjectWithoutUidStore; +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.arch.handlers.internal.HandlerWithTransformer; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.maintenance.ForeignKeyCleaner; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.maintenance.internal.ForeignKeyCleaner; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitModuleDownloader; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitModuleDownloader; import org.hisp.dhis.android.core.user.AuthenticatedUser; import org.hisp.dhis.android.core.user.User; @@ -48,12 +47,13 @@ import javax.inject.Inject; +import androidx.annotation.NonNull; import dagger.Reusable; @Reusable -final class EventPersistenceCallFactory { +public final class EventPersistenceCallFactory { - private final SyncHandlerWithTransformer eventHandler; + private final HandlerWithTransformer eventHandler; private final ObjectWithoutUidStore authenticatedUserStore; private final IdentifiableObjectStore organisationUnitStore; private final OrganisationUnitModuleDownloader organisationUnitDownloader; @@ -61,7 +61,7 @@ final class EventPersistenceCallFactory { @Inject EventPersistenceCallFactory( - @NonNull SyncHandlerWithTransformer eventHandler, + @NonNull HandlerWithTransformer eventHandler, @NonNull ObjectWithoutUidStore authenticatedUserStore, @NonNull IdentifiableObjectStore organisationUnitStore, @NonNull OrganisationUnitModuleDownloader organisationUnitDownloader, diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventPostCall.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPostCall.java similarity index 95% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventPostCall.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPostCall.java index 1c56cedc0f..b5b338c7cc 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventPostCall.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventPostCall.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.imports.EventWebResponse; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.imports.internal.EventWebResponse; import org.hisp.dhis.android.core.imports.TrackerImportConflict; import org.hisp.dhis.android.core.systeminfo.DHISVersionManager; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventProjectionTransformer.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventProjectionTransformer.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventProjectionTransformer.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventProjectionTransformer.java index 786cab0e44..09a28bbf52 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventProjectionTransformer.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventProjectionTransformer.java @@ -26,11 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; +import org.hisp.dhis.android.core.arch.handlers.internal.Transformer; import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.common.Transformer; +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.utils.CodeGeneratorImpl; import java.util.Date; @@ -54,6 +57,7 @@ public Event transform(EventCreateProjection projection) { .programStage(projection.programStage()) .organisationUnit(projection.organisationUnit()) .attributeOptionCombo(projection.attributeOptionCombo()) + .status(EventStatus.ACTIVE) .build(); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventQuery.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventQuery.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventQuery.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventQuery.java index 01520ed61a..8474c1bd76 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventQuery.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventQuery.java @@ -26,19 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.event.internal; import com.google.auto.value.AutoValue; -import org.hisp.dhis.android.core.common.BaseQuery; -import org.hisp.dhis.android.core.data.api.OuMode; +import org.hisp.dhis.android.core.arch.call.queries.internal.BaseQuery; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitMode; import java.util.Collection; import java.util.Collections; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue public abstract class EventQuery extends BaseQuery { @@ -52,7 +52,7 @@ public abstract class EventQuery extends BaseQuery { public abstract String trackedEntityInstance(); @NonNull - public abstract OuMode ouMode(); + public abstract OrganisationUnitMode ouMode(); @Nullable public abstract String lastUpdatedStartDate(); @@ -65,7 +65,7 @@ public static Builder builder() { .page(1) .pageSize(DEFAULT_PAGE_SIZE) .paging(true) - .ouMode(OuMode.SELECTED) + .ouMode(OrganisationUnitMode.SELECTED) .uIds(Collections.emptyList()); } @@ -77,7 +77,7 @@ public abstract static class Builder extends BaseQuery.Builder { public abstract Builder trackedEntityInstance(String trackedEntityInstance); - public abstract Builder ouMode(OuMode ouMode); + public abstract Builder ouMode(OrganisationUnitMode ouMode); public abstract Builder lastUpdatedStartDate(String lastUpdatedStartDate); diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventService.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventService.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventService.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventService.java index 9d1ab802a3..332f5d753e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventService.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Which; -import org.hisp.dhis.android.core.imports.EventWebResponse; +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.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.imports.internal.EventWebResponse; import retrofit2.Call; import retrofit2.http.Body; @@ -40,7 +41,7 @@ import retrofit2.http.Path; import retrofit2.http.Query; -public interface EventService { +interface EventService { String ORG_UNIT = "orgUnit"; String PROGRAM = "program"; String TRACKED_ENTITY_INSTANCE = "trackedEntityInstance"; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventStore.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventStore.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventStore.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventStore.java index 589502610b..226c1501f2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventStore.java @@ -26,9 +26,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; -import org.hisp.dhis.android.core.common.IdentifiableObjectWithStateStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectWithStateStore; +import org.hisp.dhis.android.core.event.Event; import java.util.List; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventStoreImpl.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventStoreImpl.java similarity index 86% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventStoreImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventStoreImpl.java index d6e89aa77c..b1a0ae541f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventStoreImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventStoreImpl.java @@ -26,24 +26,26 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; import android.database.Cursor; -import org.hisp.dhis.android.core.arch.db.WhereClauseBuilder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorModelFactory; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.SQLStatementBuilderImpl; +import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; +import org.hisp.dhis.android.core.arch.db.statementwrapper.internal.SQLStatementWrapper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectWithStateStoreImpl; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.helpers.CoordinateHelper; import org.hisp.dhis.android.core.common.BaseDataModel; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; -import org.hisp.dhis.android.core.common.CoordinateHelper; -import org.hisp.dhis.android.core.common.CursorModelFactory; -import org.hisp.dhis.android.core.common.IdentifiableObjectWithStateStoreImpl; -import org.hisp.dhis.android.core.common.SQLStatementBuilder; -import org.hisp.dhis.android.core.common.SQLStatementWrapper; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; -import org.hisp.dhis.android.core.enrollment.EnrollmentFields; import org.hisp.dhis.android.core.enrollment.EnrollmentTableInfo; +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentFields; +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.event.EventTableInfo; import java.util.ArrayList; import java.util.Arrays; @@ -51,7 +53,7 @@ import java.util.List; import java.util.Map; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class EventStoreImpl extends IdentifiableObjectWithStateStoreImpl implements EventStore { @@ -75,7 +77,6 @@ public final class EventStoreImpl extends IdentifiableObjectWithStateStoreImpl binder, CursorModelFactory modelFactory) { super(databaseAdapter, statementWrapper, builder, binder, modelFactory); @@ -168,7 +169,7 @@ private void addEventsToMap(Map> eventsMap, Event event) { } public static EventStore create(DatabaseAdapter databaseAdapter) { - SQLStatementBuilder statementBuilder = new SQLStatementBuilder( + SQLStatementBuilderImpl statementBuilder = new SQLStatementBuilderImpl( EventTableInfo.TABLE_INFO.name(), EventTableInfo.TABLE_INFO.columns()); SQLStatementWrapper statementWrapper = new SQLStatementWrapper(statementBuilder, databaseAdapter); diff --git a/core/src/main/java/org/hisp/dhis/android/core/event/EventWithLimitCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallFactory.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/event/EventWithLimitCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallFactory.java index f49b7695ac..d7d09803a0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/event/EventWithLimitCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallFactory.java @@ -26,22 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.event; +package org.hisp.dhis.android.core.event.internal; +import org.hisp.dhis.android.core.arch.api.paging.internal.ApiPagingEngine; +import org.hisp.dhis.android.core.arch.api.paging.internal.Paging; +import org.hisp.dhis.android.core.arch.call.executors.internal.D2CallExecutor; import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyWithDownloadObjectRepository; -import org.hisp.dhis.android.core.common.D2CallExecutor; import org.hisp.dhis.android.core.common.Unit; -import org.hisp.dhis.android.core.data.api.OuMode; +import org.hisp.dhis.android.core.event.Event; import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.program.ProgramStoreInterface; -import org.hisp.dhis.android.core.resource.Resource; -import org.hisp.dhis.android.core.resource.ResourceHandler; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitMode; +import org.hisp.dhis.android.core.program.internal.ProgramStoreInterface; +import org.hisp.dhis.android.core.resource.internal.Resource; +import org.hisp.dhis.android.core.resource.internal.ResourceHandler; import org.hisp.dhis.android.core.systeminfo.SystemInfo; import org.hisp.dhis.android.core.user.UserOrganisationUnitLink; -import org.hisp.dhis.android.core.user.UserOrganisationUnitLinkStore; -import org.hisp.dhis.android.core.utils.services.ApiPagingEngine; -import org.hisp.dhis.android.core.utils.services.Paging; +import org.hisp.dhis.android.core.user.internal.UserOrganisationUnitLinkStore; import java.util.Collection; import java.util.HashSet; @@ -55,7 +56,7 @@ import dagger.Reusable; @Reusable -final class EventWithLimitCallFactory { +public final class EventWithLimitCallFactory { private final Resource.Type resourceType = Resource.Type.EVENT; @@ -107,7 +108,7 @@ private Unit getEvents(int eventLimit, boolean limitByOrgUnit, boolean limitByPr organisationUnitUids = getOrgUnitUids(); } else { organisationUnitUids = userOrganisationUnitLinkStore.queryRootCaptureOrganisationUnitUids(); - eventQueryBuilder.ouMode(OuMode.DESCENDANTS); + eventQueryBuilder.ouMode(OrganisationUnitMode.DESCENDANTS); } int eventsCount = 0; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummaryHandler.java b/core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummaryHandler.java deleted file mode 100644 index e3e23965c5..0000000000 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummaryHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.imports; - -public class ImportSummaryHandler { - - public void handle(DataValueImportSummary dataValueImportSummary) { - // handle the import summary - } -} diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictCollectionRepository.java index 25fbb7007e..838200d5c3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictCollectionRepository.java @@ -28,14 +28,14 @@ package org.hisp.dhis.android.core.imports; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl; +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.ObjectStore; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictTableInfo.java index 1d90676175..7ba93eb552 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictTableInfo.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.imports; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/BaseImportSummaries.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/BaseImportSummaries.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/imports/BaseImportSummaries.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/BaseImportSummaries.java index 0936a8b116..6e406f0726 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/BaseImportSummaries.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/BaseImportSummaries.java @@ -26,13 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import org.hisp.dhis.android.core.imports.ImportStatus; + +import androidx.annotation.NonNull; + public abstract class BaseImportSummaries { private static final String RESPONSE_TYPE = "responseType"; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/BaseImportSummary.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/BaseImportSummary.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/imports/BaseImportSummary.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/BaseImportSummary.java index 047bed5bf4..d9fd5a3cc4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/BaseImportSummary.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/BaseImportSummary.java @@ -26,16 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import org.hisp.dhis.android.core.imports.ImportStatus; + import java.util.List; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + public abstract class BaseImportSummary implements ImportSummary { private static final String IMPORT_COUNT = "importCount"; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/DataValueImportSummary.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummary.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/DataValueImportSummary.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummary.java index 587fbc0025..c1dc98f667 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/DataValueImportSummary.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/DataValueImportSummary.java @@ -26,17 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.auto.value.AutoValue; +import org.hisp.dhis.android.core.imports.ImportStatus; + import java.util.List; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import static org.hisp.dhis.android.core.utils.Utils.safeUnmodifiableList; @AutoValue diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/EnrollmentImportSummaries.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EnrollmentImportSummaries.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/EnrollmentImportSummaries.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/EnrollmentImportSummaries.java index 9e4f70fd45..6aa97994dc 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/EnrollmentImportSummaries.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EnrollmentImportSummaries.java @@ -26,9 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -37,6 +35,8 @@ import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_EnrollmentImportSummaries.Builder.class) public abstract class EnrollmentImportSummaries extends BaseImportSummaries implements ImportSummaries { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/EnrollmentImportSummary.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EnrollmentImportSummary.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/EnrollmentImportSummary.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/EnrollmentImportSummary.java index 4264e8c9d7..1ebb025d96 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/EnrollmentImportSummary.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EnrollmentImportSummary.java @@ -26,15 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; 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; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_EnrollmentImportSummary.Builder.class) public abstract class EnrollmentImportSummary extends BaseImportSummary { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/EventImportSummaries.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventImportSummaries.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/EventImportSummaries.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventImportSummaries.java index 1bee83d613..92688d2a8e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/EventImportSummaries.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventImportSummaries.java @@ -26,9 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -37,6 +35,8 @@ import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_EventImportSummaries.Builder.class) public abstract class EventImportSummaries extends BaseImportSummaries implements ImportSummaries { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/EventImportSummary.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventImportSummary.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/EventImportSummary.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventImportSummary.java index 2ebba694c2..45e60435be 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/EventImportSummary.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventImportSummary.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/EventWebResponse.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventWebResponse.java similarity index 98% rename from core/src/main/java/org/hisp/dhis/android/core/imports/EventWebResponse.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventWebResponse.java index 0a77ef2b3f..b2d01227c1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/EventWebResponse.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/EventWebResponse.java @@ -26,15 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; 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; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_EventWebResponse.Builder.class) public abstract class EventWebResponse extends WebResponse { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/HttpMessageResponse.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/HttpMessageResponse.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/HttpMessageResponse.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/HttpMessageResponse.java index c20fa0b9b4..8f0742be49 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/HttpMessageResponse.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/HttpMessageResponse.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportConflict.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportConflict.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/ImportConflict.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportConflict.java index 77b6807434..589bcff68e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportConflict.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportConflict.java @@ -26,15 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import com.google.auto.value.AutoValue; +import androidx.annotation.NonNull; + @AutoValue @JsonRootName("conflicts") public abstract class ImportConflict { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportCount.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportCount.java similarity index 98% rename from core/src/main/java/org/hisp/dhis/android/core/imports/ImportCount.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportCount.java index dcb9673d5f..9f237c28b4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportCount.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportCount.java @@ -26,14 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.auto.value.AutoValue; +import androidx.annotation.NonNull; + @AutoValue public abstract class ImportCount { private static final String IMPORTED = "imported"; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportModule.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportModule.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/imports/ImportModule.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportModule.java index bdcf2d124e..293742db6f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportModule.java @@ -25,7 +25,9 @@ * (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; +package org.hisp.dhis.android.core.imports.internal; + +import org.hisp.dhis.android.core.imports.TrackerImportConflictCollectionRepository; import javax.inject.Inject; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportModuleWiper.java similarity index 94% rename from core/src/main/java/org/hisp/dhis/android/core/imports/ImportModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportModuleWiper.java index aea7fc0617..248db84ccc 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportModuleWiper.java @@ -25,8 +25,9 @@ * (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; +package org.hisp.dhis.android.core.imports.internal; +import org.hisp.dhis.android.core.imports.TrackerImportConflictTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportPackageDIModule.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/imports/ImportPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportPackageDIModule.java index 4289ff85e4..be648b73f9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportPackageDIModule.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; import dagger.Module; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummaries.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportSummaries.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummaries.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportSummaries.java index 2e63012209..d50497f9d2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummaries.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportSummaries.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummary.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportSummary.java similarity index 93% rename from core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummary.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportSummary.java index a7e25395ea..cccf9549a6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/ImportSummary.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/ImportSummary.java @@ -26,7 +26,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; + +import org.hisp.dhis.android.core.imports.ImportStatus; interface ImportSummary { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/TEIImportSummaries.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIImportSummaries.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/TEIImportSummaries.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIImportSummaries.java index ab907a6912..b93df55434 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/TEIImportSummaries.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIImportSummaries.java @@ -26,9 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -37,6 +35,8 @@ import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_TEIImportSummaries.Builder.class) public abstract class TEIImportSummaries extends BaseImportSummaries implements ImportSummaries { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/TEIImportSummary.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIImportSummary.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/TEIImportSummary.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIImportSummary.java index c424aa09a4..6b741e796d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/TEIImportSummary.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIImportSummary.java @@ -26,15 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; 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; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_TEIImportSummary.Builder.class) public abstract class TEIImportSummary extends BaseImportSummary { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/TEIWebResponse.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIWebResponse.java similarity index 98% rename from core/src/main/java/org/hisp/dhis/android/core/imports/TEIWebResponse.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIWebResponse.java index 5aa4e98e90..bf7f52bfd0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/TEIWebResponse.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIWebResponse.java @@ -26,15 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.Nullable; +package org.hisp.dhis.android.core.imports.internal; 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; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_TEIWebResponse.Builder.class) public abstract class TEIWebResponse extends WebResponse { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/TEIWebResponseHandler.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIWebResponseHandler.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/TEIWebResponseHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIWebResponseHandler.java index a6e7c667d6..f89c59c275 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/TEIWebResponseHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TEIWebResponseHandler.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceImportHandler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictEntityDIModule.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictEntityDIModule.java index 9e3720a683..1f6616c13e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictEntityDIModule.java @@ -26,11 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.imports.TrackerImportConflict; import java.util.Collections; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictStore.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStore.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictStore.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStore.java index 015f521548..c45f7d02b3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/TrackerImportConflictStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; +package org.hisp.dhis.android.core.imports.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.ObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.imports.TrackerImportConflict; +import org.hisp.dhis.android.core.imports.TrackerImportConflictTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class TrackerImportConflictStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/imports/WebResponse.java b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/WebResponse.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/imports/WebResponse.java rename to core/src/main/java/org/hisp/dhis/android/core/imports/internal/WebResponse.java index ad24410422..5ad014d488 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/imports/WebResponse.java +++ b/core/src/main/java/org/hisp/dhis/android/core/imports/internal/WebResponse.java @@ -26,12 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.imports; - -import androidx.annotation.NonNull; +package org.hisp.dhis.android.core.imports.internal; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import androidx.annotation.NonNull; + public abstract class WebResponse { @NonNull diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLink.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLink.java index f4df90fffb..1d217cb86c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLink.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLink.java @@ -28,13 +28,14 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.Model; +import androidx.annotation.Nullable; + @AutoValue public abstract class DataSetIndicatorLink implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkModel.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkModel.java index b52cdd5b9e..6464f28a73 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkModel.java @@ -28,7 +28,6 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -36,6 +35,8 @@ import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class DataSetIndicatorLinkModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkTableInfo.java index 81e5bed974..43d07a8d30 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkTableInfo.java @@ -28,8 +28,7 @@ package org.hisp.dhis.android.core.indicator; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; @@ -48,18 +47,13 @@ public Columns columns() { } }; - static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( - IndicatorTableInfo.TABLE_INFO, - Columns.DATA_SET, - Columns.INDICATOR); - private DataSetIndicatorLinkTableInfo() { } - static class Columns extends BaseModel.Columns { + public static class Columns extends BaseModel.Columns { - static final String DATA_SET = "dataSet"; - private static final String INDICATOR = "indicator"; + public static final String DATA_SET = "dataSet"; + public static final String INDICATOR = "indicator"; @Override public String[] all() { 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 00c9d2ddc5..be45253247 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 @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -42,13 +41,15 @@ import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.data.database.ObjectWithUidColumnAdapter; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_Indicator.Builder.class) public abstract class Indicator extends BaseNameableObject implements Model { @Nullable @JsonProperty() - abstract Boolean annualized(); + public abstract Boolean annualized(); @Nullable @JsonProperty() @@ -57,23 +58,23 @@ public abstract class Indicator extends BaseNameableObject implements Model { @Nullable @JsonProperty() - abstract String numerator(); + public abstract String numerator(); @Nullable @JsonProperty() - abstract String numeratorDescription(); + public abstract String numeratorDescription(); @Nullable @JsonProperty() - abstract String denominator(); + public abstract String denominator(); @Nullable @JsonProperty() - abstract String denominatorDescription(); + public abstract String denominatorDescription(); @Nullable @JsonProperty() - abstract String url(); + public abstract String url(); public static Builder builder() { return new $$AutoValue_Indicator.Builder(); 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 6f51523950..251f456480 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 @@ -27,13 +27,14 @@ */ package org.hisp.dhis.android.core.indicator; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyNameableCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyNameableCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.BooleanFilterConnector; +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.IdentifiableObjectStore; +import org.hisp.dhis.android.core.indicator.internal.IndicatorFields; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorModel.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorModel.java index 8ada1ab0c2..7cdd739287 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -37,6 +36,8 @@ import org.hisp.dhis.android.core.common.BaseNameableObjectModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class IndicatorModel extends BaseNameableObjectModel { 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 df99a10575..8a51ec43ea 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 @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.indicator; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.BaseNameableObjectModel; +import org.hisp.dhis.android.core.indicator.internal.IndicatorFields; import org.hisp.dhis.android.core.utils.Utils; public final class IndicatorTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorType.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorType.java index bbe6a6c7e6..7389ce165a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorType.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorType.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -39,6 +38,8 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.common.Model; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_IndicatorType.Builder.class) public abstract class IndicatorType extends BaseIdentifiableObject implements Model { 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 095c2cd970..7fad61ebb8 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 @@ -27,13 +27,14 @@ */ package org.hisp.dhis.android.core.indicator; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyIdentifiableCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.BooleanFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.IntegerFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyIdentifiableCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.BooleanFilterConnector; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.IntegerFilterConnector; import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.indicator.internal.IndicatorTypeFields; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeModel.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeModel.java index 5209581126..b0b67a5925 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.indicator; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -37,6 +36,8 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class IndicatorTypeModel extends BaseIdentifiableObjectModel { 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.java index 466b9c7d15..87a1db416b 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.java @@ -28,9 +28,10 @@ package org.hisp.dhis.android.core.indicator; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseModel; +import org.hisp.dhis.android.core.indicator.internal.IndicatorTypeFields; import org.hisp.dhis.android.core.utils.Utils; public final class IndicatorTypeTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorChildrenAppender.java similarity index 74% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorChildrenAppender.java index 31b7dab01c..0e426114c2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorChildrenAppender.java @@ -25,16 +25,24 @@ * (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; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.db.stores.LinkModelChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.dataset.DataSet; +import org.hisp.dhis.android.core.indicator.DataSetIndicatorLinkTableInfo; +import org.hisp.dhis.android.core.indicator.Indicator; +import org.hisp.dhis.android.core.indicator.IndicatorTableInfo; public final class DataSetIndicatorChildrenAppender extends ChildrenAppender { + private static final LinkTableChildProjection CHILD_PROJECTION = new LinkTableChildProjection( + IndicatorTableInfo.TABLE_INFO, + DataSetIndicatorLinkTableInfo.Columns.DATA_SET, + DataSetIndicatorLinkTableInfo.Columns.INDICATOR); private final LinkModelChildStore linkModelChildStore; private DataSetIndicatorChildrenAppender( @@ -54,7 +62,7 @@ public static ChildrenAppender create(DatabaseAdapter databaseAdapter) StoreFactory.linkModelChildStore( databaseAdapter, DataSetIndicatorLinkTableInfo.TABLE_INFO, - DataSetIndicatorLinkTableInfo.CHILD_PROJECTION, + CHILD_PROJECTION, Indicator::create) ); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorEntityDIModule.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorEntityDIModule.java index e1c413e985..6f0ed44bd4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorEntityDIModule.java @@ -26,12 +26,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandler; -import org.hisp.dhis.android.core.arch.handlers.LinkSyncHandlerImpl; -import org.hisp.dhis.android.core.common.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandler; +import org.hisp.dhis.android.core.arch.handlers.internal.LinkHandlerImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.indicator.DataSetIndicatorLink; +import org.hisp.dhis.android.core.indicator.Indicator; import dagger.Module; import dagger.Provides; @@ -48,7 +50,7 @@ LinkModelStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - LinkSyncHandler handler(LinkModelStore store) { - return new LinkSyncHandlerImpl<>(store); + LinkHandler handler(LinkModelStore store) { + return new LinkHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStore.java index 3ad64bd98a..032277a8ae 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/DataSetIndicatorLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.indicator.DataSetIndicatorLink; +import org.hisp.dhis.android.core.indicator.DataSetIndicatorLinkTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class DataSetIndicatorLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorEndpointCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorEndpointCallFactory.java similarity index 74% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorEndpointCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorEndpointCallFactory.java index 6c3bf063e5..5fd6ce1932 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorEndpointCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorEndpointCallFactory.java @@ -26,18 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.UidsNoResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.common.UidsQuery; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.UidsNoResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.call.queries.internal.UidsQuery; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.indicator.Indicator; import java.util.Set; @@ -49,7 +50,7 @@ final class IndicatorEndpointCallFactory extends UidsCallFactoryImpl { private final IndicatorService service; - private final SyncHandler handler; + private final Handler handler; private static final int MAX_UID_LIST_SIZE = 100; @@ -57,7 +58,7 @@ final class IndicatorEndpointCallFactory extends UidsCallFactoryImpl IndicatorEndpointCallFactory(GenericCallData data, APICallExecutor apiCallExecutor, IndicatorService service, - SyncHandler handler) { + Handler handler) { super(data, apiCallExecutor); this.service = service; this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorEntityDIModule.java similarity index 77% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorEntityDIModule.java index 125f92839b..2e953b63f2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorEntityDIModule.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.di.IdentifiableEntityDIModule; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.di.internal.IdentifiableEntityDIModule; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.indicator.Indicator; import java.util.Collections; import java.util.Map; @@ -55,8 +56,8 @@ public IdentifiableObjectStore store(DatabaseAdapter databaseAdapter) @Override @Provides @Reusable - public SyncHandler handler(IdentifiableObjectStore store) { - return new IdentifiableSyncHandlerImpl<>(store); + public Handler handler(IdentifiableObjectStore store) { + return new IdentifiableHandlerImpl<>(store); } @Provides diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorFields.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java similarity index 76% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorFields.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java index a2dd5aa928..f8803025a9 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorFields.java @@ -26,21 +26,22 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +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.indicator.Indicator; public final class IndicatorFields { - final static String ANNUALIZED = "annualized"; - final static String INDICATOR_TYPE = "indicatorType"; - final static String NUMERATOR = "numerator"; - final static String NUMERATOR_DESCRIPTION = "numeratorDescription"; - final static String DENOMINATOR = "denominator"; - final static String DENOMINATOR_DESCRIPTION = "denominatorDescription"; - final static String URL = "url"; + 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"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorModuleWiper.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorModuleWiper.java index dad21acb43..0664d57318 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorModuleWiper.java @@ -26,8 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; +import org.hisp.dhis.android.core.indicator.DataSetIndicatorLinkTableInfo; +import org.hisp.dhis.android.core.indicator.IndicatorTableInfo; +import org.hisp.dhis.android.core.indicator.IndicatorTypeTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorPackageDIModule.java similarity index 90% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorPackageDIModule.java index 62ddf56da9..66e0a12f0f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorPackageDIModule.java @@ -26,9 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactory; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactory; +import org.hisp.dhis.android.core.indicator.Indicator; +import org.hisp.dhis.android.core.indicator.IndicatorType; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeService.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorService.java similarity index 65% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeService.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorService.java index 536303d858..6d7aa55e3a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorService.java @@ -25,23 +25,24 @@ * (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; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Filter; -import org.hisp.dhis.android.core.data.api.Where; -import org.hisp.dhis.android.core.data.api.Which; +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; +import org.hisp.dhis.android.core.arch.api.filters.internal.Filter; +import org.hisp.dhis.android.core.arch.api.filters.internal.Where; +import org.hisp.dhis.android.core.arch.api.filters.internal.Which; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.indicator.Indicator; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; -public interface IndicatorTypeService { - @GET("indicatorTypes") - Call> getIndicatorTypes(@Query("fields") @Which Fields fields, - @Query("filter") @Where Filter lastUpdated, - @Query("filter") @Where Filter uids, - @Query("paging") Boolean paging); +public interface IndicatorService { + @GET("indicators") + Call> getIndicators(@Query("fields") @Which Fields fields, + @Query("filter") @Where Filter lastUpdated, + @Query("filter") @Where Filter uids, + @Query("paging") Boolean paging); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorStore.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorStore.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java index 757de150ee..a04a34d41b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStore.java @@ -26,19 +26,22 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.NameableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.NameableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.indicator.Indicator; +import org.hisp.dhis.android.core.indicator.IndicatorTableInfo; + +import androidx.annotation.NonNull; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class IndicatorStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeEndpointCallFactory.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeEndpointCallFactory.java similarity index 74% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeEndpointCallFactory.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeEndpointCallFactory.java index 8595b5ff12..a89967737f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeEndpointCallFactory.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeEndpointCallFactory.java @@ -26,18 +26,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.api.executors.APICallExecutor; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.calls.factories.UidsCallFactoryImpl; -import org.hisp.dhis.android.core.calls.fetchers.CallFetcher; -import org.hisp.dhis.android.core.calls.fetchers.UidsNoResourceCallFetcher; -import org.hisp.dhis.android.core.calls.processors.CallProcessor; -import org.hisp.dhis.android.core.calls.processors.TransactionalNoResourceSyncCallProcessor; -import org.hisp.dhis.android.core.common.GenericCallData; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.common.UidsQuery; +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.arch.call.factories.internal.UidsCallFactoryImpl; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.CallFetcher; +import org.hisp.dhis.android.core.arch.call.fetchers.internal.UidsNoResourceCallFetcher; +import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; +import org.hisp.dhis.android.core.arch.call.processors.internal.CallProcessor; +import org.hisp.dhis.android.core.arch.call.processors.internal.TransactionalNoResourceSyncCallProcessor; +import org.hisp.dhis.android.core.arch.call.queries.internal.UidsQuery; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.indicator.IndicatorType; import java.util.Set; @@ -51,13 +52,13 @@ final class IndicatorTypeEndpointCallFactory extends UidsCallFactoryImpl handler; + private final Handler handler; @Inject IndicatorTypeEndpointCallFactory(GenericCallData data, APICallExecutor apiCallExecutor, IndicatorTypeService service, - SyncHandler handler) { + Handler handler) { super(data, apiCallExecutor); this.service = service; this.handler = handler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeEntityDIModule.java similarity index 77% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeEntityDIModule.java index 01bfc0bee9..dab2929741 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeEntityDIModule.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.di.IdentifiableEntityDIModule; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.di.internal.IdentifiableEntityDIModule; +import org.hisp.dhis.android.core.arch.handlers.internal.Handler; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.indicator.IndicatorType; import java.util.Collections; import java.util.Map; @@ -55,8 +56,8 @@ public IdentifiableObjectStore store(DatabaseAdapter databaseAdap @Override @Provides @Reusable - public SyncHandler handler(IdentifiableObjectStore store) { - return new IdentifiableSyncHandlerImpl<>(store); + public Handler handler(IdentifiableObjectStore store) { + return new IdentifiableHandlerImpl<>(store); } @Provides diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeFields.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeFields.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeFields.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeFields.java index c9f50ccc7d..1a7c59268f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeFields.java @@ -26,16 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +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.indicator.IndicatorType; public final class IndicatorTypeFields { - final static String NUMBER = "number"; - final static String FACTOR = "factor"; + public final static String NUMBER = "number"; + public final static String FACTOR = "factor"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorService.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeService.java similarity index 71% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorService.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeService.java index 644c1b2a73..3d9f9d0c17 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeService.java @@ -25,23 +25,24 @@ * (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; +package org.hisp.dhis.android.core.indicator.internal; -import org.hisp.dhis.android.core.common.Payload; -import org.hisp.dhis.android.core.data.api.Fields; -import org.hisp.dhis.android.core.data.api.Filter; -import org.hisp.dhis.android.core.data.api.Where; -import org.hisp.dhis.android.core.data.api.Which; +import org.hisp.dhis.android.core.arch.api.fields.internal.Fields; +import org.hisp.dhis.android.core.arch.api.filters.internal.Filter; +import org.hisp.dhis.android.core.arch.api.filters.internal.Where; +import org.hisp.dhis.android.core.arch.api.filters.internal.Which; +import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; +import org.hisp.dhis.android.core.indicator.IndicatorType; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; -public interface IndicatorService { - @GET("indicators") - Call> getIndicators(@Query("fields") @Which Fields fields, - @Query("filter") @Where Filter lastUpdated, - @Query("filter") @Where Filter uids, +public interface IndicatorTypeService { + @GET("indicatorTypes") + Call> getIndicatorTypes(@Query("fields") @Which Fields fields, + @Query("filter") @Where Filter lastUpdated, + @Query("filter") @Where Filter uids, @Query("paging") Boolean paging); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeStore.java b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeStore.java similarity index 80% rename from core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeStore.java rename to core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeStore.java index 692d650d17..896f8ec282 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/indicator/IndicatorTypeStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/indicator/internal/IndicatorTypeStore.java @@ -26,18 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.indicator; +package org.hisp.dhis.android.core.indicator.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.IdentifiableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.indicator.IndicatorType; +import org.hisp.dhis.android.core.indicator.IndicatorTypeTableInfo; + +import androidx.annotation.NonNull; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class IndicatorTypeStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/Legend.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/Legend.java index 4c2ec818df..375320134d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/Legend.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/Legend.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -42,6 +41,8 @@ import org.hisp.dhis.android.core.common.ObjectWithUid; import org.hisp.dhis.android.core.data.database.ObjectWithUidColumnAdapter; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_Legend.Builder.class) public abstract class Legend extends BaseIdentifiableObject implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendModel.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendModel.java index fdd5e5fce2..e8d40417e1 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -37,6 +36,8 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class LegendModel extends BaseIdentifiableObjectModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSet.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSet.java index 778360466f..3abff8254d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSet.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSet.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -43,6 +42,8 @@ import java.util.List; +import androidx.annotation.Nullable; + @AutoValue @JsonDeserialize(builder = AutoValue_LegendSet.Builder.class) public abstract class LegendSet extends BaseIdentifiableObject implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetCollectionRepository.java index b5493fd337..812d02cfa4 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetCollectionRepository.java @@ -27,12 +27,13 @@ */ package org.hisp.dhis.android.core.legendset; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyIdentifiableCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyIdentifiableCollectionRepositoryImpl; +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.IdentifiableObjectStore; +import org.hisp.dhis.android.core.legendset.internal.LegendSetFields; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetModel.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetModel.java index 0219c12d55..fbd6affb00 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetModel.java @@ -29,7 +29,6 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -37,6 +36,8 @@ import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class LegendSetModel extends BaseIdentifiableObjectModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetTableInfo.java index 972b79f13f..de534ec6df 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetTableInfo.java @@ -28,12 +28,12 @@ package org.hisp.dhis.android.core.legendset; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; -import static org.hisp.dhis.android.core.legendset.LegendSetFields.SYMBOLIZER; +import static org.hisp.dhis.android.core.legendset.internal.LegendSetFields.SYMBOLIZER; public final class LegendSetTableInfo { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendTableInfo.java index fe2a437104..77e7ccdaeb 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendTableInfo.java @@ -28,14 +28,14 @@ package org.hisp.dhis.android.core.legendset; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; -import static org.hisp.dhis.android.core.legendset.LegendFields.COLOR; -import static org.hisp.dhis.android.core.legendset.LegendFields.END_VALUE; -import static org.hisp.dhis.android.core.legendset.LegendFields.START_VALUE; +import static org.hisp.dhis.android.core.legendset.internal.LegendFields.COLOR; +import static org.hisp.dhis.android.core.legendset.internal.LegendFields.END_VALUE; +import static org.hisp.dhis.android.core.legendset.internal.LegendFields.START_VALUE; public final class LegendTableInfo { @@ -55,8 +55,8 @@ public BaseModel.Columns columns() { } }; - static class Columns extends BaseIdentifiableObjectModel.Columns { - final static String LEGEND_SET = "legendSet"; + public static class Columns extends BaseIdentifiableObjectModel.Columns { + public final static String LEGEND_SET = "legendSet"; @Override public String[] all() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLink.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLink.java index a4d1376eb8..9e4695ce7c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLink.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLink.java @@ -29,13 +29,14 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.google.auto.value.AutoValue; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.common.Model; +import androidx.annotation.Nullable; + @AutoValue public abstract class ProgramIndicatorLegendSetLink implements Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkModel.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkModel.java index 4d985b6fe5..462bd2592c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkModel.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkModel.java @@ -28,7 +28,6 @@ package org.hisp.dhis.android.core.legendset; import android.database.Cursor; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnName; import com.google.auto.value.AutoValue; @@ -36,6 +35,8 @@ import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; +import androidx.annotation.Nullable; + @Deprecated @AutoValue public abstract class ProgramIndicatorLegendSetLinkModel extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkTableInfo.java index 0eb223b3d1..7f40675b7c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkTableInfo.java @@ -28,8 +28,8 @@ package org.hisp.dhis.android.core.legendset; -import org.hisp.dhis.android.core.arch.db.TableInfo; -import org.hisp.dhis.android.core.arch.db.tableinfos.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.LinkTableChildProjection; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; @@ -56,10 +56,10 @@ public BaseModel.Columns columns() { private ProgramIndicatorLegendSetLinkTableInfo() { } - static class Columns extends BaseModel.Columns { + public static class Columns extends BaseModel.Columns { - static final String PROGRAM_INDICATOR = "programIndicator"; - static final String LEGEND_SET = "legendSet"; + public static final String PROGRAM_INDICATOR = "programIndicator"; + public static final String LEGEND_SET = "legendSet"; @Override public String[] all() { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendChildrenAppender.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendChildrenAppender.java similarity index 85% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendChildrenAppender.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendChildrenAppender.java index 62a2a3ecfb..d0987449ba 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendChildrenAppender.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendChildrenAppender.java @@ -25,12 +25,14 @@ * (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.legendset; +package org.hisp.dhis.android.core.legendset.internal; -import org.hisp.dhis.android.core.arch.db.stores.SingleParentChildStore; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.internal.SingleParentChildStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.legendset.Legend; +import org.hisp.dhis.android.core.legendset.LegendSet; final class LegendChildrenAppender extends ChildrenAppender { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendEntityDIModule.java index 4451a4a150..1b4fdb492a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendEntityDIModule.java @@ -26,12 +26,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.legendset.Legend; import dagger.Module; import dagger.Provides; @@ -48,7 +49,7 @@ public IdentifiableObjectStore store(DatabaseAdapter databaseAdapter) { @Provides @Reusable - public SyncHandlerWithTransformer handler(IdentifiableObjectStore store) { - return new IdentifiableSyncHandlerImpl<>(store); + public HandlerWithTransformer handler(IdentifiableObjectStore store) { + return new IdentifiableHandlerImpl<>(store); } } \ No newline at end of file diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendFields.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendFields.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendFields.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendFields.java index 828bb33d23..a33c4456d0 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendFields.java @@ -26,15 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.legendset.Legend; -final class LegendFields { - final static String START_VALUE = "startValue"; - final static String END_VALUE = "endValue"; - final static String COLOR = "color"; +public final class LegendFields { + public final static String START_VALUE = "startValue"; + public final static String END_VALUE = "endValue"; + public final static String COLOR = "color"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendPackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendPackageDIModule.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendPackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendPackageDIModule.java index 42b9d41991..4e5605fff2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendPackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendPackageDIModule.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; import dagger.Module; diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetEntityDIModule.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetEntityDIModule.java index a049aba128..7b66b1517a 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetEntityDIModule.java @@ -26,14 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; -import org.hisp.dhis.android.core.arch.handlers.SyncHandler; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.OrphanCleaner; -import org.hisp.dhis.android.core.common.OrphanCleanerImpl; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleaner; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleanerImpl; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +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.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.legendset.Legend; +import org.hisp.dhis.android.core.legendset.LegendSet; +import org.hisp.dhis.android.core.legendset.LegendTableInfo; import java.util.Collections; import java.util.Map; @@ -53,7 +56,7 @@ public IdentifiableObjectStore store(DatabaseAdapter databaseAdapter) @Provides @Reusable - public SyncHandler handler(LegendSetHandler impl) { + public Handler handler(LegendSetHandler impl) { return impl; } diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetFields.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetFields.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetFields.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetFields.java index 34c3d0762c..e4d80e5237 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetFields.java @@ -26,15 +26,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; -import org.hisp.dhis.android.core.data.api.Fields; +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.legendset.Legend; +import org.hisp.dhis.android.core.legendset.LegendSet; public final class LegendSetFields { - final static String SYMBOLIZER = "symbolizer"; - final static String LEGENDS = "legends"; + public final static String SYMBOLIZER = "symbolizer"; + public final static String LEGENDS = "legends"; private static final FieldsHelper fh = new FieldsHelper<>(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetHandler.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetHandler.java similarity index 76% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetHandler.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetHandler.java index ec60ff15f6..c785479f66 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetHandler.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetHandler.java @@ -25,28 +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.legendset; +package org.hisp.dhis.android.core.legendset.internal; -import org.hisp.dhis.android.core.arch.handlers.IdentifiableSyncHandlerImpl; -import org.hisp.dhis.android.core.arch.handlers.SyncHandlerWithTransformer; -import org.hisp.dhis.android.core.common.HandleAction; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.cleaners.internal.OrphanCleaner; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.handlers.internal.HandleAction; +import org.hisp.dhis.android.core.arch.handlers.internal.HandlerWithTransformer; +import org.hisp.dhis.android.core.arch.handlers.internal.IdentifiableHandlerImpl; import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.common.OrphanCleaner; +import org.hisp.dhis.android.core.legendset.Legend; +import org.hisp.dhis.android.core.legendset.LegendSet; import javax.inject.Inject; import dagger.Reusable; @Reusable -final class LegendSetHandler extends IdentifiableSyncHandlerImpl { +final class LegendSetHandler extends IdentifiableHandlerImpl { - private final SyncHandlerWithTransformer legendHandler; + private final HandlerWithTransformer legendHandler; private final OrphanCleaner legendCleaner; @Inject LegendSetHandler(IdentifiableObjectStore legendSetStore, - SyncHandlerWithTransformer legendHandler, + HandlerWithTransformer legendHandler, OrphanCleaner legendCleaner) { super(legendSetStore); this.legendHandler = legendHandler; diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetModuleWiper.java similarity index 89% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetModuleWiper.java index eacabeb660..c444b670c3 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetModuleWiper.java @@ -26,8 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; +import org.hisp.dhis.android.core.legendset.LegendSetTableInfo; +import org.hisp.dhis.android.core.legendset.LegendTableInfo; +import org.hisp.dhis.android.core.legendset.ProgramIndicatorLegendSetLinkTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetStore.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStore.java similarity index 79% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetStore.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStore.java index 67ee199362..439a439033 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendSetStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStore.java @@ -26,18 +26,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; import android.database.sqlite.SQLiteStatement; -import androidx.annotation.NonNull; -import org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.IdentifiableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.legendset.LegendSet; +import org.hisp.dhis.android.core.legendset.LegendSetTableInfo; + +import androidx.annotation.NonNull; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class LegendSetStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendStore.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendStore.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/LegendStore.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendStore.java index 41c0c7ea48..03f8cf2b1b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/LegendStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/LegendStore.java @@ -26,21 +26,23 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; import android.database.sqlite.SQLiteStatement; -import org.hisp.dhis.android.core.arch.db.binders.IdentifiableStatementBinder; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.arch.db.tableinfos.SingleParentChildProjection; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.IdentifiableStatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.projections.internal.SingleParentChildProjection; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.legendset.Legend; +import org.hisp.dhis.android.core.legendset.LegendTableInfo; import androidx.annotation.NonNull; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class LegendStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStore.java b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/ProgramIndicatorLegendSetLinkStore.java similarity index 81% rename from core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStore.java rename to core/src/main/java/org/hisp/dhis/android/core/legendset/internal/ProgramIndicatorLegendSetLinkStore.java index e5a801ebaa..062b1cc288 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/legendset/internal/ProgramIndicatorLegendSetLinkStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.legendset; +package org.hisp.dhis.android.core.legendset.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.LinkModelStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.LinkModelStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.legendset.ProgramIndicatorLegendSetLink; +import org.hisp.dhis.android.core.legendset.ProgramIndicatorLegendSetLinkTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class ProgramIndicatorLegendSetLinkStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2Error.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2Error.java index c2a7edb58f..068a7c63c2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2Error.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2Error.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.maintenance; import android.database.Cursor; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.google.auto.value.AutoValue; @@ -45,6 +43,9 @@ import java.util.Date; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue public abstract class D2Error extends Exception implements ObjectWithUidInterface, Model { diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorCollectionRepository.java index ab0573efc6..6a0e91acd6 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorCollectionRepository.java @@ -28,16 +28,16 @@ package org.hisp.dhis.android.core.maintenance; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.EnumFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.IntegerFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl; +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.IntegerFilterConnector; +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.BaseIdentifiableObjectModel; -import org.hisp.dhis.android.core.common.ObjectStore; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorTableInfo.java index 78602c91eb..cb4c37211f 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorTableInfo.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.maintenance; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolation.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolation.java index 3f2df4aea3..413522f5df 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolation.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolation.java @@ -29,8 +29,6 @@ package org.hisp.dhis.android.core.maintenance; import android.database.Cursor; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import com.gabrielittner.auto.value.cursor.ColumnAdapter; import com.google.auto.value.AutoValue; @@ -40,6 +38,9 @@ import java.util.Date; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + @AutoValue public abstract class ForeignKeyViolation extends BaseModel { diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationCollectionRepository.java index 4c390efb67..5bc96f8cdf 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationCollectionRepository.java @@ -28,13 +28,13 @@ package org.hisp.dhis.android.core.maintenance; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.DateFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.DateFilterConnector; +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.ObjectStore; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationTableInfo.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationTableInfo.java index 53bade169d..ccba4f223e 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationTableInfo.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationTableInfo.java @@ -28,7 +28,7 @@ package org.hisp.dhis.android.core.maintenance; -import org.hisp.dhis.android.core.arch.db.TableInfo; +import org.hisp.dhis.android.core.arch.db.tableinfos.TableInfo; import org.hisp.dhis.android.core.common.BaseModel; import org.hisp.dhis.android.core.utils.Utils; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/PerformanceHintsService.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/PerformanceHintsService.java index 62e78bcb03..e47e09a566 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/PerformanceHintsService.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/PerformanceHintsService.java @@ -28,15 +28,15 @@ package org.hisp.dhis.android.core.maintenance; -import org.hisp.dhis.android.core.common.IdentifiableObjectStore; -import org.hisp.dhis.android.core.common.UidsHelper; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.helpers.UidsHelper; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitStore; +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; import org.hisp.dhis.android.core.program.Program; import org.hisp.dhis.android.core.program.ProgramRule; -import org.hisp.dhis.android.core.program.ProgramRuleStore; -import org.hisp.dhis.android.core.program.ProgramStore; +import org.hisp.dhis.android.core.program.internal.ProgramRuleStore; +import org.hisp.dhis.android.core.program.internal.ProgramStore; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorEntityDIModule.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorEntityDIModule.java index 7287149386..a0a53eb028 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorEntityDIModule.java @@ -26,11 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.maintenance.D2Error; import java.util.Collections; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorStore.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStore.java similarity index 83% rename from core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorStore.java rename to core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStore.java index fe3e63bf79..344b29de3d 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/D2ErrorStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStore.java @@ -26,14 +26,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.ObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.maintenance.D2ErrorTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; public final class D2ErrorStore { diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleaner.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleaner.java similarity index 96% rename from core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleaner.java rename to core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleaner.java index 5fba6ccf35..d32652dd36 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleaner.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleaner.java @@ -26,7 +26,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; public interface ForeignKeyCleaner { Integer cleanForeignKeyErrors(); diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleanerImpl.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerImpl.java similarity index 97% rename from core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleanerImpl.java rename to core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerImpl.java index b2fb47ab57..62be98513b 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyCleanerImpl.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerImpl.java @@ -26,14 +26,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; import android.database.Cursor; import android.util.Log; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; import org.hisp.dhis.android.core.common.BaseIdentifiableObjectModel; -import org.hisp.dhis.android.core.common.ObjectStore; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolation; import org.hisp.dhis.android.core.utils.Utils; import java.util.ArrayList; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationEntityDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationEntityDIModule.java similarity index 88% rename from core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationEntityDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationEntityDIModule.java index 759e90aa1a..b5a9a08228 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationEntityDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationEntityDIModule.java @@ -26,11 +26,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolation; import java.util.Collections; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationStore.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStore.java similarity index 78% rename from core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationStore.java rename to core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStore.java index 08e590d15b..98bfd30581 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/ForeignKeyViolationStore.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStore.java @@ -26,16 +26,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; -import org.hisp.dhis.android.core.arch.db.binders.StatementBinder; -import org.hisp.dhis.android.core.common.ObjectStore; -import org.hisp.dhis.android.core.common.StoreFactory; +import org.hisp.dhis.android.core.arch.db.stores.binders.internal.StatementBinder; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.StoreFactory; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolation; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolationTableInfo; -import static org.hisp.dhis.android.core.utils.StoreUtils.sqLiteBind; +import static org.hisp.dhis.android.core.arch.db.stores.internal.StoreUtils.sqLiteBind; -public final class ForeignKeyViolationStore { +final class ForeignKeyViolationStore { private static final StatementBinder BINDER = (o, sqLiteStatement) -> { sqLiteBind(sqLiteStatement, 1, o.fromTable()); @@ -51,7 +53,7 @@ public final class ForeignKeyViolationStore { private ForeignKeyViolationStore() { } - public static ObjectStore create(DatabaseAdapter databaseAdapter) { + static ObjectStore create(DatabaseAdapter databaseAdapter) { return StoreFactory.objectStore(databaseAdapter, ForeignKeyViolationTableInfo.TABLE_INFO, BINDER, ForeignKeyViolation::create); } diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/MaintenanceModuleWiper.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/MaintenanceModuleWiper.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/maintenance/MaintenanceModuleWiper.java rename to core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/MaintenanceModuleWiper.java index bd1126ee6f..dfdbee0890 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/MaintenanceModuleWiper.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/MaintenanceModuleWiper.java @@ -25,8 +25,10 @@ * (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.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; +import org.hisp.dhis.android.core.maintenance.D2ErrorTableInfo; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolationTableInfo; import org.hisp.dhis.android.core.wipe.ModuleWiper; import org.hisp.dhis.android.core.wipe.TableWiper; diff --git a/core/src/main/java/org/hisp/dhis/android/core/maintenance/MaintenancePackageDIModule.java b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/MaintenancePackageDIModule.java similarity index 91% rename from core/src/main/java/org/hisp/dhis/android/core/maintenance/MaintenancePackageDIModule.java rename to core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/MaintenancePackageDIModule.java index d54370ccc6..87cf93ea5c 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/maintenance/MaintenancePackageDIModule.java +++ b/core/src/main/java/org/hisp/dhis/android/core/maintenance/internal/MaintenancePackageDIModule.java @@ -26,10 +26,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.android.core.maintenance; +package org.hisp.dhis.android.core.maintenance.internal; -import org.hisp.dhis.android.core.common.ObjectStore; +import org.hisp.dhis.android.core.arch.db.stores.internal.ObjectStore; import org.hisp.dhis.android.core.data.database.DatabaseAdapter; +import org.hisp.dhis.android.core.maintenance.ForeignKeyViolation; import dagger.Module; import dagger.Provides; diff --git a/core/src/main/java/org/hisp/dhis/android/core/option/OptionCollectionRepository.java b/core/src/main/java/org/hisp/dhis/android/core/option/OptionCollectionRepository.java index 7abdc20293..1a280a52c5 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/option/OptionCollectionRepository.java +++ b/core/src/main/java/org/hisp/dhis/android/core/option/OptionCollectionRepository.java @@ -27,13 +27,13 @@ */ package org.hisp.dhis.android.core.option; -import org.hisp.dhis.android.core.arch.repositories.children.ChildrenAppender; -import org.hisp.dhis.android.core.arch.repositories.collection.ReadOnlyIdentifiableCollectionRepositoryImpl; -import org.hisp.dhis.android.core.arch.repositories.filters.FilterConnectorFactory; -import org.hisp.dhis.android.core.arch.repositories.filters.IntegerFilterConnector; -import org.hisp.dhis.android.core.arch.repositories.filters.StringFilterConnector; +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; +import org.hisp.dhis.android.core.arch.repositories.children.internal.ChildrenAppender; +import org.hisp.dhis.android.core.arch.repositories.collection.internal.ReadOnlyIdentifiableCollectionRepositoryImpl; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.FilterConnectorFactory; +import org.hisp.dhis.android.core.arch.repositories.filters.internal.IntegerFilterConnector; +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.IdentifiableObjectStore; import java.util.Map; diff --git a/core/src/main/java/org/hisp/dhis/android/core/option/OptionFields.java b/core/src/main/java/org/hisp/dhis/android/core/option/OptionFields.java index 5afa6ec111..a4910524b2 100644 --- a/core/src/main/java/org/hisp/dhis/android/core/option/OptionFields.java +++ b/core/src/main/java/org/hisp/dhis/android/core/option/OptionFields.java @@ -28,17 +28,17 @@ package org.hisp.dhis.android.core.option; -import org.hisp.dhis.android.core.arch.fields.FieldsHelper; +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.ObjectStyleFields; -import org.hisp.dhis.android.core.data.api.Field; -import org.hisp.dhis.android.core.data.api.Fields; +import org.hisp.dhis.android.core.common.objectstyle.internal.ObjectStyleFields; public final class OptionFields { - final static String SORT_ORDER = "sortOrder"; + public final static String SORT_ORDER = "sortOrder"; public final static String OPTION_SET = "optionSet"; - final static String STYLE = "style"; + public final static String STYLE = "style"; private static final FieldsHelper