dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14946
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5222: Impl system setting for org unit group set aggregation level for data mart
------------------------------------------------------------
revno: 5222
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-11-25 19:01:49 +0100
message:
Impl system setting for org unit group set aggregation level for data mart
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/SystemSettingManager.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm
resources/sql/div.sql
--
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-api/src/main/java/org/hisp/dhis/options/SystemSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/SystemSettingManager.java 2011-11-24 13:19:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/options/SystemSettingManager.java 2011-11-25 18:01:49 +0000
@@ -67,12 +67,14 @@
final String KEY_EMAIL_PASSWORD = "keyEmailPassword";
final String KEY_SCHEDULED_PERIOD_TYPES = "keyScheduledPeriodTypes";
final String KEY_SCHEDULED_TASKS = "keyScheduledTasks";
+ final String KEY_ORGUNITGROUPSET_AGG_LEVEL = "orgUnitGroupSetAggregationLevel";
final int DEFAULT_MAX_NUMBER_OF_ATTEMPTS = 20;
final int DEFAULT_TIMEFRAME_MINUTES = 1;
final double DEFAULT_FACTOR_OF_DEVIATION = 2.0;
-
+ final int DEFAULT_ORGUNITGROUPSET_AGG_LEVEL = 3;
final String DEFAULT_GOOGLE_MAPS_API_KEY = "ABQIAAAAut6AhySExnYIXm5s2OFIkxRKNzJ-_9njnryRTbvC6CtrS4sRvRREWnxwlZUa630pLuPf3nD9i4fq9w";
+
final String AGGREGATION_STRATEGY_REAL_TIME = "real_time";
final String AGGREGATION_STRATEGY_BATCH = "batch";
final String DEFAULT_AGGREGATION_STRATEGY = AGGREGATION_STRATEGY_REAL_TIME;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java 2011-11-24 16:04:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/scheduling/ScheduleTasksAction.java 2011-11-25 18:01:49 +0000
@@ -27,15 +27,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_SCHEDULED_PERIOD_TYPES;
+import static org.hisp.dhis.options.SystemSettingManager.KEY_ORGUNITGROUPSET_AGG_LEVEL;
+import static org.hisp.dhis.options.SystemSettingManager.DEFAULT_ORGUNITGROUPSET_AGG_LEVEL;
import static org.hisp.dhis.options.SystemSettingManager.KEY_SCHEDULED_PERIOD_TYPES;
-import static org.hisp.dhis.options.SystemSettingManager.*;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.scheduling.SchedulingManager;
import org.hisp.dhis.system.scheduling.Scheduler;
@@ -68,6 +73,13 @@
this.schedulingManager = schedulingManager;
}
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -88,11 +100,28 @@
private Set<String> scheduledPeriodTypes = new HashSet<String>();
+ public Set<String> getScheduledPeriodTypes()
+ {
+ return scheduledPeriodTypes;
+ }
+
public void setScheduledPeriodTypes( Set<String> scheduledPeriodTypes )
{
this.scheduledPeriodTypes = scheduledPeriodTypes;
}
+ private Integer orgUnitGroupSetAggLevel;
+
+ public Integer getOrgUnitGroupSetAggLevel()
+ {
+ return orgUnitGroupSetAggLevel;
+ }
+
+ public void setOrgUnitGroupSetAggLevel( Integer orgUnitGroupSetAggLevel )
+ {
+ this.orgUnitGroupSetAggLevel = orgUnitGroupSetAggLevel;
+ }
+
private String dataMartStrategy;
public String getDataMartStrategy()
@@ -122,12 +151,12 @@
{
return running;
}
-
- private Set<String> periodTypes = new HashSet<String>();
+
+ private List<OrganisationUnitLevel> levels;
- public Set<String> getPeriodTypes()
+ public List<OrganisationUnitLevel> getLevels()
{
- return periodTypes;
+ return levels;
}
// -------------------------------------------------------------------------
@@ -144,6 +173,7 @@
else if ( schedule )
{
systemSettingManager.saveSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, (HashSet<String>) scheduledPeriodTypes );
+ systemSettingManager.saveSystemSetting( KEY_ORGUNITGROUPSET_AGG_LEVEL, orgUnitGroupSetAggLevel );
if ( Scheduler.STATUS_RUNNING.equals( schedulingManager.getTaskStatus() ) )
{
@@ -168,13 +198,15 @@
}
else
{
+ scheduledPeriodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
+ orgUnitGroupSetAggLevel = (Integer) systemSettingManager.getSystemSetting( KEY_ORGUNITGROUPSET_AGG_LEVEL, DEFAULT_ORGUNITGROUPSET_AGG_LEVEL );
dataMartStrategy = schedulingManager.getScheduledTasks().containsKey( SchedulingManager.TASK_DATAMART_LAST_12_MONTHS ) ?
STRATEGY_LAST_12_DAILY : STRATEGY_LAST_6_DAILY_6_TO_12_WEEKLY;
}
status = schedulingManager.getTaskStatus();
running = Scheduler.STATUS_RUNNING.equals( status );
- periodTypes = (Set<String>) systemSettingManager.getSystemSetting( KEY_SCHEDULED_PERIOD_TYPES, DEFAULT_SCHEDULED_PERIOD_TYPES );
+ levels = organisationUnitService.getOrganisationUnitLevels();
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2011-11-02 14:39:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2011-11-25 18:01:49 +0000
@@ -329,6 +329,7 @@
scope="prototype">
<property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
<property name="schedulingManager" ref="org.hisp.dhis.scheduling.SchedulingManager" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2011-11-24 16:04:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2011-11-25 18:01:49 +0000
@@ -373,4 +373,5 @@
datamart_task_strategy = Data mart task strategy
never = Never
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
\ No newline at end of file
+last_6_months_daily_6_to_12_months_weekly = Last 6 months daily + 6 to 12 months weekly
+organisation_unit_group_set_aggregation_level = Organisation unit group set aggregation level
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm 2011-11-24 16:04:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/viewScheduledTasks.vm 2011-11-25 18:01:49 +0000
@@ -5,28 +5,43 @@
<form id="schedulingForm" action="scheduleTasks.action" method="post">
-<table>
+<table style="width:300px">
<tr>
- <th>$i18n.getString( "aggregation_period_types" )</th>
+ <th style="width:100%">$i18n.getString( "aggregation_period_types" )</th>
</tr>
<tr>
<td>
- <label for="monthly">$i18n.getString( "Monthly" )</label><input type="checkbox" id="monthly" class="scheduling" name="scheduledPeriodTypes" value="Monthly"#if( $periodTypes.contains( "Monthly" ) ) checked="checked"#end>
- <label for="biMonthly">$i18n.getString( "BiMonthly" )</label><input type="checkbox" id="biMonthly" class="scheduling" name="scheduledPeriodTypes" value="BiMonthly"#if( $periodTypes.contains( "BiMonthly" ) ) checked="checked"#end>
- <label for="quarterly">$i18n.getString( "Quarterly" )</label><input type="checkbox" id="quarterly" class="scheduling" name="scheduledPeriodTypes" value="Quarterly"#if( $periodTypes.contains( "Quarterly" ) ) checked="checked"#end><br><br>
- <label for="sixMonthly">$i18n.getString( "SixMonthly" )</label><input type="checkbox" id="sixMonthly" class="scheduling" name="scheduledPeriodTypes" value="SixMonthly"#if( $periodTypes.contains( "SixMonthly" ) ) checked="checked"#end>
- <label for="yearly">$i18n.getString( "Yearly" )</label><input type="checkbox" id="yearly" class="scheduling" name="scheduledPeriodTypes" class="scheduler" value="Yearly"#if( $periodTypes.contains( "Yearly" ) ) checked="checked"#end>
+ <label for="monthly">$i18n.getString( "Monthly" )</label><input type="checkbox" id="monthly" class="scheduling" name="scheduledPeriodTypes" value="Monthly"#if( $scheduledPeriodTypes.contains( "Monthly" ) ) checked="checked"#end>
+ <label for="biMonthly">$i18n.getString( "BiMonthly" )</label><input type="checkbox" id="biMonthly" class="scheduling" name="scheduledPeriodTypes" value="BiMonthly"#if( $scheduledPeriodTypes.contains( "BiMonthly" ) ) checked="checked"#end>
+ <label for="quarterly">$i18n.getString( "Quarterly" )</label><input type="checkbox" id="quarterly" class="scheduling" name="scheduledPeriodTypes" value="Quarterly"#if( $scheduledPeriodTypes.contains( "Quarterly" ) ) checked="checked"#end><br><br>
+ <label for="sixMonthly">$i18n.getString( "SixMonthly" )</label><input type="checkbox" id="sixMonthly" class="scheduling" name="scheduledPeriodTypes" value="SixMonthly"#if( $scheduledPeriodTypes.contains( "SixMonthly" ) ) checked="checked"#end>
+ <label for="yearly">$i18n.getString( "Yearly" )</label><input type="checkbox" id="yearly" class="scheduling" name="scheduledPeriodTypes" class="scheduler" value="Yearly"#if( $scheduledPeriodTypes.contains( "Yearly" ) ) checked="checked"#end>
</td>
</tr>
<tr>
<td style="height:10px"></td>
</tr>
<tr>
+ <th>$i18n.getString( "organisation_unit_group_set_aggregation_level" )</th>
+</tr>
+<tr>
+ <td>
+ <select id="orgUnitGroupSetAggLevel" name="orgUnitGroupSetAggLevel" class="scheduling" style="width:100%">
+ #foreach( $level in $levels )
+ <option value="$level.level"#if( $orgUnitGroupSetAggLevel && $orgUnitGroupSetAggLevel == $level.level ) selected="selected"#end>$encoder.htmlEncode( $level.name )</option>
+ #end
+ </select>
+ </td>
+</tr>
+<tr>
+ <td style="height:10px"></td>
+</tr>
+<tr>
<th>$i18n.getString( "datamart_task_strategy" )</th>
</tr>
<tr>
<td>
- <select id="dataMartStrategy" name="dataMartStrategy" class="scheduling">
+ <select id="dataMartStrategy" name="dataMartStrategy" class="scheduling" style="width:100%">
<option value="never">$i18n.getString( "never" )</option>
<option value="last12Daily"#if( $dataMartStrategy && $dataMartStrategy == "last12Daily" ) selected="selected"#end>$i18n.getString( "last_12_months_daily" )</option>
<option value="last6Daily6To12Weekly"#if( $dataMartStrategy && $dataMartStrategy == "last6Daily6To12Weekly" ) selected="selected"#end>$i18n.getString( "last_6_months_daily_6_to_12_months_weekly" )</option>
=== modified file 'resources/sql/div.sql'
--- resources/sql/div.sql 2011-11-24 09:54:47 +0000
+++ resources/sql/div.sql 2011-11-25 18:01:49 +0000
@@ -33,3 +33,9 @@
select count(*) from dataelement de
where (select count(*) from datavalue dv where de.dataelementid=dv.dataelementid) < 100;
+-- Duplicate codes
+
+select code, count(code) as count
+from dataelement
+group by code
+order by count desc;