← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15597: removed ExchangeClasses, all schema info will now be served by SchemaService

 

------------------------------------------------------------
revno: 15597
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-06-09 12:37:39 +0200
message:
  removed ExchangeClasses, all schema info will now be served by SchemaService
removed:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/WebUtils.java
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/indicator/IndicatorGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.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
=== removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java	2014-05-31 13:18:51 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java	1970-01-01 00:00:00 +0000
@@ -1,227 +0,0 @@
-package org.hisp.dhis.dxf2.metadata;
-
-/*
- * Copyright (c) 2004-2014, 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 com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.hisp.dhis.attribute.Attribute;
-import org.hisp.dhis.chart.Chart;
-import org.hisp.dhis.common.BaseDimensionalObject;
-import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.concept.Concept;
-import org.hisp.dhis.constant.Constant;
-import org.hisp.dhis.dashboard.Dashboard;
-import org.hisp.dhis.dataapproval.DataApprovalLevel;
-import org.hisp.dhis.datadictionary.DataDictionary;
-import org.hisp.dhis.dataelement.CategoryOptionGroup;
-import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategory;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
-import org.hisp.dhis.dataelement.DataElementOperand;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.Section;
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.eventreport.EventReport;
-import org.hisp.dhis.filter.MetaDataFilter;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorGroupSet;
-import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.interpretation.Interpretation;
-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.OptionSet;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageSection;
-import org.hisp.dhis.program.ProgramValidation;
-import org.hisp.dhis.relationship.RelationshipType;
-import org.hisp.dhis.report.Report;
-import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.sqlview.SqlView;
-import org.hisp.dhis.trackedentity.TrackedEntity;
-import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
-import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserAuthorityGroup;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.validation.ValidationCriteria;
-import org.hisp.dhis.validation.ValidationRule;
-import org.hisp.dhis.validation.ValidationRuleGroup;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-final public class ExchangeClasses
-{
-    // all available classes for export, used for controllers etc
-    private final static Map<Class<? extends IdentifiableObject>, String> allExportClasses;
-
-    // these are the ones that are available for dxf2 export
-    private final static Map<Class<? extends IdentifiableObject>, String> exportClasses;
-
-    // these are the ones that are available for dxf2 import
-    private final static Map<Class<? extends IdentifiableObject>, String> importClasses;
-
-    static
-    {
-        allExportClasses = Maps.newLinkedHashMap();
-
-        allExportClasses.put( SqlView.class, "sqlViews" );
-        allExportClasses.put( Concept.class, "concepts" );
-        allExportClasses.put( Constant.class, "constants" );
-        allExportClasses.put( Document.class, "documents" );
-        allExportClasses.put( OptionSet.class, "optionSets" );
-        allExportClasses.put( Attribute.class, "attributes" );
-
-        allExportClasses.put( MapLegend.class, "mapLegends" );
-        allExportClasses.put( MapLegendSet.class, "mapLegendSets" );
-        allExportClasses.put( MapLayer.class, "mapLayers" );
-
-        allExportClasses.put( OrganisationUnit.class, "organisationUnits" );
-        allExportClasses.put( OrganisationUnitLevel.class, "organisationUnitLevels" );
-        allExportClasses.put( OrganisationUnitGroup.class, "organisationUnitGroups" );
-        allExportClasses.put( OrganisationUnitGroupSet.class, "organisationUnitGroupSets" );
-
-        allExportClasses.put( DataElementCategoryOption.class, "categoryOptions" );
-        allExportClasses.put( CategoryOptionGroup.class, "categoryOptionGroups" );
-        allExportClasses.put( CategoryOptionGroupSet.class, "categoryOptionGroupSets" );
-        allExportClasses.put( DataElementCategory.class, "categories" );
-        allExportClasses.put( DataElementCategoryCombo.class, "categoryCombos" );
-        allExportClasses.put( DataElementCategoryOptionCombo.class, "categoryOptionCombos" ); // 119
-
-        allExportClasses.put( DataElement.class, "dataElements" );
-        allExportClasses.put( DataElementGroup.class, "dataElementGroups" );
-        allExportClasses.put( DataElementGroupSet.class, "dataElementGroupSets" );
-        allExportClasses.put( DataElementOperand.class, "dataElementOperands" );
-
-        allExportClasses.put( IndicatorType.class, "indicatorTypes" );
-        allExportClasses.put( Indicator.class, "indicators" );
-        allExportClasses.put( IndicatorGroup.class, "indicatorGroups" );
-        allExportClasses.put( IndicatorGroupSet.class, "indicatorGroupSets" );
-
-        allExportClasses.put( DataDictionary.class, "dataDictionaries" ); // 128
-
-        allExportClasses.put( User.class, "users" );
-        allExportClasses.put( UserGroup.class, "userGroups" );
-
-        allExportClasses.put( DataSet.class, "dataSets" );
-        allExportClasses.put( Section.class, "sections" );
-
-        allExportClasses.put( UserAuthorityGroup.class, "userRoles" );
-
-        allExportClasses.put( ReportTable.class, "reportTables" );
-        allExportClasses.put( Report.class, "reports" );
-        allExportClasses.put( Chart.class, "charts" );
-
-        allExportClasses.put( DataApprovalLevel.class, "dataApprovalLevels" );
-
-        allExportClasses.put( Dashboard.class, "dashboards" );
-
-        allExportClasses.put( ValidationRule.class, "validationRules" );
-        allExportClasses.put( ValidationRuleGroup.class, "validationRuleGroups" );
-
-        allExportClasses.put( MapView.class, "mapViews" );
-        allExportClasses.put( org.hisp.dhis.mapping.Map.class, "maps" );
-
-        allExportClasses.put( MessageConversation.class, "messageConversations" );
-        allExportClasses.put( Interpretation.class, "interpretations" );
-
-        allExportClasses.put( RelationshipType.class, "relationshipTypes" );
-        allExportClasses.put( ValidationCriteria.class, "validationCriterias" );
-        allExportClasses.put( ProgramStageSection.class, "programStageSections" );
-        allExportClasses.put( TrackedEntity.class, "trackedEntities" );
-        allExportClasses.put( TrackedEntityAttribute.class, "trackedEntityAttributes" );
-        allExportClasses.put( TrackedEntityAttributeGroup.class, "trackedEntityAttributeGroups" );
-        allExportClasses.put( ProgramStage.class, "programStages" );
-        allExportClasses.put( Program.class, "programs" );
-        allExportClasses.put( ProgramValidation.class, "programValidations" );
-
-        allExportClasses.put( EventReport.class, "eventReports" );
-
-        allExportClasses.put( BaseDimensionalObject.class, "dimensions" );
-
-        exportClasses = Maps.newLinkedHashMap( allExportClasses );
-        importClasses = Maps.newLinkedHashMap( allExportClasses );
-
-        // this is considered data, and is not available for meta-data export/import
-        exportClasses.remove( MessageConversation.class );
-        exportClasses.remove( Interpretation.class );
-        exportClasses.remove( Dashboard.class );
-        exportClasses.remove( BaseDimensionalObject.class );
-        importClasses.remove( MessageConversation.class );
-        importClasses.remove( Interpretation.class );
-        importClasses.remove( Dashboard.class );
-        importClasses.remove( BaseDimensionalObject.class );
-
-        // special class which is created on demand in association with other objects
-        exportClasses.remove( DataElementOperand.class );
-        importClasses.remove( DataElementOperand.class );
-
-        allExportClasses.put( MetaDataFilter.class, "metaDataFilters" );
-        exportClasses.remove( MetaDataFilter.class );
-        importClasses.remove( MetaDataFilter.class );
-    }
-
-    public static Map<Class<? extends IdentifiableObject>, String> getAllExportMap()
-    {
-        return Collections.unmodifiableMap( allExportClasses );
-    }
-
-    public static Map<Class<? extends IdentifiableObject>, String> getExportMap()
-    {
-        return Collections.unmodifiableMap( exportClasses );
-    }
-
-    public static Map<Class<? extends IdentifiableObject>, String> getImportMap()
-    {
-        return Collections.unmodifiableMap( importClasses );
-    }
-
-    public static List<Class<? extends IdentifiableObject>> getImportClasses()
-    {
-        return Lists.newArrayList( importClasses.keySet() );
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java	2014-05-27 12:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DashboardController.java	2014-06-09 10:37:39 +0000
@@ -36,7 +36,6 @@
 import org.hisp.dhis.dxf2.utils.JacksonUtils;
 import org.hisp.dhis.schema.descriptors.DashboardSchemaDescriptor;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.WebUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Controller;
@@ -59,15 +58,15 @@
  * @author Lars Helge Overland
  */
 @Controller
-@RequestMapping( value = DashboardSchemaDescriptor.API_ENDPOINT )
+@RequestMapping(value = DashboardSchemaDescriptor.API_ENDPOINT)
 public class DashboardController
     extends AbstractCrudController<Dashboard>
 {
     @Autowired
     private DashboardService dashboardService;
 
-    @RequestMapping( value = "/q/{query}", method = RequestMethod.GET )
-    public String search( @PathVariable String query, @RequestParam( required = false ) Set<String> max,
+    @RequestMapping(value = "/q/{query}", method = RequestMethod.GET)
+    public String search( @PathVariable String query, @RequestParam(required = false) Set<String> max,
         Model model, HttpServletResponse response ) throws Exception
     {
         DashboardSearchResult result = dashboardService.search( query, max );
@@ -78,7 +77,7 @@
     }
 
     @Override
-    @RequestMapping( method = RequestMethod.POST, consumes = "application/json" )
+    @RequestMapping(method = RequestMethod.POST, consumes = "application/json")
     public void postJsonObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception
     {
         Dashboard dashboard = JacksonUtils.fromJson( input, Dashboard.class );
@@ -91,9 +90,9 @@
     }
 
     @Override
-    @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" )
-    @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
+    @RequestMapping(value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json")
+    @ResponseStatus(value = HttpStatus.NO_CONTENT)
+    public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid, InputStream input ) throws Exception
     {
         Dashboard dashboard = dashboardService.getDashboard( uid );
 
@@ -111,9 +110,9 @@
     }
 
     @Override
-    @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE )
-    @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid ) throws Exception
+    @RequestMapping(value = "/{uid}", method = RequestMethod.DELETE)
+    @ResponseStatus(value = HttpStatus.NO_CONTENT)
+    public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid ) throws Exception
     {
         Dashboard dashboard = dashboardService.getDashboard( uid );
 
@@ -128,7 +127,7 @@
         ContextUtils.okResponse( response, "Dashboard deleted" );
     }
 
-    @RequestMapping( value = "/{uid}/items", method = RequestMethod.POST, consumes = "application/json" )
+    @RequestMapping(value = "/{uid}/items", method = RequestMethod.POST, consumes = "application/json")
     public void postJsonItem( HttpServletResponse response, HttpServletRequest request,
         InputStream input, @PathVariable String uid ) throws Exception
     {
@@ -151,9 +150,9 @@
         ContextUtils.createdResponse( response, "Dashboard item created", item.getUid() );
     }
 
-    @RequestMapping( value = "/{dashboardUid}/items/content", method = RequestMethod.POST )
+    @RequestMapping(value = "/{dashboardUid}/items/content", method = RequestMethod.POST)
     public void postJsonItemContent( HttpServletResponse response, HttpServletRequest request,
-        @PathVariable String dashboardUid, @RequestParam String type, @RequestParam( "id" ) String contentUid ) throws Exception
+        @PathVariable String dashboardUid, @RequestParam String type, @RequestParam("id") String contentUid ) throws Exception
     {
         boolean result = dashboardService.addItemContent( dashboardUid, type, contentUid );
 
@@ -167,7 +166,7 @@
         }
     }
 
-    @RequestMapping( value = "/{dashboardUid}/items/{itemUid}/position/{position}", method = RequestMethod.POST )
+    @RequestMapping(value = "/{dashboardUid}/items/{itemUid}/position/{position}", method = RequestMethod.POST)
     public void moveItem( HttpServletResponse response, HttpServletRequest request,
         @PathVariable String dashboardUid, @PathVariable String itemUid, @PathVariable int position ) throws Exception
     {
@@ -187,7 +186,7 @@
         }
     }
 
-    @RequestMapping( value = "/{dashboardUid}/items/{itemUid}", method = RequestMethod.DELETE )
+    @RequestMapping(value = "/{dashboardUid}/items/{itemUid}", method = RequestMethod.DELETE)
     public void deleteItem( HttpServletResponse response, HttpServletRequest request,
         @PathVariable String dashboardUid, @PathVariable String itemUid )
     {
@@ -207,7 +206,7 @@
         }
     }
 
-    @RequestMapping( value = "/{dashboardUid}/items/{itemUid}/content/{contentUid}", method = RequestMethod.DELETE )
+    @RequestMapping(value = "/{dashboardUid}/items/{itemUid}/content/{contentUid}", method = RequestMethod.DELETE)
     public void deleteItemContent( HttpServletResponse response, HttpServletRequest request,
         @PathVariable String dashboardUid, @PathVariable String itemUid, @PathVariable String contentUid )
     {
@@ -255,13 +254,13 @@
 
                 if ( item.getEmbeddedItem() != null )
                 {
-                    WebUtils.generateLinks( item.getEmbeddedItem() );
+                    linkService.generateLinks( item.getEmbeddedItem() );
                 }
                 else if ( item.getLinkItems() != null )
                 {
                     for ( IdentifiableObject link : item.getLinkItems() )
                     {
-                        WebUtils.generateLinks( link );
+                        linkService.generateLinks( link );
                     }
                 }
             }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java	2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DimensionController.java	2014-06-09 10:37:39 +0000
@@ -28,20 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.hisp.dhis.webapi.utils.WebUtils;
 import org.hisp.dhis.common.DimensionService;
 import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.NameableObject;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.common.PagerUtils;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.webapi.utils.LinkService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -50,8 +43,14 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
 @Controller
-@RequestMapping(value = DimensionController.RESOURCE_PATH)
+@RequestMapping( value = DimensionController.RESOURCE_PATH )
 public class DimensionController
 {
     public static final String RESOURCE_PATH = "/dimensions";
@@ -63,13 +62,16 @@
     @Autowired
     private DimensionService dimensionService;
 
+    @Autowired
+    private LinkService linkService;
+
     // -------------------------------------------------------------------------
     // Controller
     // -------------------------------------------------------------------------
 
     @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
-    public String getDimension( @PathVariable("uid") String uid,
-        @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links, 
+    public String getDimension( @PathVariable( "uid" ) String uid,
+        @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links,
         Model model )
     {
         DimensionalObject dimension = dimensionService.getDimension( uid );
@@ -79,29 +81,29 @@
 
         if ( links )
         {
-            WebUtils.generateLinks( dimension );
+            linkService.generateLinks( dimension );
         }
 
         return "dimension";
     }
-    
+
     @RequestMapping( value = "/{uid}/items", method = RequestMethod.GET )
     public String getItems( @PathVariable String uid, @RequestParam Map<String, String> parameters,
         Model model, HttpServletRequest request, HttpServletResponse response )
     {
-        WebOptions options = new WebOptions( parameters );        
+        WebOptions options = new WebOptions( parameters );
         List<NameableObject> items = dimensionService.getCanReadDimensionItems( uid );
-                
+
         WebMetaData metaData = new WebMetaData();
         Collections.sort( items, IdentifiableObjectNameComparator.INSTANCE );
-        
+
         if ( options.hasPaging() )
         {
             Pager pager = new Pager( options.getPage(), items.size(), options.getPageSize() );
             metaData.setPager( pager );
             items = PagerUtils.pageCollection( items, pager );
         }
-        
+
         metaData.setItems( items );
 
         model.addAttribute( "model", metaData );
@@ -112,7 +114,7 @@
 
     @RequestMapping( method = RequestMethod.GET )
     public String getDimensions(
-        @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links, 
+        @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links,
         Model model )
     {
         WebMetaData metaData = new WebMetaData();
@@ -123,7 +125,7 @@
 
         if ( links )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         return "dimensions";
@@ -131,7 +133,7 @@
 
     @RequestMapping( value = "/constraints", method = RequestMethod.GET )
     public String getDimensionConstraints(
-        @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links, 
+        @RequestParam( value = "links", defaultValue = "true", required = false ) Boolean links,
         Model model )
     {
         WebMetaData metaData = new WebMetaData();
@@ -142,7 +144,7 @@
 
         if ( links )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         return "dimensions";

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementGroupController.java	2014-05-27 12:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementGroupController.java	2014-06-09 10:37:39 +0000
@@ -41,7 +41,6 @@
 import org.hisp.dhis.webapi.controller.WebMetaData;
 import org.hisp.dhis.webapi.controller.WebOptions;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.WebUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -97,7 +96,7 @@
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         model.addAttribute( "model", metaData );
@@ -144,7 +143,7 @@
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         model.addAttribute( "model", metaData );
@@ -186,7 +185,7 @@
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         model.addAttribute( "model", metaData );
@@ -233,7 +232,7 @@
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         model.addAttribute( "model", metaData );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/indicator/IndicatorGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/indicator/IndicatorGroupController.java	2014-05-27 12:49:13 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/indicator/IndicatorGroupController.java	2014-06-09 10:37:39 +0000
@@ -41,7 +41,6 @@
 import org.hisp.dhis.webapi.controller.WebMetaData;
 import org.hisp.dhis.webapi.controller.WebOptions;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.WebUtils;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.common.PagerUtils;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
@@ -91,7 +90,7 @@
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         model.addAttribute( "model", metaData );
@@ -138,7 +137,7 @@
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         model.addAttribute( "model", metaData );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java	2014-06-06 07:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java	2014-06-09 10:37:39 +0000
@@ -41,7 +41,6 @@
 import org.hisp.dhis.webapi.controller.WebMetaData;
 import org.hisp.dhis.webapi.controller.WebOptions;
 import org.hisp.dhis.webapi.controller.exception.NotFoundException;
-import org.hisp.dhis.webapi.utils.WebUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitGroupController.java	2014-05-27 13:18:27 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitGroupController.java	2014-06-09 10:37:39 +0000
@@ -40,7 +40,6 @@
 import org.hisp.dhis.webapi.controller.WebMetaData;
 import org.hisp.dhis.webapi.controller.WebOptions;
 import org.hisp.dhis.webapi.utils.ContextUtils;
-import org.hisp.dhis.webapi.utils.WebUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -110,7 +109,7 @@
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         model.addAttribute( "model", metaData );
@@ -157,7 +156,7 @@
 
         if ( options.hasLinks() )
         {
-            WebUtils.generateLinks( metaData );
+            linkService.generateLinks( metaData );
         }
 
         model.addAttribute( "model", metaData );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java	2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java	2014-06-09 10:37:39 +0000
@@ -48,7 +48,6 @@
 import org.hisp.dhis.common.BaseDimensionalObject;
 import org.hisp.dhis.common.DimensionalObject;
 import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.dxf2.metadata.ExchangeClasses;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.system.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -217,33 +216,6 @@
         return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
     }
 
-    public static String getPathWithUid( IdentifiableObject identifiableObject )
-    {
-        return getPath( identifiableObject.getClass() ) + "/" + identifiableObject.getUid();
-    }
-
-    public static String getPath( Class<?> clazz )
-    {
-        if ( ProxyObject.class.isAssignableFrom( clazz ) )
-        {
-            clazz = clazz.getSuperclass();
-        }
-
-        String resourcePath;
-
-        // special case
-        if ( DimensionalObject.class.isAssignableFrom( clazz ) )
-        {
-            resourcePath = ExchangeClasses.getAllExportMap().get( BaseDimensionalObject.class );
-        }
-        else
-        {
-            resourcePath = ExchangeClasses.getAllExportMap().get( clazz );
-        }
-
-        return getRootPath( getRequest() ) + "/" + resourcePath;
-    }
-
     public static String getContextPath( HttpServletRequest request )
     {
         StringBuilder builder = new StringBuilder();

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/WebUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/WebUtils.java	2014-05-31 13:34:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/WebUtils.java	1970-01-01 00:00:00 +0000
@@ -1,187 +0,0 @@
-package org.hisp.dhis.webapi.utils;
-
-/*
- * Copyright (c) 2004-2014, 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.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.DimensionalObject;
-import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.common.Pager;
-import org.hisp.dhis.system.util.ReflectionUtils;
-import org.hisp.dhis.user.UserCredentials;
-import org.hisp.dhis.webapi.controller.WebMetaData;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static org.hisp.dhis.system.util.PredicateUtils.alwaysTrue;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-final public class WebUtils
-{
-    private static final Log log = LogFactory.getLog( WebUtils.class );
-
-    public static void generateLinks( WebMetaData metaData )
-    {
-        generateLinks( metaData, true );
-    }
-
-    public static void generateLinks( WebMetaData metaData, boolean deep )
-    {
-        Class<?> baseType = null;
-        Collection<Field> fields = ReflectionUtils.collectFields( metaData.getClass(), alwaysTrue );
-
-        for ( Field field : fields )
-        {
-            if ( ReflectionUtils.isCollection( field.getName(), metaData, IdentifiableObject.class ) ||
-                ReflectionUtils.isCollection( field.getName(), metaData, DimensionalObject.class ) )
-            {
-                List<Object> objects = new ArrayList<>( (Collection<?>) ReflectionUtils.getFieldObject( field, metaData ) );
-
-                if ( !objects.isEmpty() )
-                {
-                    if ( baseType != null )
-                    {
-                        log.warn( "baseType already set, overwriting" );
-                    }
-
-                    baseType = objects.get( 0 ).getClass();
-
-                    for ( Object object : objects )
-                    {
-                        generateLinks( object, deep );
-                    }
-                }
-            }
-        }
-
-        if ( baseType == null )
-        {
-            log.warn( "baseType was not found, returning." );
-            return;
-        }
-
-        if ( metaData.getPager() != null )
-        {
-            String basePath = ContextUtils.getPath( baseType );
-            Pager pager = metaData.getPager();
-
-            if ( pager.getPage() < pager.getPageCount() )
-            {
-                String nextPath = basePath + "?page=" + (pager.getPage() + 1);
-                nextPath += pager.pageSizeIsDefault() ? "" : "&pageSize=" + pager.getPageSize();
-
-                pager.setNextPage( nextPath );
-            }
-
-            if ( pager.getPage() > 1 )
-            {
-                if ( (pager.getPage() - 1) == 1 )
-                {
-                    String prevPath = pager.pageSizeIsDefault() ? basePath : basePath + "?pageSize=" + pager.getPageSize();
-                    pager.setPrevPage( prevPath );
-                }
-                else
-                {
-                    String prevPath = basePath + "?page=" + (pager.getPage() - 1);
-                    prevPath += pager.pageSizeIsDefault() ? "" : "&pageSize=" + pager.getPageSize();
-
-                    pager.setPrevPage( prevPath );
-                }
-            }
-        }
-    }
-
-    public static void generateLinks( Object object )
-    {
-        generateLinks( object, true );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public static void generateLinks( Object object, boolean deep )
-    {
-        if ( object == null )
-        {
-            return;
-        }
-
-        if ( IdentifiableObject.class.isAssignableFrom( object.getClass() ) )
-        {
-            IdentifiableObject identifiableObject = (IdentifiableObject) object;
-            identifiableObject.setHref( ContextUtils.getPathWithUid( identifiableObject ) );
-        }
-
-        List<Field> fields = new ArrayList<>();
-        fields.addAll( ReflectionUtils.collectFields( object.getClass() ) );
-
-        if ( !deep )
-        {
-            return;
-        }
-
-        for ( Field field : fields )
-        {
-            if ( IdentifiableObject.class.isAssignableFrom( field.getType() ) )
-            {
-                Object fieldObject = ReflectionUtils.getFieldObject( field, object );
-
-                if ( fieldObject != null && !UserCredentials.class.isAssignableFrom( fieldObject.getClass() ) )
-                {
-                    IdentifiableObject idObject = (IdentifiableObject) fieldObject;
-                    idObject.setHref( ContextUtils.getPathWithUid( idObject ) );
-                }
-            }
-            else if ( ReflectionUtils.isCollection( field.getName(), object, IdentifiableObject.class ) )
-            {
-                Object collection = ReflectionUtils.getFieldObject( field, object );
-
-                if ( collection != null )
-                {
-                    Collection<IdentifiableObject> collectionObjects = (Collection<IdentifiableObject>) collection;
-
-                    for ( IdentifiableObject collectionObject : collectionObjects )
-                    {
-                        if ( collectionObject != null )
-                        {
-                            collectionObject.setHref( ContextUtils.getPathWithUid( collectionObject ) );
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    private WebUtils()
-    {
-    }
-}