dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20417
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9308: updated mapViewController to only use getAll() instead of getBetween() since MapView no lenger ha...
------------------------------------------------------------
revno: 9308
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-12-13 20:52:21 +0300
message:
updated mapViewController to only use getAll() instead of getBetween() since MapView no lenger has a name.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapViewController.java
--
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/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2012-11-29 16:21:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java 2012-12-13 17:52:21 +0000
@@ -55,7 +55,7 @@
/**
* @author Jan Henrik Overland
*/
-@JacksonXmlRootElement( localName = "map", namespace = Dxf2Namespace.NAMESPACE )
+@JacksonXmlRootElement( localName = "mapView", namespace = Dxf2Namespace.NAMESPACE )
public class MapView
extends BaseIdentifiableObject
{
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapViewController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapViewController.java 2012-10-25 17:18:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapViewController.java 2012-12-13 17:52:21 +0000
@@ -27,12 +27,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.awt.image.BufferedImage;
-
-import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletResponse;
-
import org.hisp.dhis.api.controller.AbstractCrudController;
+import org.hisp.dhis.api.controller.WebMetaData;
+import org.hisp.dhis.api.controller.WebOptions;
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.api.utils.ContextUtils.CacheStrategy;
import org.hisp.dhis.mapgeneration.MapGenerationService;
@@ -48,11 +45,18 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
/**
* @author Lars Helge Overland
*/
@Controller
-@RequestMapping( value = MapViewController.RESOURCE_PATH )
+@RequestMapping(value = MapViewController.RESOURCE_PATH)
public class MapViewController
extends AbstractCrudController<MapView>
{
@@ -70,7 +74,7 @@
@Autowired
private MapGenerationService mapGenerationService;
- @RequestMapping( value = { "/{uid}/data", "/{uid}/data.png" }, method = RequestMethod.GET )
+ @RequestMapping(value = { "/{uid}/data", "/{uid}/data.png" }, method = RequestMethod.GET)
public void getMap( @PathVariable String uid, HttpServletResponse response ) throws Exception
{
MapView mapView = mappingService.getMapView( uid );
@@ -78,11 +82,11 @@
renderMapViewPng( mapView, response );
}
- @RequestMapping( value = { "/data", "/data.png" }, method = RequestMethod.GET )
+ @RequestMapping(value = { "/data", "/data.png" }, method = RequestMethod.GET)
public void getMap( Model model,
- @RequestParam( value = "in" ) String indicatorUid,
- @RequestParam( value = "ou" ) String organisationUnitUid,
- @RequestParam( value = "level", required = false ) Integer level,
+ @RequestParam(value = "in") String indicatorUid,
+ @RequestParam(value = "ou") String organisationUnitUid,
+ @RequestParam(value = "level", required = false) Integer level,
HttpServletResponse response ) throws Exception
{
if ( level == null )
@@ -98,6 +102,25 @@
renderMapViewPng( mapView, response );
}
+ @Override
+ protected List<MapView> getEntityList( WebMetaData metaData, WebOptions options )
+ {
+ List<MapView> entityList;
+
+ Date lastUpdated = options.getLastUpdated();
+
+ if ( lastUpdated != null )
+ {
+ entityList = new ArrayList<MapView>( manager.getByLastUpdatedSorted( getEntityClass(), lastUpdated ) );
+ }
+ else
+ {
+ entityList = new ArrayList<MapView>( manager.getAll( getEntityClass() ) );
+ }
+
+ return entityList;
+ }
+
//--------------------------------------------------------------------------
// Supportive methods
//--------------------------------------------------------------------------