← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5308: - Showing maps a bit better in api, some cleanup

 

------------------------------------------------------------
revno: 5308
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-12-06 16:03:45 +0100
message:
  - Showing maps a bit better in api, some cleanup
added:
  dhis-2/dhis-web/dhis-web-api/src/test/
  dhis-2/dhis-web/dhis-web-api/src/test/java/
  dhis-2/dhis-web/dhis-web-api/src/test/java/org/
  dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/
  dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/
  dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/api/
  dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/api/utils/
  dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/api/utils/WebLinkPopulatorTest.java
renamed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulatorListener.java => dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java
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/AttributeController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryComboController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionComboController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java
  dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/map.xsl
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.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	2011-12-05 12:21:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2011-12-06 15:03:45 +0000
@@ -268,8 +268,6 @@
         this.mapDateType = mapDateType;
     }
 
-    @XmlElement
-    @JsonProperty
     public PeriodType getPeriodType()
     {
         return periodType;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.Attributes;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( attributes );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( attributes );
         }
 
         model.addAttribute( "model", attributes );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( attribute );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( attribute );
         }
 
         model.addAttribute( "model", attribute );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2011-12-06 06:13:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.chart.Chart;
 import org.hisp.dhis.chart.ChartService;
 import org.hisp.dhis.chart.Charts;
@@ -68,8 +68,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( charts );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( charts );
         }
 
         model.addAttribute( "model", charts );
@@ -84,8 +84,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( chart );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( chart );
         }
 
         model.addAttribute( "model", chart );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryComboController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryComboController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryComboController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryCombos;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementCategoryCombos );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementCategoryCombos );
         }
 
         model.addAttribute( "model", dataElementCategoryCombos );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementCategoryCombo );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementCategoryCombo );
         }
 
         model.addAttribute( "model", dataElementCategoryCombo );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.dataelement.DataElementCategories;
 import org.hisp.dhis.dataelement.DataElementCategory;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementCategories );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementCategories );
         }
 
         model.addAttribute( "model", dataElementCategories );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementCategory );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementCategory );
         }
 
         model.addAttribute( "model", dataElementCategory );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionComboController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionComboController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionComboController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombos;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementCategoryOptionCombos );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementCategoryOptionCombos );
         }
 
         model.addAttribute( "model", dataElementCategoryOptionCombos );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementCategoryOptionCombo );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementCategoryOptionCombo );
         }
 
         model.addAttribute( "model", dataElementCategoryOptionCombo );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementCategoryOptionController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
 import org.hisp.dhis.dataelement.DataElementCategoryOptions;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementCategoryOptions );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementCategoryOptions );
         }
 
         model.addAttribute( "model", dataElementCategoryOptions );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementCategoryOption );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementCategoryOption );
         }
 
         model.addAttribute( "model", dataElementCategoryOption );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataelement.DataElements;
@@ -64,8 +64,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElements );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElements );
         }
 
         model.addAttribute( "model", dataElements );
@@ -98,8 +98,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElement );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElement );
         }
 
         model.addAttribute( "model", dataElement );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dataelement.DataElementGroups;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -57,8 +57,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementGroups );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementGroups );
         }
 
         model.addAttribute( "model", dataElementGroups );
@@ -73,8 +73,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementGroup );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementGroup );
         }
 
         model.addAttribute( "model", dataElementGroup );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataElementGroupSetController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataelement.DataElementGroupSets;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementGroupSets );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementGroupSets );
         }
 
         model.addAttribute( "model", dataElementGroupSets );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataElementGroupSet );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataElementGroupSet );
         }
 
         model.addAttribute( "model", dataElementGroupSet );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.dataset.DataSets;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataSets );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataSets );
         }
 
         model.addAttribute( "model", dataSets );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( dataSet );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( dataSet );
         }
 
         model.addAttribute( "model", dataSet );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.Indicators;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( indicators );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( indicators );
         }
 
         model.addAttribute( "model", indicators );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( indicator );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( indicator );
         }
 
         model.addAttribute( "model", indicator );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorGroups;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( indicatorGroups );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( indicatorGroups );
         }
 
         model.addAttribute( "model", indicatorGroups );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( indicatorGroup );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( indicatorGroup );
         }
 
         model.addAttribute( "model", indicatorGroup );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorGroupSetController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorGroupSets;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( indicatorGroupSets );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( indicatorGroupSets );
         }
 
         model.addAttribute( "model", indicatorGroupSets );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( indicatorGroupSet );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( indicatorGroupSet );
         }
 
         model.addAttribute( "model", indicatorGroupSet );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndicatorTypeController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.indicator.IndicatorTypes;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( indicatorTypes );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( indicatorTypes );
         }
 
         model.addAttribute( "model", indicatorTypes );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( indicatorType );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( indicatorType );
         }
 
         model.addAttribute( "model", indicatorType );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java	2011-12-05 12:21:38 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MapController.java	2011-12-06 15:03:45 +0000
@@ -32,6 +32,8 @@
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.hisp.dhis.api.utils.IdentifiableObjectParams;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.mapgeneration.MapGenerationService;
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.mapping.MappingService;
@@ -54,18 +56,24 @@
     MappingService mappingService;
 
     @RequestMapping( method = RequestMethod.GET )
-    public String getMaps( Model model, HttpServletRequest request ) throws IOException
+    public String getMaps(IdentifiableObjectParams params, Model model, HttpServletRequest request ) throws IOException
     {
         Maps maps = new Maps();
         maps.setMaps( new ArrayList<MapView>( mappingService.getAllMapViews() ) );
 
+        if ( params.hasLinks() )
+        {
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( maps );
+        }
+        
         model.addAttribute( "model", maps );
 
         return "maps";
     }
 
     @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
-    public String getChart( @PathVariable String uid, Model model, HttpServletRequest request )
+    public String getChart( @PathVariable String uid, IdentifiableObjectParams params, Model model, HttpServletRequest request )
     {
         MapView mapView = mappingService.getMapView( uid );
 
@@ -73,6 +81,12 @@
             throw new IllegalArgumentException("No map with id " + uid);
         }
         
+        if ( params.hasLinks() )
+        {
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( mapView );
+        }
+
         model.addAttribute( "model", mapView );
 
         return "map";

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitController.java	2011-12-06 15:03:45 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.api.controller;
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.organisationunit.OrganisationUnits;
@@ -33,8 +33,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( organisationUnits );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( organisationUnits );
         }
 
         model.addAttribute( "model", organisationUnits );
@@ -49,8 +49,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( organisationUnit );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( organisationUnit );
         }
 
         model.addAttribute( "model", organisationUnit );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupController.java	2011-12-06 15:03:45 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.api.controller;
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroups;
@@ -33,8 +33,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( organisationUnitGroups );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( organisationUnitGroups );
         }
 
         model.addAttribute( "model", organisationUnitGroups );
@@ -49,8 +49,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( organisationUnitGroup );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( organisationUnitGroup );
         }
 
         model.addAttribute( "model", organisationUnitGroup );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitGroupSetController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSets;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( organisationUnitGroupSets );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( organisationUnitGroupSets );
         }
 
         model.addAttribute( "model", organisationUnitGroupSets );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( organisationUnitGroupSet );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( organisationUnitGroupSet );
         }
 
         model.addAttribute( "model", organisationUnitGroupSet );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/OrganisationUnitLevelController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevels;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( organisationUnitLevels );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( organisationUnitLevels );
         }
 
         model.addAttribute( "model", organisationUnitLevels );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( organisationUnitLevel );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( organisationUnitLevel );
         }
 
         model.addAttribute( "model", organisationUnitLevel );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java	2011-12-06 10:58:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.api.webdomain.Resources;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -51,8 +51,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( resources );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( resources );
         }
 
         model.addAttribute( "model", resources );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java	2011-12-06 04:28:54 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/UserController.java	2011-12-06 15:03:45 +0000
@@ -28,7 +28,7 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.WebLinkPopulatorListener;
+import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.user.Users;
@@ -60,8 +60,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( users );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( users );
         }
 
         model.addAttribute( "model", users );
@@ -76,8 +76,8 @@
 
         if ( params.hasLinks() )
         {
-            WebLinkPopulatorListener listener = new WebLinkPopulatorListener( request );
-            listener.beforeMarshal( user );
+            WebLinkPopulator listener = new WebLinkPopulator( request );
+            listener.addLinks( user );
         }
 
         model.addAttribute( "model", user );

=== renamed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulatorListener.java' => 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulatorListener.java	2011-12-06 11:37:04 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/WebLinkPopulator.java	2011-12-06 15:03:45 +0000
@@ -27,6 +27,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javassist.util.proxy.ProxyObject;
+
+import javax.servlet.http.HttpServletRequest;
+
 import org.hisp.dhis.api.webdomain.Resource;
 import org.hisp.dhis.api.webdomain.Resources;
 import org.hisp.dhis.attribute.Attribute;
@@ -34,98 +42,63 @@
 import org.hisp.dhis.chart.Chart;
 import org.hisp.dhis.chart.Charts;
 import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.dataelement.*;
-import org.hisp.dhis.dataset.CompleteDataSetRegistration;
-import org.hisp.dhis.dataset.CompleteDataSetRegistrations;
+import org.hisp.dhis.common.BaseLinkableObject;
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategories;
+import org.hisp.dhis.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryCombos;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombos;
+import org.hisp.dhis.dataelement.DataElementCategoryOptions;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
+import org.hisp.dhis.dataelement.DataElementGroupSets;
+import org.hisp.dhis.dataelement.DataElementGroups;
+import org.hisp.dhis.dataelement.DataElements;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSets;
-import org.hisp.dhis.indicator.*;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
+import org.hisp.dhis.indicator.IndicatorGroupSets;
+import org.hisp.dhis.indicator.IndicatorGroups;
+import org.hisp.dhis.indicator.Indicators;
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.mapping.Maps;
-import org.hisp.dhis.organisationunit.*;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.Users;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.bind.Marshaller;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSets;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroups;
+import org.hisp.dhis.organisationunit.OrganisationUnits;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
-public class WebLinkPopulatorListener
-    extends Marshaller.Listener
+public class WebLinkPopulator
 {
-    private HttpServletRequest request;
-
-    private static Map<Class, String> resourcePaths = new HashMap<Class, String>();
-
-    private String rootPath = null;
+
+    /**
+     * Custom linkable object -> path mappings
+     */
+    private static Map<Class<? extends BaseLinkableObject>, String> resourcePaths = new HashMap<Class<? extends BaseLinkableObject>, String>();
 
     static
     {
-        resourcePaths.put( Resources.class, "resources" );
-
-        resourcePaths.put( Attributes.class, "attributes" );
-        resourcePaths.put( Attribute.class, "attributes" );
-
-        resourcePaths.put( Charts.class, "charts" );
-        resourcePaths.put( Chart.class, "charts" );
-
-        resourcePaths.put( Maps.class, "maps" );
         resourcePaths.put( MapView.class, "maps" );
-
-        resourcePaths.put( CompleteDataSetRegistrations.class, "completeDataSetRegistrations" );
-        resourcePaths.put( CompleteDataSetRegistration.class, "completeDataSetRegistrations" );
-
-        resourcePaths.put( Indicators.class, "indicators" );
-        resourcePaths.put( Indicator.class, "indicators" );
-        resourcePaths.put( IndicatorGroups.class, "indicatorGroups" );
-        resourcePaths.put( IndicatorGroup.class, "indicatorGroups" );
-        resourcePaths.put( IndicatorGroupSets.class, "indicatorGroupSets" );
-        resourcePaths.put( IndicatorGroupSet.class, "indicatorGroupSets" );
-        resourcePaths.put( IndicatorTypes.class, "indicatorTypes" );
-        resourcePaths.put( IndicatorType.class, "indicatorTypes" );
-
-        resourcePaths.put( DataElements.class, "dataElements" );
-        resourcePaths.put( DataElement.class, "dataElements" );
-        resourcePaths.put( DataElementGroups.class, "dataElementGroups" );
-        resourcePaths.put( DataElementGroup.class, "dataElementGroups" );
-        resourcePaths.put( DataElementGroupSets.class, "dataElementGroupSets" );
-        resourcePaths.put( DataElementGroupSet.class, "dataElementGroupSets" );
-
-        resourcePaths.put( DataElementCategories.class, "dataElementCategories" );
-        resourcePaths.put( DataElementCategory.class, "dataElementCategories" );
-        resourcePaths.put( DataElementCategoryCombos.class, "dataElementCategoryCombos" );
-        resourcePaths.put( DataElementCategoryCombo.class, "dataElementCategoryCombos" );
-        resourcePaths.put( DataElementCategoryOptions.class, "dataElementCategoryOptions" );
-        resourcePaths.put( DataElementCategoryOption.class, "dataElementCategoryOptions" );
-        resourcePaths.put( DataElementCategoryOptionCombos.class, "dataElementCategoryOptionCombos" );
-        resourcePaths.put( DataElementCategoryOptionCombo.class, "dataElementCategoryOptionCombos" );
-
-        resourcePaths.put( OrganisationUnits.class, "organisationUnits" );
-        resourcePaths.put( OrganisationUnit.class, "organisationUnits" );
-        resourcePaths.put( OrganisationUnitGroups.class, "organisationUnitGroups" );
-        resourcePaths.put( OrganisationUnitGroup.class, "organisationUnitGroups" );
-        resourcePaths.put( OrganisationUnitGroupSets.class, "organisationUnitGroupSets" );
-        resourcePaths.put( OrganisationUnitGroupSet.class, "organisationUnitGroupSets" );
-
-        resourcePaths.put( DataSets.class, "dataSets" );
-        resourcePaths.put( DataSet.class, "dataSets" );
-
-        resourcePaths.put( Users.class, "users" );
-        resourcePaths.put( User.class, "users" );
     }
 
-    public WebLinkPopulatorListener( HttpServletRequest request )
+    private String rootPath;
+
+    public WebLinkPopulator( HttpServletRequest request )
     {
-        this.request = request;
+        rootPath = createRootPath( request );
     }
 
-    @Override
-    public void beforeMarshal( Object source )
+    public void addLinks( Object source )
     {
         if ( source instanceof Resources )
         {
@@ -259,6 +232,41 @@
         {
             populateAttribute( (Attribute) source, true );
         }
+        else if ( source instanceof Maps )
+        {
+            populateMaps( (Maps) source, true );
+        }
+        else if ( source instanceof MapView )
+        {
+            populateMap( (MapView) source, true );
+        }
+
+    }
+
+    private void populateMaps( Maps maps, boolean b )
+    {
+        maps.setLink( getBasePath( maps.getClass() ) );
+
+        for ( MapView map : maps.getMaps() )
+        {
+            populateMap( map, false );
+        }
+    }
+
+    private void populateMap( MapView map, boolean root )
+    {
+        populateIdentifiableObject( map );
+
+        if ( root )
+        {
+            populateIdentifiableObject( map.getDataElement() );
+            populateIdentifiableObject( map.getDataElementGroup() );
+            populateIdentifiableObject( map.getIndicator() );
+            populateIdentifiableObject( map.getIndicatorGroup() );
+            populateIdentifiableObject( map.getOrganisationUnitLevel() );
+            populateIdentifiableObject( map.getParentOrganisationUnit() );
+            populateIdentifiableObject( map.getPeriod() );
+        }
     }
 
     private void populateResources( Resources resources )
@@ -323,7 +331,8 @@
 
         if ( root )
         {
-            for ( DataElementCategoryCombo dataElementCategoryCombo : dataElementCategoryCombos.getDataElementCategoryCombos() )
+            for ( DataElementCategoryCombo dataElementCategoryCombo : dataElementCategoryCombos
+                .getDataElementCategoryCombos() )
             {
                 populateDataElementCategoryCombo( dataElementCategoryCombo, false );
             }
@@ -347,7 +356,8 @@
 
         if ( root )
         {
-            for ( DataElementCategoryOption dataElementCategoryOption : dataElementCategoryOptions.getDataElementCategoryOptions() )
+            for ( DataElementCategoryOption dataElementCategoryOption : dataElementCategoryOptions
+                .getDataElementCategoryOptions() )
             {
                 populateDataElementCategoryOption( dataElementCategoryOption, false );
             }
@@ -365,20 +375,23 @@
         }
     }
 
-    private void populateDataElementCategoryOptionCombos( DataElementCategoryOptionCombos dataElementCategoryOptionCombos, boolean root )
+    private void populateDataElementCategoryOptionCombos(
+        DataElementCategoryOptionCombos dataElementCategoryOptionCombos, boolean root )
     {
         dataElementCategoryOptionCombos.setLink( getBasePath( DataElementCategoryOptionCombos.class ) );
 
         if ( root )
         {
-            for ( DataElementCategoryOptionCombo dataElementCategoryOptionCombo : dataElementCategoryOptionCombos.getDataElementCategoryOptionCombos() )
+            for ( DataElementCategoryOptionCombo dataElementCategoryOptionCombo : dataElementCategoryOptionCombos
+                .getDataElementCategoryOptionCombos() )
             {
                 populateDataElementCategoryOptionCombo( dataElementCategoryOptionCombo, false );
             }
         }
     }
 
-    private void populateDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo, boolean root )
+    private void populateDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo,
+        boolean root )
     {
         dataElementCategoryOptionCombo.setLink( getPathWithUid( dataElementCategoryOptionCombo ) );
 
@@ -562,7 +575,8 @@
 
         if ( root )
         {
-            for ( OrganisationUnitGroupSet organisationUnitGroupSet : organisationUnitGroupSets.getOrganisationUnitGroupSets() )
+            for ( OrganisationUnitGroupSet organisationUnitGroupSet : organisationUnitGroupSets
+                .getOrganisationUnitGroupSets() )
             {
                 populateOrganisationUnitGroupSet( organisationUnitGroupSet, false );
             }
@@ -658,15 +672,19 @@
 
     public void handleIdentifiableObjectCollection( Collection<? extends BaseIdentifiableObject> identifiableObjects )
     {
-        for ( BaseIdentifiableObject baseIdentifiableObject : identifiableObjects )
+        if ( identifiableObjects != null )
         {
-            populateIdentifiableObject( baseIdentifiableObject );
+            for ( BaseIdentifiableObject baseIdentifiableObject : identifiableObjects )
+            {
+                populateIdentifiableObject( baseIdentifiableObject );
+            }
         }
     }
 
     private void populateIdentifiableObject( BaseIdentifiableObject baseIdentifiableObject )
     {
-        baseIdentifiableObject.setLink( getPathWithUid( baseIdentifiableObject ) );
+        if ( baseIdentifiableObject != null )
+            baseIdentifiableObject.setLink( getPathWithUid( baseIdentifiableObject ) );
     }
 
     private String getPathWithUid( BaseIdentifiableObject baseIdentifiableObject )
@@ -676,35 +694,57 @@
 
     private String getBasePath( Class<?> clazz )
     {
-        if ( rootPath == null )
-        {
-            StringBuilder builder = new StringBuilder();
-
-            builder.append( request.getScheme() );
-            builder.append( "://" ).append( request.getServerName() );
-
-            if ( request.getServerPort() != 80 && request.getServerPort() != 443 )
-            {
-                builder.append( ":" ).append( request.getServerPort() );
-            }
-
-            builder.append( request.getContextPath() );
-            builder.append( request.getServletPath() );
-
-            rootPath = builder.toString();
+        if (ProxyObject.class.isAssignableFrom( clazz ) ) {
+            clazz = clazz.getSuperclass();
         }
-
+        
         String resourcePath = resourcePaths.get( clazz );
 
-        // in some cases, the class is a dynamic subclass (usually subclassed
-        // with javaassist), so
-        // we need to fetch the superClass instead.
+//        // in some cases, the class is a dynamic subclass (usually subclassed
+//        // with javaassist), so
+//        // we need to fetch the superClass instead.
+//        if ( resourcePath == null )
+//        {
+//            resourcePath = resourcePaths.get( clazz.getSuperclass() );
+//        }
+
         if ( resourcePath == null )
         {
-            resourcePath = resourcePaths.get( clazz.getSuperclass() );
+            resourcePath = getPath( clazz );
         }
 
         return rootPath + "/" + resourcePath;
     }
 
+    public static String createRootPath( HttpServletRequest request )
+    {
+        StringBuilder builder = new StringBuilder();
+        builder.append( request.getScheme() );
+
+        builder.append( "://" + request.getServerName() );
+
+        if ( request.getServerPort() != 80 && request.getServerPort() != 443 )
+        {
+            builder.append( ":" + request.getServerPort() );
+        }
+
+        builder.append( request.getContextPath() );
+        builder.append( request.getServletPath() );
+
+        return builder.toString();
+    }
+
+    public static String getPath( Class<?> clazz )
+    {
+        String path = clazz.getSimpleName();
+
+        path = path.substring( 0, 1 ).toLowerCase() + path.substring( 1 );
+
+        if ( IdentifiableObject.class.isAssignableFrom( clazz ) )
+        {
+            path += "s";
+        }
+        return path;
+    }
+
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/map.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/map.xsl	2011-12-06 13:47:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/xslt/map.xsl	2011-12-06 15:03:45 +0000
@@ -3,38 +3,57 @@
     xmlns="http://www.w3.org/1999/xhtml";
     xmlns:d="http://dhis2.org/schema/dxf/2.0";
     >
-    
-<<<<<<< TREE
+
     <xsl:template match="d:map">
-        <div class="d:map">
-            <h2>Map <xsl:value-of select="@name"/></h2>
-=======
-    <xsl:template match="map">
         <div class="map">
             <h2>Map: <xsl:value-of select="@name"/></h2>
->>>>>>> MERGE-SOURCE
+              <a href="{@link}.png"><img src="{@link}.png" style="border-style:solid; border-width: 1px; padding: 5px;" /></a>
+
             <table border="1">
-                <tr>
-                    <td>Map rendering</td>
-                    <td>
-                        <a href="{@link}.png">PNG</a>
-                    </td>
-                </tr>
-                <tr>
-                    <td>ID</td>
-                    <td>
-                        <xsl:value-of select="@id"/>
-                    </td>
-                </tr>
-                <tr>
-                    <td>Last Updated</td>
-                    <td>
-                        <xsl:value-of select="@lastUpdated"/>
-                    </td>
-                </tr>
+               <xsl:for-each select="attribute::*">
+                 <tr><td><xsl:value-of select="local-name()"/></td><td><xsl:value-of select="."/></td></tr>  
+               </xsl:for-each>
+               <xsl:for-each select="child::*">
+                 <tr><td><xsl:value-of select="local-name()"/></td><td><xsl:value-of select="@name"/></td></tr>  
+               </xsl:for-each>
             </table>
-
         </div>
     </xsl:template>
 
+    <xsl:template match="d:map" mode="row">
+        <tr>
+            <td><xsl:value-of select="@name"/></td>
+            <td>
+                <xsl:element name="a">
+                    <xsl:attribute name="href"><xsl:value-of select="@link"/></xsl:attribute>
+                    <xsl:text>html</xsl:text>
+                </xsl:element>
+            </td>
+            <td>
+                <xsl:element name="a">
+                    <xsl:attribute name="href"><xsl:value-of select="concat(@link,'.png')"/></xsl:attribute>
+                    <xsl:text>png</xsl:text>
+                </xsl:element>
+            </td>
+            <td>
+                <xsl:element name="a">
+                    <xsl:attribute name="href"><xsl:value-of select="concat(@link,'.xml')"/></xsl:attribute>
+                    <xsl:text>xml</xsl:text>
+                </xsl:element>
+            </td>
+            <td>
+                <xsl:element name="a">
+                    <xsl:attribute name="href"><xsl:value-of select="concat(@link,'.json')"/></xsl:attribute>
+                    <xsl:text>json</xsl:text>
+                </xsl:element>
+            </td>
+            <td>
+                <xsl:element name="a">
+                    <xsl:attribute name="href"><xsl:value-of select="concat(@link,'.jsonp')"/></xsl:attribute>
+                    <xsl:text>jsonp</xsl:text>
+                </xsl:element>
+            </td>
+        </tr>
+    </xsl:template>
+
 </xsl:stylesheet>

=== added directory 'dhis-2/dhis-web/dhis-web-api/src/test'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/test/java'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/test/java/org'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/api'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/api/utils'
=== added file 'dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/api/utils/WebLinkPopulatorTest.java'
--- dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/api/utils/WebLinkPopulatorTest.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/test/java/org/hisp/dhis/api/utils/WebLinkPopulatorTest.java	2011-12-06 15:03:45 +0000
@@ -0,0 +1,22 @@
+package org.hisp.dhis.api.utils;
+
+import static org.hisp.dhis.api.utils.WebLinkPopulator.getPath;
+import static org.junit.Assert.assertEquals;
+
+import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.chart.Charts;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.junit.Test;
+
+public class WebLinkPopulatorTest
+{
+
+    @Test
+    public void testClassToPathMapping()
+    {
+        assertEquals( "charts", getPath( Charts.class ) );
+        assertEquals( "charts", getPath( Chart.class ) );
+        assertEquals( "dataElementCategoryOptionCombos", getPath( DataElementCategoryOptionCombo.class ) );
+    }
+
+}