dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28782
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14423: Event analytics. Supporting HTML and XML.
------------------------------------------------------------
revno: 14423
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-03-26 10:26:06 +0100
message:
Event analytics. Supporting HTML and XML.
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/EventAnalyticsController.java 2014-03-26 09:26:06 +0000
@@ -98,6 +98,28 @@
return "grid";
}
+ @RequestMapping( value = RESOURCE_PATH + "/aggregate/{program}.xml", method = RequestMethod.GET )
+ public void getAggregateXml(
+ @PathVariable String program,
+ @RequestParam(required=false) String stage,
+ @RequestParam(required=false) String startDate,
+ @RequestParam(required=false) String endDate,
+ @RequestParam Set<String> dimension,
+ @RequestParam(required=false) Set<String> filter,
+ @RequestParam(required=false) boolean skipMeta,
+ @RequestParam(required=false) boolean hierarchyMeta,
+ @RequestParam(required=false) Integer limit,
+ @RequestParam(required=false) SortOrder sortOrder,
+ Model model,
+ HttpServletResponse response ) throws Exception
+ {
+ EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, skipMeta, hierarchyMeta, sortOrder, limit, i18nManager.getI18nFormat() );
+
+ contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xml", false );
+ Grid grid = analyticsService.getAggregatedEventData( params );
+ GridUtils.toXml( substituteMetaData( grid ), response.getOutputStream() );
+ }
+
@RequestMapping( value = RESOURCE_PATH + "/aggregate/{program}.xls", method = RequestMethod.GET )
public void getAggregateXls(
@PathVariable String program,
@@ -141,7 +163,29 @@
Grid grid = analyticsService.getAggregatedEventData( params );
GridUtils.toCsv( substituteMetaData( grid ), response.getOutputStream() );
}
-
+
+ @RequestMapping( value = RESOURCE_PATH + "/aggregate/{program}.html", method = RequestMethod.GET )
+ public void getAggregateHtml(
+ @PathVariable String program,
+ @RequestParam(required=false) String stage,
+ @RequestParam(required=false) String startDate,
+ @RequestParam(required=false) String endDate,
+ @RequestParam Set<String> dimension,
+ @RequestParam(required=false) Set<String> filter,
+ @RequestParam(required=false) boolean skipMeta,
+ @RequestParam(required=false) boolean hierarchyMeta,
+ @RequestParam(required=false) Integer limit,
+ @RequestParam(required=false) SortOrder sortOrder,
+ Model model,
+ HttpServletResponse response ) throws Exception
+ {
+ EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, skipMeta, hierarchyMeta, sortOrder, limit, i18nManager.getI18nFormat() );
+
+ contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.html", false );
+ Grid grid = analyticsService.getAggregatedEventData( params );
+ GridUtils.toHtml( substituteMetaData( grid ), response.getWriter() );
+ }
+
// -------------------------------------------------------------------------
// Query
// -------------------------------------------------------------------------
@@ -175,6 +219,33 @@
return "grid";
}
+ @RequestMapping( value = RESOURCE_PATH + "/query/{program}.xml", method = RequestMethod.GET )
+ public void getQueryXml(
+ @PathVariable String program,
+ @RequestParam(required=false) String stage,
+ @RequestParam(required=false) String startDate,
+ @RequestParam(required=false) String endDate,
+ @RequestParam Set<String> dimension,
+ @RequestParam(required=false) Set<String> filter,
+ @RequestParam(required=false) String ouMode,
+ @RequestParam(required=false) Set<String> asc,
+ @RequestParam(required=false) Set<String> desc,
+ @RequestParam(required=false) boolean skipMeta,
+ @RequestParam(required=false) boolean hierarchyMeta,
+ @RequestParam(required=false) boolean coordinatesOnly,
+ @RequestParam(required=false) Integer page,
+ @RequestParam(required=false) Integer pageSize,
+ Model model,
+ HttpServletResponse response ) throws Exception
+ {
+ EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
+ ouMode, asc, desc, skipMeta, hierarchyMeta, coordinatesOnly, page, pageSize, i18nManager.getI18nFormat() );
+
+ contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xml", false );
+ Grid grid = analyticsService.getEvents( params );
+ GridUtils.toXml( substituteMetaData( grid ), response.getOutputStream() );
+ }
+
@RequestMapping( value = RESOURCE_PATH + "/query/{program}.xls", method = RequestMethod.GET )
public void getQueryXls(
@PathVariable String program,
@@ -228,6 +299,33 @@
Grid grid = analyticsService.getEvents( params );
GridUtils.toCsv( substituteMetaData( grid ), response.getOutputStream() );
}
+
+ @RequestMapping( value = RESOURCE_PATH + "/query/{program}.html", method = RequestMethod.GET )
+ public void getQueryHtml(
+ @PathVariable String program,
+ @RequestParam(required=false) String stage,
+ @RequestParam(required=false) String startDate,
+ @RequestParam(required=false) String endDate,
+ @RequestParam Set<String> dimension,
+ @RequestParam(required=false) Set<String> filter,
+ @RequestParam(required=false) String ouMode,
+ @RequestParam(required=false) Set<String> asc,
+ @RequestParam(required=false) Set<String> desc,
+ @RequestParam(required=false) boolean skipMeta,
+ @RequestParam(required=false) boolean hierarchyMeta,
+ @RequestParam(required=false) boolean coordinatesOnly,
+ @RequestParam(required=false) Integer page,
+ @RequestParam(required=false) Integer pageSize,
+ Model model,
+ HttpServletResponse response ) throws Exception
+ {
+ EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter,
+ ouMode, asc, desc, skipMeta, hierarchyMeta, coordinatesOnly, page, pageSize, i18nManager.getI18nFormat() );
+
+ contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.html", false );
+ Grid grid = analyticsService.getEvents( params );
+ GridUtils.toHtml( substituteMetaData( grid ), response.getWriter() );
+ }
// -------------------------------------------------------------------------
// Exception handling
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java 2014-03-25 15:41:15 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java 2014-03-26 09:26:06 +0000
@@ -28,6 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.hisp.dhis.api.controller.AbstractCrudController;
import org.hisp.dhis.api.controller.WebMetaData;
import org.hisp.dhis.api.controller.WebOptions;
@@ -41,15 +49,6 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>