dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17192
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6762: Impl AttributeValueDeletionHandler. Made org unit selection in reporting module more robust.
Merge authors:
Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 6762 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-26 19:08:35 +0200
message:
Impl AttributeValueDeletionHandler. Made org unit selection in reporting module more robust.
added:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/AttributeValueDeletionHandler.java
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js
--
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
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/AttributeValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/AttributeValueDeletionHandler.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/AttributeValueDeletionHandler.java 2012-04-26 14:30:09 +0000
@@ -0,0 +1,124 @@
+package org.hisp.dhis.attribute;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met: *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer. * Redistributions in binary
+ * form must reproduce the above copyright notice, this list of conditions and
+ * the following disclaimer in the documentation and/or other materials provided
+ * with the distribution. * Neither the name of the HISP project nor the names
+ * of its contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission. THIS SOFTWARE IS
+ * PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Iterator;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.hisp.dhis.user.User;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class AttributeValueDeletionHandler
+ extends DeletionHandler
+{
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
+ private JdbcTemplate jdbcTemplate;
+
+ public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+ {
+ this.jdbcTemplate = jdbcTemplate;
+ }
+
+ // -------------------------------------------------------------------------
+ // DeletionHandler implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String getClassName()
+ {
+ return AttributeValue.class.getSimpleName();
+ }
+
+ @Override
+ public String allowDeleteAttribute( Attribute attribute )
+ {
+ String sql = "select count(*) from attributevalue where attributeid=" + attribute.getId();
+
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
+ }
+
+ @Override
+ public void deleteDataElement( DataElement dataElement )
+ {
+ Iterator<AttributeValue> iterator = dataElement.getAttributeValues().iterator();
+
+ while ( iterator.hasNext() )
+ {
+ AttributeValue attributeValue = iterator.next();
+ iterator.remove();
+ attributeService.deleteAttributeValue( attributeValue );
+ }
+ }
+
+ @Override
+ public void deleteIndicator( Indicator indicator )
+ {
+ Iterator<AttributeValue> iterator = indicator.getAttributeValues().iterator();
+
+ while ( iterator.hasNext() )
+ {
+ AttributeValue attributeValue = iterator.next();
+ iterator.remove();
+ attributeService.deleteAttributeValue( attributeValue );
+ }
+ }
+
+ @Override
+ public void deleteOrganisationUnit( OrganisationUnit unit )
+ {
+ Iterator<AttributeValue> iterator = unit.getAttributeValues().iterator();
+
+ while ( iterator.hasNext() )
+ {
+ AttributeValue attributeValue = iterator.next();
+ iterator.remove();
+ attributeService.deleteAttributeValue( attributeValue );
+ }
+ }
+
+ @Override
+ public void deleteUser( User user )
+ {
+ Iterator<AttributeValue> iterator = user.getAttributeValues().iterator();
+
+ while ( iterator.hasNext() )
+ {
+ AttributeValue attributeValue = iterator.next();
+ iterator.remove();
+ attributeService.deleteAttributeValue( attributeValue );
+ }
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java 2012-02-08 04:05:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java 2012-04-26 14:30:09 +0000
@@ -29,10 +29,6 @@
import static org.hisp.dhis.dataelement.DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME;
-import java.util.Iterator;
-
-import org.hisp.dhis.attribute.AttributeService;
-import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.option.OptionSet;
import org.hisp.dhis.system.deletion.DeletionHandler;
@@ -63,13 +59,6 @@
this.categoryService = categoryService;
}
- private AttributeService attributeService;
-
- public void setAttributeService( AttributeService attributeService )
- {
- this.attributeService = attributeService;
- }
-
private JdbcTemplate jdbcTemplate;
public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
@@ -88,22 +77,6 @@
}
@Override
- public void deleteDataElement( DataElement dataElement )
- {
- // Delete attributeValues
- Iterator<AttributeValue> iterator = dataElement.getAttributeValues().iterator();
-
- while ( iterator.hasNext() )
- {
- AttributeValue attributeValue = iterator.next();
- iterator.remove();
- attributeService.deleteAttributeValue( attributeValue );
- }
-
- dataElementService.updateDataElement( dataElement );
- }
-
- @Override
public void deleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
{
DataElementCategoryCombo default_ = categoryService
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java 2012-04-26 14:30:09 +0000
@@ -27,11 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Iterator;
import java.util.Set;
-import org.hisp.dhis.attribute.AttributeService;
-import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -64,13 +61,6 @@
this.expressionService = expressionService;
}
- private AttributeService attributeService;
-
- public void setAttributeService( AttributeService attributeService )
- {
- this.attributeService = attributeService;
- }
-
// -------------------------------------------------------------------------
// DeletionHandler implementation
// -------------------------------------------------------------------------
@@ -82,22 +72,6 @@
}
@Override
- public void deleteIndicator( Indicator indicator )
- {
- // Delete attributeValues
- Iterator<AttributeValue> iterator = indicator.getAttributeValues().iterator();
-
- while ( iterator.hasNext() )
- {
- AttributeValue attributeValue = iterator.next();
- iterator.remove();
- attributeService.deleteAttributeValue( attributeValue );
- }
-
- indicatorService.updateIndicator( indicator );
- }
-
- @Override
public String allowDeleteIndicatorType( IndicatorType indicatorType )
{
for ( Indicator indicator : indicatorService.getAllIndicators() )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDeletionHandler.java 2012-01-11 19:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDeletionHandler.java 2012-04-26 14:30:09 +0000
@@ -27,10 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Iterator;
-
-import org.hisp.dhis.attribute.AttributeService;
-import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.system.deletion.DeletionHandler;
import org.hisp.dhis.user.User;
@@ -52,13 +48,6 @@
this.organisationUnitService = organisationUnitService;
}
- private AttributeService attributeService;
-
- public void setAttributeService( AttributeService attributeService )
- {
- this.attributeService = attributeService;
- }
-
// -------------------------------------------------------------------------
// DeletionHandler implementation
// -------------------------------------------------------------------------
@@ -70,21 +59,6 @@
}
@Override
- public void deleteOrganisationUnit( OrganisationUnit unit )
- {
- Iterator<AttributeValue> iterator = unit.getAttributeValues().iterator();
-
- while ( iterator.hasNext() )
- {
- AttributeValue attributeValue = iterator.next();
- iterator.remove();
- attributeService.deleteAttributeValue( attributeValue );
- }
-
- organisationUnitService.updateOrganisationUnit( unit );
- }
-
- @Override
public void deleteDataSet( DataSet dataSet )
{
for ( OrganisationUnit unit : organisationUnitService.getAllOrganisationUnits() )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java 2012-04-26 14:30:09 +0000
@@ -27,10 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Iterator;
-
-import org.hisp.dhis.attribute.AttributeService;
-import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.system.deletion.DeletionHandler;
@@ -52,13 +48,6 @@
this.userService = userService;
}
- private AttributeService attributeService;
-
- public void setAttributeService( AttributeService attributeService )
- {
- this.attributeService = attributeService;
- }
-
// -------------------------------------------------------------------------
// DeletionHandler implementation
// -------------------------------------------------------------------------
@@ -70,21 +59,6 @@
}
@Override
- public void deleteUser( User user )
- {
- Iterator<AttributeValue> iterator = user.getAttributeValues().iterator();
-
- while ( iterator.hasNext() )
- {
- AttributeValue attributeValue = iterator.next();
- iterator.remove();
- attributeService.deleteAttributeValue( attributeValue );
- }
-
- userService.updateUser( user );
- }
-
- @Override
public void deleteOrganisationUnit( OrganisationUnit unit )
{
for ( User user : userService.getAllUsers() )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2012-04-25 11:13:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2012-04-26 14:30:09 +0000
@@ -694,7 +694,6 @@
<bean id="org.hisp.dhis.dataelement.DataElementDeletionHandler" class="org.hisp.dhis.dataelement.DataElementDeletionHandler">
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
- <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
<property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
@@ -735,7 +734,6 @@
<bean id="org.hisp.dhis.indicator.IndicatorDeletionHandler" class="org.hisp.dhis.indicator.IndicatorDeletionHandler">
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
<property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
- <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.indicator.IndicatorGroupDeletionHandler" class="org.hisp.dhis.indicator.IndicatorGroupDeletionHandler">
@@ -764,7 +762,6 @@
<bean id="org.hisp.dhis.organisationunit.OrganisationUnitDeletionHandler" class="org.hisp.dhis.organisationunit.OrganisationUnitDeletionHandler">
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupDeletionHandler" class="org.hisp.dhis.organisationunit.OrganisationUnitGroupDeletionHandler">
@@ -781,7 +778,6 @@
<bean id="org.hisp.dhis.user.UserDeletionHandler" class="org.hisp.dhis.user.UserDeletionHandler">
<property name="userService" ref="org.hisp.dhis.user.UserService" />
- <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler" class="org.hisp.dhis.user.UserAuthorityGroupDeletionHandler">
@@ -817,6 +813,11 @@
<property name="i18nService" ref="org.hisp.dhis.i18n.I18nService"/>
</bean>
+ <bean id="org.hisp.dhis.attribute.AttributeValueDeletionHandler" class="org.hisp.dhis.attribute.AttributeValueDeletionHandler">
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ <property name="jdbcTemplate" ref="jdbcTemplate" />
+ </bean>
+
<!-- DeletionManager -->
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
@@ -855,6 +856,7 @@
<ref local="org.hisp.dhis.configuration.ConfigurationDeletionHandler" />
<ref local="org.hisp.dhis.message.MessageConversationDeletionHandler" />
<ref local="org.hisp.dhis.translation.TranslationDeletionHandler" />
+ <ref local="org.hisp.dhis.attribute.AttributeValueDeletionHandler" />
</list>
</list>
</property>
@@ -871,27 +873,23 @@
<aop:config>
<aop:aspect ref="deletionInterceptor">
- <aop:before pointcut="execution( * org.hisp.dhis.datadictionary.DataDictionaryService.delete*(..) )"
- method="intercept" />
+ <aop:before pointcut="execution( * org.hisp.dhis.datadictionary.DataDictionaryService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.dataelement.DataElementService.delete*(..) )" method="intercept" />
- <aop:before pointcut="execution( * org.hisp.dhis.dataelement.DataElementCategoryService.delete*(..) )"
- method="intercept" />
+ <aop:before pointcut="execution( * org.hisp.dhis.dataelement.DataElementCategoryService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.dataset.DataSetService.deleteDataSet(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.dataset.SectionService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.indicator.IndicatorService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.expression.ExpressionService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.minmax.MinMaxDataElementService.delete*(..) )" method="intercept" />
- <aop:before pointcut="execution( * org.hisp.dhis.validation.ValidationRuleService.delete*(..) )"
- method="intercept" />
+ <aop:before pointcut="execution( * org.hisp.dhis.validation.ValidationRuleService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.period.PeriodService.delete*(..) )" method="intercept" />
- <aop:before pointcut="execution( * org.hisp.dhis.organisationunit.OrganisationUnitService.delete*(..) )"
- method="intercept" />
- <aop:before pointcut="execution( * org.hisp.dhis.organisationunit.OrganisationUnitGroupService.delete*(..) )"
- method="intercept" />
+ <aop:before pointcut="execution( * org.hisp.dhis.organisationunit.OrganisationUnitService.delete*(..) )" method="intercept" />
+ <aop:before pointcut="execution( * org.hisp.dhis.organisationunit.OrganisationUnitGroupService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.user.UserService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.concept.ConceptService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.user.UserGroupService.delete*(..) )" method="intercept" />
<aop:before pointcut="execution( * org.hisp.dhis.option.OptionService.delete*(..) )" method="intercept" />
+ <aop:before pointcut="execution( * org.hisp.dhis.attribute.AttributeService.delete*(..) )" method="intercept" />
</aop:aspect>
<aop:aspect ref="statementInterceptor">
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml 2012-04-22 20:32:54 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml 2012-04-26 14:30:09 +0000
@@ -94,8 +94,6 @@
<cache name="org.hisp.dhis.attribute.Attribute" maxElementsInMemory="500" />
- <cache name="org.hisp.dhis.attribute.AttributeOption" maxElementsInMemory="500" />
-
<cache name="org.hisp.dhis.attribute.AttributeValue" maxElementsInMemory="5000" />
<cache name="org.hisp.dhis.option.OptionSet" maxElementsInMemory="50" />
@@ -184,11 +182,7 @@
<cache name="org.hisp.dhis.user.User.organisationUnits" maxElementsInMemory="20000" />
- <cache name="org.hisp.dhis.attribute.Attribute.attributeOptions" maxElementsInMemory="500" />
-
<cache name="org.hisp.dhis.attribute.Attribute.attributeValues" maxElementsInMemory="5000" />
-
- <cache name="org.hisp.dhis.attribute.AttributeOption.attributes" maxElementsInMemory="500" />
<cache name="org.hisp.dhis.option.OptionSet.options" maxElementsInMemory="2000" />
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2012-03-20 12:15:48 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2012-04-26 14:30:09 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.concept.Concept;
@@ -114,6 +116,24 @@
// Public methods
// -------------------------------------------------------------------------
+ public void deleteAttribute( Attribute attribute )
+ {
+ }
+
+ public String allowDeleteAttribute( Attribute attribute )
+ {
+ return null;
+ }
+
+ public void deleteAttributeValue( AttributeValue attributeValue )
+ {
+ }
+
+ public String allowDeleteAttributeValue( AttributeValue attributeValue )
+ {
+ return null;
+ }
+
public void deleteChart( Chart chart )
{
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js 2012-04-22 21:15:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/oust/oust.js 2012-04-26 15:26:28 +0000
@@ -161,6 +161,7 @@
this.buildSelectionTree = function()
{
selectedOrganisationUnit = new Array();
+ selectedOrganisationUnitUid = new Array();
var treeTag = document.getElementById( 'selectionTree' );
@@ -255,6 +256,7 @@
function createTreeElementTag( child )
{
var childId = child.getAttribute( 'id' );
+ var childUid = child.getAttribute( 'uid' );
var hasChildren = child.getAttribute( 'hasChildren' ) != '0';
var toggleTag = document.createElement( 'span' );
@@ -277,7 +279,9 @@
if ( child.getAttribute( 'selected' ) == 'true' )
{
linkTag.className = 'selected';
+
selectedOrganisationUnit.push( childId );
+ selectedOrganisationUnitUid.push( childUid );
if ( typeof ( window.addSelectedOrganisationUnit__ ) == 'function' )
{
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm 2011-07-18 10:46:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm 2012-04-26 15:26:28 +0000
@@ -2,7 +2,7 @@
<units>
<roots>
#foreach( $root in $roots )
- <unit id="$root.id" #if( $selected.contains( $root )) selected="true" #end>$encoder.xmlEncode( $root.name )</unit>
+ <unit id="${root.id}" uid="${root.uid}" #if( $selected.contains( $root )) selected="true" #end>$encoder.xmlEncode( $root.name )</unit>
#end
</roots>
@@ -10,7 +10,7 @@
#foreach( $parent in $parents )
<parent parentId="$parent.id">
#foreach( $child in $childrenMap.get( $parent ) )
- <child id="$child.id" hasChildren="$child.children.size()" #if( $selected.contains( $child )) selected="true" #end>$encoder.xmlEncode( $child.name )</child>
+ <child id="${child.id}" uid="${child.uid}" hasChildren="$child.children.size()" #if( $selected.contains( $child )) selected="true" #end>$encoder.xmlEncode( $child.name )</child>
#end
</parent>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2012-04-05 13:13:13 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateDataSetReportAction.java 2012-04-26 15:26:28 +0000
@@ -44,7 +44,7 @@
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.util.SessionUtils;
@@ -62,13 +62,6 @@
// Dependencies
// -------------------------------------------------------------------------
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
private DataSetReportService dataSetReportService;
public void setDataSetReportService( DataSetReportService dataSetReportService )
@@ -97,6 +90,13 @@
this.periodService = periodService;
}
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
private I18nFormat format;
public void setFormat( I18nFormat format )
@@ -129,6 +129,13 @@
this.periodId = periodId;
}
+ private Integer orgUnitId;
+
+ public void setOrgUnitId( Integer orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
private boolean selectedUnitOnly;
public boolean isSelectedUnitOnly()
@@ -217,14 +224,14 @@
public String execute()
throws Exception
{
- selectedOrgunit = selectionTreeManager.getSelectedOrganisationUnit();
-
selectedDataSet = dataSetService.getDataSet( dataSetId );
if ( periodId != null )
{
selectedPeriod = periodService.getPeriodByExternalId( periodId );
}
+
+ selectedOrgunit = organisationUnitService.getOrganisationUnit( orgUnitId );
String dataSetType = selectedDataSet.getDataSetType();
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-04-23 09:35:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-04-26 15:26:28 +0000
@@ -195,11 +195,11 @@
<bean id="org.hisp.dhis.reporting.dataset.action.GenerateDataSetReportAction" class="org.hisp.dhis.reporting.dataset.action.GenerateDataSetReportAction"
scope="prototype">
- <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
<property name="dataSetReportService" ref="org.hisp.dhis.datasetreport.DataSetReportService" />
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
<property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
<!-- Data completeness -->
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm 2012-04-23 09:35:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm 2012-04-26 15:26:28 +0000
@@ -6,7 +6,6 @@
#end
selectionTreeSelection.setMultipleSelectionAllowed( false );
- selectionTree.clearSelectedOrganisationUnits();
selectionTree.buildSelectionTree();
});
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js 2012-04-05 13:13:13 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js 2012-04-26 15:26:28 +0000
@@ -1,18 +1,4 @@
-// -----------------------------------------------------------------------------
-// Validation
-// ----------------------------------------------------------------------------
-
-function setSelectedOrganisationUnitIds( ids )
-{
- selectedOrganisationUnitIds = ids;
-}
-
-if ( typeof ( selectionTreeSelection ) != "undefined" )
-{
- selectionTreeSelection.setListenerFunction( setSelectedOrganisationUnitIds );
-}
-
function getPeriods( periodTypeList, availableList, selectedList, timespan )
{
$( "#periodId" ).removeAttr( "disabled" );
@@ -45,9 +31,10 @@
var dataSetId = $( "#dataSetId" ).val();
var periodId = $( "#periodId" ).val();
- var selectedUnitOnly = $( "#selectedUnitOnly" ).is( ":checked" );
+ var selectedUnitOnly = $( "#selectedUnitOnly" ).is( ":checked" );
+ var orgUnitId = selectionTreeSelection.getSelected()[0];
- var currentParams = { dataSetId: dataSetId, periodId: periodId, selectedUnitOnly: selectedUnitOnly };
+ var currentParams = { dataSetId: dataSetId, periodId: periodId, selectedUnitOnly: selectedUnitOnly, orgUnitId: orgUnitId };
$( '#content' ).load( 'generateDataSetReport.action', currentParams, function() {
hideLoader();
@@ -62,6 +49,7 @@
"&dataSetId=" + $( "#dataSetId" ).val() +
"&periodId=" + $( "#periodId" ).val() +
"&selectedUnitOnly=" + $( "#selectedUnitOnly" ).val() +
+ "&orgUnitId=" + selectionTreeSelection.getSelected() +
"&type=" + type;
window.location.href = url;