dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37710
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19254: return tei attributes together with events for eventRows
------------------------------------------------------------
revno: 19254
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-06-02 14:24:22 +0200
message:
return tei attributes together with events for eventRows
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/EventSearchParams.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/JdbcEventStore.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-05-28 15:04:54 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2015-06-02 12:24:22 +0000
@@ -487,7 +487,7 @@
@Override
public EventSearchParams getFromUrl( String program, String programStage, ProgramStatus programStatus, Boolean followUp, String orgUnit,
OrganisationUnitSelectionMode orgUnitSelectionMode, String trackedEntityInstance, Date startDate, Date endDate,
- EventStatus status, Date lastUpdated, IdSchemes idSchemes, Integer page, Integer pageSize, boolean totalPages, boolean skipPaging )
+ EventStatus status, Date lastUpdated, IdSchemes idSchemes, Integer page, Integer pageSize, boolean totalPages, boolean skipPaging, boolean addAttributes )
{
EventSearchParams params = new EventSearchParams();
@@ -535,6 +535,7 @@
params.setPageSize( pageSize );
params.setTotalPages( totalPages );
params.setSkipPaging( skipPaging );
+ params.setAddAttributes( addAttributes );
return params;
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventSearchParams.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventSearchParams.java 2015-05-01 15:17:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventSearchParams.java 2015-06-02 12:24:22 +0000
@@ -45,40 +45,43 @@
public class EventSearchParams
{
public static final int DEFAULT_PAGE = 1;
+
public static final int DEFAULT_PAGE_SIZE = 50;
-
+
private Program program;
-
+
private ProgramStage programStage;
-
+
private ProgramStatus programStatus;
-
+
private Boolean followUp;
-
+
private OrganisationUnit orgUnit;
-
+
private OrganisationUnitSelectionMode orgUnitSelectionMode;
-
+
private TrackedEntityInstance trackedEntityInstance;
-
+
private Date startDate;
-
+
private Date endDate;
-
+
private EventStatus eventStatus;
-
+
private Date lastUpdated;
-
+
private IdSchemes idSchemes;
private Integer page;
-
+
private Integer pageSize;
private boolean totalPages;
-
+
private boolean skipPaging;
-
+
+ private boolean addAttributes;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -100,7 +103,7 @@
{
return page != null && page > 0 ? page : DEFAULT_PAGE;
}
-
+
public int getPageSizeWithDefault()
{
return pageSize != null && pageSize >= 0 ? pageSize : DEFAULT_PAGE_SIZE;
@@ -108,7 +111,7 @@
public int getOffset()
{
- return ( getPageWithDefault() - 1 ) * getPageSizeWithDefault();
+ return (getPageWithDefault() - 1) * getPageSizeWithDefault();
}
/**
@@ -284,4 +287,15 @@
{
this.skipPaging = skipPaging;
}
+
+ public boolean isAddAttributes()
+ {
+ return addAttributes;
+ }
+
+ public void setAddAttributes( boolean addAttributes )
+ {
+ this.addAttributes = addAttributes;
+ }
+
}
=== 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-05-18 17:05:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java 2015-06-02 12:24:22 +0000
@@ -59,7 +59,7 @@
EventSearchParams getFromUrl( String program, String programStage, ProgramStatus programStatus, Boolean followUp, String orgUnit,
OrganisationUnitSelectionMode orgUnitSelectionMode, String trackedEntityInstance, Date startDate, Date endDate,
- EventStatus status, Date lastUpdated, IdSchemes idSchemes, Integer page, Integer pageSize, boolean totalPages, boolean skipPaging );
+ EventStatus status, Date lastUpdated, IdSchemes idSchemes, Integer page, Integer pageSize, boolean totalPages, boolean skipPaging, boolean addAttributes );
Event getEvent( String uid );
=== 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-06-01 03:59:21 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-06-02 12:24:22 +0000
@@ -301,9 +301,12 @@
sql += ") as event left join (";
- sql += getAttributeValueQuery();
+ if ( params.isAddAttributes() )
+ {
+ sql += getAttributeValueQuery();
- sql += ") as att on event.tei_id=att.pav_id left join (";
+ sql += ") as att on event.tei_id=att.pav_id left join (";
+ }
sql += getDataValueQuery();
=== 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-05-28 16:10:07 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2015-06-02 12:24:22 +0000
@@ -146,13 +146,14 @@
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) boolean totalPages,
@RequestParam( required = false ) boolean skipPaging,
+ @RequestParam( required = false ) boolean addAttributes,
@RequestParam( required = false ) String attachment,
@RequestParam Map<String, String> parameters, IdSchemes idSchemes, Model model, HttpServletResponse response, HttpServletRequest request )
{
WebOptions options = new WebOptions( parameters );
EventSearchParams params = eventService.getFromUrl( program, programStage, programStatus, followUp, orgUnit, ouMode,
- trackedEntityInstance, startDate, endDate, status, lastUpdated, idSchemes, page, pageSize, totalPages, skipPaging );
+ trackedEntityInstance, startDate, endDate, status, lastUpdated, idSchemes, page, pageSize, totalPages, skipPaging, false );
Events events = eventService.getEvents( params );
@@ -198,13 +199,14 @@
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) boolean totalPages,
@RequestParam( required = false ) boolean skipPaging,
+ @RequestParam( required = false ) boolean addAttributes,
@RequestParam( required = false ) String attachment,
@RequestParam( required = false, defaultValue = "false" ) boolean skipHeader,
@RequestParam Map<String, String> parameters,
IdSchemes idSchemes, Model model, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
EventSearchParams params = eventService.getFromUrl( program, programStage, programStatus, followUp, orgUnit, ouMode,
- trackedEntityInstance, startDate, endDate, status, lastUpdated, idSchemes, page, pageSize, totalPages, skipPaging );
+ trackedEntityInstance, startDate, endDate, status, lastUpdated, idSchemes, page, pageSize, totalPages, skipPaging, false );
Events events = eventService.getEvents( params );
@@ -240,12 +242,13 @@
@RequestParam( required = false ) Date endDate,
@RequestParam( required = false ) boolean totalPages,
@RequestParam( required = false ) boolean skipPaging,
+ @RequestParam( required = false ) boolean addAttributes,
@RequestParam Map<String, String> parameters, Model model, HttpServletRequest request )
{
WebOptions options = new WebOptions( parameters );
EventSearchParams params = eventService.getFromUrl( program, null, programStatus, null,
- orgUnit, ouMode, null, startDate, endDate, eventStatus, null, null, null, null, totalPages, skipPaging );
+ orgUnit, ouMode, null, startDate, endDate, eventStatus, null, null, null, null, totalPages, skipPaging, addAttributes );
EventRows eventRows = eventRowService.getEventRows( params );