dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00791
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 225: Added GetAllMapLegendSetsAction class
------------------------------------------------------------
revno: 225
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-04-22 18:10:50 +0200
message:
Added GetAllMapLegendSetsAction class
added:
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLegendSetsAction.java
gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminMapLegendSets.vm
modified:
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java
gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
gis/dhis-web-mapping/src/main/resources/xwork.xml
=== modified file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java 2009-04-21 16:52:52 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java 2009-04-22 16:10:50 +0000
@@ -102,7 +102,7 @@
{
MapLegendSet legendSet = new MapLegendSet();
- legendSet.setColorHigh( name );
+ legendSet.setName( name );
legendSet.setColorLow( colorLow );
legendSet.setColorHigh( colorHigh );
legendSet.setIndicators( new ArrayList<Indicator>() );
=== added file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLegendSetsAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLegendSetsAction.java 1970-01-01 00:00:00 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetAllMapLegendSetsAction.java 2009-04-22 16:10:50 +0000
@@ -0,0 +1,77 @@
+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 java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.mapping.MappingService;
+
+import com.opensymphony.xwork.Action;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class GetAllMapLegendSetsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private MappingService mappingService;
+
+ public void setMappingService( MappingService mappingService )
+ {
+ this.mappingService = mappingService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<MapLegendSet> object;
+
+ public List<MapLegendSet> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ object = new ArrayList<MapLegendSet>( mappingService.getAllMapLegendSets() );
+
+ 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-21 16:52:52 +0000
+++ gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2009-04-22 16:10:50 +0000
@@ -95,6 +95,13 @@
ref="org.hisp.dhis.mapping.MappingService"/>
</bean>
+ <bean id="org.hisp.dhis.mapping.action.GetAllMapLegendSetsAction"
+ class="org.hisp.dhis.mapping.action.GetAllMapLegendSetsAction"
+ scope="prototype">
+ <property name="mappingService"
+ ref="org.hisp.dhis.mapping.MappingService"/>
+ </bean>
+
<!-- Indicator -->
<bean id="org.hisp.dhis.mapping.action.GetAllIndicatorGroupsAction"
=== modified file 'gis/dhis-web-mapping/src/main/resources/xwork.xml'
--- gis/dhis-web-mapping/src/main/resources/xwork.xml 2009-04-21 16:52:52 +0000
+++ gis/dhis-web-mapping/src/main/resources/xwork.xml 2009-04-22 16:10:50 +0000
@@ -63,6 +63,10 @@
<result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
</action>
+ <action name="getAllMapLegendSets" class="org.hisp.dhis.mapping.action.GetAllMapLegendSetsAction">
+ <result name="success" type="velocity-json">/dhis-web-mapping/jsonminMapLegendSets.vm</result>
+ </action>
+
<!-- Indicator -->
<action name="getAllIndicatorGroups" class="org.hisp.dhis.mapping.action.GetAllIndicatorGroupsAction">
=== added file 'gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminMapLegendSets.vm'
--- gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminMapLegendSets.vm 1970-01-01 00:00:00 +0000
+++ gis/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminMapLegendSets.vm 2009-04-22 16:10:50 +0000
@@ -0,0 +1,9 @@
+#set( $size = $object.size() )
+{ "mapLegendSets": [
+#foreach( $legendSet in $object )
+ {
+ "id": $!{legendSet.id},
+ "name": "$!encoder.jsEncode( ${legendSet.name} )",
+ }#if( $velocityCount < $size ),#end
+#end
+] }
\ No newline at end of file
--
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.