@@ -105,23 +105,23 @@ public void checkSyncStrategy() {
105
105
// Subject with one concept attribute, location migrated
106
106
ObservationCollection observations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" ).getUuid ());
107
107
Individual s1 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (observations ).build ());
108
- subjectMigrationService .markSubjectMigrationIfRequired (s1 .getUuid (), catchmentData .getAddressLevel2 (), observations , false );
108
+ subjectMigrationService .markSubjectMigrationIfRequired (s1 .getUuid (), null , catchmentData .getAddressLevel2 (), null , observations , false );
109
109
List syncDetails = getSyncDetails ();
110
110
assertTrue (syncDetails .contains (EntitySyncStatusContract .createForComparison (SyncEntityName .SubjectMigration .name (), subjectType .getUuid ())));
111
111
assertEquals (1 , getMigrations (subjectType , DateTime .now ().minusDays (1 ), DateTime .now ()).size ());
112
112
assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s1 ));
113
113
114
114
// Subject with one concept attribute, attribute migrated
115
115
Individual s3 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" ).getUuid ())).build ());
116
- subjectMigrationService .markSubjectMigrationIfRequired (s3 .getUuid (), catchmentData .getAddressLevel1 (), ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" ).getUuid ()), false );
116
+ subjectMigrationService .markSubjectMigrationIfRequired (s3 .getUuid (), null , catchmentData .getAddressLevel1 (), null , ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" ).getUuid ()), false );
117
117
assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s3 ));
118
118
assertEquals (2 , getMigrations (subjectType , DateTime .now ().minusDays (1 ), DateTime .now ()).size ());
119
119
120
120
// Subject migrated but its old and new attributes are not assigned to user
121
121
observations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" ).getUuid ());
122
122
ObservationCollection newObservations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 13" ).getUuid ());
123
123
Individual s7 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (observations ).build ());
124
- subjectMigrationService .markSubjectMigrationIfRequired (s7 .getUuid (), catchmentData .getAddressLevel1 (), newObservations , false );
124
+ subjectMigrationService .markSubjectMigrationIfRequired (s7 .getUuid (), null , catchmentData .getAddressLevel1 (), null , newObservations , false );
125
125
assertFalse (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s7 ));
126
126
assertEquals (2 , getMigrations (subjectType , DateTime .now ().minusDays (1 ), DateTime .now ()).size ());
127
127
@@ -140,23 +140,23 @@ public void checkSyncStrategy() {
140
140
// Subject with two concept attributes, location migrated
141
141
observations = new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build ();
142
142
Individual s2 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (observations ).build ());
143
- subjectMigrationService .markSubjectMigrationIfRequired (s2 .getUuid (), catchmentData .getAddressLevel2 (), observations , false );
143
+ subjectMigrationService .markSubjectMigrationIfRequired (s2 .getUuid (), null , catchmentData .getAddressLevel2 (), null , observations , false );
144
144
assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s2 ));
145
145
146
146
// Subject with two concept attributes, first attribute migrated
147
147
Individual s4 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build ()).build ());
148
- subjectMigrationService .markSubjectMigrationIfRequired (s4 .getUuid (), catchmentData .getAddressLevel1 (), new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build (), false );
148
+ subjectMigrationService .markSubjectMigrationIfRequired (s4 .getUuid (), null , catchmentData .getAddressLevel1 (), null , new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build (), false );
149
149
assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s4 ));
150
150
151
151
// Subject with two concept attributes, second attribute migrated
152
152
Individual s5 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build ()).build ());
153
- subjectMigrationService .markSubjectMigrationIfRequired (s5 .getUuid (), catchmentData .getAddressLevel1 (), new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build (), false );
153
+ subjectMigrationService .markSubjectMigrationIfRequired (s5 .getUuid (), null , catchmentData .getAddressLevel1 (), null , new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build (), false );
154
154
boolean hasMigrationFor = hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s5 );
155
155
assertTrue (hasMigrationFor );
156
156
157
157
// Subject with two concept attributes, both attributes migrated
158
158
Individual s6 = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 21" )).build ()).build ());
159
- subjectMigrationService .markSubjectMigrationIfRequired (s6 .getUuid (), catchmentData .getAddressLevel1 (), new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build (), false );
159
+ subjectMigrationService .markSubjectMigrationIfRequired (s6 .getUuid (), null , catchmentData .getAddressLevel1 (), null , new ObservationCollectionBuilder ().addObservation (concept1 , concept1 .getAnswerConcept ("Answer 12" )).addObservation (concept2 , concept2 .getAnswerConcept ("Answer 22" )).build (), false );
160
160
assertTrue (hasMigrationFor (subjectType , DateTime .now ().minusDays (1 ), DateTime .now (), s6 ));
161
161
162
162
// User without sync attributes setup will not get any migration as that is more performance optimised. Setting
@@ -178,7 +178,7 @@ public void migrations_created_by_one_user_is_returned_for_another_user_even_whe
178
178
ObservationCollection observations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" ).getUuid ());
179
179
ObservationCollection newObservations = ObservationCollectionBuilder .withOneObservation (concept1 , concept1 .getAnswerConcept ("Answer 11" ).getUuid ());
180
180
Individual s = testSubjectService .save (new SubjectBuilder ().withMandatoryFieldsForNewEntity ().withSubjectType (subjectType ).withLocation (catchmentData .getAddressLevel1 ()).withObservations (observations ).build ());
181
- subjectMigrationService .markSubjectMigrationIfRequired (s .getUuid (), catchmentData .getAddressLevel2 (), newObservations , false );
181
+ subjectMigrationService .markSubjectMigrationIfRequired (s .getUuid (), null , catchmentData .getAddressLevel2 (), null , newObservations , false );
182
182
assertTrue (getSyncDetails ().contains (EntitySyncStatusContract .createForComparison (SyncEntityName .SubjectMigration .name (), subjectType .getUuid ())));
183
183
assertEquals (1 , getMigrations (subjectType , DateTime .now ().minusDays (1 ), DateTime .now ()).size ());
184
184
0 commit comments