diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Enrollment.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Enrollment.java index af2e119d9631..9b1d85b1d7bd 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Enrollment.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Enrollment.java @@ -67,7 +67,7 @@ public class Enrollment extends SoftDeletableObject { @AuditAttribute private OrganisationUnit organisationUnit; - private Date incidentDate; + private Date occurredDate; private Date enrollmentDate; @@ -104,9 +104,9 @@ public class Enrollment extends SoftDeletableObject { public Enrollment() {} public Enrollment( - Date enrollmentDate, Date incidentDate, TrackedEntity trackedEntity, Program program) { + Date enrollmentDate, Date occurredDate, TrackedEntity trackedEntity, Program program) { this.enrollmentDate = enrollmentDate; - this.incidentDate = incidentDate; + this.occurredDate = occurredDate; this.trackedEntity = trackedEntity; this.program = program; } @@ -160,7 +160,7 @@ public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + ((incidentDate == null) ? 0 : incidentDate.hashCode()); + result = prime * result + ((occurredDate == null) ? 0 : occurredDate.hashCode()); result = prime * result + ((enrollmentDate == null) ? 0 : enrollmentDate.hashCode()); result = prime * result + ((trackedEntity == null) ? 0 : trackedEntity.hashCode()); result = prime * result + ((program == null) ? 0 : program.hashCode()); @@ -174,7 +174,7 @@ public boolean equals(Object obj) { } private boolean objectEquals(Enrollment other) { - return Objects.equals(incidentDate, other.incidentDate) + return Objects.equals(occurredDate, other.occurredDate) && Objects.equals(enrollmentDate, other.enrollmentDate) && Objects.equals(trackedEntity, other.trackedEntity) && Objects.equals(program, other.program); @@ -218,12 +218,12 @@ public Enrollment setOrganisationUnit(OrganisationUnit organisationUnit) { @JsonProperty @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) - public Date getIncidentDate() { - return incidentDate; + public Date getOccurredDate() { + return occurredDate; } - public void setIncidentDate(Date incidentDate) { - this.incidentDate = incidentDate; + public void setOccurredDate(Date occurredDate) { + this.occurredDate = occurredDate; } @JsonProperty @@ -405,7 +405,7 @@ public String toString() { + ", organisationUnit=" + (organisationUnit != null ? organisationUnit.getUid() : "null") + ", incidentDate=" - + incidentDate + + occurredDate + ", enrollmentDate=" + enrollmentDate + ", entityInstance=" @@ -439,7 +439,7 @@ private static void setShallowCopyValues( copy.setEvents(new HashSet<>()); copy.setFollowup(original.getFollowup()); copy.setGeometry(original.getGeometry()); - copy.setIncidentDate(original.getIncidentDate()); + copy.setOccurredDate(original.getOccurredDate()); copy.setLastUpdatedAtClient(original.getLastUpdatedAtClient()); copy.setLastUpdatedByUserInfo(original.getLastUpdatedByUserInfo()); copy.setMessageConversations(ObjectUtils.copyOf(original.getMessageConversations())); diff --git a/dhis-2/dhis-api/src/test/java/org/hisp/dhis/program/EnrollmentTest.java b/dhis-2/dhis-api/src/test/java/org/hisp/dhis/program/EnrollmentTest.java index 4f34112e5c6f..febb4f0ecb84 100644 --- a/dhis-2/dhis-api/src/test/java/org/hisp/dhis/program/EnrollmentTest.java +++ b/dhis-2/dhis-api/src/test/java/org/hisp/dhis/program/EnrollmentTest.java @@ -63,7 +63,7 @@ void testCopyOfWithPropertyValuesSet() { assertEquals(original.getStatus(), copy.getStatus()); assertEquals(original.getNotes(), copy.getNotes()); assertEquals(original.getName(), copy.getName()); - assertEquals(original.getIncidentDate(), copy.getIncidentDate()); + assertEquals(original.getOccurredDate(), copy.getOccurredDate()); assertEquals(original.getEnrollmentDate(), copy.getEnrollmentDate()); assertEquals(original.getFollowup(), copy.getFollowup()); assertEquals(original.getGeometry(), copy.getGeometry()); @@ -90,7 +90,7 @@ void testCopyOfWithNullPropertyValues() { assertEquals(original.getEnrollmentDate(), copy.getEnrollmentDate()); assertEquals(original.getFollowup(), copy.getFollowup()); assertEquals(original.getGeometry(), copy.getGeometry()); - assertEquals(original.getIncidentDate(), copy.getIncidentDate()); + assertEquals(original.getOccurredDate(), copy.getOccurredDate()); assertEquals(original.getName(), copy.getName()); assertEquals(original.getOrganisationUnit(), copy.getOrganisationUnit()); assertEquals(original.getStatus(), copy.getStatus()); @@ -121,7 +121,7 @@ private Enrollment getNewEnrollmentWithNoNulls() { e.setEnrollmentDate(new Date()); e.setEvents(Set.of()); e.setFollowup(true); - e.setIncidentDate(new Date()); + e.setOccurredDate(new Date()); e.setMessageConversations(List.of(new MessageConversation())); e.setName("Enrollment 1"); e.setOrganisationUnit(new OrganisationUnit("org1")); @@ -141,7 +141,7 @@ private Enrollment getNewEnrollmentWithNulls() { e.setCompletedDate(null); e.setEnrollmentDate(null); e.setEvents(null); - e.setIncidentDate(null); + e.setOccurredDate(null); e.setMessageConversations(null); e.setOrganisationUnit(null); e.setProgram(null); diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEnrollmentAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEnrollmentAnalyticsTableManager.java index 380890094e29..826dfe59944a 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEnrollmentAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEnrollmentAnalyticsTableManager.java @@ -111,7 +111,7 @@ public JdbcEnrollmentAnalyticsTableManager( new AnalyticsTableColumn( quote("completeddate"), TIMESTAMP, - "case pi.status when 'COMPLETED' then pi.enddate end"), + "case pi.status when 'COMPLETED' then pi.completeddate end"), new AnalyticsTableColumn(quote("lastupdated"), TIMESTAMP, "pi.lastupdated"), new AnalyticsTableColumn(quote("storedby"), VARCHAR_255, "pi.storedby"), new AnalyticsTableColumn( diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java index be2333f65c91..6c8c718a1ec4 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOwnershipAnalyticsTableManager.java @@ -178,30 +178,32 @@ private void populateTableInternal(AnalyticsTablePartition partition, String sql List columnNames = getDimensionColumns().stream().map(AnalyticsTableColumn::getName).collect(toList()); - MappingBatchHandler batchHandler = + try (MappingBatchHandler batchHandler = MappingBatchHandler.builder() .jdbcConfiguration(jdbcConfiguration) .tableName(partition.getTempTableName()) .columns(columnNames) - .build(); - - batchHandler.init(); - - JdbcOwnershipWriter writer = JdbcOwnershipWriter.getInstance(batchHandler); - AtomicInteger queryRowCount = new AtomicInteger(); - - jdbcTemplate.query( - sql, - resultSet -> { - writer.write(getRowMap(columnNames, resultSet)); - queryRowCount.getAndIncrement(); - }); - - log.info( - "OwnershipAnalytics query row count was {} for {}", - queryRowCount, - partition.getTempTableName()); - batchHandler.flush(); + .build()) { + batchHandler.init(); + + JdbcOwnershipWriter writer = JdbcOwnershipWriter.getInstance(batchHandler); + AtomicInteger queryRowCount = new AtomicInteger(); + + jdbcTemplate.query( + sql, + resultSet -> { + writer.write(getRowMap(columnNames, resultSet)); + queryRowCount.getAndIncrement(); + }); + + log.info( + "OwnershipAnalytics query row count was {} for {}", + queryRowCount, + partition.getTempTableName()); + batchHandler.flush(); + } catch (Exception ex) { + log.error("Failed to alter table ownership: ", ex); + } } private String getInputSql(Program program) { diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcTeiEnrollmentsAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcTeiEnrollmentsAnalyticsTableManager.java index 6edfaef05b46..8825abcfae9b 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcTeiEnrollmentsAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcTeiEnrollmentsAnalyticsTableManager.java @@ -120,7 +120,7 @@ public JdbcTeiEnrollmentsAnalyticsTableManager( new AnalyticsTableColumn(quote("programuid"), CHARACTER_11, NULL, "p.uid"), new AnalyticsTableColumn(quote("programinstanceuid"), CHARACTER_11, NULL, "pi.uid"), new AnalyticsTableColumn(quote("enrollmentdate"), TIMESTAMP, "pi.enrollmentdate"), - new AnalyticsTableColumn(quote("enddate"), TIMESTAMP, "pi.enddate"), + new AnalyticsTableColumn(quote("enddate"), TIMESTAMP, "pi.completeddate"), new AnalyticsTableColumn(quote("incidentdate"), TIMESTAMP, "pi.incidentdate"), new AnalyticsTableColumn(quote("enrollmentstatus"), VARCHAR_50, "pi.status"), new AnalyticsTableColumn(quote("pigeometry"), GEOMETRY, "pi.geometry") diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/notification/ProgramNotificationMessageRenderer.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/notification/ProgramNotificationMessageRenderer.java index 622ac2f09c64..19c07616aece 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/notification/ProgramNotificationMessageRenderer.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/notification/ProgramNotificationMessageRenderer.java @@ -56,7 +56,7 @@ public class ProgramNotificationMessageRenderer e -> e.getOrganisationUnit().getDisplayName()) .put(ProgramTemplateVariable.CURRENT_DATE, e -> formatDate(new Date())) .put(ProgramTemplateVariable.ENROLLMENT_DATE, e -> formatDate(e.getEnrollmentDate())) - .put(ProgramTemplateVariable.INCIDENT_DATE, e -> formatDate(e.getIncidentDate())) + .put(ProgramTemplateVariable.INCIDENT_DATE, e -> formatDate(e.getOccurredDate())) .put( ProgramTemplateVariable.DAYS_SINCE_ENROLLMENT_DATE, e -> daysSince(e.getEnrollmentDate())) diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultEnrollmentService.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultEnrollmentService.java index f4e8752ba6da..45c4120be415 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultEnrollmentService.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultEnrollmentService.java @@ -357,9 +357,9 @@ public Enrollment prepareEnrollment( } if (incidentDate != null) { - enrollment.setIncidentDate(incidentDate); + enrollment.setOccurredDate(incidentDate); } else { - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); } enrollment.setStatus(programStatus); diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateEnrollmentStore.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateEnrollmentStore.java index 4fb046b2b216..52098886b6b0 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateEnrollmentStore.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateEnrollmentStore.java @@ -449,7 +449,7 @@ private String toDateProperty(NotificationTrigger trigger) { if (trigger == NotificationTrigger.SCHEDULED_DAYS_ENROLLMENT_DATE) { return "enrollmentDate"; } else if (trigger == NotificationTrigger.SCHEDULED_DAYS_INCIDENT_DATE) { - return "incidentDate"; + return "occurredDate"; } return null; diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/CommandSMSListener.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/CommandSMSListener.java index ac6185408ada..19ee1f9a358b 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/CommandSMSListener.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/CommandSMSListener.java @@ -222,7 +222,7 @@ protected void register( if (enrollments.isEmpty()) { Enrollment enrollment = new Enrollment(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setProgram(smsCommand.getProgram()); enrollment.setStatus(ProgramStatus.ACTIVE); diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/EnrollmentSMSListener.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/EnrollmentSMSListener.java index eaf87ce99a97..2e0b295fc500 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/EnrollmentSMSListener.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/EnrollmentSMSListener.java @@ -184,7 +184,7 @@ protected SmsResponse postProcess(IncomingSms sms, SmsSubmission submission) enrollment = enrollmentService.getEnrollment(enrollmentid.getUid()); // Update these dates in case they've changed enrollment.setEnrollmentDate(enrollmentDate); - enrollment.setIncidentDate(incidentDate); + enrollment.setOccurredDate(incidentDate); } else { enrollment = enrollmentService.enrollTrackedEntity( diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/SimpleEventSMSListener.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/SimpleEventSMSListener.java index aebd48be0af6..fb2e0b861480 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/SimpleEventSMSListener.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/listener/SimpleEventSMSListener.java @@ -130,7 +130,7 @@ protected SmsResponse postProcess(IncomingSms sms, SmsSubmission submission) if (enrollments.isEmpty()) { Enrollment enrollment = new Enrollment(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setProgram(program); enrollment.setStatus(ProgramStatus.ACTIVE); diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Enrollment.hbm.xml b/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Enrollment.hbm.xml index 630a7f13bb6d..78ff6139137d 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Enrollment.hbm.xml +++ b/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/program/hibernate/Enrollment.hbm.xml @@ -28,11 +28,11 @@ - + - + diff --git a/dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/notification/TrackerNotificationWebHookServiceTest.java b/dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/notification/TrackerNotificationWebHookServiceTest.java index 4e11768f6bde..7ad265ced286 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/notification/TrackerNotificationWebHookServiceTest.java +++ b/dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/notification/TrackerNotificationWebHookServiceTest.java @@ -139,7 +139,7 @@ public void initTest() { enrollment.setProgram(programA); enrollment.setOrganisationUnit(organisationUnitA); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setTrackedEntity(tei); event = new Event(); diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/DefaultCompleteDataSetRegistrationExchangeService.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/DefaultCompleteDataSetRegistrationExchangeService.java index a14e523ecd6b..d5b1b2b653d1 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/DefaultCompleteDataSetRegistrationExchangeService.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/DefaultCompleteDataSetRegistrationExchangeService.java @@ -244,9 +244,9 @@ public ImportSummary saveCompleteDataSetRegistrationsJson( private ImportSummary saveCompleteDataSetRegistrations( ImportOptions importOptions, Callable deserializeRegistrations) { - BatchHandler batchHandler = - batchHandlerFactory.createBatchHandler(CompleteDataSetRegistrationBatchHandler.class); - try { + + try (BatchHandler batchHandler = + batchHandlerFactory.createBatchHandler(CompleteDataSetRegistrationBatchHandler.class)) { CompleteDataSetRegistrations completeDataSetRegistrations = deserializeRegistrations.call(); ImportSummary summary = saveCompleteDataSetRegistrations( @@ -256,7 +256,7 @@ private ImportSummary saveCompleteDataSetRegistrations( return summary; } catch (Exception ex) { - batchHandler.flush(); + log.error("Complete data set registrations could not be saved."); return handleImportError(ex); } } diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java index d338bd8b2e99..df29650af7d3 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java @@ -620,14 +620,13 @@ private ImportSummary importDataValueSet( ImportOptions options, JobConfiguration id, Callable createReader) { options = ObjectUtils.firstNonNull(options, ImportOptions.getDefaultImportOptions()); - BatchHandler dvBatch = - batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class); - BatchHandler dvaBatch = - batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class); - notifier.clear(id); - try (DataValueSetReader reader = createReader.call()) { + try (BatchHandler dvBatch = + batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class); + BatchHandler dvaBatch = + batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class); + DataValueSetReader reader = createReader.call()) { ImportSummary summary = importDataValueSet(options, id, reader, dvBatch, dvaBatch); dvBatch.flush(); @@ -640,8 +639,6 @@ private ImportSummary importDataValueSet( return summary; } catch (Exception ex) { - dvBatch.flush(); - dvaBatch.flush(); log.error(DebugUtils.getStackTrace(ex)); notifier.notify(id, ERROR, "Process failed: " + ex.getMessage(), true); return new ImportSummary(ImportStatus.ERROR, "The import process failed: " + ex.getMessage()); diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/enrollment/AbstractEnrollmentService.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/enrollment/AbstractEnrollmentService.java index 11ab9b31dfb3..6bb5bc2ad172 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/enrollment/AbstractEnrollmentService.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/enrollment/AbstractEnrollmentService.java @@ -318,7 +318,7 @@ public org.hisp.dhis.dxf2.deprecated.tracker.enrollment.Enrollment getEnrollment enrollment.setProgram(programInstance.getProgram().getUid()); enrollment.setStatus(EnrollmentStatus.fromProgramStatus(programInstance.getStatus())); enrollment.setEnrollmentDate(programInstance.getEnrollmentDate()); - enrollment.setIncidentDate(programInstance.getIncidentDate()); + enrollment.setIncidentDate(programInstance.getOccurredDate()); enrollment.setFollowup(programInstance.getFollowup()); enrollment.setCompletedDate(programInstance.getCompletedDate()); enrollment.setCompletedBy(programInstance.getCompletedBy()); @@ -668,7 +668,7 @@ private ImportSummary validateProgramInstance( return importSummary; } - if (program.getDisplayIncidentDate() && programInstance.getIncidentDate() == null) { + if (program.getDisplayIncidentDate() && programInstance.getOccurredDate() == null) { importSummary.setStatus(ImportStatus.ERROR); importSummary.setDescription("DisplayIncidentDate is true but IncidentDate is null "); importSummary.incrementIgnored(); @@ -676,12 +676,12 @@ private ImportSummary validateProgramInstance( return importSummary; } - if (programInstance.getIncidentDate() != null + if (programInstance.getOccurredDate() != null && !DateUtils.dateIsValid( - DateUtils.getMediumDateString(programInstance.getIncidentDate()))) { + DateUtils.getMediumDateString(programInstance.getOccurredDate()))) { importSummary.setStatus(ImportStatus.ERROR); importSummary.setDescription( - "Invalid enollment incident date: " + programInstance.getIncidentDate()); + "Invalid enollment incident date: " + programInstance.getOccurredDate()); importSummary.incrementIgnored(); return importSummary; @@ -936,7 +936,7 @@ private ImportSummary updateEnrollment( programInstance.setProgram(program); if (enrollment.getIncidentDate() != null) { - programInstance.setIncidentDate(enrollment.getIncidentDate()); + programInstance.setOccurredDate(enrollment.getIncidentDate()); } if (enrollment.getEnrollmentDate() != null) { @@ -951,7 +951,7 @@ private ImportSummary updateEnrollment( programInstance.setFollowup(enrollment.getFollowup()); - if (program.getDisplayIncidentDate() && programInstance.getIncidentDate() == null) { + if (program.getDisplayIncidentDate() && programInstance.getOccurredDate() == null) { return new ImportSummary( ImportStatus.ERROR, "DisplayIncidentDate is true but IncidentDate is null") .incrementIgnored(); diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/trackedentity/store/query/EnrollmentQuery.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/trackedentity/store/query/EnrollmentQuery.java index 204212d6f6e6..93fc34014238 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/trackedentity/store/query/EnrollmentQuery.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/trackedentity/store/query/EnrollmentQuery.java @@ -79,7 +79,7 @@ public enum COLUMNS { .put(COLUMNS.ENROLLMENTDATE, new TableColumn("pi", "enrollmentdate")) .put(COLUMNS.INCIDENTDATE, new TableColumn("pi", "incidentdate")) .put(COLUMNS.FOLLOWUP, new TableColumn("pi", "followup")) - .put(COLUMNS.COMPLETED, new TableColumn("pi", "enddate")) + .put(COLUMNS.COMPLETED, new TableColumn("pi", "completeddate")) .put(COLUMNS.COMPLETEDBY, new TableColumn("pi", "completedby")) .put(COLUMNS.STOREDBY, new TableColumn("pi", "storedby")) .put(COLUMNS.DELETED, new TableColumn("pi", "deleted")) diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramObjectBundleHook.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramObjectBundleHook.java index febb7bc6f1ad..ee6531a39e3b 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramObjectBundleHook.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramObjectBundleHook.java @@ -113,7 +113,7 @@ private void addProgramInstance(Program program) { if (getProgramInstancesCount(program) == 0 && program.isWithoutRegistration()) { Enrollment pi = new Enrollment(); pi.setEnrollmentDate(new Date()); - pi.setIncidentDate(new Date()); + pi.setOccurredDate(new Date()); pi.setProgram(program); pi.setStatus(ProgramStatus.ACTIVE); pi.setStoredBy("system-process"); diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramObjectBundleHookTest.java b/dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramObjectBundleHookTest.java index 9e463eb88919..1d33996fef12 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramObjectBundleHookTest.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/objectbundle/hooks/ProgramObjectBundleHookTest.java @@ -113,7 +113,7 @@ void verifyProgramInstanceIsSavedForEventProgram() { verify(enrollmentService).addEnrollment(argument.capture()); assertThat(argument.getValue().getEnrollmentDate(), is(notNullValue())); - assertThat(argument.getValue().getIncidentDate(), is(notNullValue())); + assertThat(argument.getValue().getOccurredDate(), is(notNullValue())); assertThat(argument.getValue().getProgram(), is(programA)); assertThat(argument.getValue().getStatus(), is(ProgramStatus.ACTIVE)); assertThat(argument.getValue().getStoredBy(), is("system-process")); diff --git a/dhis-2/dhis-services/dhis-service-program-rule/src/main/java/org/hisp/dhis/programrule/engine/DefaultProgramRuleEntityMapperService.java b/dhis-2/dhis-services/dhis-service-program-rule/src/main/java/org/hisp/dhis/programrule/engine/DefaultProgramRuleEntityMapperService.java index e62b9d711bce..2d277f2bca9a 100644 --- a/dhis-2/dhis-services/dhis-service-program-rule/src/main/java/org/hisp/dhis/programrule/engine/DefaultProgramRuleEntityMapperService.java +++ b/dhis-2/dhis-services/dhis-service-program-rule/src/main/java/org/hisp/dhis/programrule/engine/DefaultProgramRuleEntityMapperService.java @@ -406,7 +406,7 @@ public RuleEnrollment toMappedRuleEnrollment( } return RuleEnrollment.create( enrollment.getUid(), - enrollment.getIncidentDate(), + enrollment.getOccurredDate(), enrollment.getEnrollmentDate(), RuleEnrollment.Status.valueOf(enrollment.getStatus().toString()), orgUnit, diff --git a/dhis-2/dhis-services/dhis-service-program-rule/src/test/java/org/hisp/dhis/programrule/engine/ProgramRuleEntityMapperServiceTest.java b/dhis-2/dhis-services/dhis-service-program-rule/src/test/java/org/hisp/dhis/programrule/engine/ProgramRuleEntityMapperServiceTest.java index 2e8597e30e01..a97019d2cd19 100644 --- a/dhis-2/dhis-services/dhis-service-program-rule/src/test/java/org/hisp/dhis/programrule/engine/ProgramRuleEntityMapperServiceTest.java +++ b/dhis-2/dhis-services/dhis-service-program-rule/src/test/java/org/hisp/dhis/programrule/engine/ProgramRuleEntityMapperServiceTest.java @@ -465,7 +465,7 @@ private void setUpProgramRules() { enrollment.setStatus(ProgramStatus.ACTIVE); enrollment.setAutoFields(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setTrackedEntity(trackedEntity); eventA = new Event(enrollment, programStage); diff --git a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/enrollment/DefaultEnrollmentService.java b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/enrollment/DefaultEnrollmentService.java index ca94d7be5498..0533ff47ec90 100644 --- a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/enrollment/DefaultEnrollmentService.java +++ b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/enrollment/DefaultEnrollmentService.java @@ -123,7 +123,7 @@ public Enrollment getEnrollment( result.setProgram(enrollment.getProgram()); result.setStatus(enrollment.getStatus()); result.setEnrollmentDate(enrollment.getEnrollmentDate()); - result.setIncidentDate(enrollment.getIncidentDate()); + result.setOccurredDate(enrollment.getOccurredDate()); result.setFollowup(enrollment.getFollowup()); result.setCompletedDate(enrollment.getCompletedDate()); result.setCompletedBy(enrollment.getCompletedBy()); diff --git a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/trackedentity/aggregates/mapper/EnrollmentRowCallbackHandler.java b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/trackedentity/aggregates/mapper/EnrollmentRowCallbackHandler.java index 79afa20af9f2..73f462c7559f 100644 --- a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/trackedentity/aggregates/mapper/EnrollmentRowCallbackHandler.java +++ b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/trackedentity/aggregates/mapper/EnrollmentRowCallbackHandler.java @@ -97,7 +97,7 @@ private Enrollment getEnrollment(ResultSet rs) throws SQLException { ProgramStatus.valueOf(rs.getString(EnrollmentQuery.getColumnName(COLUMNS.STATUS)))); enrollment.setEnrollmentDate( rs.getTimestamp(EnrollmentQuery.getColumnName(COLUMNS.ENROLLMENTDATE))); - enrollment.setIncidentDate( + enrollment.setOccurredDate( rs.getTimestamp(EnrollmentQuery.getColumnName(COLUMNS.INCIDENTDATE))); enrollment.setCompletedDate(rs.getTimestamp(EnrollmentQuery.getColumnName(COLUMNS.COMPLETED))); enrollment.setCompletedBy(rs.getString(EnrollmentQuery.getColumnName(COLUMNS.COMPLETEDBY))); diff --git a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/trackedentity/aggregates/query/EnrollmentQuery.java b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/trackedentity/aggregates/query/EnrollmentQuery.java index aa22d90a5c36..b264122eca7f 100644 --- a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/trackedentity/aggregates/query/EnrollmentQuery.java +++ b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/export/trackedentity/aggregates/query/EnrollmentQuery.java @@ -76,7 +76,7 @@ public enum COLUMNS { .put(COLUMNS.ENROLLMENTDATE, new TableColumn("en", "enrollmentdate")) .put(COLUMNS.INCIDENTDATE, new TableColumn("en", "incidentdate")) .put(COLUMNS.FOLLOWUP, new TableColumn("en", "followup")) - .put(COLUMNS.COMPLETED, new TableColumn("en", "enddate")) + .put(COLUMNS.COMPLETED, new TableColumn("en", "completeddate")) .put(COLUMNS.COMPLETEDBY, new TableColumn("en", "completedby")) .put(COLUMNS.STOREDBY, new TableColumn("en", "storedby")) .put(COLUMNS.DELETED, new TableColumn("en", "deleted")) diff --git a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/converter/EnrollmentTrackerConverterService.java b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/converter/EnrollmentTrackerConverterService.java index ef7a396bde6b..67b0fc34c522 100644 --- a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/converter/EnrollmentTrackerConverterService.java +++ b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/converter/EnrollmentTrackerConverterService.java @@ -139,10 +139,10 @@ private Enrollment from( dbEnrollment.setLastUpdatedAtClient(DateUtils.fromInstant(enrollment.getUpdatedAtClient())); Date enrollmentDate = DateUtils.fromInstant(enrollment.getEnrolledAt()); - Date incidentDate = DateUtils.fromInstant(enrollment.getOccurredAt()); + Date occurredDate = DateUtils.fromInstant(enrollment.getOccurredAt()); dbEnrollment.setEnrollmentDate(enrollmentDate); - dbEnrollment.setIncidentDate(incidentDate != null ? incidentDate : enrollmentDate); + dbEnrollment.setOccurredDate(occurredDate != null ? occurredDate : enrollmentDate); dbEnrollment.setOrganisationUnit(organisationUnit); dbEnrollment.setProgram(program); dbEnrollment.setTrackedEntity(trackedEntity); diff --git a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/preheat/mappers/EnrollmentMapper.java b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/preheat/mappers/EnrollmentMapper.java index 99da624d1112..8a06de0c8a33 100644 --- a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/preheat/mappers/EnrollmentMapper.java +++ b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/preheat/mappers/EnrollmentMapper.java @@ -54,7 +54,7 @@ public interface EnrollmentMapper extends PreheatMapper { @Mapping(target = "trackedEntity") @Mapping(target = "organisationUnit") @Mapping(target = "created") - @Mapping(target = "incidentDate") + @Mapping(target = "occurredDate") @Mapping(target = "enrollmentDate") @Mapping(target = "notes") @Mapping(target = "deleted") diff --git a/dhis-2/dhis-support/dhis-support-db-migration/src/main/resources/org/hisp/dhis/db/migration/2.41/V2_41_37__RenameEndDateToCompletedDateInEnrollmentTable.sql b/dhis-2/dhis-support/dhis-support-db-migration/src/main/resources/org/hisp/dhis/db/migration/2.41/V2_41_37__RenameEndDateToCompletedDateInEnrollmentTable.sql new file mode 100644 index 000000000000..f428158bcd52 --- /dev/null +++ b/dhis-2/dhis-support/dhis-support-db-migration/src/main/resources/org/hisp/dhis/db/migration/2.41/V2_41_37__RenameEndDateToCompletedDateInEnrollmentTable.sql @@ -0,0 +1,11 @@ +-- rename enddate in enrollment + +do $$ +begin + if exists(select 1 + from information_schema.columns + where table_schema != 'information_schema' and table_name='enrollment' and column_name='enddate') + then +alter table enrollment rename column enddate to completeddate; +end if; +end $$; \ No newline at end of file diff --git a/dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java b/dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java index e18bedb2aab5..b2faadcacc5b 100644 --- a/dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java +++ b/dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java @@ -1631,7 +1631,7 @@ public static Enrollment createEnrollment( enrollment.setTrackedEntity(te); enrollment.setOrganisationUnit(organisationUnit); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); return enrollment; } diff --git a/dhis-2/dhis-test-e2e/pom.xml b/dhis-2/dhis-test-e2e/pom.xml index 0cd24fdb058a..e628b97153a8 100644 --- a/dhis-2/dhis-test-e2e/pom.xml +++ b/dhis-2/dhis-test-e2e/pom.xml @@ -19,7 +19,7 @@ 5.3.2 2.15.3 32.1.3-jre - 0.10.1 + 0.10.3 5.1.8 1.0.2 5.8 diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java index ba97b3659f8e..95826df56aef 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/analytics/event/data/EventAnalyticsServiceTest.java @@ -394,12 +394,12 @@ public void setUpTest() throws IOException, InterruptedException { // Enrollments (Enrollments) Enrollment piA = enrollmentService.enrollTrackedEntity(teiA, programA, jan1, jan1, ouE); piA.setEnrollmentDate(jan1); - piA.setIncidentDate(jan1); + piA.setOccurredDate(jan1); enrollmentService.addEnrollment(piA); Enrollment piB = enrollmentService.enrollTrackedEntity(teiA, programB, jan1, jan1, ouE); piB.setEnrollmentDate(jan1); - piB.setIncidentDate(jan1); + piB.setOccurredDate(jan1); enrollmentService.addEnrollment(piB); // Change programA / teiA ownership through time: diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EnrollmentImportTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EnrollmentImportTest.java index d8f06e44cde6..6b245fe490b6 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EnrollmentImportTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EnrollmentImportTest.java @@ -97,7 +97,7 @@ protected void setUpTest() throws Exception { enrollment = new Enrollment(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setProgram(program); enrollment.setStatus(ProgramStatus.ACTIVE); enrollment.setStoredBy("test"); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EventImportTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EventImportTest.java index 66bd1cadb33f..eea35c02b4bf 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EventImportTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EventImportTest.java @@ -241,7 +241,7 @@ protected void setUpTest() throws Exception { manager.update(programB); enrollment = new Enrollment(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setProgram(programB); enrollment.setStatus(ProgramStatus.ACTIVE); enrollment.setStoredBy("test"); @@ -305,7 +305,7 @@ void testAddEventWithDueDateForProgramWithoutRegistration() { void testAddEventOnProgramWithoutRegistrationAndExistingEnrollment() throws IOException { Enrollment dbEnrollment = new Enrollment(); dbEnrollment.setEnrollmentDate(new Date()); - dbEnrollment.setIncidentDate(new Date()); + dbEnrollment.setOccurredDate(new Date()); dbEnrollment.setProgram(programB); dbEnrollment.setStatus(ProgramStatus.ACTIVE); dbEnrollment.setStoredBy("test"); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EventXmlImportTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EventXmlImportTest.java index 1cc1d13b9ed2..4e1813e847c1 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EventXmlImportTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/EventXmlImportTest.java @@ -110,7 +110,7 @@ protected void setUpTest() throws Exception { enrollment.setProgram(programA); enrollment.setAutoFields(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setStatus(ProgramStatus.ACTIVE); enrollmentService.addEnrollment(enrollment); programStageA.getProgramStageDataElements().add(programStageDataElement); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/NoRegistrationSingleEventServiceTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/NoRegistrationSingleEventServiceTest.java index 02f13553a339..709e4f537eee 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/NoRegistrationSingleEventServiceTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/NoRegistrationSingleEventServiceTest.java @@ -103,7 +103,7 @@ protected void setUpTest() throws Exception { identifiableObjectManager.update(programA); Enrollment enrollment = new Enrollment(); enrollment.setProgram(programA); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setEnrollmentDate(new Date()); enrollmentService.addEnrollment(enrollment); identifiableObjectManager.update(programA); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/ProgramStageValidationStrategyTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/ProgramStageValidationStrategyTest.java index ff457bd57f07..8acc81fb1107 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/ProgramStageValidationStrategyTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/ProgramStageValidationStrategyTest.java @@ -206,7 +206,7 @@ protected void setUpTest() { manager.update(programA); Enrollment enrollment = new Enrollment(); enrollment.setProgram(programA); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setEnrollmentDate(new Date()); enrollment.setTrackedEntity(maleA); enrollment.getSharing().addUserAccess(userAccess1); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/security/EventSecurityTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/security/EventSecurityTest.java index 5d1e21f623a1..98f891c94a43 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/security/EventSecurityTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/dxf2/deprecated/tracker/security/EventSecurityTest.java @@ -117,7 +117,7 @@ protected void setUpTest() { manager.update(programA); Enrollment enrollment = new Enrollment(); enrollment.setProgram(programA); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setEnrollmentDate(new Date()); enrollmentService.addEnrollment(enrollment); manager.update(programA); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java index 0a1c66996b50..cf2a368c39a5 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java @@ -92,11 +92,11 @@ class CompleteDataSetRegistrationBatchHandlerTest extends IntegrationTestBase { private CompleteDataSetRegistration regD; - private Date now = new Date(); + private final Date now = new Date(); - private String storedBy = "johndoe"; + private final String storedBy = "johndoe"; - private String lastUpdatedBy = "johndoe"; + private final String lastUpdatedBy = "johndoe"; // ------------------------------------------------------------------------- // Fixture @@ -165,9 +165,7 @@ public void setUpTest() { } @Override - public void tearDownTest() { - batchHandler.flush(); - } + public void tearDownTest() {} // ------------------------------------------------------------------------- // Tests diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java index 3eff0bd09422..1e6ac8f700db 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueAuditBatchHandlerTest.java @@ -72,8 +72,6 @@ class DataValueAuditBatchHandlerTest extends SingleSetupIntegrationTestBase { @Autowired private CategoryService categoryService; - private BatchHandler batchHandler; - private DataElement dataElementA; private CategoryOptionCombo categoryOptionComboA; @@ -107,7 +105,7 @@ class DataValueAuditBatchHandlerTest extends SingleSetupIntegrationTestBase { // ------------------------------------------------------------------------- @Override public void setUpTest() { - batchHandler = batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class); + dataElementA = createDataElement('A'); dataElementService.addDataElement(dataElementA); categoryOptionComboA = categoryService.getDefaultCategoryOptionCombo(); @@ -132,19 +130,18 @@ public void setUpTest() { auditB = new DataValueAudit(dataValueA, "12", storedBy, AuditType.UPDATE); auditC = new DataValueAudit(dataValueB, "21", storedBy, AuditType.UPDATE); auditD = new DataValueAudit(dataValueB, "22", storedBy, AuditType.UPDATE); - batchHandler.init(); } @Override - public void tearDownTest() { - batchHandler.flush(); - } + public void tearDownTest() {} // ------------------------------------------------------------------------- // Tests // ------------------------------------------------------------------------- @Test void testAddObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class).init(); batchHandler.addObject(auditA); batchHandler.addObject(auditB); batchHandler.addObject(auditC); @@ -161,6 +158,8 @@ void testAddObject() { /** DataValueAudit can never equal another. */ @Test void testObjectExists() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class).init(); auditService.addDataValueAudit(auditA); auditService.addDataValueAudit(auditB); assertFalse(batchHandler.objectExists(auditA)); @@ -171,6 +170,8 @@ void testObjectExists() { @Test void testUpdateObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueAuditBatchHandler.class).init(); auditService.addDataValueAudit(auditA); auditA.setModifiedBy("bill"); batchHandler.updateObject(auditA); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java index e76c66da4b6f..e04fdd38e7b8 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java @@ -72,8 +72,6 @@ class DataValueBatchHandlerTest extends IntegrationTestBase { @Autowired private CategoryService categoryService; - private BatchHandler batchHandler; - private DataElement dataElementA; private CategoryOptionCombo categoryOptionComboA; @@ -105,7 +103,7 @@ class DataValueBatchHandlerTest extends IntegrationTestBase { // ------------------------------------------------------------------------- @Override public void setUpTest() { - batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class); + dataElementA = createDataElement('A'); dataElementService.addDataElement(dataElementA); categoryOptionComboA = categoryService.getDefaultCategoryOptionCombo(); @@ -142,19 +140,19 @@ public void setUpTest() { dataElementA, periodB, unitB, categoryOptionComboA, categoryOptionComboA, "15"); // with // 4th - batchHandler.init(); + } @Override - public void tearDownTest() { - batchHandler.flush(); - } + public void tearDownTest() {} // ------------------------------------------------------------------------- // Tests // ------------------------------------------------------------------------- @Test void testInsertObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); batchHandler.insertObject(dataValueA); DataValue dataValue = dataValueService.getDataValue( @@ -164,6 +162,8 @@ void testInsertObject() { @Test void testAddObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); batchHandler.addObject(dataValueA); batchHandler.addObject(dataValueB); batchHandler.addObject(dataValueC); @@ -185,6 +185,8 @@ void testAddObject() { @Test void testAddObjectDuplicates() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); batchHandler.addObject(dataValueA); batchHandler.addObject(dataValueB); batchHandler.addObject(dataValueC); @@ -208,6 +210,8 @@ void testAddObjectDuplicates() { @Test void testFindObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); dataValueService.addDataValue(dataValueA); dataValueService.addDataValue(dataValueC); DataValue retrievedDataValueA = batchHandler.findObject(dataValueA); @@ -224,6 +228,8 @@ void testFindObject() { @Test void testObjectExists() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); dataValueService.addDataValue(dataValueA); dataValueService.addDataValue(dataValueC); assertTrue(batchHandler.objectExists(dataValueA)); @@ -235,6 +241,8 @@ void testObjectExists() { @Test @Disabled("ERROR: cannot execute UPDATE in a read-only transaction") void testUpdateObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); dataValueService.addDataValue(dataValueA); dataValueA.setValue("20"); batchHandler.updateObject(dataValueA); @@ -247,6 +255,8 @@ void testUpdateObject() { @Test void testDeleteObject() { + BatchHandler batchHandler; + batchHandler = batchHandlerFactory.createBatchHandler(DataValueBatchHandler.class).init(); dataValueService.addDataValue(dataValueA); dataValueService.addDataValue(dataValueC); assertTrue(batchHandler.objectExists(dataValueA)); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/program/EnrollmentServiceTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/program/EnrollmentServiceTest.java index aa8787bb9463..f9d03871ca3a 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/program/EnrollmentServiceTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/program/EnrollmentServiceTest.java @@ -205,9 +205,9 @@ void testSoftDeleteEnrollmentAndLinkedEvent() { void testUpdateEnrollment() { long idA = enrollmentService.addEnrollment(enrollmentA); assertNotNull(enrollmentService.getEnrollment(idA)); - enrollmentA.setIncidentDate(enrollmentDate); + enrollmentA.setOccurredDate(enrollmentDate); enrollmentService.updateEnrollment(enrollmentA); - assertEquals(enrollmentDate, enrollmentService.getEnrollment(idA).getIncidentDate()); + assertEquals(enrollmentDate, enrollmentService.getEnrollment(idA).getOccurredDate()); } @Test diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/relationship/hibernate/RelationshipStoreTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/relationship/hibernate/RelationshipStoreTest.java index 67e0f090ed22..9a54d99dbb9d 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/relationship/hibernate/RelationshipStoreTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/relationship/hibernate/RelationshipStoreTest.java @@ -269,7 +269,7 @@ private Enrollment addEnrollment(Program programA) { enrollment.setProgram(programA); enrollment.setAutoFields(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setStatus(ProgramStatus.ACTIVE); enrollmentService.addEnrollment(enrollment); return enrollment; diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/export/trackedentity/TrackedEntityServiceTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/export/trackedentity/TrackedEntityServiceTest.java index 6bac0f7f7a18..d216bf9f623a 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/export/trackedentity/TrackedEntityServiceTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/export/trackedentity/TrackedEntityServiceTest.java @@ -786,7 +786,7 @@ void shouldReturnEmptyIfTEWasEnrolledAfterPassedDateAndTime() @Test void shouldReturnTrackedEntityIfEnrollmentOccurredAfterPassedDateAndTime() throws ForbiddenException, NotFoundException, BadRequestException { - Date oneHourBeforeIncidentDate = oneHourBefore(enrollmentA.getIncidentDate()); + Date oneHourBeforeIncidentDate = oneHourBefore(enrollmentA.getOccurredDate()); TrackedEntityOperationParams operationParams = TrackedEntityOperationParams.builder() @@ -805,7 +805,7 @@ void shouldReturnTrackedEntityIfEnrollmentOccurredAfterPassedDateAndTime() @Test void shouldReturnEmptyIfEnrollmentOccurredBeforePassedDateAndTime() throws ForbiddenException, NotFoundException, BadRequestException { - Date oneHourAfterIncidentDate = oneHourAfter(enrollmentA.getIncidentDate()); + Date oneHourAfterIncidentDate = oneHourAfter(enrollmentA.getOccurredDate()); TrackedEntityOperationParams operationParams = TrackedEntityOperationParams.builder() @@ -824,7 +824,7 @@ void shouldReturnEmptyIfEnrollmentOccurredBeforePassedDateAndTime() @Test void shouldReturnTrackedEntityIfEnrollmentOccurredBeforePassedDateAndTime() throws ForbiddenException, NotFoundException, BadRequestException { - Date oneHourAfterIncidentDate = oneHourAfter(enrollmentA.getIncidentDate()); + Date oneHourAfterIncidentDate = oneHourAfter(enrollmentA.getOccurredDate()); TrackedEntityOperationParams operationParams = TrackedEntityOperationParams.builder() @@ -843,7 +843,7 @@ void shouldReturnTrackedEntityIfEnrollmentOccurredBeforePassedDateAndTime() @Test void shouldReturnEmptyIfEnrollmentOccurredPassedDateAndTime() throws ForbiddenException, NotFoundException, BadRequestException { - Date oneHourBeforeIncidentDate = oneHourBefore(enrollmentA.getIncidentDate()); + Date oneHourBeforeIncidentDate = oneHourBefore(enrollmentA.getOccurredDate()); TrackedEntityOperationParams operationParams = TrackedEntityOperationParams.builder() @@ -1292,7 +1292,7 @@ void shouldReturnEnrollmentMappedCorrectly() () -> checkDate(currentTime, enrollment.getLastUpdated()), () -> checkDate(currentTime, enrollment.getLastUpdatedAtClient()), () -> checkDate(currentTime, enrollment.getEnrollmentDate()), - () -> checkDate(currentTime, enrollment.getIncidentDate()), + () -> checkDate(currentTime, enrollment.getOccurredDate()), () -> assertNull(enrollment.getStoredBy())); } diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/OwnershipTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/OwnershipTest.java index 017ca502bac7..043c53b88888 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/OwnershipTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/OwnershipTest.java @@ -290,7 +290,7 @@ private void compareEnrollmentBasicProperties( Enrollment dbEnrollment, org.hisp.dhis.tracker.imports.domain.Enrollment enrollment) { assertEquals( DateUtils.fromInstant(enrollment.getEnrolledAt()), dbEnrollment.getEnrollmentDate()); - assertEquals(DateUtils.fromInstant(enrollment.getOccurredAt()), dbEnrollment.getIncidentDate()); + assertEquals(DateUtils.fromInstant(enrollment.getOccurredAt()), dbEnrollment.getOccurredDate()); assertEquals( DateUtils.fromInstant(enrollment.getCreatedAtClient()), dbEnrollment.getCreatedAtClient()); assertEquals( diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/TrackedEntityAttributeControllerTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/TrackedEntityAttributeControllerTest.java index da9b617021c2..044d233b2d53 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/TrackedEntityAttributeControllerTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/TrackedEntityAttributeControllerTest.java @@ -145,7 +145,7 @@ void setUp() { enrollment = new Enrollment(program, te, orgUnit); enrollment.setAutoFields(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setStatus(ProgramStatus.COMPLETED); enrollment.setFollowup(true); manager.save(enrollment); diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/deduplication/DeduplicationControllerTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/deduplication/DeduplicationControllerTest.java index b726996d31c9..d8b813fa09cb 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/deduplication/DeduplicationControllerTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/deduplication/DeduplicationControllerTest.java @@ -28,12 +28,15 @@ package org.hisp.dhis.webapi.controller.deduplication; import static org.hisp.dhis.web.WebClientUtils.assertStatus; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import com.fasterxml.jackson.databind.ObjectMapper; import org.hisp.dhis.common.CodeGenerator; import org.hisp.dhis.common.IdentifiableObjectManager; import org.hisp.dhis.deduplication.DeduplicationStatus; import org.hisp.dhis.deduplication.PotentialDuplicate; +import org.hisp.dhis.jsontree.JsonList; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.trackedentity.TrackedEntity; import org.hisp.dhis.web.HttpStatus; @@ -76,6 +79,26 @@ void shouldPostPotentialDuplicateWhenTrackedEntitiesExist() throws Exception { HttpStatus.OK, POST(ENDPOINT, objectMapper.writeValueAsString(potentialDuplicate))); } + @Test + void shouldContainsDefaultFieldsWhenGetPotentialDuplicates() { + PotentialDuplicate potentialDuplicate = + new PotentialDuplicate(origin.getUid(), duplicate.getUid()); + save(potentialDuplicate); + + JsonList list = + GET(ENDPOINT, HttpStatus.OK) + .content() + .getList("potentialDuplicates", JsonPotentialDuplicate.class); + + JsonPotentialDuplicate jsonPotentialDuplicate = list.get(0); + assertEquals(potentialDuplicate.getUid(), jsonPotentialDuplicate.getUid()); + assertEquals(potentialDuplicate.getStatus().name(), jsonPotentialDuplicate.getStatus()); + assertEquals(potentialDuplicate.getOriginal(), jsonPotentialDuplicate.getOriginal()); + assertEquals(potentialDuplicate.getDuplicate(), jsonPotentialDuplicate.getDuplicate()); + assertNotNull(potentialDuplicate.getCreated()); + assertNotNull(potentialDuplicate.getLastUpdated()); + } + @Test void shouldThrowPostPotentialDuplicateWhenMissingDuplicateTeiInPayload() throws Exception { PotentialDuplicate potentialDuplicate = new PotentialDuplicate(origin.getUid(), null); diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/deduplication/JsonPotentialDuplicate.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/deduplication/JsonPotentialDuplicate.java new file mode 100644 index 000000000000..3a27aacf8d67 --- /dev/null +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/deduplication/JsonPotentialDuplicate.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2004-2022, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.hisp.dhis.webapi.controller.deduplication; + +import org.hisp.dhis.jsontree.JsonObject; + +/** Representation of {@link org.hisp.dhis.deduplication.PotentialDuplicate}. */ +public interface JsonPotentialDuplicate extends JsonObject { + default String getUid() { + return getString("id").string(); + } + + default String getOriginal() { + return getString("original").string(); + } + + default String getDuplicate() { + return getString("duplicate").string(); + } + + default String getLastUpdated() { + return getString("lastUpdated").string(); + } + + default String getCreated() { + return getString("created").string(); + } + + default String getStatus() { + return getString("status").string(); + } +} diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/enrollment/EnrollmentsExportControllerTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/enrollment/EnrollmentsExportControllerTest.java index 88a4659403a2..be8d93aca805 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/enrollment/EnrollmentsExportControllerTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/enrollment/EnrollmentsExportControllerTest.java @@ -355,7 +355,7 @@ private Enrollment enrollment(TrackedEntity te) { Enrollment enrollment = new Enrollment(program, te, orgUnit); enrollment.setAutoFields(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setStatus(ProgramStatus.COMPLETED); enrollment.setFollowup(true); manager.save(enrollment, false); diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/event/EventsExportControllerTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/event/EventsExportControllerTest.java index f728b3a0a74c..a0c9d9f1a14b 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/event/EventsExportControllerTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/event/EventsExportControllerTest.java @@ -406,7 +406,7 @@ private Enrollment enrollment(TrackedEntity te) { Enrollment enrollment = new Enrollment(program, te, te.getOrganisationUnit()); enrollment.setAutoFields(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setStatus(ProgramStatus.COMPLETED); manager.save(enrollment); return enrollment; diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipsExportControllerTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipsExportControllerTest.java index b13245283228..b7d1cb0154a8 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipsExportControllerTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipsExportControllerTest.java @@ -697,7 +697,7 @@ private Enrollment enrollment(TrackedEntity te) { Enrollment enrollment = new Enrollment(program, te, orgUnit); enrollment.setAutoFields(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setStatus(ProgramStatus.COMPLETED); manager.save(enrollment, false); te.setEnrollments(Set.of(enrollment)); diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/trigramsummary/TrigramSummaryControllerTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/trigramsummary/TrigramSummaryControllerTest.java index ead861c476bc..4a30de913aa8 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/trigramsummary/TrigramSummaryControllerTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/trigramsummary/TrigramSummaryControllerTest.java @@ -188,7 +188,7 @@ void setUp() { enrollment = new Enrollment(program, tei, orgUnit); enrollment.setAutoFields(); enrollment.setEnrollmentDate(new Date()); - enrollment.setIncidentDate(new Date()); + enrollment.setOccurredDate(new Date()); enrollment.setStatus(ProgramStatus.COMPLETED); enrollment.setFollowup(true); manager.save(enrollment); diff --git a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/deduplication/DeduplicationController.java b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/deduplication/DeduplicationController.java index d8d063f28e73..1c4093311f32 100644 --- a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/deduplication/DeduplicationController.java +++ b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/deduplication/DeduplicationController.java @@ -87,7 +87,7 @@ public class DeduplicationController { private final FieldFilterService fieldFilterService; private static final String DEFAULT_FIELDS_PARAM = - "created, lastUpdated, original, duplicate, status"; + "id, created, lastUpdated, original, duplicate, status"; @OpenApi.Response(PotentialDuplicate[].class) @GetMapping diff --git a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/enrollment/EnrollmentMapper.java b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/enrollment/EnrollmentMapper.java index 3a58126c3798..7a05d95c994a 100644 --- a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/enrollment/EnrollmentMapper.java +++ b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/enrollment/EnrollmentMapper.java @@ -75,7 +75,7 @@ public interface EnrollmentMapper @Mapping(target = "program", source = "program.uid") @Mapping(target = "orgUnit", source = "organisationUnit.uid") @Mapping(target = "enrolledAt", source = "enrollmentDate") - @Mapping(target = "occurredAt", source = "incidentDate") + @Mapping(target = "occurredAt", source = "occurredDate") @Mapping(target = "followUp", source = "followup") @Mapping(target = "completedAt", source = "completedDate") @Mapping(target = "createdBy", source = "createdByUserInfo") diff --git a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipItemMapper.java b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipItemMapper.java index 204f856aa4ac..ebc1ea22226d 100644 --- a/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipItemMapper.java +++ b/dhis-2/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/tracker/export/relationship/RelationshipItemMapper.java @@ -81,7 +81,7 @@ interface RelationshipItemMapper @Mapping(target = "program", source = "program.uid") @Mapping(target = "orgUnit", source = "organisationUnit.uid") @Mapping(target = "enrolledAt", source = "enrollmentDate") - @Mapping(target = "occurredAt", source = "incidentDate") + @Mapping(target = "occurredAt", source = "occurredDate") @Mapping(target = "followUp", source = "followup") @Mapping(target = "completedAt", source = "completedDate") @Mapping(target = "createdBy", source = "createdByUserInfo") diff --git a/dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_es.properties b/dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_es.properties index 4d181b3c64e1..4df6837164e5 100644 --- a/dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_es.properties +++ b/dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module_es.properties @@ -30,6 +30,7 @@ saving_value_failed_dataset_is_locked=El set de datos est\u00e1 bloqueado, por f saving_comment_failed_status_code=Guardando comentario fallido con codigo de estado saving_comment_failed_error_code=Guardando comentario fallido con codigo de error saving_minmax_failed_error_code=Guardando m\u00ednimo/m\u00e1ximo valor fallido con c\u00f3digo de error +saving_comment_failed_error_code=Guardando comentario fallido con codigo de error move=Mover date=Fecha min_limit=L\u00edmite m\u00ednimo @@ -119,7 +120,7 @@ print_blank_form=Imprimir en blanco instruction=Instrucci\u00f3n there_is_no_audit_trail_for_this_value=No hay pista de auditor\u00eda para este valor are_you_sure_you_want_to_delete_this_file=Are you sure you want to delete this file? -confirm_deletion=Confirm deletion +confirm_deletion=Confirmar eliminaci\u00f3n file_upload_failed=File upload failed loading_file_info_failed=Loading file info failed orgunit_is_closed=Organisation unit is closed for the selected period. diff --git a/dhis-2/pom.xml b/dhis-2/pom.xml index 22dcd0e7b27e..4716a9e17837 100644 --- a/dhis-2/pom.xml +++ b/dhis-2/pom.xml @@ -89,9 +89,9 @@ 2.1.9 - 1.4.1 + 1.4.3 2.0.0 - 0.10.1 + 0.10.3 5.8.8