dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19469
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8501: Improve Aggregate Query Builder (WIP).
------------------------------------------------------------
revno: 8501
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-10-12 14:34:56 +0700
message:
Improve Aggregate Query Builder (WIP).
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/ScheduleCaseAggregateConditionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/scheduling.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/scheduleSendMessage.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewScheduledCaseAggTasks.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
--
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-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/ScheduleCaseAggregateConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/ScheduleCaseAggregateConditionAction.java 2012-10-12 06:24:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/schedule/ScheduleCaseAggregateConditionAction.java 2012-10-12 07:34:56 +0000
@@ -27,19 +27,14 @@
package org.hisp.dhis.patient.action.schedule;
-import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_ORGUNITGROUPSET_AGG_LEVEL;
-import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_SCHEDULED_PERIOD_TYPES;
import static org.hisp.dhis.setting.SystemSettingManager.KEY_AGGREGATE_QUERY_BUILDER_ORGUNITGROUPSET_AGG_LEVEL;
import static org.hisp.dhis.setting.SystemSettingManager.KEY_SCHEDULED_AGGREGATE_QUERY_BUILDER_PERIOD_TYPES;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.patient.scheduling.CaseAggregateConditionSchedulingManager;
import org.hisp.dhis.setting.SystemSettingManager;
import org.hisp.dhis.system.scheduling.Scheduler;
@@ -76,13 +71,6 @@
this.schedulingManager = schedulingManager;
}
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -94,20 +82,8 @@
this.execute = execute;
}
- private boolean schedule;
-
- public void setSchedule( boolean schedule )
- {
- this.schedule = schedule;
- }
-
private Set<String> scheduledPeriodTypes = new HashSet<String>();
- public Set<String> getScheduledPeriodTypes()
- {
- return scheduledPeriodTypes;
- }
-
public void setScheduledPeriodTypes( Set<String> scheduledPeriodTypes )
{
this.scheduledPeriodTypes = scheduledPeriodTypes;
@@ -115,11 +91,6 @@
private Integer orgUnitGroupSetAggLevel;
- public Integer getOrgUnitGroupSetAggLevel()
- {
- return orgUnitGroupSetAggLevel;
- }
-
public void setOrgUnitGroupSetAggLevel( Integer orgUnitGroupSetAggLevel )
{
this.orgUnitGroupSetAggLevel = orgUnitGroupSetAggLevel;
@@ -127,11 +98,6 @@
private String aggQueryBuilderStrategy;
- public String getAggQueryBuilderStrategy()
- {
- return aggQueryBuilderStrategy;
- }
-
public void setAggQueryBuilderStrategy( String aggQueryBuilderStrategy )
{
this.aggQueryBuilderStrategy = aggQueryBuilderStrategy;
@@ -154,19 +120,11 @@
{
return running;
}
-
- private List<OrganisationUnitLevel> levels;
-
- public List<OrganisationUnitLevel> getLevels()
- {
- return levels;
- }
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- @SuppressWarnings( "unchecked" )
@Override
public String execute()
throws Exception
@@ -175,13 +133,13 @@
{
schedulingManager.executeTasks();
}
- else if ( schedule )
+ else
{
systemSettingManager.saveSystemSetting( KEY_SCHEDULED_AGGREGATE_QUERY_BUILDER_PERIOD_TYPES,
(HashSet<String>) scheduledPeriodTypes );
- systemSettingManager.saveSystemSetting(
- KEY_AGGREGATE_QUERY_BUILDER_ORGUNITGROUPSET_AGG_LEVEL, orgUnitGroupSetAggLevel );
-
+ systemSettingManager.saveSystemSetting( KEY_AGGREGATE_QUERY_BUILDER_ORGUNITGROUPSET_AGG_LEVEL,
+ orgUnitGroupSetAggLevel );
+
if ( Scheduler.STATUS_RUNNING.equals( schedulingManager.getTaskStatus() ) )
{
schedulingManager.stopTasks();
@@ -192,33 +150,26 @@
if ( STRATEGY_LAST_12_DAILY.equals( aggQueryBuilderStrategy ) )
{
- keyCronMap.put( CaseAggregateConditionSchedulingManager.TASK_AGGREGATE_QUERY_BUILDER_LAST_12_MONTHS, Scheduler.CRON_DAILY_0AM );
+ keyCronMap.put(
+ CaseAggregateConditionSchedulingManager.TASK_AGGREGATE_QUERY_BUILDER_LAST_12_MONTHS,
+ Scheduler.CRON_DAILY_0AM );
}
else if ( STRATEGY_LAST_6_DAILY_6_TO_12_WEEKLY.equals( aggQueryBuilderStrategy ) )
{
keyCronMap.put( CaseAggregateConditionSchedulingManager.TASK_AGGREGATE_QUERY_BUILDER_LAST_6_MONTS,
Scheduler.CRON_DAILY_0AM_EXCEPT_SUNDAY );
- keyCronMap.put( CaseAggregateConditionSchedulingManager.TASK_AGGREGATE_QUERY_BUILDER_FROM_6_TO_12_MONTS,
+ keyCronMap.put(
+ CaseAggregateConditionSchedulingManager.TASK_AGGREGATE_QUERY_BUILDER_FROM_6_TO_12_MONTS,
Scheduler.CRON_WEEKLY_SUNDAY_0AM );
}
schedulingManager.scheduleTasks( keyCronMap );
}
}
- else
- {
- scheduledPeriodTypes = (Set<String>) systemSettingManager.getSystemSetting(
- KEY_SCHEDULED_AGGREGATE_QUERY_BUILDER_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
- orgUnitGroupSetAggLevel = (Integer) systemSettingManager.getSystemSetting(
- KEY_AGGREGATE_QUERY_BUILDER_ORGUNITGROUPSET_AGG_LEVEL, DEFAULT_ORGUNITGROUPSET_AGG_LEVEL );
- aggQueryBuilderStrategy = schedulingManager.getScheduledTasks().containsKey(
- CaseAggregateConditionSchedulingManager.TASK_AGGREGATE_QUERY_BUILDER_LAST_12_MONTHS ) ? STRATEGY_LAST_12_DAILY
- : STRATEGY_LAST_6_DAILY_6_TO_12_WEEKLY;
- }
-
+
status = schedulingManager.getTaskStatus();
+
running = Scheduler.STATUS_RUNNING.equals( status );
- levels = organisationUnitService.getOrganisationUnitLevels();
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2012-10-10 08:50:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2012-10-12 07:34:56 +0000
@@ -930,14 +930,22 @@
<property name="outboundSmsService" ref="org.hisp.dhis.sms.outbound.OutboundSmsService" />
</bean>
+ <bean id="org.hisp.dhis.patient.action.schedule.GetScheduleAggQueryBuilderParamsAction"
+ class="org.hisp.dhis.patient.action.schedule.GetScheduleAggQueryBuilderParamsAction"
+ scope="prototype">
+ <property name="systemSettingManager"
+ ref="org.hisp.dhis.setting.SystemSettingManager" />
+ <property name="schedulingManager" ref="org.hisp.dhis.patient.scheduling.CaseAggregateConditionSchedulingManager" />
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
+
<bean id="org.hisp.dhis.patient.action.schedule.ScheduleCaseAggregateConditionAction"
class="org.hisp.dhis.patient.action.schedule.ScheduleCaseAggregateConditionAction"
scope="prototype">
<property name="systemSettingManager"
ref="org.hisp.dhis.setting.SystemSettingManager" />
<property name="schedulingManager" ref="org.hisp.dhis.patient.scheduling.CaseAggregateConditionSchedulingManager" />
- <property name="organisationUnitService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
</beans>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-10-10 09:16:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-10-12 07:34:56 +0000
@@ -312,4 +312,5 @@
aggregate_task_strategy = Aggregate task strategy
last_12_months_daily = Last 12 months daily
last_6_months_daily_6_to_12_months_weekly = Last 6 months daily + 6 to 12 months weekly
-execute_tasks_confirmation=Are you sure you want to execute all tasks now? Task processing might fully utilize your system resources and slow down other operations.
\ No newline at end of file
+execute_tasks_confirmation=Are you sure you want to execute all tasks now? Task processing might fully utilize your system resources and slow down other operations.
+executing = Executing
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2012-10-10 08:50:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2012-10-12 07:34:56 +0000
@@ -1024,22 +1024,20 @@
</action>
<action name="viewScheduledCaseAggCondTasks"
- class="org.hisp.dhis.patient.action.schedule.ScheduleCaseAggregateConditionAction">
+ class="org.hisp.dhis.patient.action.schedule.GetScheduleAggQueryBuilderParamsAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-patient/viewScheduledCaseAggTasks.vm</param>
<param name="menu">/dhis-web-maintenance-patient/menu.vm</param>
<param name="javascripts">javascript/scheduling.js</param>
- <param name="requiredAuthorities">F_SCHEDULING_ADMIN</param>
+ <param name="requiredAuthorities">F_SCHEDULING_CASE_AGGREGATE_QUERY_BUILDER</param>
</action>
<action name="scheduleCaseAggTasks"
class="org.hisp.dhis.patient.action.schedule.ScheduleCaseAggregateConditionAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-maintenance-patient/viewScheduledCaseAggTasks.vm</param>
- <param name="menu">/dhis-web-maintenance-patient/menu.vm</param>
- <param name="javascripts">javascript/scheduling.js</param>
- <param name="schedule">true</param>
- <param name="requiredAuthorities">F_SCHEDULING_ADMIN</param>
+ <result name="success" type="velocity-json">
+ /dhis-web-maintenance-patient/jsonResponseScheduleTasks.vm
+ </result>
+ <param name="requiredAuthorities">F_SCHEDULING_CASE_AGGREGATE_QUERY_BUILDER</param>
</action>
</package>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/scheduling.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/scheduling.js 2012-10-10 08:50:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/scheduling.js 2012-10-12 07:34:56 +0000
@@ -1,4 +1,3 @@
-
// -----------------------------------------------------------------------
// Schedule Messages
// -----------------------------------------------------------------------
@@ -15,7 +14,7 @@
if( status=='not_started' ){
status = i18n_not_started;
}
- setMessage(i18n_scheduling_is + " " + status);
+ setInnerHTML('info', i18n_scheduling_is + " " + status);
if( json.scheduleTasks.running=="true" ){
setFieldValue('scheduledBtn', i18n_stop);
}
@@ -27,32 +26,68 @@
function executeTasks()
{
- $.post( 'executeSendMessage.action',{
- execute:true,
- schedule: false,
- gateWayId: getFieldValue("gatewayId"),
- timeSendingMessage: getFieldValue("timeSendingMessage")
- }, function( json ){
- setMessage(i18n_execute_success);
- });
+ var ok = confirm( i18n_execute_tasks_confirmation );
+ setWaitMessage( i18n_executing );
+ if ( ok )
+ {
+ $.post( 'executeSendMessage.action',{
+ execute:true,
+ schedule: false,
+ gateWayId: getFieldValue("gatewayId"),
+ timeSendingMessage: getFieldValue("timeSendingMessage")
+ }, function( json ){
+ setMessage(i18n_execute_success);
+ });
+ }
}
// -----------------------------------------------------------------------
// Schedule Aggregate Query Builder
// -----------------------------------------------------------------------
-function submitSchedulingForm()
+function schedulingAggCondTasks()
{
- $( '.scheduling' ).removeAttr( 'disabled' );
- $( '#schedulingForm' ).submit();
+ var scheduledPeriodTypes = "";
+ jQuery("#scheduledPeriodTypes").each(function(){
+ scheduledPeriodTypes+='&scheduledPeriodTypes=' + this.value;
+ });
+
+ $.post( 'scheduleCaseAggTasks.action?' + scheduledPeriodTypes,{
+ execute:false,
+ orgUnitGroupSetAggLevel:getFieldValue("orgUnitGroupSetAggLevel"),
+ aggQueryBuilderStrategy:getFieldValue("aggQueryBuilderStrategy")
+ }, function( json ){
+ var status = json.scheduleTasks.status;
+ if( status=='not_started' ){
+ status = i18n_not_started;
+ }
+ setInnerHTML('info', i18n_scheduling_is + " " + status);
+ if( json.scheduleTasks.running=="true" ){
+ setFieldValue('scheduledBtn', i18n_stop);
+ }
+ else{
+ setFieldValue('scheduledBtn', i18n_start);
+ }
+ });
}
function executeAggCondTasks()
{
var ok = confirm( i18n_execute_tasks_confirmation );
-
+ setWaitMessage( i18n_executing );
if ( ok )
{
- $.get( 'scheduleCaseAggTasks.action?execute=true' );
+ var scheduledPeriodTypes = "";
+ jQuery("#scheduledPeriodTypes").each(function(){
+ scheduledPeriodTypes+='&scheduledPeriodTypes=' + this.value;
+ });
+
+ $.post( 'scheduleCaseAggTasks.action?' + scheduledPeriodTypes,{
+ execute:true,
+ orgUnitGroupSetAggLevel:getFieldValue("orgUnitGroupSetAggLevel"),
+ aggQueryBuilderStrategy:getFieldValue("aggQueryBuilderStrategy")
+ },function( json ){
+ setMessage(i18n_execute_success);
+ });
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/scheduleSendMessage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/scheduleSendMessage.vm 2012-10-09 05:25:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/scheduleSendMessage.vm 2012-10-12 07:34:56 +0000
@@ -24,7 +24,8 @@
</tbody>
</table>
-<span id='message' style="display:block;">$i18n.getString( "scheduling_is" ) $!i18n.getString( $!status )</span>
+<span id="info">$i18n.getString( "scheduling_is" ) $!i18n.getString( $!status )</span>
+<span id='message'></span>
<script>
var i18n_scheduled = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )';
@@ -32,5 +33,7 @@
var i18n_stop = '$encoder.jsEscape( $i18n.getString( "stop" ) , "'" )';
var i18n_not_started = '$encoder.jsEscape( $i18n.getString( "not_started" ) , "'" )';
var i18n_scheduling_is = '$encoder.jsEscape( $i18n.getString( "scheduling_is" ) , "'" )';
+ var i18n_executing = '$encoder.jsEscape( $i18n.getString( "executing" ) , "'" )';
var i18n_execute_success = '$encoder.jsEscape( $i18n.getString( "execute_success" ) , "'" )';
+ var i18n_execute_tasks_confirmation = '$encoder.jsEscape( $i18n.getString( "execute_tasks_confirmation" ) , "'" )';
</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewScheduledCaseAggTasks.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewScheduledCaseAggTasks.vm 2012-10-10 09:16:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewScheduledCaseAggTasks.vm 2012-10-12 07:34:56 +0000
@@ -1,5 +1,12 @@
<script type="text/javascript">
- var i18n_execute_tasks_confirmation = '$encoder.jsEscape( $i18n.getString( "execute_tasks_confirmation" ), "'" )';
+ var i18n_scheduled = '$encoder.jsEscape( $i18n.getString( "run_success" ) , "'" )';
+ var i18n_start = '$encoder.jsEscape( $i18n.getString( "start" ) , "'" )';
+ var i18n_stop = '$encoder.jsEscape( $i18n.getString( "stop" ) , "'" )';
+ var i18n_not_started = '$encoder.jsEscape( $i18n.getString( "not_started" ) , "'" )';
+ var i18n_scheduling_is = '$encoder.jsEscape( $i18n.getString( "scheduling_is" ) , "'" )';
+ var i18n_executing = '$encoder.jsEscape( $i18n.getString( "executing" ) , "'" )';
+ var i18n_execute_success = '$encoder.jsEscape( $i18n.getString( "execute_success" ) , "'" )';
+ var i18n_execute_tasks_confirmation = '$encoder.jsEscape( $i18n.getString( "execute_tasks_confirmation" ), "'" )';
</script>
<h3>$i18n.getString( "schedule_aggregation_query_builder" ) #openHelp( "scheduling" )</h3>
@@ -7,7 +14,7 @@
<input id="isRunning" type="hidden" value="${running}">
<form id="schedulingForm" action="scheduleCaseAggTasks.action" method="post">
-<input type='hidden' id='schedule' name='schedule' value='true'/>
+<input type='hidden' id='execute' name='execute'/>
<table style="width:300px">
<tr>
@@ -60,17 +67,18 @@
</tr>
<tr>
<td>
- <input type="button" style="width:140px" onclick="submitSchedulingForm()"
+ <input type="button" style="width:140px" onclick="schedulingAggCondTasks();"
#if ( $running )
value="$i18n.getString( 'stop' )"
#else
value="$i18n.getString( 'start' )"
#end
/>
- <input type="button" id="executeButton" style="width:140px" onclick="executeAggCondTasks()" value="$i18n.getString( 'execute' )" />
+ <input type="button" id="executeButton" style="width:140px" onclick="executeAggCondTasks();" value="$i18n.getString( 'execute' )" />
</td>
</tr>
</table>
</form>
<span id="info">$i18n.getString( "scheduling_is" ) $!i18n.getString( $!status )</span>
+<span id="message"></span>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-10-06 08:45:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-10-12 07:34:56 +0000
@@ -153,6 +153,8 @@
F_PATIENT_DATAVALUE_ADD = Add Person Data Value
F_PATIENT_DATAVALUE_UPDATE = Update Person Data Value
F_PATIENT_DATAVALUE_DELETE = Delete Person Data Value
+F_SCHEDULING_SEND_MESSAGE = Scheduling send messages
+F_SCHEDULING_CASE_AGGREGATE_QUERY_BUILDER = Scheduling case aggregate query builder
F_ACTIVITY_PLAN = Search Activity Plan
F_GENERATE_ACTIVITY_PLANS = Generate Activity Plans
F_GENERATE_PROGRAM_SUMMARY_REPORT = Generate Program Summary Report