← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18388: Renamed MapLegend > Legend and MapLegendSet > LegendSet. Added new service LegendService and remo...

 

------------------------------------------------------------
revno: 18388
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-24 14:16:58 +0100
message:
  Renamed MapLegend > Legend and MapLegendSet > LegendSet. Added new service LegendService and removed legend methods from MappingService. There awas a need to generalize legends away from maps as it is being used for pivot tables, event reports and more.
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLayerNameComparator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLegendComparator.java
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/LegendService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/DefaultLegendService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/legend/
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/legend/LegendServiceTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/
renamed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegend.java => dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/Legend.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java => dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/LegendSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/MapLegendSchemaDescriptor.java => dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/LegendSchemaDescriptor.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/MapLegendSetSchemaDescriptor.java => dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/LegendSetSchemaDescriptor.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapLegendSetDeletionHandler.java => dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/LegendSetDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegend.hbm.xml => dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/Legend.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml => dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/LegendSet.hbm.xml
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapLegendController.java => dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapLegendSetController.java => dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapViewStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Typed.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapViewStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml
  dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapLayerTest.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/EditDataSetFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/Legend.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/LegendSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/LegendSchemaDescriptor.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/LegendSetSchemaDescriptor.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/LegendSetDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/Legend.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/LegendSet.hbm.xml
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.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/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2015-02-16 04:03:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2015-02-24 13:16:58 +0000
@@ -28,12 +28,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import static org.hisp.dhis.dataset.DataSet.NO_EXPIRY;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 import org.hisp.dhis.attribute.AttributeValue;
 import org.hisp.dhis.common.BaseDimensionalObject;
 import org.hisp.dhis.common.BaseIdentifiableObject;
@@ -45,7 +47,7 @@
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.comparator.DataSetFrequencyComparator;
-import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.YearlyPeriodType;
@@ -53,13 +55,12 @@
 import org.hisp.dhis.schema.annotation.Property;
 import org.hisp.dhis.schema.annotation.PropertyRange;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import static org.hisp.dhis.dataset.DataSet.NO_EXPIRY;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 
 /**
  * A DataElement is a definition (meta-information about) of the entities that
@@ -200,7 +201,7 @@
     /**
      * The legend set for this data element.
      */
-    private MapLegendSet legendSet;
+    private LegendSet legendSet;
 
     // -------------------------------------------------------------------------
     // Constructors
@@ -722,12 +723,12 @@
     @JsonSerialize( as = BaseIdentifiableObject.class )
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public MapLegendSet getLegendSet()
+    public LegendSet getLegendSet()
     {
         return legendSet;
     }
 
-    public void setLegendSet( MapLegendSet legendSet )
+    public void setLegendSet( LegendSet legendSet )
     {
         this.legendSet = legendSet;
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2015-02-18 13:39:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2015-02-24 13:16:58 +0000
@@ -28,13 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.util.HashSet;
+import java.util.Set;
 
 import org.hisp.dhis.attribute.AttributeValue;
 import org.hisp.dhis.common.BaseIdentifiableObject;
@@ -57,13 +52,18 @@
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.user.UserGroup;
 
-import java.util.HashSet;
-import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 
 /**
  * This class is used for defining the standardized DataSets. A DataSet consists
@@ -232,7 +232,7 @@
     /**
      * The legend set for this indicator.
      */
-    private MapLegendSet legendSet;
+    private LegendSet legendSet;
 
     // -------------------------------------------------------------------------
     // Constructors
@@ -788,12 +788,12 @@
     @JsonSerialize( as = BaseIdentifiableObject.class )
     @JsonView( { DetailedView.class, ExportView.class, WithoutOrganisationUnitsView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public MapLegendSet getLegendSet()
+    public LegendSet getLegendSet()
     {
         return legendSet;
     }
 
-    public void setLegendSet( MapLegendSet legendSet )
+    public void setLegendSet( LegendSet legendSet )
     {
         this.legendSet = legendSet;
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java	2015-02-05 06:53:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java	2015-02-24 13:16:58 +0000
@@ -35,6 +35,7 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
 import org.hisp.dhis.attribute.AttributeValue;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.BaseNameableObject;
@@ -44,7 +45,7 @@
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.schema.PropertyType;
 import org.hisp.dhis.schema.annotation.Property;
 
@@ -98,7 +99,7 @@
     /**
      * The legend set for this indicator.
      */
-    private MapLegendSet legendSet;
+    private LegendSet legendSet;
 
     public Indicator()
     {
@@ -356,12 +357,12 @@
     @JsonSerialize( as = BaseIdentifiableObject.class )
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public MapLegendSet getLegendSet()
+    public LegendSet getLegendSet()
     {
         return legendSet;
     }
 
-    public void setLegendSet( MapLegendSet legendSet )
+    public void setLegendSet( LegendSet legendSet )
     {
         this.legendSet = legendSet;
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java	2015-02-24 13:16:58 +0000
@@ -28,7 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.mapping.MapLegendSet;
 
 import java.util.Collection;
 import java.util.List;
@@ -178,6 +177,4 @@
     int getIndicatorGroupSetCount();
 
     int getIndicatorGroupSetCountByName( String name );
-
-    int countMapLegendSetIndicators( MapLegendSet mapLegendSet );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorStore.java	2015-02-24 13:16:58 +0000
@@ -28,14 +28,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
+
 import org.hisp.dhis.common.GenericNameableObjectStore;
-import org.hisp.dhis.mapping.MapLegendSet;
-
-import java.util.Collection;
 
 /**
  * @author Lars Helge Overland
- * @version $Id: IndicatorStore.java 3305 2007-05-14 18:55:52Z larshelg $
  */
 public interface IndicatorStore
     extends GenericNameableObjectStore<Indicator>
@@ -47,6 +45,4 @@
     Collection<Indicator> getIndicatorsWithoutGroups();
 
     Collection<Indicator> getIndicatorsWithDataSets();
-
-    int countMapLegendSetIndicators( MapLegendSet mapLegendSet );
 }

=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend'
=== renamed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegend.java' => 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/Legend.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegend.java	2015-02-05 06:53:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/Legend.java	2015-02-24 13:16:58 +0000
@@ -1,4 +1,4 @@
-package org.hisp.dhis.mapping;
+package org.hisp.dhis.legend;
 
 /*
  * Copyright (c) 2004-2015, University of Oslo
@@ -42,8 +42,8 @@
 /**
  * @author Jan Henrik Overland
  */
-@JacksonXmlRootElement( localName = "mapLegend", namespace = DxfNamespaces.DXF_2_0 )
-public class MapLegend
+@JacksonXmlRootElement( localName = "legend", namespace = DxfNamespaces.DXF_2_0 )
+public class Legend
     extends BaseIdentifiableObject
 {
     private Double startValue;
@@ -54,11 +54,11 @@
 
     private String image;
 
-    public MapLegend()
+    public Legend()
     {
     }
 
-    public MapLegend( String name, Double startValue, Double endValue, String color, String image )
+    public Legend( String name, Double startValue, Double endValue, String color, String image )
     {
         this.name = name;
         this.startValue = startValue;
@@ -136,21 +136,21 @@
 
         if ( other.getClass().isInstance( this ) )
         {
-            MapLegend mapLegend = (MapLegend) other;
+            Legend legend = (Legend) other;
 
             if ( MergeStrategy.MERGE_ALWAYS.equals( strategy ) )
             {
-                startValue = mapLegend.getStartValue();
-                endValue = mapLegend.getEndValue();
-                color = mapLegend.getColor();
-                image = mapLegend.getImage();
+                startValue = legend.getStartValue();
+                endValue = legend.getEndValue();
+                color = legend.getColor();
+                image = legend.getImage();
             }
             else if ( MergeStrategy.MERGE_IF_NOT_NULL.equals( strategy ) )
             {
-                startValue = mapLegend.getStartValue() == null ? startValue : mapLegend.getStartValue();
-                endValue = mapLegend.getEndValue() == null ? endValue : mapLegend.getEndValue();
-                color = mapLegend.getColor() == null ? color : mapLegend.getColor();
-                image = mapLegend.getImage() == null ? image : mapLegend.getImage();
+                startValue = legend.getStartValue() == null ? startValue : legend.getStartValue();
+                endValue = legend.getEndValue() == null ? endValue : legend.getEndValue();
+                color = legend.getColor() == null ? color : legend.getColor();
+                image = legend.getImage() == null ? image : legend.getImage();
             }
         }
     }

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/LegendService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/LegendService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/LegendService.java	2015-02-24 13:16:58 +0000
@@ -0,0 +1,69 @@
+package org.hisp.dhis.legend;
+
+import java.util.List;
+
+/*
+ * Copyright (c) 2004-2015, 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.
+ */
+
+/**
+ * @author Lars Helge Overland
+ */
+public interface LegendService
+{
+    // -------------------------------------------------------------------------
+    // Legend
+    // -------------------------------------------------------------------------
+
+    int addLegend( Legend legend );
+    
+    void updateLegend( Legend legend );
+    
+    Legend getLegend( int id );
+    
+    Legend getLegend( String uid );
+    
+    void deleteLegend( Legend legend );
+    
+    List<Legend> getAllLegends();
+    
+    // -------------------------------------------------------------------------
+    // LegendSet
+    // -------------------------------------------------------------------------
+
+    int addLegendSet( LegendSet legend );
+    
+    void updateLegendSet( LegendSet legend );
+    
+    LegendSet getLegendSet( int id );
+    
+    LegendSet getLegendSet( String uid );
+    
+    void deleteLegendSet( LegendSet legendSet );
+    
+    List<LegendSet> getAllLegendSets();
+}

=== renamed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java' => 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/LegendSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLegendSet.java	2015-02-05 06:53:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/legend/LegendSet.java	2015-02-24 13:16:58 +0000
@@ -1,4 +1,4 @@
-package org.hisp.dhis.mapping;
+package org.hisp.dhis.legend;
 
 /*
  * Copyright (c) 2004-2015, University of Oslo
@@ -49,25 +49,25 @@
 /**
  * @author Jan Henrik Overland
  */
-@JacksonXmlRootElement( localName = "mapLegendSet", namespace = DxfNamespaces.DXF_2_0 )
-public class MapLegendSet
+@JacksonXmlRootElement( localName = "legendSet", namespace = DxfNamespaces.DXF_2_0 )
+public class LegendSet
     extends BaseIdentifiableObject
 {
     private String symbolizer;
 
     @Scanned
-    private Set<MapLegend> mapLegends = new HashSet<>();
+    private Set<Legend> legends = new HashSet<>();
 
-    public MapLegendSet()
+    public LegendSet()
     {
     }
 
-    public MapLegendSet( String name, String type, String symbolizer, Set<MapLegend> mapLegends,
+    public LegendSet( String name, String type, String symbolizer, Set<Legend> legends,
         Set<Indicator> indicators, Set<DataElement> dataElements )
     {
         this.name = name;
         this.symbolizer = symbolizer;
-        this.mapLegends = mapLegends;
+        this.legends = legends;
     }
 
     // -------------------------------------------------------------------------
@@ -76,7 +76,7 @@
 
     public void removeAllMapLegends()
     {
-        mapLegends.clear();
+        legends.clear();
     }
 
     // -------------------------------------------------------------------------
@@ -98,16 +98,16 @@
 
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlElementWrapper( localName = "mapLegends", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "mapLegend", namespace = DxfNamespaces.DXF_2_0 )
-    public Set<MapLegend> getMapLegends()
+    @JacksonXmlElementWrapper( localName = "legends", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "legend", namespace = DxfNamespaces.DXF_2_0 )
+    public Set<Legend> getLegends()
     {
-        return mapLegends;
+        return legends;
     }
 
-    public void setMapLegends( Set<MapLegend> mapLegends )
+    public void setLegends( Set<Legend> legends )
     {
-        this.mapLegends = mapLegends;
+        this.legends = legends;
     }
 
     @Override
@@ -117,19 +117,19 @@
 
         if ( other.getClass().isInstance( this ) )
         {
-            MapLegendSet mapLegendSet = (MapLegendSet) other;
+            LegendSet legendSet = (LegendSet) other;
 
             if ( MergeStrategy.MERGE_ALWAYS.equals( strategy ) )
             {
-                symbolizer = mapLegendSet.getSymbolizer();
+                symbolizer = legendSet.getSymbolizer();
             }
             else if ( MergeStrategy.MERGE_IF_NOT_NULL.equals( strategy ) )
             {
-                symbolizer = mapLegendSet.getSymbolizer() == null ? symbolizer : mapLegendSet.getSymbolizer();
+                symbolizer = legendSet.getSymbolizer() == null ? symbolizer : legendSet.getSymbolizer();
             }
 
             removeAllMapLegends();
-            mapLegends.addAll( mapLegendSet.getMapLegends() );
+            legends.addAll( legendSet.getLegends() );
         }
     }
 }
\ No newline at end of file

=== 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	2015-02-05 06:53:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2015-02-24 13:16:58 +0000
@@ -33,6 +33,7 @@
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
 import org.hisp.dhis.common.BaseAnalyticalObject;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DimensionalObject;
@@ -44,6 +45,7 @@
 import org.hisp.dhis.common.view.DimensionalView;
 import org.hisp.dhis.common.view.ExportView;
 import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.schema.PropertyType;
@@ -91,7 +93,7 @@
 
     private String colorHigh;
 
-    private MapLegendSet legendSet;
+    private LegendSet legendSet;
 
     private Integer radiusLow;
 
@@ -282,12 +284,12 @@
     @JsonSerialize( as = BaseIdentifiableObject.class )
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public MapLegendSet getLegendSet()
+    public LegendSet getLegendSet()
     {
         return legendSet;
     }
 
-    public void setLegendSet( MapLegendSet legendSet )
+    public void setLegendSet( LegendSet legendSet )
     {
         this.legendSet = legendSet;
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapViewStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapViewStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapViewStore.java	2015-02-24 13:16:58 +0000
@@ -29,6 +29,7 @@
  */
 
 import org.hisp.dhis.common.AnalyticalObjectStore;
+import org.hisp.dhis.legend.LegendSet;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -36,5 +37,5 @@
 public interface MapViewStore
     extends AnalyticalObjectStore<MapView>
 {
-    int countMapLegendSetMapViews( MapLegendSet mapLegendSet );
+    int countLegendSetMapViews( LegendSet legendSet );
 }

=== 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	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2015-02-24 13:16:58 +0000
@@ -28,16 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
+import java.util.List;
+
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
 /**
  * @author Jan Henrik Overland
  * @version $Id$
@@ -63,44 +63,6 @@
     final String MAP_LAYER_TYPE_OVERLAY = "overlay";
 
     // -------------------------------------------------------------------------
-    // MapLegend
-    // -------------------------------------------------------------------------
-
-    void addOrUpdateMapLegend( String name, Double startValue, Double endValue, String color, String image );
-
-    int addMapLegend( MapLegend mapLegend );
-
-    void deleteMapLegend( MapLegend legend );
-
-    MapLegend getMapLegend( int id );
-
-    MapLegend getMapLegend( String uid );
-
-    MapLegend getMapLegendByName( String name );
-
-    Collection<MapLegend> getAllMapLegends();
-
-    // -------------------------------------------------------------------------
-    // MapLegendSet
-    // -------------------------------------------------------------------------
-
-    int addMapLegendSet( MapLegendSet legendSet );
-
-    void updateMapLegendSet( MapLegendSet legendSet );
-
-    void addOrUpdateMapLegendSet( String name, String type, String symbolizer, Set<MapLegend> mapLegends );
-
-    void deleteMapLegendSet( MapLegendSet legendSet );
-
-    MapLegendSet getMapLegendSet( int id );
-
-    MapLegendSet getMapLegendSet( String uid );
-
-    MapLegendSet getMapLegendSetByName( String name );
-
-    Collection<MapLegendSet> getAllMapLegendSets();
-
-    // -------------------------------------------------------------------------
     // Map
     // -------------------------------------------------------------------------
 
@@ -179,5 +141,5 @@
     
     int countOrganisationUnitMapViews( OrganisationUnit organisationUnit );
 
-    int countMapLegendSetMapViews( MapLegendSet mapLegendSet );
+    int countLegendSetMapViews( LegendSet legendSet );
 }
\ No newline at end of file

=== removed directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator'
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLayerNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLayerNameComparator.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLayerNameComparator.java	1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-package org.hisp.dhis.mapping.comparator;
-
-/*
- * Copyright (c) 2004-2015, 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.Comparator;
-
-import org.hisp.dhis.mapping.MapLayer;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class MapLayerNameComparator
-    implements Comparator<MapLayer>
-{
-    @Override
-    public int compare( MapLayer mapLayer0, MapLayer mapLayer1 )
-    {
-        return mapLayer0.getName().compareToIgnoreCase( mapLayer1.getName() );
-    }
-}

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLegendComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLegendComparator.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/comparator/MapLegendComparator.java	1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-package org.hisp.dhis.mapping.comparator;
-
-/*
- * Copyright (c) 2004-2015, 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.Comparator;
-
-import org.hisp.dhis.mapping.MapLegend;
-
-/**
- * @author Tran Thanh Tri
- * @version $Id$
- */
-
-public class MapLegendComparator
-    implements Comparator<MapLegend>
-{
-    @Override
-    public int compare( MapLegend o1, MapLegend o2 )
-    {
-        return o1.getStartValue().compareTo( o2.getStartValue() );
-    }
-}
\ No newline at end of file

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Typed.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Typed.java	2015-02-20 08:28:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Typed.java	2015-02-24 13:16:58 +0000
@@ -28,8 +28,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.schema.Klass;
+
 import com.google.common.collect.Iterators;
-import org.hisp.dhis.schema.Klass;
 
 /**
  * Simple class for checking if an object is one of several allowed classes, mainly used in Operator where
@@ -74,12 +75,12 @@
         return false;
     }
 
-    public static Typed from( Class... klasses )
+    public static Typed from( Class<?>... klasses )
     {
         return new Typed( klasses );
     }
 
-    public static Typed from( Iterable<? extends Class> iterable )
+    public static Typed from( Iterable<? extends Class<?>> iterable )
     {
         return new Typed( Iterators.toArray( iterable.iterator(), Class.class ) );
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2015-02-24 13:16:58 +0000
@@ -28,12 +28,18 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import static org.hisp.dhis.common.DimensionalObject.CATEGORYOPTIONCOMBO_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.DATA_X_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.ORGUNIT_DIM_ID;
+import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.commons.lang3.StringUtils;
 import org.hisp.dhis.common.BaseAnalyticalObject;
 import org.hisp.dhis.common.CombinationGenerator;
@@ -54,20 +60,18 @@
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.RelativePeriods;
 import org.hisp.dhis.user.User;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.hisp.dhis.common.DimensionalObject.*;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 
 /**
  * @author Lars Helge Overland
@@ -185,7 +189,7 @@
     /**
      * The legend set in the table.
      */
-    private MapLegendSet legendSet;
+    private LegendSet legendSet;
 
     /**
      * Indicates showing organisation unit hierarchy names.
@@ -992,12 +996,12 @@
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    public MapLegendSet getLegendSet()
+    public LegendSet getLegendSet()
     {
         return legendSet;
     }
 
-    public void setLegendSet( MapLegendSet legendSet )
+    public void setLegendSet( LegendSet legendSet )
     {
         this.legendSet = legendSet;
     }

=== renamed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/MapLegendSchemaDescriptor.java' => 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/LegendSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/MapLegendSchemaDescriptor.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/LegendSchemaDescriptor.java	2015-02-24 13:16:58 +0000
@@ -28,7 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.mapping.MapLegend;
+import org.hisp.dhis.legend.Legend;
 import org.hisp.dhis.schema.Schema;
 import org.hisp.dhis.schema.SchemaDescriptor;
 import org.springframework.stereotype.Component;
@@ -37,18 +37,18 @@
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 @Component
-public class MapLegendSchemaDescriptor implements SchemaDescriptor
+public class LegendSchemaDescriptor implements SchemaDescriptor
 {
-    public static final String SINGULAR = "mapLegend";
+    public static final String SINGULAR = "legend";
 
-    public static final String PLURAL = "mapLegends";
+    public static final String PLURAL = "legends";
 
     public static final String API_ENDPOINT = "/" + PLURAL;
 
     @Override
     public Schema getSchema()
     {
-        Schema schema = new Schema( MapLegend.class, SINGULAR, PLURAL );
+        Schema schema = new Schema( Legend.class, SINGULAR, PLURAL );
         schema.setApiEndpoint( API_ENDPOINT );
         schema.setOrder( 1070 );
 

=== renamed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/MapLegendSetSchemaDescriptor.java' => 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/LegendSetSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/MapLegendSetSchemaDescriptor.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/LegendSetSchemaDescriptor.java	2015-02-24 13:16:58 +0000
@@ -28,7 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.schema.Schema;
 import org.hisp.dhis.schema.SchemaDescriptor;
 import org.springframework.stereotype.Component;
@@ -37,18 +37,18 @@
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 @Component
-public class MapLegendSetSchemaDescriptor implements SchemaDescriptor
+public class LegendSetSchemaDescriptor implements SchemaDescriptor
 {
-    public static final String SINGULAR = "mapLegendSet";
+    public static final String SINGULAR = "legendSet";
 
-    public static final String PLURAL = "mapLegendSets";
+    public static final String PLURAL = "legendSets";
 
     public static final String API_ENDPOINT = "/" + PLURAL;
 
     @Override
     public Schema getSchema()
     {
-        Schema schema = new Schema( MapLegendSet.class, SINGULAR, PLURAL );
+        Schema schema = new Schema( LegendSet.class, SINGULAR, PLURAL );
         schema.setApiEndpoint( API_ENDPOINT );
         schema.setOrder( 1080 );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java	2015-02-20 07:42:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java	2015-02-24 13:16:58 +0000
@@ -322,7 +322,7 @@
                 lowestApprovalLevelForOrgUnit = dal;
             }
 
-            if ( dal.getOrgUnitLevel() > orgUnitLevel ) // If there is a lower (higher number) approval orgUnit level:
+            if ( dal.getOrgUnitLevel() > orgUnitLevel ) // If there is a lower (higher number) approval orgUnit level.
             {
                 boolean acceptanceRequiredForApproval = (Boolean) systemSettingManager.getSystemSetting( KEY_ACCEPTANCE_REQUIRED_FOR_APPROVAL, false );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java	2015-02-24 13:16:58 +0000
@@ -41,7 +41,6 @@
 
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.i18n.I18nService;
-import org.hisp.dhis.mapping.MapLegendSet;
 import org.hisp.dhis.system.util.Filter;
 import org.hisp.dhis.system.util.FilterUtils;
 import org.springframework.transaction.annotation.Transactional;
@@ -220,12 +219,6 @@
         return getObjectsBetweenByName( i18nService, indicatorStore, name, first, max );
     }
 
-    @Override
-    public int countMapLegendSetIndicators( MapLegendSet mapLegendSet )
-    {
-        return indicatorStore.countMapLegendSetIndicators( mapLegendSet );
-    }
-
     // -------------------------------------------------------------------------
     // IndicatorType
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java	2015-02-24 13:16:58 +0000
@@ -35,7 +35,6 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.expression.ExpressionService;
-import org.hisp.dhis.mapping.MapLegendSet;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
@@ -155,10 +154,4 @@
 
         return null;
     }
-
-    @Override
-    public String allowDeleteMapLegendSet( MapLegendSet mapLegendSet )
-    {
-        return indicatorService.countMapLegendSetIndicators( mapLegendSet ) == 0 ? null : ERROR;
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/hibernate/HibernateIndicatorStore.java	2015-02-24 13:16:58 +0000
@@ -28,13 +28,11 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hibernate.Query;
+import java.util.Collection;
+
 import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorStore;
-import org.hisp.dhis.mapping.MapLegendSet;
-
-import java.util.Collection;
 
 /**
  * @author Lars Helge Overland
@@ -74,13 +72,4 @@
 
         return getQuery( hql ).setCacheable( true ).list();
     }
-
-    @Override
-    public int countMapLegendSetIndicators( MapLegendSet mapLegendSet )
-    {
-        Query query = getQuery( "select count(distinct c) from Indicator c where c.legendSet=:mapLegendSet" );
-        query.setEntity( "mapLegendSet", mapLegendSet );
-
-        return ((Long) query.uniqueResult()).intValue();
-    }
 }

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/DefaultLegendService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/DefaultLegendService.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/DefaultLegendService.java	2015-02-24 13:16:58 +0000
@@ -0,0 +1,110 @@
+package org.hisp.dhis.legend;
+
+import java.util.List;
+
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class DefaultLegendService
+    implements LegendService
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private GenericIdentifiableObjectStore<Legend> legendStore;
+
+    public void setLegendStore( GenericIdentifiableObjectStore<Legend> legendStore )
+    {
+        this.legendStore = legendStore;
+    }
+
+    private GenericIdentifiableObjectStore<LegendSet> legendSetStore;
+
+    public void setLegendSetStore( GenericIdentifiableObjectStore<LegendSet> legendSetStore )
+    {
+        this.legendSetStore = legendSetStore;
+    }
+
+    // -------------------------------------------------------------------------
+    // Legend
+    // -------------------------------------------------------------------------
+
+    @Override
+    public int addLegend( Legend legend )
+    {
+        return legendStore.save( legend );
+    }
+
+    @Override
+    public void updateLegend( Legend legend )
+    {
+        legendStore.update( legend );        
+    }
+
+    @Override
+    public Legend getLegend( int id )
+    {
+        return legendStore.get( id );
+    }
+
+    @Override
+    public Legend getLegend( String uid )
+    {
+        return legendStore.getByUid( uid );
+    }
+    
+    @Override
+    public void deleteLegend( Legend legend )
+    {
+        legendStore.delete( legend );
+    }
+
+    @Override
+    public List<Legend> getAllLegends()
+    {
+        return legendStore.getAll();
+    }
+
+    // -------------------------------------------------------------------------
+    // LegendSet
+    // -------------------------------------------------------------------------
+
+    @Override
+    public int addLegendSet( LegendSet legend )
+    {
+        return legendSetStore.save( legend );
+    }
+
+    @Override
+    public void updateLegendSet( LegendSet legend )
+    {
+        legendSetStore.update( legend );
+    }
+
+    @Override
+    public LegendSet getLegendSet( int id )
+    {
+        return legendSetStore.get( id );
+    }
+
+    @Override
+    public LegendSet getLegendSet( String uid )
+    {
+        return legendSetStore.getByUid( uid );
+    }
+    
+    @Override
+    public void deleteLegendSet( LegendSet legendSet )
+    {
+        legendSetStore.delete( legendSet );
+    }
+
+    @Override
+    public List<LegendSet> getAllLegendSets()
+    {
+        return legendSetStore.getAll();
+    }
+}

=== renamed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapLegendSetDeletionHandler.java' => 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/LegendSetDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapLegendSetDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/legend/LegendSetDeletionHandler.java	2015-02-24 13:16:58 +0000
@@ -1,4 +1,4 @@
-package org.hisp.dhis.mapping;
+package org.hisp.dhis.legend;
 
 /*
  * Copyright (c) 2004-2015, University of Oslo
@@ -28,25 +28,24 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.legend.Legend;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
-public class MapLegendSetDeletionHandler
+public class LegendSetDeletionHandler
     extends DeletionHandler
 {
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private MappingService mappingService;
-
-    public void setMappingService( MappingService mappingService )
-    {
-        this.mappingService = mappingService;
-    }
+    @Autowired
+    private LegendService legendService;
 
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
@@ -55,17 +54,17 @@
     @Override
     protected String getClassName()
     {
-        return MapLegendSet.class.getSimpleName();
+        return LegendSet.class.getSimpleName();
     }
 
     @Override
-    public void deleteMapLegend( MapLegend mapLegend )
+    public void deleteLegend( Legend legend )
     {
-        for ( MapLegendSet legendSet : mappingService.getAllMapLegendSets() )
+        for ( LegendSet legendSet : legendService.getAllLegendSets() )
         {
-            if ( legendSet.getMapLegends().remove( mapLegend ) )
+            if ( legendSet.getLegends().remove( legend ) )
             {
-                mappingService.updateMapLegendSet( legendSet );
+                legendService.updateLegendSet( legendSet );
             }
         }
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2015-02-24 13:16:58 +0000
@@ -29,15 +29,13 @@
  */
 
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
@@ -77,20 +75,6 @@
         this.mapLayerStore = mapLayerStore;
     }
 
-    private GenericIdentifiableObjectStore<MapLegend> mapLegendStore;
-
-    public void setMapLegendStore( GenericIdentifiableObjectStore<MapLegend> mapLegendStore )
-    {
-        this.mapLegendStore = mapLegendStore;
-    }
-
-    private GenericIdentifiableObjectStore<MapLegendSet> mapLegendSetStore;
-
-    public void setMapLegendSetStore( GenericIdentifiableObjectStore<MapLegendSet> mapLegendSetStore )
-    {
-        this.mapLegendSetStore = mapLegendSetStore;
-    }
-
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -117,139 +101,6 @@
     // -------------------------------------------------------------------------
 
     // -------------------------------------------------------------------------
-    // MapLegend
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void addOrUpdateMapLegend( String name, Double startValue, Double endValue, String color, String image )
-    {
-        MapLegend mapLegend = getMapLegendByName( name );
-
-        if ( mapLegend != null )
-        {
-            mapLegend.setName( name );
-            mapLegend.setStartValue( startValue );
-            mapLegend.setEndValue( endValue );
-            mapLegend.setColor( color );
-            mapLegend.setImage( image );
-
-            mapLegendStore.update( mapLegend );
-        }
-        else
-        {
-            mapLegend = new MapLegend( name, startValue, endValue, color, image );
-
-            mapLegendStore.save( mapLegend );
-        }
-    }
-
-    @Override
-    public int addMapLegend( MapLegend mapLegend )
-    {
-        return mapLegendStore.save( mapLegend );
-    }
-
-    @Override
-    public void deleteMapLegend( MapLegend mapLegend )
-    {
-        mapLegendStore.delete( mapLegend );
-    }
-
-    @Override
-    public MapLegend getMapLegend( int id )
-    {
-        return mapLegendStore.get( id );
-    }
-
-    @Override
-    public MapLegend getMapLegend( String uid )
-    {
-        return mapLegendStore.getByUid( uid );
-    }
-
-    @Override
-    public MapLegend getMapLegendByName( String name )
-    {
-        return mapLegendStore.getByName( name );
-    }
-
-    @Override
-    public Collection<MapLegend> getAllMapLegends()
-    {
-        return mapLegendStore.getAll();
-    }
-
-    // -------------------------------------------------------------------------
-    // MapLegendSet
-    // -------------------------------------------------------------------------
-
-    @Override
-    public int addMapLegendSet( MapLegendSet mapLegendSet )
-    {
-        return mapLegendSetStore.save( mapLegendSet );
-    }
-
-    @Override
-    public void updateMapLegendSet( MapLegendSet mapLegendSet )
-    {
-        mapLegendSetStore.update( mapLegendSet );
-    }
-
-    @Override
-    public void addOrUpdateMapLegendSet( String name, String type, String symbolizer, Set<MapLegend> mapLegends )
-    {
-        MapLegendSet mapLegendSet = getMapLegendSetByName( name );
-
-        Set<Indicator> indicators = new HashSet<>();
-
-        Set<DataElement> dataElements = new HashSet<>();
-
-        if ( mapLegendSet != null )
-        {
-            mapLegendSet.setSymbolizer( symbolizer );
-            mapLegendSet.setMapLegends( mapLegends );
-
-            mapLegendSetStore.update( mapLegendSet );
-        }
-        else
-        {
-            mapLegendSet = new MapLegendSet( name, type, symbolizer, mapLegends, indicators, dataElements );
-
-            mapLegendSetStore.save( mapLegendSet );
-        }
-    }
-
-    @Override
-    public void deleteMapLegendSet( MapLegendSet mapLegendSet )
-    {
-        mapLegendSetStore.delete( mapLegendSet );
-    }
-
-    @Override
-    public MapLegendSet getMapLegendSet( int id )
-    {
-        return mapLegendSetStore.get( id );
-    }
-
-    @Override
-    public MapLegendSet getMapLegendSet( String uid )
-    {
-        return mapLegendSetStore.getByUid( uid );
-    }
-
-    @Override
-    public MapLegendSet getMapLegendSetByName( String name )
-    {
-        return mapLegendSetStore.getByName( name );
-    }
-
-    @Override
-    public Collection<MapLegendSet> getAllMapLegendSets()
-    {
-        return mapLegendSetStore.getAll();
-    }
-
-    // -------------------------------------------------------------------------
     // Map
     // -------------------------------------------------------------------------
 
@@ -528,8 +379,8 @@
     }
 
     @Override
-    public int countMapLegendSetMapViews( MapLegendSet mapLegendSet )
+    public int countLegendSetMapViews( LegendSet legendSet )
     {
-        return mapViewStore.countMapLegendSetMapViews( mapLegendSet );
+        return mapViewStore.countLegendSetMapViews( legendSet );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java	2015-02-24 13:16:58 +0000
@@ -31,13 +31,13 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class MapViewDeletionHandler
     extends DeletionHandler
@@ -100,8 +100,8 @@
     }
 
     @Override
-    public String allowDeleteMapLegendSet( MapLegendSet mapLegendSet )
+    public String allowDeleteLegendSet( LegendSet legendSet )
     {
-        return mappingService.countMapLegendSetMapViews( mapLegendSet ) == 0 ? null : ERROR;
+        return mappingService.countLegendSetMapViews( legendSet ) == 0 ? null : ERROR;
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapViewStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapViewStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMapViewStore.java	2015-02-24 13:16:58 +0000
@@ -30,7 +30,7 @@
 
 import org.hibernate.Query;
 import org.hisp.dhis.common.hibernate.HibernateAnalyticalObjectStore;
-import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.mapping.MapViewStore;
 
@@ -41,10 +41,10 @@
     extends HibernateAnalyticalObjectStore<MapView> implements MapViewStore
 {
     @Override
-    public int countMapLegendSetMapViews( MapLegendSet mapLegendSet )
+    public int countLegendSetMapViews( LegendSet legendSet )
     {
-        Query query = getQuery( "select count(distinct c) from MapView c where c.legendSet=:mapLegendSet" );
-        query.setEntity( "mapLegendSet", mapLegendSet );
+        Query query = getQuery( "select count(distinct c) from MapView c where c.legendSet=:legendSet" );
+        query.setEntity( "legendSet", legendSet );
 
         return ((Long) query.uniqueResult()).intValue();
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-02-18 13:08:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2015-02-24 13:16:58 +0000
@@ -380,15 +380,15 @@
     <property name="sessionFactory" ref="sessionFactory" />
   </bean>
 
-  <bean id="org.hisp.dhis.mapping.MapLegendStore"
+  <bean id="org.hisp.dhis.legend.LegendStore"
     class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
-    <property name="clazz" value="org.hisp.dhis.mapping.MapLegend" />
+    <property name="clazz" value="org.hisp.dhis.legend.Legend" />
     <property name="sessionFactory" ref="sessionFactory" />
   </bean>
 
-  <bean id="org.hisp.dhis.mapping.MapLegendSetStore"
+  <bean id="org.hisp.dhis.legend.LegendSetStore"
     class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
-    <property name="clazz" value="org.hisp.dhis.mapping.MapLegendSet" />
+    <property name="clazz" value="org.hisp.dhis.legend.LegendSet" />
     <property name="sessionFactory" ref="sessionFactory" />
   </bean>
 
@@ -680,12 +680,15 @@
     <property name="mapStore" ref="org.hisp.dhis.mapping.MapStore" />
     <property name="mapViewStore" ref="org.hisp.dhis.mapping.MapViewStore" />
     <property name="mapLayerStore" ref="org.hisp.dhis.mapping.MapLayerStore" />
-    <property name="mapLegendStore" ref="org.hisp.dhis.mapping.MapLegendStore" />
-    <property name="mapLegendSetStore" ref="org.hisp.dhis.mapping.MapLegendSetStore" />
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
   </bean>
+  
+  <bean id="org.hisp.dhis.legend.LegendService" class="org.hisp.dhis.legend.DefaultLegendService">
+    <property name="legendStore" ref="org.hisp.dhis.legend.LegendStore" />
+    <property name="legendSetStore" ref="org.hisp.dhis.legend.LegendSetStore" />
+  </bean>
 
   <bean id="org.hisp.dhis.setting.SystemSettingManager" class="org.hisp.dhis.setting.DefaultSystemSettingManager">
     <property name="systemSettingStore" ref="org.hisp.dhis.setting.SystemSettingStore" />
@@ -1172,9 +1175,7 @@
     <property name="jdbcTemplate" ref="jdbcTemplate" />
   </bean>
 
-  <bean id="org.hisp.dhis.mapping.MapLegendSetDeletionHandler" class="org.hisp.dhis.mapping.MapLegendSetDeletionHandler">
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
-  </bean>
+  <bean id="org.hisp.dhis.legend.LegendSetDeletionHandler" class="org.hisp.dhis.legend.LegendSetDeletionHandler"/>
 
   <bean id="org.hisp.dhis.mapping.MapViewDeletionHandler" class="org.hisp.dhis.mapping.MapViewDeletionHandler">
     <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
@@ -1232,7 +1233,7 @@
           <ref bean="org.hisp.dhis.message.MessageConversationDeletionHandler" />
           <ref bean="org.hisp.dhis.translation.TranslationDeletionHandler" />
           <ref bean="org.hisp.dhis.attribute.AttributeValueDeletionHandler" />
-          <ref bean="org.hisp.dhis.mapping.MapLegendSetDeletionHandler" />
+          <ref bean="org.hisp.dhis.legend.LegendSetDeletionHandler" />
           <ref bean="org.hisp.dhis.mapping.MapViewDeletionHandler" />
         </list>
       </list>
@@ -1260,8 +1261,8 @@
       <aop:before pointcut="execution( * org.hisp.dhis.user.UserGroupService.delete*(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.option.OptionService.delete*(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.attribute.AttributeService.delete*(..) )" method="intercept" />
-      <aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteMapLegend(..) )" method="intercept" />
-      <aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteMapLegendSet(..) )" method="intercept" />
+      <aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteLegend(..) )" method="intercept" />
+      <aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteLegendSet(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteMapView(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.mapping.MappingService.deleteMap(..) )" method="intercept" />
       <aop:before pointcut="execution( * org.hisp.dhis.i18n.I18nLocaleService.delete*(..) )" method="intercept" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2014-09-15 20:06:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2015-02-24 13:16:58 +0000
@@ -72,7 +72,7 @@
     <many-to-one name="commentOptionSet" class="org.hisp.dhis.option.OptionSet" column="commentoptionsetid"
       foreign-key="fk_dataelement_commentoptionsetid" />
 
-    <many-to-one name="legendSet" class="org.hisp.dhis.mapping.MapLegendSet" column="legendsetid"
+    <many-to-one name="legendSet" class="org.hisp.dhis.legend.LegendSet" column="legendsetid"
       foreign-key="fk_dataelement_legendset" />
 
     <!-- Access properties -->

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2014-11-29 05:27:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2015-02-24 13:16:58 +0000
@@ -109,7 +109,7 @@
       <many-to-many class="org.hisp.dhis.user.UserGroupAccess" column="usergroupaccessid" unique="true" />
     </set>
 
-    <many-to-one name="legendSet" class="org.hisp.dhis.mapping.MapLegendSet" column="legendsetid"
+    <many-to-one name="legendSet" class="org.hisp.dhis.legend.LegendSet" column="legendsetid"
       foreign-key="fk_dataset_legendset" />
 
     <!-- Dynamic attribute values -->

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml	2015-01-09 13:25:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml	2015-02-24 13:16:58 +0000
@@ -69,7 +69,7 @@
       <many-to-many class="org.hisp.dhis.attribute.AttributeValue" column="attributevalueid" unique="true" />
     </set>
 
-    <many-to-one name="legendSet" class="org.hisp.dhis.mapping.MapLegendSet" column="legendsetid"
+    <many-to-one name="legendSet" class="org.hisp.dhis.legend.LegendSet" column="legendsetid"
       foreign-key="fk_indicator_legendset" />
 
   </class>

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend'
=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate'
=== renamed file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegend.hbm.xml' => 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/Legend.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegend.hbm.xml	2015-02-17 21:46:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/Legend.hbm.xml	2015-02-24 13:16:58 +0000
@@ -6,7 +6,7 @@
   >
 
 <hibernate-mapping>
-  <class name="org.hisp.dhis.mapping.MapLegend" table="maplegend">
+  <class name="org.hisp.dhis.legend.Legend" table="maplegend">
 
     <id name="id" column="maplegendid">
       <generator class="native" />

=== renamed file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml' => 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/LegendSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml	2013-02-07 10:25:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/legend/hibernate/LegendSet.hbm.xml	2015-02-24 13:16:58 +0000
@@ -6,7 +6,7 @@
 >
 
 <hibernate-mapping>
-  <class name="org.hisp.dhis.mapping.MapLegendSet" table="maplegendset">
+  <class name="org.hisp.dhis.legend.LegendSet" table="maplegendset">
 
     <id name="id" column="maplegendsetid">
       <generator class="native" />
@@ -17,9 +17,9 @@
 
     <property name="symbolizer" column="symbolizer" />
 
-    <set name="mapLegends" table="maplegendsetmaplegend">
+    <set name="legends" table="maplegendsetmaplegend">
       <key column="legendsetid" foreign-key="fk_maplegendsetmaplegend_legendsetid" />
-      <many-to-many column="maplegendid" class="org.hisp.dhis.mapping.MapLegend" foreign-key="fk_maplegendset_maplegend" />
+      <many-to-many column="maplegendid" class="org.hisp.dhis.legend.Legend" foreign-key="fk_maplegendset_maplegend" />
     </set>
 
   </class>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2014-07-02 14:26:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2015-02-24 13:16:58 +0000
@@ -100,7 +100,7 @@
 
     <property name="colorHigh" />
 
-    <many-to-one name="legendSet" class="org.hisp.dhis.mapping.MapLegendSet" column="legendsetid"
+    <many-to-one name="legendSet" class="org.hisp.dhis.legend.LegendSet" column="legendsetid"
       foreign-key="fk_mapview_maplegendsetid" />
 
     <property name="radiusLow" />

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/legend'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/legend/LegendServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/legend/LegendServiceTest.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/legend/LegendServiceTest.java	2015-02-24 13:16:58 +0000
@@ -0,0 +1,94 @@
+package org.hisp.dhis.legend;
+
+/*
+ * Copyright (c) 2004-2015, 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 org.hisp.dhis.DhisSpringTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import static org.junit.Assert.*;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class LegendServiceTest
+    extends DhisSpringTest
+{
+    @Autowired
+    private LegendService legendService;
+
+    private Legend legendA;
+    private Legend legendB;
+    
+    private LegendSet legendSetA;
+    
+    @Test
+    public void testAddGetLegend()
+    {
+        legendA = createLegend( 'A', 0d, 10d );
+        legendB = createLegend( 'B', 0d, 10d );
+        
+        int idA = legendService.addLegend( legendA );
+        int idB = legendService.addLegend( legendB );
+        
+        assertEquals( legendA, legendService.getLegend( idA ) );
+        assertEquals( legendB, legendService.getLegend( idB ) );
+    }
+    
+    @Test
+    public void testDeleteLegend()
+    {
+        //TODO
+    }
+    
+    @Test
+    public void testAddGetLegendSet()
+    {
+        legendA = createLegend( 'A', 0d, 10d );
+        legendB = createLegend( 'B', 0d, 10d );
+        
+        legendService.addLegend( legendA );
+        legendService.addLegend( legendB );
+        
+        legendSetA = createLegendSet( 'A' );
+        legendSetA.getLegends().add( legendA );
+        legendSetA.getLegends().add( legendB );
+        
+        int idA = legendService.addLegendSet( legendSetA );
+        
+        assertEquals( legendSetA, legendService.getLegendSet( idA ) );
+        assertEquals( 2, legendService.getLegendSet( idA ).getLegends().size() );
+    }
+    
+    @Test
+    public void testDeleteLegendSet()
+    {
+        //TODO
+    }   
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java	2015-02-24 13:16:58 +0000
@@ -28,15 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
-import java.util.Collection;
-import java.util.HashSet;
-
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementGroup;
@@ -57,7 +48,6 @@
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class MappingServiceTest
     extends DhisSpringTest
@@ -91,8 +81,6 @@
 
     private Period period;
 
-    private MapLegendSet mapLegendSet;
-
     // -------------------------------------------------------------------------
     // Fixture
     // -------------------------------------------------------------------------
@@ -125,155 +113,17 @@
         periodType = periodService.getPeriodTypeByName( MonthlyPeriodType.NAME );
         period = createPeriod( periodType, getDate( 2000, 1, 1 ), getDate( 2000, 2, 1 ) );
         periodService.addPeriod( period );
-
-        mapLegendSet = createMapLegendSet( 'A' );
-        mappingService.addMapLegendSet( mapLegendSet );
-    }
-
-    // -------------------------------------------------------------------------
-    // MapLegend
-    // -------------------------------------------------------------------------
-
-    @Test
-    public void testGetAddOrUpdateMapLegend()
-    {
-        MapLegend legend = createMapLegend( 'A', 0.1, 0.2 );
-
-        mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), legend.getEndValue(),
-            legend.getColor(), legend.getImage() );
-
-        legend = mappingService.getMapLegendByName( legend.getName() );
-
-        assertNotNull( legend );
-
-        int id = legend.getId();
-
-        mappingService.addOrUpdateMapLegend( legend.getName(), legend.getStartValue(), 0.3, "ColorB", "img.png" );
-
-        assertEquals( "MapLegendA", mappingService.getMapLegend( id ).getName() );
-        assertEquals( new Double( 0.1 ), mappingService.getMapLegend( id ).getStartValue() );
-        assertEquals( new Double( 0.3 ), mappingService.getMapLegend( id ).getEndValue() );
-        assertEquals( "ColorB", mappingService.getMapLegend( id ).getColor() );
-        assertEquals( "img.png", mappingService.getMapLegend( id ).getImage() );
-    }
-
-    @Test
-    public void testDeleteMapLegend()
-    {
-        MapLegend legend = createMapLegend( 'A', 0.1, 0.2 );
-
-        int id = mappingService.addMapLegend( legend );
-
-        legend = mappingService.getMapLegend( id );
-        
-        assertNotNull( legend );
-
-        mappingService.deleteMapLegend( legend );
-
-        assertNull( mappingService.getMapLegend( id ) );
-    }
-
-    @Test
-    public void testGetAllMapLegends()
-    {
-        MapLegend legend1 = createMapLegend( 'A', 0.1, 0.2 );
-        MapLegend legend2 = createMapLegend( 'B', 0.3, 0.4 );
-        MapLegend legend3 = createMapLegend( 'C', 0.5, 0.6 );
-
-        mappingService.addMapLegend( legend1 );
-        mappingService.addMapLegend( legend3 );
-
-        Collection<MapLegend> legends = mappingService.getAllMapLegends();
-        
-        assertEquals( 2, legends.size() );
-        assertTrue( legends.contains( legend1 ) );
-        assertTrue( legends.contains( legend3 ) );
-        assertFalse( legends.contains( legend2 ) );
-    }
-
-    @Test
-    public void testGetMapLegendsByName()
-    {
-        MapLegend legend1 = createMapLegend( 'A', 0.1, 0.2 );
-        MapLegend legend2 = createMapLegend( 'B', 0.3, 0.4 );
-        
-        mappingService.addMapLegend( legend1 );
-        mappingService.addMapLegend( legend2 );
-        
-        assertNotNull( mappingService.getMapLegendByName( "MapLegendA" ) );
-        assertNotNull( mappingService.getMapLegendByName( "MapLegendB" ) );
-        assertNull( mappingService.getMapLegendByName( "MapLegendC" ) );
-    }
-
-    // -------------------------------------------------------------------------
-    // MapLegendSet
-    // -------------------------------------------------------------------------
-
-    @Test
-    public void testAddGetMapLegendSet()
-    {
-        MapLegendSet legendSet = createMapLegendSet( 'B' );
-
-        int id = mappingService.addMapLegendSet( legendSet );
-
-        assertNotNull( mappingService.getMapLegendSet( id ) );
-    }
-
-    @Test
-    public void testGetUpdateMapLegendSet()
-    {
-        MapLegendSet legendSet = createMapLegendSet( 'F' );
-        legendSet.setSymbolizer( "SymbolF" );
-
-        int id = mappingService.addMapLegendSet( legendSet );
-
-        legendSet = mappingService.getMapLegendSet( id );
-
-        assertNotNull( legendSet );
-        assertEquals( "SymbolF", legendSet.getSymbolizer() );
-
-        legendSet.setSymbolizer( "SymbolG" );
-
-        mappingService.updateMapLegendSet( legendSet );
-
-        legendSet = mappingService.getMapLegendSet( id );
-
-        assertNotNull( legendSet );
-        assertEquals( "SymbolG", legendSet.getSymbolizer() );
-    }
-
-    @Test
-    public void testGetAllMapLegendSets()
-    {
-        MapLegendSet legendSet1 = createMapLegendSet( 'B' );
-        MapLegendSet legendSet2 = createMapLegendSet( 'C' );
-        MapLegendSet legendSet3 = createMapLegendSet( 'D' );
-
-        Collection<MapLegendSet> mapLegendSets = new HashSet<>();
-
-        mapLegendSets.add( mapLegendSet );
-        mapLegendSets.add( legendSet1 );
-        mapLegendSets.add( legendSet2 );
-        mapLegendSets.add( legendSet3 );
-
-        mappingService.addMapLegendSet( legendSet1 );
-        mappingService.addMapLegendSet( legendSet2 );
-        mappingService.addMapLegendSet( legendSet3 );
-
-        assertTrue( mappingService.getAllMapLegendSets().containsAll( mapLegendSets ) );
-    }
-
-    @Test
-    public void testGetMapLegendSetByName()
-    {
-        MapLegendSet legendSet1 = createMapLegendSet( 'B' );
-        MapLegendSet legendSet2 = createMapLegendSet( 'C' );
-
-        mappingService.addMapLegendSet( legendSet1 );
-        mappingService.addMapLegendSet( legendSet2 );
-
-        assertNotNull( mappingService.getMapLegendSetByName( "MapLegendSetB" ) );
-        assertNotNull( mappingService.getMapLegendSetByName( "MapLegendSetC" ) );
-        assertNull( mappingService.getMapLegendSetByName( "MapLegendSetD" ) );
+    }
+    
+    @Test
+    public void testAddGetMap()
+    {
+        //TODO
+    }
+
+    @Test
+    public void testDeleteMap()
+    {
+        //TODO
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java	2015-02-13 07:14:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java	2015-02-24 13:16:58 +0000
@@ -63,10 +63,10 @@
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.interpretation.Interpretation;
+import org.hisp.dhis.legend.Legend;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.mapping.Map;
 import org.hisp.dhis.mapping.MapLayer;
-import org.hisp.dhis.mapping.MapLegend;
-import org.hisp.dhis.mapping.MapLegendSet;
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.message.MessageConversation;
 import org.hisp.dhis.option.Option;
@@ -193,9 +193,9 @@
 
     private List<MapView> mapViews = new ArrayList<>();
 
-    private List<MapLegend> mapLegends = new ArrayList<>();
+    private List<Legend> legends = new ArrayList<>();
 
-    private List<MapLegendSet> mapLegendSets = new ArrayList<>();
+    private List<LegendSet> legendSets = new ArrayList<>();
 
     private List<MapLayer> mapLayers = new ArrayList<>();
 
@@ -807,29 +807,29 @@
     }
 
     @JsonProperty
-    @JacksonXmlElementWrapper( localName = "mapLegends", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "mapLegend", namespace = DxfNamespaces.DXF_2_0 )
-    public List<MapLegend> getMapLegends()
+    @JacksonXmlElementWrapper( localName = "legends", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "legend", namespace = DxfNamespaces.DXF_2_0 )
+    public List<Legend> getLegends()
     {
-        return mapLegends;
+        return legends;
     }
 
-    public void setMapLegends( List<MapLegend> mapLegends )
+    public void setLegends( List<Legend> legends )
     {
-        this.mapLegends = mapLegends;
+        this.legends = legends;
     }
 
     @JsonProperty
-    @JacksonXmlElementWrapper( localName = "mapLegendSets", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "mapLegendSet", namespace = DxfNamespaces.DXF_2_0 )
-    public List<MapLegendSet> getMapLegendSets()
+    @JacksonXmlElementWrapper( localName = "legendSets", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "legendSet", namespace = DxfNamespaces.DXF_2_0 )
+    public List<LegendSet> getLegendSets()
     {
-        return mapLegendSets;
+        return legendSets;
     }
 
-    public void setMapLegendSets( List<MapLegendSet> mapLegendSets )
+    public void setLegendSets( List<LegendSet> legendSets )
     {
-        this.mapLegendSets = mapLegendSets;
+        this.legendSets = legendSets;
     }
 
     @JsonProperty
@@ -1084,8 +1084,8 @@
             ", reportTables=" + reportTables +
             ", maps=" + maps +
             ", mapViews=" + mapViews +
-            ", mapLegends=" + mapLegends +
-            ", mapLegendSets=" + mapLegendSets +
+            ", legends=" + legends +
+            ", legendSets=" + legendSets +
             ", mapLayers=" + mapLayers +
             ", sections=" + sections +
             ", dataSets=" + dataSets +

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml	2015-02-13 08:31:40 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/resources/META-INF/dhis/beans.xml	2015-02-24 13:16:58 +0000
@@ -160,12 +160,12 @@
     <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapView" />
   </bean>
 
-  <bean id="mapLegendImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapLegend" />
+  <bean id="legendImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.legend.Legend" />
   </bean>
 
-  <bean id="mapLegendSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapLegendSet" />
+  <bean id="legendSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.legend.LegendSet" />
   </bean>
 
   <bean id="mapLayerImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java	2015-02-22 20:02:00 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapLayer.java	2015-02-24 13:16:58 +0000
@@ -34,8 +34,6 @@
 import java.util.List;
 
 import org.hisp.dhis.mapgeneration.comparator.IntervalLowValueAscComparator;
-import org.hisp.dhis.mapping.MapLegend;
-import org.hisp.dhis.mapping.MapLegendSet;
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
@@ -216,11 +214,11 @@
      * 
      * @param legendSet the legend set.
      */
-    public void setIntervalSetFromLegendSet( MapLegendSet legendSet )
+    public void setIntervalSetFromLegendSet( org.hisp.dhis.legend.LegendSet legendSet )
     {
         IntervalSet intervalSet = new IntervalSet();
         
-        for ( MapLegend legend : legendSet.getMapLegends() )
+        for ( org.hisp.dhis.legend.Legend legend : legendSet.getLegends() )
         {
             Color color = MapUtils.createColorFromString( legend.getColor() );
             

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2014-10-14 06:43:28 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml	2015-02-24 13:16:58 +0000
@@ -175,7 +175,7 @@
 
     <property name="userOrganisationUnitGrandChildren" />
 
-    <many-to-one name="legendSet" class="org.hisp.dhis.mapping.MapLegendSet" column="legendsetid"
+    <many-to-one name="legendSet" class="org.hisp.dhis.legend.LegendSet" column="legendsetid"
       foreign-key="fk_reporttable_legendsetid" />
 
     <property name="showHierarchy" />

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapLayerTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapLayerTest.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapLayerTest.java	2015-02-24 13:16:58 +0000
@@ -40,8 +40,7 @@
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.mapgeneration.InternalMapLayer;
-import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.legend.LegendService;
 import org.hisp.dhis.mapping.MappingService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -75,6 +74,9 @@
     @Autowired
     private PeriodService periodService;
 
+    @Autowired
+    private LegendService legendService;
+    
     private OrganisationUnit organisationUnit;
     
     private InternalMapLayer internalMapLayer;
@@ -95,7 +97,7 @@
 
     private Period period;
 
-    private MapLegendSet mapLegendSet;
+    private org.hisp.dhis.legend.LegendSet mapLegendSet;
 
     @Override
     public void setUpTest()
@@ -126,8 +128,8 @@
         period = createPeriod( periodType, getDate( 2000, 1, 1 ), getDate( 2000, 2, 1 ) );
         periodService.addPeriod( period );
 
-        mapLegendSet = createMapLegendSet( 'A' );
-        mappingService.addMapLegendSet( mapLegendSet );
+        mapLegendSet = createLegendSet( 'A' );
+        legendService.addLegendSet( mapLegendSet );
 
         internalMapLayer = new InternalMapLayer();
         internalMapLayer.setRadiusLow( 15 );

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java	2015-02-24 13:16:58 +0000
@@ -61,9 +61,9 @@
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.interpretation.Interpretation;
+import org.hisp.dhis.legend.Legend;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.mapping.Map;
-import org.hisp.dhis.mapping.MapLegend;
-import org.hisp.dhis.mapping.MapLegendSet;
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.minmax.MinMaxDataElement;
 import org.hisp.dhis.option.OptionSet;
@@ -461,20 +461,20 @@
         return null;
     }
 
-    public void deleteMapLegend( MapLegend mapLegend )
+    public void deleteLegend( Legend mapLegend )
     {
     }
 
-    public String allowDeleteMapLegend( MapLegend mapLegend )
+    public String allowDeleteLegend( Legend mapLegend )
     {
         return null;
     }
 
-    public void deleteMapLegendSet( MapLegendSet mapLegendSet )
+    public void deleteLegendSet( LegendSet legendSet )
     {
     }
 
-    public String allowDeleteMapLegendSet( MapLegendSet mapLegendSet )
+    public String allowDeleteLegendSet( LegendSet legendSet )
     {
         return null;
     }

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-02-11 22:32:01 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2015-02-24 13:16:58 +0000
@@ -75,8 +75,8 @@
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.mapping.MapLegend;
-import org.hisp.dhis.mapping.MapLegendSet;
+import org.hisp.dhis.legend.Legend;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
@@ -994,12 +994,12 @@
         return importDataValue;
     }
 
-    public static MapLegend createMapLegend( char uniqueCharacter, Double startValue, Double endValue )
+    public static Legend createLegend( char uniqueCharacter, Double startValue, Double endValue )
     {
-        MapLegend legend = new MapLegend();
+        Legend legend = new Legend();
         legend.setAutoFields();
 
-        legend.setName( "MapLegend" + uniqueCharacter );
+        legend.setName( "Legend" + uniqueCharacter );
         legend.setStartValue( startValue );
         legend.setEndValue( endValue );
         legend.setColor( "Color" + uniqueCharacter );
@@ -1007,12 +1007,12 @@
         return legend;
     }
 
-    public static MapLegendSet createMapLegendSet( char uniqueCharacter )
+    public static LegendSet createLegendSet( char uniqueCharacter )
     {
-        MapLegendSet legendSet = new MapLegendSet();
+        LegendSet legendSet = new LegendSet();
         legendSet.setAutoFields();
 
-        legendSet.setName( "MapLegendSet" + uniqueCharacter );
+        legendSet.setName( "LegendSet" + uniqueCharacter );
 
         return legendSet;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java	2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java	2015-02-24 13:16:58 +0000
@@ -44,6 +44,7 @@
 import org.hisp.dhis.dxf2.common.JacksonUtils;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.i18n.I18nManager;
+import org.hisp.dhis.legend.LegendService;
 import org.hisp.dhis.mapping.MappingService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -84,6 +85,9 @@
 
     @Autowired
     private MappingService mappingService;
+    
+    @Autowired
+    private LegendService legendService;
 
     @Autowired
     private I18nManager i18nManager;
@@ -304,7 +308,7 @@
 
         if ( reportTable.getLegendSet() != null )
         {
-            reportTable.setLegendSet( mappingService.getMapLegendSet( reportTable.getLegendSet().getUid() ) );
+            reportTable.setLegendSet( legendService.getLegendSet( reportTable.getLegendSet().getUid() ) );
         }
     }
 }

=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend'
=== renamed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapLegendController.java' => 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapLegendController.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendController.java	2015-02-24 13:16:58 +0000
@@ -1,4 +1,4 @@
-package org.hisp.dhis.webapi.controller.mapping;
+package org.hisp.dhis.webapi.controller.legend;
 
 /*
  * Copyright (c) 2004-2015, University of Oslo
@@ -28,8 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.mapping.MapLegend;
-import org.hisp.dhis.schema.descriptors.MapLegendSchemaDescriptor;
+import org.hisp.dhis.legend.Legend;
+import org.hisp.dhis.schema.descriptors.LegendSchemaDescriptor;
 import org.hisp.dhis.webapi.controller.AbstractCrudController;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -38,8 +38,8 @@
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 @Controller
-@RequestMapping( value = MapLegendSchemaDescriptor.API_ENDPOINT )
-public class MapLegendController
-    extends AbstractCrudController<MapLegend>
+@RequestMapping( value = LegendSchemaDescriptor.API_ENDPOINT )
+public class LegendController
+    extends AbstractCrudController<Legend>
 {
 }

=== renamed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapLegendSetController.java' => 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapLegendSetController.java	2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java	2015-02-24 13:16:58 +0000
@@ -1,4 +1,4 @@
-package org.hisp.dhis.webapi.controller.mapping;
+package org.hisp.dhis.webapi.controller.legend;
 
 /*
  * Copyright (c) 2004-2015, University of Oslo
@@ -28,12 +28,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import org.hisp.dhis.common.MergeStrategy;
 import org.hisp.dhis.dxf2.common.JacksonUtils;
-import org.hisp.dhis.mapping.MapLegend;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.schema.descriptors.MapLegendSetSchemaDescriptor;
+import org.hisp.dhis.legend.Legend;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
+import org.hisp.dhis.schema.descriptors.LegendSetSchemaDescriptor;
 import org.hisp.dhis.webapi.controller.AbstractCrudController;
 import org.hisp.dhis.webapi.utils.ContextUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,36 +48,32 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Iterator;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 @Controller
-@RequestMapping( value = MapLegendSetSchemaDescriptor.API_ENDPOINT )
-public class MapLegendSetController
-    extends AbstractCrudController<MapLegendSet>
+@RequestMapping( value = LegendSetSchemaDescriptor.API_ENDPOINT )
+public class LegendSetController
+    extends AbstractCrudController<LegendSet>
 {
     @Autowired
-    private MappingService mappingService;
+    private LegendService legendService;
 
     @Override
     @RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
     @PreAuthorize( "hasRole('F_GIS_ADMIN') or hasRole('ALL')" )
     public void postJsonObject( HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
-        MapLegendSet legendSet = JacksonUtils.fromJson( request.getInputStream(), MapLegendSet.class );
+        LegendSet legendSet = JacksonUtils.fromJson( request.getInputStream(), LegendSet.class );
 
-        for ( MapLegend legend : legendSet.getMapLegends() )
+        for ( Legend legend : legendSet.getLegends() )
         {
-            mappingService.addMapLegend( legend );
+            legendService.addLegend( legend );
         }
 
-        mappingService.addMapLegendSet( legendSet );
+        legendService.addLegendSet( legendSet );
 
-        ContextUtils.createdResponse( response, "Map legend set created", MapLegendSetSchemaDescriptor.API_ENDPOINT + "/" + legendSet.getUid() );
+        ContextUtils.createdResponse( response, "Map legend set created", LegendSetSchemaDescriptor.API_ENDPOINT + "/" + legendSet.getUid() );
     }
 
     @Override
@@ -80,7 +81,7 @@
     @PreAuthorize( "hasRole('F_GIS_ADMIN') or hasRole('ALL')" )
     public void putJsonObject( @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
-        MapLegendSet legendSet = mappingService.getMapLegendSet( uid );
+        LegendSet legendSet = legendService.getLegendSet( uid );
 
         if ( legendSet == null )
         {
@@ -88,25 +89,25 @@
             return;
         }
 
-        Iterator<MapLegend> legends = legendSet.getMapLegends().iterator();
+        Iterator<Legend> legends = legendSet.getLegends().iterator();
 
         while ( legends.hasNext() )
         {
-            MapLegend legend = legends.next();
+            Legend legend = legends.next();
             legends.remove();
-            mappingService.deleteMapLegend( legend );
+            legendService.deleteLegend( legend );
         }
 
-        MapLegendSet newLegendSet = JacksonUtils.fromJson( request.getInputStream(), MapLegendSet.class );
+        LegendSet newLegendSet = JacksonUtils.fromJson( request.getInputStream(), LegendSet.class );
 
-        for ( MapLegend legend : newLegendSet.getMapLegends() )
+        for ( Legend legend : newLegendSet.getLegends() )
         {
-            mappingService.addMapLegend( legend );
+            legendService.addLegend( legend );
         }
 
         legendSet.mergeWith( newLegendSet, MergeStrategy.MERGE_IF_NOT_NULL );
 
-        mappingService.updateMapLegendSet( legendSet );
+        legendService.updateLegendSet( legendSet );
     }
 
     @Override
@@ -114,7 +115,7 @@
     @PreAuthorize( "hasRole('F_GIS_ADMIN') or hasRole('ALL')" )
     public void deleteObject( @PathVariable String uid, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
-        MapLegendSet legendSet = mappingService.getMapLegendSet( uid );
+        LegendSet legendSet = legendService.getLegendSet( uid );
 
         if ( legendSet == null )
         {
@@ -122,15 +123,15 @@
             return;
         }
 
-        Iterator<MapLegend> legends = legendSet.getMapLegends().iterator();
+        Iterator<Legend> legends = legendSet.getLegends().iterator();
 
         while ( legends.hasNext() )
         {
-            MapLegend legend = legends.next();
+            Legend legend = legends.next();
             legends.remove();
-            mappingService.deleteMapLegend( legend );
+            legendService.deleteLegend( legend );
         }
 
-        mappingService.deleteMapLegendSet( legendSet );
+        legendService.deleteLegendSet( legendSet );
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java	2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java	2015-02-24 13:16:58 +0000
@@ -44,6 +44,7 @@
 import org.hisp.dhis.dxf2.common.JacksonUtils;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.i18n.I18nManager;
+import org.hisp.dhis.legend.LegendService;
 import org.hisp.dhis.mapgeneration.MapGenerationService;
 import org.hisp.dhis.mapping.Map;
 import org.hisp.dhis.mapping.MapView;
@@ -80,6 +81,9 @@
 
     @Autowired
     private MappingService mappingService;
+    
+    @Autowired
+    private LegendService legendService;
 
     @Autowired
     private OrganisationUnitService organisationUnitService;
@@ -276,7 +280,7 @@
 
         if ( view.getLegendSet() != null )
         {
-            view.setLegendSet( mappingService.getMapLegendSet( view.getLegendSet().getUid() ) );
+            view.setLegendSet( legendService.getLegendSet( view.getLegendSet().getUid() ) );
         }
 
         if ( view.getOrganisationUnitGroupSet() != null )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java	2015-02-24 13:16:58 +0000
@@ -41,8 +41,8 @@
 import org.hisp.dhis.dataelement.DataElementDomain;
 import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.option.OptionService;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.system.util.AttributeUtils;
@@ -87,12 +87,12 @@
     {
         this.optionService = optionService;
     }
-    
-    private MappingService mappingService;
-
-    public void setMappingService( MappingService mappingService )
+
+    private LegendService legendService;
+
+    public void setLegendService( LegendService legendService )
     {
-        this.mappingService = mappingService;
+        this.legendService = legendService;
     }
 
     // -------------------------------------------------------------------------
@@ -266,7 +266,7 @@
 
         OptionSet optionSet = optionService.getOptionSet( selectedOptionSetId );
         OptionSet commentOptionSet = optionService.getOptionSet( selectedCommentOptionSetId );
-        MapLegendSet legendSet = mappingService.getMapLegendSet( selectedLegendSetId );
+        LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
 
         dataElement.setName( name );
         dataElement.setShortName( shortName );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java	2015-02-24 13:16:58 +0000
@@ -28,7 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -39,20 +45,15 @@
 import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.option.OptionService;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.system.util.AttributeUtils;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import com.opensymphony.xwork2.Action;
 
 /**
  * @author Hans S. Toemmerholt
@@ -71,7 +72,7 @@
     private OrganisationUnitService organisationUnitService;
     private AttributeService attributeService;
     private OptionService optionService;
-    private MappingService mappingService;
+    private LegendService legendService;
     private Integer id;
     private DataElement dataElement;
     private Collection<DataElementGroup> dataElementGroups;
@@ -81,12 +82,13 @@
     // -------------------------------------------------------------------------
     // Input/output
     // -------------------------------------------------------------------------
+    
     private List<OrganisationUnitLevel> aggregationLevels = new ArrayList<>();
     private DataElementCategoryCombo defaultCategoryCombo;
     private List<DataElementGroupSet> groupSets;
     private List<Attribute> attributes;
     private List<OptionSet> optionSets;
-    private List<MapLegendSet> legendSets;
+    private List<LegendSet> legendSets;
     private boolean update;
 
     public void setDataElementService( DataElementService dataElementService )
@@ -114,9 +116,9 @@
         this.optionService = optionService;
     }
 
-    public void setMappingService( MappingService mappingService )
+    public void setLegendService( LegendService legendService )
     {
-        this.mappingService = mappingService;
+        this.legendService = legendService;
     }
 
     public void setId( Integer id )
@@ -174,7 +176,7 @@
         return optionSets;
     }
 
-    public List<MapLegendSet> getLegendSets()
+    public List<LegendSet> getLegendSets()
     {
         return legendSets;
     }
@@ -233,7 +235,7 @@
 
         optionSets = new ArrayList<>( optionService.getAllOptionSets() );
 
-        legendSets = new ArrayList<>( mappingService.getAllMapLegendSets() );
+        legendSets = new ArrayList<>( legendService.getAllLegendSets() );
 
         Collections.sort( dataElementCategoryCombos, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java	2015-02-18 13:39:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java	2015-02-24 13:16:58 +0000
@@ -44,8 +44,8 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.option.OptionService;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.system.util.AttributeUtils;
@@ -98,11 +98,11 @@
         this.optionService = optionService;
     }
 
-    private MappingService mappingService;
+    private LegendService legendService;
 
-    public void setMappingService( MappingService mappingService )
+    public void setLegendService( LegendService legendService )
     {
-        this.mappingService = mappingService;
+        this.legendService = legendService;
     }
 
     // -------------------------------------------------------------------------
@@ -290,7 +290,7 @@
 
         OptionSet optionSet = optionService.getOptionSet( selectedOptionSetId );
         OptionSet commentOptionSet = optionService.getOptionSet( selectedCommentOptionSetId );
-        MapLegendSet legendSet = mappingService.getMapLegendSet( selectedLegendSetId );
+        LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
 
         dataElement.setName( name );
         dataElement.setShortName( shortName );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java	2015-02-24 13:16:58 +0000
@@ -38,8 +38,8 @@
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.system.util.AttributeUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -68,11 +68,11 @@
         this.attributeService = attributeService;
     }
 
-    private MappingService mappingService;
+    private LegendService legendService;
 
-    public void setMappingService( MappingService mappingService )
+    public void setLegendService( LegendService legendService )
     {
-        this.mappingService = mappingService;
+        this.legendService = legendService;
     }
 
     // -------------------------------------------------------------------------
@@ -196,7 +196,7 @@
         code = StringUtils.trimToNull( code );
         description = StringUtils.trimToNull( description );
 
-        MapLegendSet legendSet = mappingService.getMapLegendSet( selectedLegendSetId );
+        LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
         
         Indicator indicator = new Indicator();
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java	2015-02-24 13:16:58 +0000
@@ -28,19 +28,20 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import com.opensymphony.xwork2.Action;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -66,11 +67,11 @@
         this.attributeService = attributeService;
     }
 
-    private MappingService mappingService;
+    private LegendService legendService;
 
-    public void setMappingService( MappingService mappingService )
+    public void setLegendService( LegendService legendService )
     {
-        this.mappingService = mappingService;
+        this.legendService = legendService;
     }
 
     // -------------------------------------------------------------------------
@@ -91,9 +92,9 @@
         return attributes;
     }
 
-    private List<MapLegendSet> legendSets;
+    private List<LegendSet> legendSets;
 
-    public List<MapLegendSet> getLegendSets()
+    public List<LegendSet> getLegendSets()
     {
         return legendSets;
     }
@@ -109,7 +110,7 @@
         
         attributes = new ArrayList<>( attributeService.getIndicatorAttributes() );
 
-        legendSets = new ArrayList<>( mappingService.getAllMapLegendSets() );
+        legendSets = new ArrayList<>( legendService.getAllLegendSets() );
         
         Collections.sort( indicatorTypes, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java	2015-02-24 13:16:58 +0000
@@ -42,8 +42,8 @@
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.system.util.AttributeUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -74,11 +74,11 @@
         this.attributeService = attributeService;
     }
 
-    private MappingService mappingService;
+    private LegendService legendService;
 
-    public void setMappingService( MappingService mappingService )
+    public void setLegendService( LegendService legendService )
     {
-        this.mappingService = mappingService;
+        this.legendService = legendService;
     }
 
     // -------------------------------------------------------------------------
@@ -141,9 +141,9 @@
         return attributeValues;
     }
 
-    private List<MapLegendSet> legendSets;
+    private List<LegendSet> legendSets;
 
-    public List<MapLegendSet> getLegendSets()
+    public List<LegendSet> getLegendSets()
     {
         return legendSets;
     }
@@ -172,7 +172,7 @@
 
         attributeValues = AttributeUtils.getAttributeValueMap( indicator.getAttributeValues() );
 
-        legendSets = new ArrayList<>( mappingService.getAllMapLegendSets() );
+        legendSets = new ArrayList<>( legendService.getAllLegendSets() );
         
         Collections.sort( indicatorTypes, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java	2015-02-19 09:18:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java	2015-02-24 13:16:58 +0000
@@ -38,8 +38,8 @@
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.system.util.AttributeUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -68,11 +68,11 @@
         this.attributeService = attributeService;
     }
 
-    private MappingService mappingService;
+    private LegendService legendService;
 
-    public void setMappingService( MappingService mappingService )
+    public void setLegendService( LegendService legendService )
     {
-        this.mappingService = mappingService;
+        this.legendService = legendService;
     }
 
     // -------------------------------------------------------------------------
@@ -209,7 +209,7 @@
 
         IndicatorType indicatorType = indicatorService.getIndicatorType( indicatorTypeId );
 
-        MapLegendSet legendSet = mappingService.getMapLegendSet( selectedLegendSetId );
+        LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
         
         code = StringUtils.trimToNull( code );
         description = StringUtils.trimToNull( description );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2015-01-07 17:49:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2015-02-24 13:16:58 +0000
@@ -41,7 +41,7 @@
     <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
     <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.dataelement.UpdateDataElementAction" class="org.hisp.dhis.dd.action.dataelement.UpdateDataElementAction"
@@ -51,7 +51,7 @@
     <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
     <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.dataelement.ShowDataElementFormAction" class="org.hisp.dhis.dd.action.dataelement.ShowDataElementFormAction"
@@ -61,7 +61,7 @@
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
     <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.dataelement.ValidateDataElementAction" class="org.hisp.dhis.dd.action.dataelement.ValidateDataElementAction"
@@ -297,7 +297,7 @@
   	scope="prototype">
 	<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.indicator.GetIndicatorListAction" class="org.hisp.dhis.dd.action.indicator.GetIndicatorListAction"
@@ -319,21 +319,21 @@
     scope="prototype">
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.indicator.ShowUpdateIndicatorFormAction" class="org.hisp.dhis.dd.action.indicator.ShowUpdateIndicatorFormAction"
     scope="prototype">
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.indicator.UpdateIndicatorAction" class="org.hisp.dhis.dd.action.indicator.UpdateIndicatorAction"
     scope="prototype">
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.indicator.ValidateIndicatorAction" class="org.hisp.dhis.dd.action.indicator.ValidateIndicatorAction"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java	2015-02-24 13:16:58 +0000
@@ -28,8 +28,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.google.common.collect.Lists;
-import com.opensymphony.xwork2.Action;
+import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -37,18 +41,15 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.user.UserGroupService;
 import org.hisp.dhis.user.UserService;
 
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
+import com.google.common.collect.Lists;
+import com.opensymphony.xwork2.Action;
 
 /**
  * @author Kristian
@@ -102,19 +103,19 @@
         this.userGroupService = userGroupService;
     }
 
-    private MappingService mappingService;
-
-    public void setMappingService( MappingService mappingService )
-    {
-        this.mappingService = mappingService;
-    }
-
     private AttributeService attributeService;
 
     public void setAttributeService( AttributeService attributeService )
     {
         this.attributeService = attributeService;
     }
+    
+    private LegendService legendService;
+
+    public void setLegendService( LegendService legendService )
+    {
+        this.legendService = legendService;
+    }
 
     // -------------------------------------------------------------------------
     // Input & output
@@ -315,7 +316,7 @@
 
         DataSet dataSet = new DataSet( name, shortName, code, periodType );
 
-        MapLegendSet legendSet = mappingService.getMapLegendSet( selectedLegendSetId );
+        LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
 
         dataSet.setExpiryDays( expiryDays );
         dataSet.setTimelyDays( timelyDays );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/EditDataSetFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/EditDataSetFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/EditDataSetFormAction.java	2015-02-24 13:16:58 +0000
@@ -44,8 +44,8 @@
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.system.util.AttributeUtils;
@@ -92,13 +92,6 @@
         this.categoryService = categoryService;
     }
 
-    private MappingService mappingService;
-
-    public void setMappingService( MappingService mappingService )
-    {
-        this.mappingService = mappingService;
-    }
-
     private AttributeService attributeService;
 
     public void setAttributeService( AttributeService attributeService )
@@ -106,6 +99,13 @@
         this.attributeService = attributeService;
     }
 
+    private LegendService legendService;
+
+    public void setLegendService( LegendService legendService )
+    {
+        this.legendService = legendService;
+    }
+
     // -------------------------------------------------------------------------
     // Input & output
     // -------------------------------------------------------------------------
@@ -159,9 +159,9 @@
         return categoryCombos;
     }
 
-    private List<MapLegendSet> legendSets;
+    private List<LegendSet> legendSets;
 
-    public List<MapLegendSet> getLegendSets()
+    public List<LegendSet> getLegendSets()
     {
         return legendSets;
     }
@@ -191,7 +191,7 @@
         periodTypes = periodService.getAllPeriodTypes();
         userGroups = new ArrayList<>( userGroupService.getAllUserGroups() );
         categoryCombos = new ArrayList<>( categoryService.getAttributeCategoryCombos() );
-        legendSets = new ArrayList<>( mappingService.getAllMapLegendSets() );
+        legendSets = new ArrayList<>( legendService.getAllLegendSets() );
         
         if ( dataSetId != null )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java	2015-02-24 13:16:58 +0000
@@ -28,8 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.google.common.collect.Lists;
-import com.opensymphony.xwork2.Action;
+import static org.hisp.dhis.system.util.TextUtils.equalsNullSafe;
+import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -40,19 +45,15 @@
 import org.hisp.dhis.dataset.SectionService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.legend.LegendService;
+import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.user.UserGroupService;
 
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import static org.hisp.dhis.system.util.TextUtils.equalsNullSafe;
-import static org.hisp.dhis.system.util.TextUtils.nullIfEmpty;
+import com.google.common.collect.Lists;
+import com.opensymphony.xwork2.Action;
 
 /**
  * @author Kristian
@@ -113,13 +114,6 @@
         this.userGroupService = userGroupService;
     }
 
-    private MappingService mappingService;
-
-    public void setMappingService( MappingService mappingService )
-    {
-        this.mappingService = mappingService;
-    }
-
     private AttributeService attributeService;
 
     public void setAttributeService( AttributeService attributeService )
@@ -127,6 +121,13 @@
         this.attributeService = attributeService;
     }
 
+    private LegendService legendService;
+
+    public void setLegendService( LegendService legendService )
+    {
+        this.legendService = legendService;
+    }
+
     // -------------------------------------------------------------------------
     // Input & output
     // -------------------------------------------------------------------------
@@ -331,7 +332,7 @@
 
         Set<DataElement> dataElements = new HashSet<>();
 
-        MapLegendSet legendSet = mappingService.getMapLegendSet( selectedLegendSetId );
+        LegendSet legendSet = legendService.getLegendSet( selectedLegendSetId );
 
         for ( String id : deSelected )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2014-12-04 06:39:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2015-02-24 13:16:58 +0000
@@ -103,8 +103,8 @@
     <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
     <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dataset.action.AddDataSetAction" class="org.hisp.dhis.dataset.action.AddDataSetAction"
@@ -115,8 +115,8 @@
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
     <property name="userService" ref="org.hisp.dhis.user.UserService" />
     <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dataset.action.UpdateDataSetAction" class="org.hisp.dhis.dataset.action.UpdateDataSetAction"
@@ -128,8 +128,8 @@
     <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
     <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
-    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
     <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+    <property name="legendService" ref="org.hisp.dhis.legend.LegendService" />
   </bean>
 
   <bean id="org.hisp.dhis.dataset.action.GetDataSetAction" class="org.hisp.dhis.dataset.action.GetDataSetAction"