dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27076
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13428: Web api, resource tables, more options for analytics table generation
------------------------------------------------------------
revno: 13428
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-12-25 22:54:14 +0100
message:
Web api, resource tables, more options for analytics table generation
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.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-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java 2013-09-24 08:11:36 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/scheduling/AnalyticsTableTask.java 2013-12-25 21:54:14 +0000
@@ -63,12 +63,33 @@
@Autowired
private MessageService messageService;
- private boolean last3Years;
+ private boolean last3Years = false;
public void setLast3Years( boolean last3Years )
{
this.last3Years = last3Years;
}
+
+ private boolean skipResourceTables = false;
+
+ public void setSkipResourceTables( boolean skipResourceTables )
+ {
+ this.skipResourceTables = skipResourceTables;
+ }
+
+ private boolean skipAggregate = false;
+
+ public void setSkipAggregate( boolean skipAggregate )
+ {
+ this.skipAggregate = skipAggregate;
+ }
+
+ private boolean skipEvents = false;
+
+ public void setSkipEvents( boolean skipEvents )
+ {
+ this.skipEvents = skipEvents;
+ }
private TaskId taskId;
@@ -88,25 +109,29 @@
try
{
- analyticsTableService.generateResourceTables();
-
- notifier.notify( taskId, "Updating analytics tables" );
-
- analyticsTableService.update( last3Years, taskId );
-
- notifier.notify( taskId, "Updating completeness tables" );
-
- completenessTableService.update( last3Years, taskId );
-
- notifier.notify( taskId, "Updating compeleteness target table" );
-
- completenessTargetTableService.update( last3Years, taskId );
-
- notifier.notify( taskId, "Updating event analytics tables" );
-
- eventAnalyticsTableService.update( last3Years, taskId );
-
- notifier.notify( taskId, INFO, "Analytics tables updated", true );
+ if ( !skipResourceTables )
+ {
+ analyticsTableService.generateResourceTables();
+ notifier.notify( taskId, "Updating analytics tables" );
+ }
+
+ if ( !skipAggregate )
+ {
+ analyticsTableService.update( last3Years, taskId );
+ notifier.notify( taskId, "Updating completeness tables" );
+
+ completenessTableService.update( last3Years, taskId );
+ notifier.notify( taskId, "Updating compeleteness target table" );
+
+ completenessTargetTableService.update( last3Years, taskId );
+ notifier.notify( taskId, "Updating event analytics tables" );
+ }
+
+ if ( !skipEvents )
+ {
+ eventAnalyticsTableService.update( last3Years, taskId );
+ notifier.notify( taskId, INFO, "Analytics tables updated", true );
+ }
}
catch ( RuntimeException ex )
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java 2013-10-23 22:03:17 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java 2013-12-25 21:54:14 +0000
@@ -45,6 +45,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
/**
* @author Lars Helge Overland
@@ -77,8 +78,15 @@
@RequestMapping( value = "/analytics", method = { RequestMethod.PUT, RequestMethod.POST } )
@PreAuthorize( "hasRole('ALL') or hasRole('F_DATA_MART_ADMIN')" )
- public void analytics( HttpServletResponse response )
+ public void analytics(
+ @RequestParam(required=false) boolean skipResourceTables,
+ @RequestParam(required=false) boolean skipAggregate,
+ @RequestParam(required=false) boolean skipEvents,
+ HttpServletResponse response )
{
+ analyticsTableTask.setSkipResourceTables( skipResourceTables );
+ analyticsTableTask.setSkipAggregate( skipAggregate );
+ analyticsTableTask.setSkipEvents( skipEvents );
analyticsTableTask.setTaskId( new TaskId( TaskCategory.DATAMART, currentUserService.getCurrentUser() ) );
scheduler.executeTask( analyticsTableTask );