dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00939
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 283: Added GetMapsByTypeAction class.
------------------------------------------------------------
revno: 283
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-05-11 14:56:56 +0200
message:
Added GetMapsByTypeAction class.
added:
dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.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-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
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-28 14:23:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-05-11 12:56:56 +0000
@@ -123,6 +123,14 @@
* @return a Map.
*/
Map getMapByMapLayerPath( String mapLayerPath );
+
+ /**
+ * Returns a Collection<Map> of maps with the right type.
+ *
+ * @param type, the map type.
+ * @return a Collection<Map>.
+ */
+ Collection<Map> getMapsByType( String type );
/**
* Returns a Collection of all Maps.
=== 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-24 10:20:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2009-05-11 12:56:56 +0000
@@ -81,6 +81,14 @@
* @return a Map.
*/
Map getMapByMapLayerPath( String mapLayerPath );
+
+ /**
+ * Returns a Collection<Map> of maps with the right type.
+ *
+ * @param type, the map type.
+ * @return a Collection<Map>.
+ */
+ Collection<Map> getMapsByType( String type );
/**
* Returns a Collection of all Maps.
=== 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-28 14:23:39 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-05-11 12:56:56 +0000
@@ -154,6 +154,11 @@
{
return mappingStore.getMapByMapLayerPath( mapLayerPath );
}
+
+ public Collection<Map> getMapsByType( String type )
+ {
+ return mappingStore.getMapsByType( type );
+ }
public Collection<Map> getAllMaps()
{
=== 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-24 10:20:52 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2009-05-11 12:56:56 +0000
@@ -101,6 +101,18 @@
return (Map) criteria.uniqueResult();
}
+
+ @SuppressWarnings("unchecked")
+ public Collection<Map> getMapsByType( String type )
+ {
+ Session session = sessionManager.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( Map.class );
+
+ criteria.add( Restrictions.eq( "type", type ) );
+
+ return criteria.list();
+ }
@SuppressWarnings( "unchecked" )
public Collection<Map> getAllMaps()
=== added file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml 2009-05-11 12:56:56 +0000
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+ <class name="org.hisp.dhis.mapping.MapLegendSet" table="maplegendset">
+
+ <id name="id" column="maplegendsetid">
+ <generator class="native"/>
+ </id>
+
+ <property name="name" column="name" unique="true"/>
+
+ <property name="colorLow" column="colorlow"/>
+
+ <property name="colorHigh" column="colorhigh"/>
+
+ <set name="indicators" table="maplegendsetindicator">
+ <key column="legendsetid"/>
+ <many-to-many column="indicatorid" class="org.hisp.dhis.indicator.Indicator"/>
+ </set>
+
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
=== added file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java 1970-01-01 00:00:00 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java 2009-05-11 12:56:56 +0000
@@ -0,0 +1,57 @@
+package org.hisp.dhis.mapping.action;
+
+import java.util.Collection;
+
+import org.hisp.dhis.mapping.Map;
+import org.hisp.dhis.mapping.MappingService;
+
+import com.opensymphony.xwork.Action;
+
+public class GetMapsByTypeAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private MappingService mappingService;
+
+ public void setMappingService( MappingService mappingService )
+ {
+ this.mappingService = mappingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String type;
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<Map> object;
+
+ public Collection<Map> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ object = mappingService.getMapsByType( type );
+
+ 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-24 10:20:52 +0000
+++ gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2009-05-11 12:56:56 +0000
@@ -48,6 +48,13 @@
<property name="mappingService"
ref="org.hisp.dhis.mapping.MappingService"/>
</bean>
+
+ <bean id="org.hisp.dhis.mapping.action.GetMapsByTypeAction"
+ class="org.hisp.dhis.mapping.action.GetMapsByTypeAction"
+ scope="prototype">
+ <property name="mappingService"
+ ref="org.hisp.dhis.mapping.MappingService"/>
+ </bean>
<bean id="org.hisp.dhis.mapping.action.DeleteMapAction"
class="org.hisp.dhis.mapping.action.DeleteMapAction"
=== modified file 'gis/dhis-web-mapping/src/main/resources/xwork.xml'
--- gis/dhis-web-mapping/src/main/resources/xwork.xml 2009-04-24 10:20:52 +0000
+++ gis/dhis-web-mapping/src/main/resources/xwork.xml 2009-05-11 12:56:56 +0000
@@ -36,6 +36,10 @@
<action name="getMapByMapLayerPath" class="org.hisp.dhis.mapping.action.GetMapByMapLayerPathAction">
<result name="success" type="velocity-json">/dhis-web-mapping/jsonMap.vm</result>
</action>
+
+ <action name="getMapsByType" class="org.hisp.dhis.mapping.action.GetMapsByTypeAction">
+ <result name="success" type="velocity-json">/dhis-web-mapping/jsonminMaps.vm</result>
+ </action>
<action name="deleteMap" class="org.hisp.dhis.mapping.action.DeleteMapAction">
<result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
--
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.