dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19850
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8829: Impl RenameMapAction class
------------------------------------------------------------
revno: 8829
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-11-01 20:07:12 +0300
message:
Impl RenameMapAction class
added:
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/RenameMapAction.java
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml
--
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-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/RenameMapAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/RenameMapAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/RenameMapAction.java 2012-11-01 17:07:12 +0000
@@ -0,0 +1,59 @@
+package org.hisp.dhis.mapping.action;
+
+import org.hisp.dhis.mapping.Map;
+import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+public class RenameMapAction
+ implements Action
+{
+ @Autowired
+ private MappingService mappingService;
+
+ @Autowired
+ private CurrentUserService currentUserService;
+
+ private String id;
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private boolean user;
+
+ public void setUser( boolean user )
+ {
+ this.user = user;
+ }
+
+ public String execute()
+ {
+ Map map = mappingService.getMap( id );
+
+ map.setName( name );
+
+ if ( user )
+ {
+ map.setUser( currentUserService.getCurrentUser() );
+ }
+ else
+ {
+ map.setUser( null );
+ }
+
+ mappingService.updateMap( map );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2012-11-01 16:45:28 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2012-11-01 17:07:12 +0000
@@ -168,6 +168,11 @@
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
</bean>
+ <!-- Map -->
+
+ <bean id="org.hisp.dhis.mapping.action.RenameMapAction" class="org.hisp.dhis.mapping.action.RenameMapAction"
+ scope="prototype"/>
+
<!-- MapView -->
<bean id="org.hisp.dhis.mapping.action.DeleteMapViewAction" class="org.hisp.dhis.mapping.action.DeleteMapViewAction"
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2012-11-01 16:45:28 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2012-11-01 17:07:12 +0000
@@ -180,11 +180,16 @@
</result>
</action>
+ <!-- Map -->
+
+ <action name="renameMap" class="org.hisp.dhis.mapping.action.RenameMapAction">
+ <result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
+ </action>
+
<!-- MapView -->
<action name="deleteMapView" class="org.hisp.dhis.mapping.action.DeleteMapViewAction">
- <result name="success" type="velocity-json">/dhis-web-mapping/void.vm
- </result>
+ <result name="success" type="velocity-json">/dhis-web-mapping/void.vm</result>
</action>
<action name="getMapView" class="org.hisp.dhis.mapping.action.GetMapViewAction">