dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06288
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1979: Applied patch from Viet. Merging of various Indian bugfixes intro trunk.
------------------------------------------------------------
revno: 1979
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Wed 2010-06-09 12:37:45 +0200
message:
Applied patch from Viet. Merging of various Indian bugfixes intro trunk.
removed:
local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/Legend.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueAuditDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveRoleAction.java
local/vn/dhis-service-gis/pom.xml
local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/DefaultFeatureService.java
local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/FeatureService.java
local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/FeatureStore.java
local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/hibernate/HibernateFeatureStore.java
local/vn/dhis-service-gis/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-gis/src/main/java/org/hisp/dhis/gis/action/legend/DeleteLegendAction.java
local/vn/dhis-web-gis/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-gis/src/main/resources/org/hisp/dhis/gis/i18n_module.properties
local/vn/dhis-web-gis/src/main/resources/struts.xml
local/vn/dhis-web-gis/src/main/webapp/WEB-INF/web.xml
local/vn/dhis-web-gis/src/main/webapp/dhis-web-gis/listLegend.vm
--
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/datavalue/DataValueAuditService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java 2010-04-21 14:32:54 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java 2010-06-09 10:37:45 +0000
@@ -30,6 +30,8 @@
import java.util.Collection;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.period.Period;
import org.hisp.dhis.source.Source;
/**
@@ -54,4 +56,8 @@
Collection<DataValueAudit> getDataValueAuditByDataValue( DataValue dataValue );
Collection<DataValueAudit> getAll();
+
+ public void deleteByPeriod( Period period );
+
+ public void deleteByDataElementCategoryOptionCombo( DataElementCategoryOptionCombo optionCombo );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java 2010-06-09 10:37:45 +0000
@@ -30,6 +30,8 @@
import java.util.Collection;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.period.Period;
import org.hisp.dhis.source.Source;
/**
@@ -53,4 +55,8 @@
Collection<DataValueAudit> getDataValueAuditByDataValue( DataValue dataValue );
Collection<DataValueAudit> getAll();
+
+ int deleteByPeriod( Period period );
+
+ int deleteByDataElementCategoryOptionCombo( DataElementCategoryOptionCombo optionCombo );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueAuditDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueAuditDeletionHandler.java 2010-06-01 13:36:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueAuditDeletionHandler.java 2010-06-09 10:37:45 +0000
@@ -27,6 +27,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.source.Source;
import org.hisp.dhis.system.deletion.DeletionHandler;
/**
@@ -59,6 +63,28 @@
}
@Override
+ public void deleteSource( Source source )
+ {
+ dataValueAuditService.deleteDataValueAuditBySource( source );
+ }
+
+ @Override
+ public void deleteDataElement( DataElement dataElement )
+ {
+ dataValueAuditService.deleteDataValueAuditByDataElement( dataElement );
+ }
+
+ @Override
+ public void deletePeriod( Period period )
+ {
+ dataValueAuditService.deleteByPeriod( period );
+ }
+
+ @Override
+ public void deleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo)
+ {
+ dataValueAuditService.deleteByDataElementCategoryOptionCombo( categoryOptionCombo );
+ }
public void deleteDataValue( DataValue dataValue )
{
dataValueAuditService.deleteDataValueAuditByDataValue( dataValue );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java 2010-04-21 12:14:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java 2010-06-09 10:37:45 +0000
@@ -30,6 +30,8 @@
import java.util.Collection;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.period.Period;
import org.hisp.dhis.source.Source;
/**
@@ -89,4 +91,13 @@
dataValueAuditStore.deleteDataValueAuditByDataElement( dataElement );
}
+ public void deleteByDataElementCategoryOptionCombo( DataElementCategoryOptionCombo optionCombo )
+ {
+ dataValueAuditStore.deleteByDataElementCategoryOptionCombo( optionCombo );
+ }
+
+ public void deleteByPeriod( Period period )
+ {
+ dataValueAuditStore.deleteByPeriod( period );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java 2010-05-18 15:42:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java 2010-06-09 10:37:45 +0000
@@ -35,9 +35,11 @@
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DataValueAudit;
import org.hisp.dhis.datavalue.DataValueAuditStore;
+import org.hisp.dhis.period.Period;
import org.hisp.dhis.source.Source;
import org.springframework.beans.factory.annotation.Autowired;
@@ -126,5 +128,27 @@
}
}
}
+
+ public int deleteByPeriod( Period period )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Query query = session.createQuery( "delete DataValueAudit where period = :period" );
+ query.setEntity( "period", period );
+
+ return query.executeUpdate();
+
+
+ }
+
+ public int deleteByDataElementCategoryOptionCombo( DataElementCategoryOptionCombo optionCombo )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Query query = session.createQuery( "delete DataValueAudit where optionCombo = :optionCombo" );
+ query.setEntity( "optionCombo", optionCombo );
+
+ return query.executeUpdate();
+ }
}
=== 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 2010-04-21 19:45:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java 2010-06-09 10:37:45 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.Collection;
+
import org.hisp.dhis.source.Source;
import org.hisp.dhis.system.deletion.DeletionHandler;
@@ -69,4 +71,24 @@
}
}
}
+
+ @Override
+ public boolean allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
+ {
+ Collection<UserCredentials> userCredentials = userStore.getAllUserCredentials();
+ for( UserCredentials uc : userCredentials )
+ {
+ if( uc != null && uc.getUserAuthorityGroups() != null )
+ {
+ for( UserAuthorityGroup role : uc.getUserAuthorityGroups())
+ {
+ if( role.getId() == authorityGroup.getId())
+ {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
}
=== 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 2010-04-23 13:37:06 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2010-06-09 10:37:45 +0000
@@ -46,6 +46,7 @@
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.document.Document;
import org.hisp.dhis.expression.Expression;
+import org.hisp.dhis.gis.Legend;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorGroupSet;
@@ -491,4 +492,9 @@
{
return true;
}
+
+ public boolean allowDeleteLegend( Legend legend )
+ {
+ return true;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveRoleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveRoleAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveRoleAction.java 2010-06-09 10:37:45 +0000
@@ -27,11 +27,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.common.DeleteNotAllowedException;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.user.UserAuthorityGroup;
+import org.hisp.dhis.user.UserService;
import org.hisp.dhis.user.UserStore;
-import org.hisp.dhis.user.UserService;
-import org.springframework.dao.DataIntegrityViolationException;
import com.opensymphony.xwork2.Action;
@@ -110,7 +110,7 @@
userStore.deleteUserAuthorityGroup( authorityGroup );
}
}
- catch ( DataIntegrityViolationException e )
+ catch ( DeleteNotAllowedException e )
{
message = i18n.getString( "user_use_group" );
=== modified file 'local/vn/dhis-service-gis/pom.xml'
--- local/vn/dhis-service-gis/pom.xml 2010-04-12 10:13:41 +0000
+++ local/vn/dhis-service-gis/pom.xml 2010-06-09 10:37:45 +0000
@@ -23,7 +23,7 @@
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-service-jdbc</artifactId>
+ <artifactId>dhis-support-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.hisp.dhis</groupId>
=== modified file 'local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/DefaultFeatureService.java'
--- local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/DefaultFeatureService.java 2010-04-12 21:23:33 +0000
+++ local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/DefaultFeatureService.java 2010-06-09 10:37:45 +0000
@@ -123,4 +123,14 @@
this.featureStore.updateMapFile( arg0 );
}
+
+ public void deleteFeatureByOrganisationUnit( int arg0 )
+ {
+ featureStore.deleteFeatureByOrganisationUnit( arg0 );
+ }
+
+ public void deleteMapFileByOrganisationUnit( int arg0 )
+ {
+ featureStore.deleteMapFileByOrganisationUnit( arg0 );
+ }
}
=== modified file 'local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/FeatureService.java'
--- local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/FeatureService.java 2010-04-12 21:23:33 +0000
+++ local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/FeatureService.java 2010-06-09 10:37:45 +0000
@@ -60,4 +60,8 @@
public Collection<MapFile> getAllMapFile();
public MapFile getMapFile( OrganisationUnit organisationUnit );
+
+ public void deleteFeatureByOrganisationUnit( int arg0 );
+
+ public void deleteMapFileByOrganisationUnit( int arg0 );
}
=== modified file 'local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/FeatureStore.java'
--- local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/FeatureStore.java 2010-04-12 21:23:33 +0000
+++ local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/FeatureStore.java 2010-06-09 10:37:45 +0000
@@ -63,4 +63,8 @@
public Collection<MapFile> getAllMapFile();
public MapFile getMapFile( OrganisationUnit organisationUnit );
+
+ public void deleteFeatureByOrganisationUnit( int arg0 );
+
+ public void deleteMapFileByOrganisationUnit( int arg0 );
}
=== removed file 'local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/Legend.java'
--- local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/Legend.java 2010-04-12 21:23:33 +0000
+++ local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/Legend.java 1970-01-01 00:00:00 +0000
@@ -1,196 +0,0 @@
-package org.hisp.dhis.gis;
-
-
-/*
- * Copyright (c) 2004-2010, 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.
- */
-
-/**
- * @author Tran Thanh Tri
- * @version $Id: Feature.java 28-01-2008 16:06:00 $
- */
-public class Legend implements Comparable<Legend>
-{
- public static final int AUTO_CREATE_MAX = 1;
-
- public static final int NO_AUTO_CREATE_MAX = 0;
-
- private int id;
-
- private String name;
-
- private String color;
-
- private double min;
-
- private double max;
-
- private int autoCreateMax;
-
- public Legend( String color, double min, double max )
- {
- this.color = color;
- this.min = min;
- this.max = max;
- }
-
- public Legend( String name, String color, double min, double max )
- {
- this.name = name;
- this.color = color;
- this.min = min;
- this.max = max;
- }
-
- public Legend( int id, String name, String color, double min, double max )
- {
- this.id = id;
- this.name = name;
- this.color = color;
- this.min = min;
- this.max = max;
- }
-
-
-
-
- public int getAutoCreateMax() {
- return autoCreateMax;
- }
-
- public void setAutoCreateMax(int autoCreateMax) {
- this.autoCreateMax = autoCreateMax;
- }
-
- public boolean in( double value )
- {
- if ( value >= min && value <= max )
- {
- return true;
- }
- return false;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- public int getId()
- {
- return id;
- }
-
- public double getAverage()
- {
- return (max - min) / 2 ;
- }
-
- public void setId( int id )
- {
- this.id = id;
- }
-
- public Legend()
- {
- super();
- }
-
- public String getColor()
- {
- return color;
- }
-
- public void setColor( String color )
- {
- this.color = color;
- }
-
- public double getMin()
- {
- return min;
- }
-
- public void setMin( double min )
- {
- this.min = min;
- }
-
- public double getMax()
- {
- return max;
- }
-
- public void setMax( double max )
- {
- this.max = max;
- }
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- return true;
- if ( obj == null )
- return false;
- if ( getClass() != obj.getClass() )
- return false;
-
- final Legend other = (Legend) obj;
-
- if ( name == null )
- {
- if ( other.name != null )
- return false;
- }
- else if ( !name.equals( other.name ) )
- return false;
-
- return true;
- }
-
-
- public int compareTo ( Legend legend ) {
- if(this.getMin() > legend.getMin()){
- return 1;
- }else if(this.getMin() < legend.getMin()){
- return -1;
- }else{
- return 0;
- }
-
- }
-}
=== modified file 'local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/hibernate/HibernateFeatureStore.java'
--- local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/hibernate/HibernateFeatureStore.java 2010-04-12 21:23:33 +0000
+++ local/vn/dhis-service-gis/src/main/java/org/hisp/dhis/gis/hibernate/HibernateFeatureStore.java 2010-06-09 10:37:45 +0000
@@ -175,4 +175,17 @@
session.update( arg0 );
}
+
+ public void deleteFeatureByOrganisationUnit( int arg0 )
+ {
+ Session session = sessionFactory.getCurrentSession();
+ session.createQuery( "delete Feature as f where f.organisationUnit.id = ?" ).setInteger( 0, arg0 ).executeUpdate();
+
+ }
+
+ public void deleteMapFileByOrganisationUnit( int arg0 )
+ {
+ Session session = sessionFactory.getCurrentSession();
+ session.createQuery( "delete MapFile as m where m.organisationUnit.id = ?" ).setInteger( 0, arg0 ).executeUpdate();
+ }
}
=== modified file 'local/vn/dhis-service-gis/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-service-gis/src/main/resources/META-INF/dhis/beans.xml 2009-06-10 22:25:07 +0000
+++ local/vn/dhis-service-gis/src/main/resources/META-INF/dhis/beans.xml 2010-06-09 10:37:45 +0000
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<bean id="org.hisp.dhis.gis.FeatureStore"
class="org.hisp.dhis.gis.hibernate.HibernateFeatureStore">
@@ -44,4 +46,32 @@
<property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
+ <bean id="org.hisp.dhis.gis.FeatureDeleteHandler"
+ class="org.hisp.dhis.gis.FeatureDeleteHandler">
+ <property name="featureService" ref="org.hisp.dhis.gis.FeatureService"/>
+ </bean>
+
+ <bean id="org.hisp.dhis.gis.LegendDeleteHandler"
+ class="org.hisp.dhis.gis.LegendDeleteHandler">
+ <property name="legendService" ref="org.hisp.dhis.gis.LegendService"/>
+ </bean>
+
+ <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="targetObject" ref="deletionManager"/>
+ <property name="targetMethod" value="addDeletionHandlers"/>
+ <property name="arguments">
+ <list>
+ <list>
+ <ref local="org.hisp.dhis.gis.FeatureDeleteHandler"/>
+ <ref local="org.hisp.dhis.gis.LegendDeleteHandler"/>
+ </list>
+ </list>
+ </property>
+ </bean>
+
+ <aop:config>
+ <aop:aspect ref="deletionInterceptor">
+ <aop:before pointcut="execution( * org.hisp.dhis.gis.LegendService.delete*(..) )" method="intercept"/>
+ </aop:aspect>
+ </aop:config>
</beans>
=== modified file 'local/vn/dhis-web-gis/src/main/java/org/hisp/dhis/gis/action/legend/DeleteLegendAction.java'
--- local/vn/dhis-web-gis/src/main/java/org/hisp/dhis/gis/action/legend/DeleteLegendAction.java 2010-04-12 21:23:33 +0000
+++ local/vn/dhis-web-gis/src/main/java/org/hisp/dhis/gis/action/legend/DeleteLegendAction.java 2010-06-09 10:37:45 +0000
@@ -27,8 +27,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.common.DeleteNotAllowedException;
import org.hisp.dhis.gis.Legend;
import org.hisp.dhis.gis.LegendService;
+import org.hisp.dhis.i18n.I18n;
import com.opensymphony.xwork2.Action;
@@ -54,13 +56,39 @@
{
this.legendId = legendId;
}
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
public String execute()
throws Exception
{
Legend legend = legendService.getLegend( legendId.intValue() );
- legendService.deleteLegend( legend );
+ try {
+
+ legendService.deleteLegend( legend );
+
+ }catch ( DeleteNotAllowedException ex )
+ {
+ if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+ {
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+
+ return ERROR;
+ }
+ }
return SUCCESS;
}
=== modified file 'local/vn/dhis-web-gis/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-gis/src/main/resources/META-INF/dhis/beans.xml 2009-06-14 19:43:19 +0000
+++ local/vn/dhis-web-gis/src/main/resources/META-INF/dhis/beans.xml 2010-06-09 10:37:45 +0000
@@ -46,7 +46,7 @@
<property name="selectionManager" ref="org.hisp.dhis.gis.state.SelectionManager" />
</bean>
- <bean
+<!--<bean
id="org.hisp.dhis.gis.action.management.SelectOrganisationUnitAction"
class="org.hisp.dhis.gis.action.management.SelectOrganisationUnitAction"
scope="prototype">
@@ -55,7 +55,7 @@
<property name="featureService" ref="org.hisp.dhis.gis.FeatureService" />
<property name="selectionManager" ref="org.hisp.dhis.gis.state.SelectionManager" />
</bean>
-
+-->
<bean id="org.hisp.dhis.gis.action.management.SelectMapAndUnitAction"
class="org.hisp.dhis.gis.action.management.SelectMapAndUnitAction"
scope="prototype">
=== modified file 'local/vn/dhis-web-gis/src/main/resources/org/hisp/dhis/gis/i18n_module.properties'
--- local/vn/dhis-web-gis/src/main/resources/org/hisp/dhis/gis/i18n_module.properties 2009-03-13 11:44:39 +0000
+++ local/vn/dhis-web-gis/src/main/resources/org/hisp/dhis/gis/i18n_module.properties 2010-06-09 10:37:45 +0000
@@ -97,6 +97,6 @@
file_null = Please select svg file !
confirm_delete = Do you want delete ?
assign_success = Assign Success
-
+object_not_deleted_associated_by_objects = Object not deleted becuause it is associated by objects of type
=== modified file 'local/vn/dhis-web-gis/src/main/resources/struts.xml'
--- local/vn/dhis-web-gis/src/main/resources/struts.xml 2009-08-21 10:34:49 +0000
+++ local/vn/dhis-web-gis/src/main/resources/struts.xml 2010-06-09 10:37:45 +0000
@@ -195,8 +195,9 @@
</action>
<action name="deleteLegend" class="org.hisp.dhis.gis.action.legend.DeleteLegendAction">
- <result name="success" type="redirect"> listLegends.action </result>
- <param name="requiredAuthorities">F_GIS_CONFIGURATION_UPDATE</param>
+ <result name="success" type="velocity-xml">/dhis-web-gis/responseSuccess.vm</result>
+ <result name="error" type="velocity-xml">/dhis-web-gis/responseError.vm</result>
+ <param name="requiredAuthorities">F_GIS_CONFIGURATION_UPDATE</param>
</action>
<action name="updateLegend"
=== modified file 'local/vn/dhis-web-gis/src/main/webapp/WEB-INF/web.xml'
--- local/vn/dhis-web-gis/src/main/webapp/WEB-INF/web.xml 2009-08-21 10:34:49 +0000
+++ local/vn/dhis-web-gis/src/main/webapp/WEB-INF/web.xml 2010-06-09 10:37:45 +0000
@@ -25,13 +25,9 @@
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
- <filter>
- <filter-name>SecurityFilterChain</filter-name>
- <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
- <init-param>
- <param-name>targetBean</param-name>
- <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
- </init-param>
+ <filter>
+ <filter-name>filterChainProxy</filter-name>
+ <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter>
<filter-name>Struts</filter-name>
@@ -47,7 +43,7 @@
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
- <filter-name>SecurityFilterChain</filter-name>
+ <filter-name>filterChainProxy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
=== modified file 'local/vn/dhis-web-gis/src/main/webapp/dhis-web-gis/listLegend.vm'
--- local/vn/dhis-web-gis/src/main/webapp/dhis-web-gis/listLegend.vm 2009-03-13 11:44:39 +0000
+++ local/vn/dhis-web-gis/src/main/webapp/dhis-web-gis/listLegend.vm 2010-06-09 10:37:45 +0000
@@ -42,7 +42,27 @@
#end
</tbody>
</table>
- </td>
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( "hide_details" )"></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "color" ):</label><br><span id="colorField"></span></p>
+ <p><label>$i18n.getString( "min" ):</label><br><span id="minField"></span></p>
+ <p><label>$i18n.getString( "max" ):</label><br><span id="maxField"></span></p>
+
+ </div>
+
+ <div id="warningArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideWarning()" title="$i18n.getString( "hide_warning" )"><img src="../images/close.png" alt="$i18n.getString( "hide_warning" )"></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+ </td>
</tr>
</table>
@@ -50,10 +70,36 @@
<script type="text/javascript">
var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete" ) , "'" )';
-function removeLegend(id){
- if(confirm(i18n_confirm_delete)){
- window.location = "deleteLegend.action?legendId=" + id;
- }
+function removeLegend(id)
+{
+ if ( confirm( i18n_confirm_delete ) )
+ {
+
+ var request = new Request();
+ request.setResponseTypeXML( 'message' );
+ request.setCallbackSuccess( removeLegendCompleted );
+ //request.send( "deleteLegend.action?legendId=" + id );
+ var requestString = "deleteLegend.action";
+ var params = "legendId=" + id ;
+ request.sendAsPost( params );
+ request.send( requestString );
+ }
+}
+
+function removeLegendCompleted( messageElement )
+{
+ var type = messageElement.getAttribute( 'type' );
+
+ if ( type == 'success' )
+ {
+ window.location.href = 'listLegends.action';
+ }
+ else if ( type = 'error' )
+ {
+ var message = messageElement.firstChild.nodeValue;
+ setFieldValue( 'warningField', message );
+ showWarning();
+ }
}
function editLegend(id){
window.location = "updateLegend.action?legendId=" + id;