dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36258
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18570: Events, added support for lastUpdated query param. Removed unnecessary overload.
------------------------------------------------------------
revno: 18570
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-10 15:59:27 +0100
message:
Events, added support for lastUpdated query param. Removed unnecessary overload.
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/AbstractEventRowService.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2015-03-10 14:44:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2015-03-10 14:59:27 +0000
@@ -396,13 +396,13 @@
@Override
public Events getEvents( Program program, OrganisationUnit organisationUnit, OrganisationUnitSelectionMode orgUnitSelectionMode )
{
- return getEvents( program, null, null, null, organisationUnit, orgUnitSelectionMode, null, null, null, null, null );
+ return getEvents( program, null, null, null, organisationUnit, orgUnitSelectionMode, null, null, null, null, null, null );
}
@Override
public Events getEvents( Program program, ProgramStage programStage, ProgramStatus programStatus, Boolean followUp, OrganisationUnit orgUnit,
OrganisationUnitSelectionMode orgUnitSelectionMode, TrackedEntityInstance trackedEntityInstance,
- Date startDate, Date endDate, EventStatus status, IdSchemes idSchemes )
+ Date startDate, Date endDate, EventStatus status, Date lastUpdated, IdSchemes idSchemes )
{
List<OrganisationUnit> organisationUnits = new ArrayList<>();
@@ -424,7 +424,7 @@
}
List<Event> eventList = eventStore.getEvents( program, programStage, programStatus, followUp, organisationUnits,
- trackedEntityInstance, startDate, endDate, status, idSchemes );
+ trackedEntityInstance, startDate, endDate, status, lastUpdated, idSchemes );
Events events = new Events();
events.setEvents( eventList );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java 2015-03-10 14:44:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java 2015-03-10 14:59:27 +0000
@@ -60,7 +60,7 @@
Events getEvents( Program program, ProgramStage programStage, ProgramStatus programStatus, Boolean followUp, OrganisationUnit orgUnit,
OrganisationUnitSelectionMode orgUnitSelectionMode, TrackedEntityInstance trackedEntityInstance,
- Date startDate, Date endDate, EventStatus status, IdSchemes idSchemes );
+ Date startDate, Date endDate, EventStatus status, Date lastUpdated, IdSchemes idSchemes );
Event getEvent( String uid );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java 2015-03-10 13:30:28 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java 2015-03-10 14:59:27 +0000
@@ -45,8 +45,5 @@
public interface EventStore
{
List<Event> getEvents( Program program, ProgramStage programStage, ProgramStatus programStatus, Boolean followUp, List<OrganisationUnit> organisationUnits,
- TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status );
-
- List<Event> getEvents( Program program, ProgramStage programStage, ProgramStatus programStatus, Boolean followUp, List<OrganisationUnit> organisationUnits,
- TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status, IdSchemes idSchemes );
+ TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status, Date lastUpdated, IdSchemes idSchemes );
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-03-10 14:29:40 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-03-10 14:59:27 +0000
@@ -77,15 +77,8 @@
@Override
public List<Event> getEvents( Program program, ProgramStage programStage, ProgramStatus programStatus, Boolean followUp,
- List<OrganisationUnit> organisationUnits, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status )
- {
- return getEvents( program, programStage, programStatus, followUp, organisationUnits, trackedEntityInstance,
- startDate, endDate, status, new IdSchemes() );
- }
-
- @Override
- public List<Event> getEvents( Program program, ProgramStage programStage, ProgramStatus programStatus, Boolean followUp,
- List<OrganisationUnit> organisationUnits, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status, IdSchemes idSchemes )
+ List<OrganisationUnit> organisationUnits, TrackedEntityInstance trackedEntityInstance,
+ Date startDate, Date endDate, EventStatus status, Date lastUpdated, IdSchemes idSchemes )
{
List<Event> events = new ArrayList<>();
@@ -103,7 +96,7 @@
}
String sql = buildSql( program, programStage, programStatus, followUp, getIdList( organisationUnits ),
- trackedEntityInstanceId, startDate, endDate, status );
+ trackedEntityInstanceId, startDate, endDate, status, lastUpdated );
SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
@@ -212,7 +205,7 @@
}
private String buildSql( Program program, ProgramStage programStage, ProgramStatus programStatus, Boolean followUp,
- List<Integer> orgUnitIds, Integer trackedEntityInstanceId, Date startDate, Date endDate, EventStatus status )
+ List<Integer> orgUnitIds, Integer trackedEntityInstanceId, Date startDate, Date endDate, EventStatus status, Date lastUpdated )
{
SqlHelper hlp = new SqlHelper();
@@ -272,6 +265,11 @@
{
sql += hlp.whereAnd() + " pi.followup is " + (followUp ? "true" : "false") + " ";
}
+
+ if ( lastUpdated != null )
+ {
+ sql += hlp.whereAnd() + " psi.lastupdated > '" + DateUtils.getLongDateString( lastUpdated ) + "' ";
+ }
if ( status == null || EventStatus.isExistingEvent( status ) )
{
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/AbstractEventRowService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/AbstractEventRowService.java 2015-03-10 14:44:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/report/AbstractEventRowService.java 2015-03-10 14:59:27 +0000
@@ -73,7 +73,7 @@
EventRows eventRows = new EventRows();
Events events = eventService.getEvents( program, null, programStatus, null, orgUnit, orgUnitSelectionMode,
- null, startDate, endDate, eventStatus, null );
+ null, startDate, endDate, eventStatus, null, null );
for ( Event event : events.getEvents() )
{
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java 2015-03-10 14:44:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java 2015-03-10 14:59:27 +0000
@@ -234,7 +234,8 @@
importSummary = eventService.addEvent( event );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
- assertEquals( 1, eventService.getEvents( programA, programStageA, null, null, organisationUnitA, OrganisationUnitSelectionMode.SELECTED, null, null, null, null, null ).getEvents().size() );
+ assertEquals( 1, eventService.getEvents( programA, programStageA, null, null, organisationUnitA,
+ OrganisationUnitSelectionMode.SELECTED, null, null, null, null, null, null ).getEvents().size() );
}
@Test
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2015-03-10 14:44:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2015-03-10 14:59:27 +0000
@@ -146,6 +146,7 @@
@RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
@RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
@RequestParam( required = false ) EventStatus status,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date lastUpdated,
@RequestParam( required = false ) String attachment,
@RequestParam( required = false, defaultValue = "false" ) boolean skipHeader,
@RequestParam Map<String, String> parameters,
@@ -180,7 +181,7 @@
}
}
- Events events = eventService.getEvents( pr, prs, programStatus, followUp, ou, ouMode, tei, startDate, endDate, status, idSchemes );
+ Events events = eventService.getEvents( pr, prs, programStatus, followUp, ou, ouMode, tei, startDate, endDate, status, lastUpdated, idSchemes );
if ( options.hasPaging() )
{
@@ -222,6 +223,7 @@
@RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
@RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
@RequestParam( required = false ) EventStatus status,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date lastUpdated,
@RequestParam( required = false ) boolean skipMeta,
@RequestParam( required = false ) String attachment,
@RequestParam Map<String, String> parameters, IdSchemes idSchemes, Model model, HttpServletResponse response, HttpServletRequest request )
@@ -255,7 +257,7 @@
}
}
- Events events = eventService.getEvents( pr, prs, programStatus, followUp, ou, ouMode, tei, startDate, endDate, status, idSchemes );
+ Events events = eventService.getEvents( pr, prs, programStatus, followUp, ou, ouMode, tei, startDate, endDate, status, lastUpdated, idSchemes );
if ( options.hasLinks() )
{