Skip to content

Commit

Permalink
[ANDROAPP-6028] Remove rule engine duplicate extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo <[email protected]>
  • Loading branch information
Balcan committed May 10, 2024
1 parent 2634d8e commit e98462f
Show file tree
Hide file tree
Showing 19 changed files with 16 additions and 1,497 deletions.
92 changes: 0 additions & 92 deletions app/src/main/java/org/dhis2/data/forms/EnrollmentFormRepository.kt

This file was deleted.

98 changes: 0 additions & 98 deletions app/src/main/java/org/dhis2/data/forms/EventRepository.java

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/main/java/org/dhis2/data/forms/FormRepository.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
import org.dhis2.commons.resources.ResourceManager;
import org.dhis2.commons.schedulers.SchedulerProvider;
import org.dhis2.data.dhislogic.DhisEnrollmentUtils;
import org.dhis2.data.forms.EventRepository;
import org.dhis2.data.forms.FormRepository;
import org.dhis2.data.forms.dataentry.SearchTEIRepository;
import org.dhis2.data.forms.dataentry.SearchTEIRepositoryImpl;
import org.dhis2.mobileProgramRules.EvaluationType;
import org.dhis2.mobileProgramRules.RuleEngineHelper;
import org.dhis2.form.data.FileController;
import org.dhis2.form.data.FormValueStore;
import org.dhis2.form.data.RulesRepository;
import org.dhis2.form.data.UniqueAttributeController;
import org.dhis2.form.model.RowAction;
import org.dhis2.form.ui.FieldViewModelFactory;
Expand Down Expand Up @@ -77,12 +74,6 @@ EventCaptureContract.EventCaptureRepository provideRepository(D2 d2) {
return new EventCaptureRepositoryImpl(eventUid, d2);
}

@Provides
@PerActivity
RulesRepository rulesRepository(@NonNull D2 d2) {
return new RulesRepository(d2);
}

@Provides
@PerActivity
RuleEngineHelper ruleEngineRepository(D2 d2) {
Expand All @@ -93,13 +84,6 @@ RuleEngineHelper ruleEngineRepository(D2 d2) {
);
}

@Provides
@PerActivity
FormRepository formRepository(@NonNull RulesRepository rulesRepository,
@NonNull D2 d2) {
return new EventRepository(rulesRepository, eventUid, d2);
}

@Provides
@PerActivity
FormValueStore valueStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
import org.dhis2.commons.resources.DhisPeriodUtils;
import org.dhis2.commons.resources.ResourceManager;
import org.dhis2.commons.schedulers.SchedulerProvider;
import org.dhis2.data.forms.EventRepository;
import org.dhis2.data.forms.FormRepository;
import org.dhis2.form.data.RulesRepository;
import org.dhis2.form.data.RulesUtilsProvider;
import org.dhis2.form.data.metadata.FileResourceConfiguration;
import org.dhis2.form.data.metadata.OptionSetConfiguration;
Expand Down Expand Up @@ -118,17 +115,6 @@ FieldViewModelFactory fieldFactory(
);
}

@Provides
FormRepository formRepository(@NonNull RulesRepository rulesRepository,
@NonNull D2 d2) {
return new EventRepository(rulesRepository, eventUid, d2);
}

@Provides
RulesRepository rulesRepository(@NonNull D2 d2) {
return new RulesRepository(d2);
}

@Provides
@PerActivity
EventInitialRepository eventDetailRepository(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import org.dhis2.commons.prefs.PreferenceProvider
import org.dhis2.commons.resources.MetadataIconProvider
import org.dhis2.commons.schedulers.SchedulerProvider
import org.dhis2.commons.viewmodel.DispatcherProvider
import org.dhis2.data.forms.EnrollmentFormRepository
import org.dhis2.data.forms.FormRepository
import org.dhis2.form.data.RulesRepository
import org.dhis2.mobileProgramRules.EvaluationType
import org.dhis2.mobileProgramRules.RuleEngineHelper
import org.dhis2.utils.analytics.AnalyticsHelper
Expand Down Expand Up @@ -73,26 +70,6 @@ class TeiDashboardModule(
)
}

@Provides
@PerActivity
fun rulesRepository(d2: D2): RulesRepository {
return RulesRepository(d2)
}

@Provides
@PerActivity
fun formRepository(
rulesRepository: RulesRepository,
d2: D2,
): FormRepository {
val enrollmentUidToUse = enrollmentUid ?: ""
return EnrollmentFormRepository(
rulesRepository,
enrollmentUidToUse,
d2,
)
}

@Provides
@PerActivity
fun ruleEngineRepository(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.dhis2.usescases.troubleshooting

import org.dhis2.commons.resources.MetadataIconProvider
import org.dhis2.form.bindings.toRuleEngineObject
import org.dhis2.form.bindings.toRuleVariableList
import org.dhis2.mobileProgramRules.toRuleEngineObject
import org.dhis2.mobileProgramRules.toRuleVariableList
import org.dhis2.usescases.development.ProgramRuleValidation
import org.dhis2.usescases.development.RuleValidation
import org.hisp.dhis.android.core.D2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.dhis2.data.forms

import org.dhis2.form.data.RulesRepository
import org.hisp.dhis.android.core.D2
import org.hisp.dhis.android.core.organisationunit.OrganisationUnit
import org.hisp.dhis.android.core.organisationunit.OrganisationUnitGroup
Expand Down

This file was deleted.

9 changes: 6 additions & 3 deletions dhis2-mobile-program-rules/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ android {
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
}

dependencies {
implementation(project(":commons"))
testImplementation(libs.test.mockitoCore)
testImplementation(libs.test.mockitoInline)
testImplementation(libs.test.mockitoKotlin)
coreLibraryDesugaring(libs.desugar)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.dhis2.mobileProgramRules
import kotlinx.datetime.Instant
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import org.dhis2.commons.rules.toRuleEngineInstant
import org.hisp.dhis.android.core.D2
import org.hisp.dhis.android.core.common.ValueType
import org.hisp.dhis.android.core.dataelement.DataElementCollectionRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import org.dhis2.commons.bindings.event
import org.dhis2.commons.bindings.organisationUnit
import org.dhis2.commons.bindings.program
import org.dhis2.commons.bindings.programStage
import org.dhis2.commons.rules.toRuleEngineInstant
import org.dhis2.commons.rules.toRuleEngineLocalDate
import org.hisp.dhis.android.core.D2
import org.hisp.dhis.android.core.arch.helpers.UidsHelper
import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope
Expand Down
Loading

0 comments on commit e98462f

Please sign in to comment.