dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29158
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14683: Event query, support for follow up
------------------------------------------------------------
revno: 14683
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-04-05 00:26:12 +0200
message:
Event query, support for follow up
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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/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 2014-04-04 22:14:22 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2014-04-04 22:26:12 +0000
@@ -327,10 +327,10 @@
}
@Override
- public Events getEvents( List<Program> programs, List<ProgramStage> programStages, ProgramStatus programStatus,
+ public Events getEvents( List<Program> programs, List<ProgramStage> programStages, ProgramStatus programStatus, Boolean followUp,
List<OrganisationUnit> organisationUnits, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status )
{
- List<Event> eventList = eventStore.getAll( programs, programStages, programStatus, organisationUnits,
+ List<Event> eventList = eventStore.getAll( programs, programStages, programStatus, followUp, organisationUnits,
trackedEntityInstance, startDate, endDate, status );
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 2014-04-04 22:14:22 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java 2014-04-04 22:26:12 +0000
@@ -56,7 +56,7 @@
Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
- Events getEvents( List<Program> programs, List<ProgramStage> programStages, ProgramStatus programStatus, List<OrganisationUnit> organisationUnits,
+ Events getEvents( List<Program> programs, List<ProgramStage> programStages, ProgramStatus programStatus, Boolean followUp, List<OrganisationUnit> organisationUnits,
TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status );
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 2014-04-04 22:14:22 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java 2014-04-04 22:26:12 +0000
@@ -45,6 +45,6 @@
List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
- List<Event> getAll( List<Program> programs, List<ProgramStage> programStages, ProgramStatus programStatus, List<OrganisationUnit> organisationUnits,
+ List<Event> getAll( List<Program> programs, List<ProgramStage> programStages, ProgramStatus programStatus, Boolean followUp, List<OrganisationUnit> organisationUnits,
TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status );
}
=== 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 2014-04-04 22:14:22 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2014-04-04 22:26:12 +0000
@@ -75,12 +75,12 @@
public List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate )
{
- return getAll( Arrays.asList( program ), Arrays.asList( programStage ), null, Arrays.asList( organisationUnit ),
+ return getAll( Arrays.asList( program ), Arrays.asList( programStage ), null, false, Arrays.asList( organisationUnit ),
trackedEntityInstance, startDate, endDate, null );
}
@Override
- public List<Event> getAll( List<Program> programs, List<ProgramStage> programStages, ProgramStatus programStatus,
+ public List<Event> getAll( List<Program> programs, List<ProgramStage> programStages, ProgramStatus programStatus, Boolean followUp,
List<OrganisationUnit> organisationUnits, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate, EventStatus status )
{
List<Event> events = new ArrayList<Event>();
@@ -97,7 +97,7 @@
}
}
- String sql = buildSql( getIdList( programs ), getIdList( programStages ), programStatus, getIdList( organisationUnits ),
+ String sql = buildSql( getIdList( programs ), getIdList( programStages ), programStatus, followUp, getIdList( organisationUnits ),
trackedEntityInstanceId, startDate, endDate, status );
SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
@@ -177,7 +177,7 @@
return events;
}
- private String buildSql( List<Integer> programIds, List<Integer> programStageIds, ProgramStatus programStatus, List<Integer> orgUnitIds,
+ private String buildSql( List<Integer> programIds, List<Integer> programStageIds, ProgramStatus programStatus, Boolean followUp, List<Integer> orgUnitIds,
Integer trackedEntityInstanceId, Date startDate, Date endDate, EventStatus status )
{
SqlHelper hlp = new SqlHelper();
@@ -213,6 +213,11 @@
{
sql += hlp.whereAnd() + " pi.status = " + programStatus.getValue() + " ";
}
+
+ if ( followUp != null )
+ {
+ sql += hlp.whereAnd() + " pi.followup is " + ( followUp ? "true" : "false" ) + " ";
+ }
if ( !orgUnitIds.isEmpty() )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java 2014-04-04 22:14:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/EventController.java 2014-04-04 22:26:12 +0000
@@ -128,6 +128,7 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String programStage,
@RequestParam( required = false ) ProgramStatus programStatus,
+ @RequestParam( required = false ) Boolean followUp,
@RequestParam( required = false ) String trackedEntityInstance,
@RequestParam( required = false ) String orgUnit,
@RequestParam( required = false ) OrganisationUnitSelectionMode ouMode,
@@ -170,7 +171,7 @@
if ( rootOrganisationUnit == null && tei != null )
{
- Events events = eventService.getEvents( Arrays.asList( pr ), Arrays.asList( prs ), programStatus, null, tei, startDate, endDate, status );
+ Events events = eventService.getEvents( Arrays.asList( pr ), Arrays.asList( prs ), programStatus, followUp, null, tei, startDate, endDate, status );
model.addAttribute( "model", events );
model.addAttribute( "viewClass", options.getViewClass( "detailed" ) );
@@ -197,7 +198,7 @@
organisationUnits.add( rootOrganisationUnit );
}
- Events events = eventService.getEvents( Arrays.asList( pr ), Arrays.asList( prs ), programStatus, organisationUnits, tei, startDate, endDate, status );
+ Events events = eventService.getEvents( Arrays.asList( pr ), Arrays.asList( prs ), programStatus, followUp, organisationUnits, tei, startDate, endDate, status );
List<Event> eventList = new ArrayList<Event>( events.getEvents() );