dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00834
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 250: - Minor improvement in datamart memory usage. - Added delete map orgunit relation actions in mapp...
------------------------------------------------------------
revno: 250
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-04-24 12:20:52 +0200
message:
- Minor improvement in datamart memory usage. - Added delete map orgunit relation actions in mapping module.
added:
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapOrganisationUnitRelationAction.java
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapOrganisationUnitRelationsByMapAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/DataElementAggregator.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java
docs/Technical Architecture DHIS 2.doc
gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
gis/dhis-web-mapping/src/main/resources/xwork.xml
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-04-23 17:07:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-04-24 10:20:52 +0000
@@ -246,6 +246,24 @@
* @return a Collection of MapOrganisationUnitRelations.
*/
Collection<MapOrganisationUnitRelation> getAvailableMapOrganisationUnitRelations( String mapLayerPath );
+
+ /**
+ * Deletes all MapOrganisationUnitRelations associated with the given
+ * OrganisationUnit.
+ *
+ * @param organisationUnit the OrganisationUnit.
+ * @return the number of deleted objects.
+ */
+ int deleteMapOrganisationUnitRelations( OrganisationUnit organisationUnit );
+
+ /**
+ * Deletes all MapOrganisationUnitRelations associated with the given
+ * Map.
+ *
+ * @param map the Map.
+ * @return the number of deleted objects.
+ */
+ int deleteMapOrganisationUnitRelations( Map map );
// -------------------------------------------------------------------------
// LegendSet
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2009-04-23 17:07:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2009-04-24 10:20:52 +0000
@@ -164,6 +164,24 @@
*/
Collection<MapOrganisationUnitRelation> getMapOrganisationUnitRelationByMap( Map map );
+ /**
+ * Deletes all MapOrganisationUnitRelations associated with the given
+ * OrganisationUnit.
+ *
+ * @param organisationUnit the OrganisationUnit.
+ * @return the number of deleted objects.
+ */
+ int deleteMapOrganisationUnitRelations( OrganisationUnit organisationUnit );
+
+ /**
+ * Deletes all MapOrganisationUnitRelations associated with the given
+ * Map.
+ *
+ * @param map the Map.
+ * @return the number of deleted objects.
+ */
+ int deleteMapOrganisationUnitRelations( Map map );
+
// -------------------------------------------------------------------------
// LegendSet
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java 2009-04-23 20:16:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java 2009-04-24 10:20:52 +0000
@@ -80,14 +80,14 @@
final Collection<CrossTabDataValue> crossTabValues =
getCrossTabDataValues( operandIndexMap, period.getStartDate(), period.getEndDate(), unit.getId(), hierarchy );
- final Map<Operand, Double[]> entries = getAggregate( crossTabValues, period.getStartDate(),
+ final Map<Operand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(),
period.getEndDate(), period.getStartDate(), period.getEndDate() ); // <data element id, [total value, total relevant days]>
final Map<Operand, Double> values = new HashMap<Operand, Double>( entries.size() ); // <Operand, total value>
double average = 0.0;
- for ( final Entry<Operand, Double[]> entry : entries.entrySet() )
+ for ( final Entry<Operand, double[]> entry : entries.entrySet() )
{
if ( entry.getValue() != null && entry.getValue()[ 1 ] > 0 )
{
@@ -118,10 +118,10 @@
return dataMartStore.getCrossTabDataValues( operandIndexMap, periodIds, sourceIds );
}
- public Map<Operand, Double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
+ public Map<Operand, double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
final Date startDate, final Date endDate, final Date aggregationStartDate, final Date aggregationEndDate )
{
- final Map<Operand, Double[]> totalSums = new HashMap<Operand, Double[]>(); // <Operand, [total value, total relevant days]>
+ final Map<Operand, double[]> totalSums = new HashMap<Operand, double[]>(); // <Operand, [total value, total relevant days]>
Period period = null;
Date currentStartDate = null;
@@ -178,7 +178,7 @@
existingValue = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 0 ] : 0;
existingRelevantDays = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 1 ] : 0;
- final Double[] values = { ( value + existingValue ), ( relevantDays + existingRelevantDays ) };
+ final double[] values = { ( value + existingValue ), ( relevantDays + existingRelevantDays ) };
totalSums.put( entry.getKey(), values );
}
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java 2009-04-23 20:16:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java 2009-04-24 10:20:52 +0000
@@ -93,10 +93,10 @@
final Collection<CrossTabDataValue> crossTabValues =
getCrossTabDataValues( operandIndexMap, period.getStartDate(), period.getEndDate(), unitId, hierarchy );
- final Map<Operand, Double[]> entries = getAggregate( crossTabValues, period.getStartDate(),
+ final Map<Operand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(),
period.getEndDate(), period.getStartDate(), period.getEndDate() ); // <Operand, [total value, total relevant days]>
- for ( final Entry<Operand, Double[]> entry : entries.entrySet() )
+ for ( final Entry<Operand, double[]> entry : entries.entrySet() )
{
if ( entry.getValue() != null && entry.getValue()[ 1 ] > 0 )
{
@@ -127,10 +127,10 @@
return dataMartStore.getCrossTabDataValues( operandIndexMap, periodIds, parentId );
}
- public Map<Operand, Double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
+ public Map<Operand, double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
final Date startDate, final Date endDate, final Date aggregationStartDate, final Date aggregationEndDate )
{
- final Map<Operand, Double[]> totalSums = new HashMap<Operand, Double[]>(); // <Operand, [total value, total relevant days]>
+ final Map<Operand, double[]> totalSums = new HashMap<Operand, double[]>(); // <Operand, [total value, total relevant days]>
Period period = null;
Date currentStartDate = null;
@@ -192,7 +192,7 @@
existingValue = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 0 ] : 0;
existingRelevantDays = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 1 ] : 0;
- final Double[] values = { ( value + existingValue ), ( relevantDays + existingRelevantDays ) };
+ final double[] values = { ( value + existingValue ), ( relevantDays + existingRelevantDays ) };
totalSums.put( entry.getKey(), values );
}
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/DataElementAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/DataElementAggregator.java 2009-04-23 20:16:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/DataElementAggregator.java 2009-04-24 10:20:52 +0000
@@ -55,6 +55,6 @@
Collection<CrossTabDataValue> getCrossTabDataValues( final Map<Operand, Integer> operandIndexMap,
final Date startDate, final Date endDate, final int parentId, final OrganisationUnitHierarchy hierarchy );
- Map<Operand, Double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
+ Map<Operand, double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
final Date startDate, final Date endDate, final Date aggregationStartDate, final Date aggregationEndDate );
}
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java 2009-04-23 20:16:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java 2009-04-24 10:20:52 +0000
@@ -81,12 +81,12 @@
final Collection<CrossTabDataValue> crossTabValues =
getCrossTabDataValues( operandIndexMap, period.getStartDate(), period.getEndDate(), unit.getId(), hierarchy );
- final Map<Operand, Double[]> entries = getAggregate( crossTabValues, period.getStartDate(),
+ final Map<Operand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(),
period.getEndDate(), period.getStartDate(), period.getEndDate() ); // <data element id, [total value, total relevant days]>
final Map<Operand, Double> values = new HashMap<Operand, Double>( entries.size() ); // <Operand, total value>
- for ( final Entry<Operand, Double[]> entry : entries.entrySet() )
+ for ( final Entry<Operand, double[]> entry : entries.entrySet() )
{
if ( entry.getValue() != null && entry.getValue()[ 1 ] > 0 )
{
@@ -114,10 +114,10 @@
return dataMartStore.getCrossTabDataValues( operandIndexMap, periodIds, sourceIds );
}
- public Map<Operand, Double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
+ public Map<Operand, double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
final Date startDate, final Date endDate, final Date aggregationStartDate, final Date aggregationEndDate )
{
- final Map<Operand, Double[]> totalSums = new HashMap<Operand, Double[]>(); // <Operand, [total value, total relevant days]>
+ final Map<Operand, double[]> totalSums = new HashMap<Operand, double[]>(); // <Operand, [total value, total relevant days]>
Period period = null;
Date currentStartDate = null;
@@ -183,7 +183,7 @@
existingValue = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 0 ] : 0;
existingRelevantDays = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 1 ] : 0;
- final Double[] values = { ( value + existingValue ), ( relevantDays + existingRelevantDays ) };
+ final double[] values = { ( value + existingValue ), ( relevantDays + existingRelevantDays ) };
totalSums.put( entry.getKey(), values );
}
@@ -194,7 +194,3 @@
return totalSums;
}
}
-
-
-
-
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java 2009-04-23 20:16:18 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java 2009-04-24 10:20:52 +0000
@@ -84,12 +84,12 @@
final Collection<CrossTabDataValue> crossTabValues =
getCrossTabDataValues( operandIndexMap, period.getStartDate(), period.getEndDate(), unit.getId(), hierarchy );
- final Map<Operand, Double[]> entries = getAggregate( crossTabValues, period.getStartDate(),
+ final Map<Operand, double[]> entries = getAggregate( crossTabValues, period.getStartDate(),
period.getEndDate(), period.getStartDate(), period.getEndDate() ); // <Operand, [total value, total relevant days]>
final Map<Operand, Double> values = new HashMap<Operand, Double>( entries.size() ); // <Operand, total value>
- for ( final Entry<Operand, Double[]> entry : entries.entrySet() )
+ for ( final Entry<Operand, double[]> entry : entries.entrySet() )
{
if ( entry.getValue() != null && entry.getValue()[ 1 ] > 0 )
{
@@ -117,10 +117,10 @@
return dataMartStore.getCrossTabDataValues( operandIndexMap, periodIds, sourceIds );
}
- public Map<Operand, Double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
+ public Map<Operand, double[]> getAggregate( final Collection<CrossTabDataValue> crossTabValues,
final Date startDate, final Date endDate, final Date aggregationStartDate, final Date aggregationEndDate )
{
- final Map<Operand, Double[]> totalSums = new HashMap<Operand, Double[]>(); // <Operand, [total value, total relevant days]>
+ final Map<Operand, double[]> totalSums = new HashMap<Operand, double[]>(); // <Operand, [total value, total relevant days]>
Period period = null;
Date currentStartDate = null;
@@ -131,6 +131,7 @@
double factor = 0.0;
double existingValue = 0.0;
double existingRelevantDays = 0.0;
+ double duration = 0.0;
for ( final CrossTabDataValue crossTabValue : crossTabValues )
{
@@ -139,7 +140,7 @@
currentStartDate = period.getStartDate();
currentEndDate = period.getEndDate();
- double duration = getDaysInclusive( currentStartDate, currentEndDate );
+ duration = getDaysInclusive( currentStartDate, currentEndDate );
if ( duration > 0 )
{
@@ -192,7 +193,7 @@
existingValue = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 0 ] : 0;
existingRelevantDays = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 1 ] : 0;
- final Double[] values = { ( value + existingValue ), ( relevantDays + existingRelevantDays ) };
+ final double[] values = { ( value + existingValue ), ( relevantDays + existingRelevantDays ) };
totalSums.put( entry.getKey(), values );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-04-23 17:07:39 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-04-24 10:20:52 +0000
@@ -262,6 +262,16 @@
return getAvailableMapOrganisationUnitRelations( map );
}
+
+ public int deleteMapOrganisationUnitRelations( OrganisationUnit organisationUnit )
+ {
+ return mappingStore.deleteMapOrganisationUnitRelations( organisationUnit );
+ }
+
+ public int deleteMapOrganisationUnitRelations( Map map )
+ {
+ return mappingStore.deleteMapOrganisationUnitRelations( map );
+ }
// -------------------------------------------------------------------------
// LegendSet
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2009-04-23 19:52:50 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2009-04-24 10:20:52 +0000
@@ -30,6 +30,7 @@
import java.util.Collection;
import org.hibernate.Criteria;
+import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.hibernate.HibernateSessionManager;
@@ -188,6 +189,24 @@
return criteria.list();
}
+
+ public int deleteMapOrganisationUnitRelations( OrganisationUnit organisationUnit )
+ {
+ Session session = sessionManager.getCurrentSession();
+
+ Query query = session.createQuery( "delete from OrganisationUnitRelation where organisationUnit = :organisationUnit" );
+
+ return query.setParameter( "organisationUnit", organisationUnit ).executeUpdate();
+ }
+
+ public int deleteMapOrganisationUnitRelations( Map map )
+ {
+ Session session = sessionManager.getCurrentSession();
+
+ Query query = session.createQuery( "delete from OrganisationUnitRelation where map = :map" );
+
+ return query.setParameter( "map", map ).executeUpdate();
+ }
// -------------------------------------------------------------------------
// LegendSet
=== modified file 'docs/Technical Architecture DHIS 2.doc'
Binary files docs/Technical Architecture DHIS 2.doc 2009-04-23 21:12:33 +0000 and docs/Technical Architecture DHIS 2.doc 2009-04-24 10:20:52 +0000 differ
=== added file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapOrganisationUnitRelationAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapOrganisationUnitRelationAction.java 1970-01-01 00:00:00 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapOrganisationUnitRelationAction.java 2009-04-24 10:20:52 +0000
@@ -0,0 +1,100 @@
+package org.hisp.dhis.mapping.action;
+
+/*
+ * Copyright (c) 2004-2007, 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 org.hisp.dhis.mapping.Map;
+import org.hisp.dhis.mapping.MapOrganisationUnitRelation;
+import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork.Action;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class DeleteMapOrganisationUnitRelationAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private MappingService mappingService;
+
+ public void setMappingService( MappingService mappingService )
+ {
+ this.mappingService = mappingService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer organisationUnitId;
+
+ public void setOrganisationUnitId( Integer organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ private String mapLayerPath;
+
+ public void setMapLayerPath( String mapLayerPath )
+ {
+ this.mapLayerPath = mapLayerPath;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implemention
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ OrganisationUnit unit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+ Map map = mappingService.getMapByMapLayerPath( mapLayerPath );
+
+ MapOrganisationUnitRelation relation = mappingService.getMapOrganisationUnitRelation( map, unit );
+
+ if ( relation != null )
+ {
+ mappingService.deleteMapOrganisationUnitRelation( relation );
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapOrganisationUnitRelationsByMapAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapOrganisationUnitRelationsByMapAction.java 1970-01-01 00:00:00 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapOrganisationUnitRelationsByMapAction.java 2009-04-24 10:20:52 +0000
@@ -0,0 +1,79 @@
+package org.hisp.dhis.mapping.action;
+
+/*
+ * Copyright (c) 2004-2007, 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 org.hisp.dhis.mapping.Map;
+import org.hisp.dhis.mapping.MappingService;
+
+import com.opensymphony.xwork.Action;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class DeleteMapOrganisationUnitRelationsByMapAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private MappingService mappingService;
+
+ public void setMappingService( MappingService mappingService )
+ {
+ this.mappingService = mappingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ Map map = mappingService.getMap( id );
+
+ if ( map != null )
+ {
+ mappingService.deleteMapOrganisationUnitRelations( map );
+ }
+
+ return SUCCESS;
+ }
+}
=== modified file 'gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2009-04-22 20:23:59 +0000
+++ gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2009-04-24 10:20:52 +0000
@@ -63,6 +63,8 @@
ref="org.hisp.dhis.datamart.DataMartStore"/>
</bean>
+ <!-- MapOrganisationUnitRelation -->
+
<bean id="org.hisp.dhis.mapping.action.AddOrUpdateMapOrganisationUnitRelationAction"
class="org.hisp.dhis.mapping.action.AddOrUpdateMapOrganisationUnitRelationAction"
scope="prototype">
@@ -77,6 +79,22 @@
ref="org.hisp.dhis.mapping.MappingService"/>
</bean>
+ <bean id="org.hisp.dhis.mapping.action.DeleteMapOrganisationUnitRelationsByMapAction"
+ class="org.hisp.dhis.mapping.action.DeleteMapOrganisationUnitRelationsByMapAction"
+ scope="prototype">
+ <property name="mappingService"
+ ref="org.hisp.dhis.mapping.MappingService"/>
+ </bean>
+
+ <bean id="org.hisp.dhis.mapping.action.DeleteMapOrganisationUnitRelationAction"
+ class="org.hisp.dhis.mapping.action.DeleteMapOrganisationUnitRelationAction"
+ scope="prototype">
+ <property name="mappingService"
+ ref="org.hisp.dhis.mapping.MappingService"/>
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+ </bean>
+
<!-- MapLegendSet -->
<bean id="org.hisp.dhis.mapping.action.AddMapLegendSetAction"
=== modified file 'gis/dhis-web-mapping/src/main/resources/xwork.xml'
--- gis/dhis-web-mapping/src/main/resources/xwork.xml 2009-04-22 20:23:59 +0000
+++ gis/dhis-web-mapping/src/main/resources/xwork.xml 2009-04-24 10:20:52 +0000
@@ -45,6 +45,8 @@
<result name="success" type="velocity-json">/dhis-web-mapping/jsonAggregatedMapValues.vm</result>
</action>
+ <!-- MapOrganisationUnitRelations -->
+
<action name="addOrUpdateMapOrganisationUnitRelation" class="org.hisp.dhis.mapping.action.AddOrUpdateMapOrganisationUnitRelationAction">
<result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
</action>
@@ -53,6 +55,14 @@
<result name="success" type="velocity-json">/dhis-web-mapping/jsonMapOrganisationUnitRelations.vm</result>
</action>
+ <action name="deleteMapOrganisationUnitRelationsByMap" class="org.hisp.dhis.mapping.action.DeleteMapOrganisationUnitRelationsByMapAction">
+ <result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
+ </action>
+
+ <action name="deleteMapOrganisationUnitRelation" class="org.hisp.dhis.mapping.action.DeleteMapOrganisationUnitRelationAction">
+ <result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
+ </action>
+
<!-- MapLegendSet -->
<action name="addMapLegendSet" class="org.hisp.dhis.mapping.action.AddMapLegendSetAction">
--
Trunk
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.