← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5083: renamed dhis-web-api2 and added new module for dhis-web-api (using spring mvc)

 

------------------------------------------------------------
revno: 5083
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-11-02 12:14:35 +0100
message:
  renamed dhis-web-api2 and added new module for dhis-web-api (using spring mvc)
removed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/HtmlPromotingUriConnegFilter.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/ResponseUtils.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/UrlResourceListener.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/action/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/action/ImportDataValueAction.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/mapping/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/mapping/IllegalArgumentExceptionMapper.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ApiResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ChartResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataValueSetsResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DhisMediaType.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitsResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ReportResource.java
  dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/
  dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataSet.vm
  dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataSets.vm
  dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataValueSets.vm
  dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/index.vm
  dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/orgUnits.vm
added:
  dhis-2/dhis-web/dhis-web-api/
  dhis-2/dhis-web/dhis-web-api/pom.xml
  dhis-2/dhis-web/dhis-web-api/src/
  dhis-2/dhis-web/dhis-web-api/src/main/
  dhis-2/dhis-web/dhis-web-api/src/main/java/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndexController.java
  dhis-2/dhis-web/dhis-web-api/src/main/resources/
  dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/
  dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/
  dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/servlet.xml
  dhis-2/dhis-web/dhis-web-api/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-api/src/main/webapp/
  dhis-2/dhis-web/dhis-web-api/src/main/webapp/WEB-INF/
  dhis-2/dhis-web/dhis-web-api/src/main/webapp/WEB-INF/web.xml
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/HtmlPromotingUriConnegFilter.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/ResponseUtils.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/UrlResourceListener.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/action/
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/action/ImportDataValueAction.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/mapping/
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/mapping/IllegalArgumentExceptionMapper.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ApiResource.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ChartResource.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataSetResource.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataSetsResource.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataValueSetsResource.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DhisMediaType.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/OrgUnitResource.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/OrgUnitsResource.java
  dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ReportResource.java
  dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/
  dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataSet.vm
  dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataSets.vm
  dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataValueSets.vm
  dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/index.vm
  dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/orgUnits.vm
renamed:
  dhis-2/dhis-web/dhis-web-api/ => dhis-2/dhis-web/dhis-web-api2/
modified:
  dhis-2/dhis-web/dhis-web-api2/pom.xml
  dhis-2/dhis-web/dhis-web-api2/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-api2/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-api2/src/main/webapp/WEB-INF/web.xml
  dhis-2/dhis-web/dhis-web-portal/pom.xml
  dhis-2/dhis-web/dhis-web-portal/src/main/webapp/WEB-INF/web.xml
  dhis-2/dhis-web/pom.xml
  dhis-2/pom.xml


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added directory 'dhis-2/dhis-web/dhis-web-api'
=== added file 'dhis-2/dhis-web/dhis-web-api/pom.xml'
--- dhis-2/dhis-web/dhis-web-api/pom.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/pom.xml	2011-11-02 11:14:35 +0000
@@ -0,0 +1,42 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.hisp.dhis</groupId>
+    <artifactId>dhis-web</artifactId>
+    <version>2.6-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>dhis-web-api</artifactId>
+  <packaging>war</packaging>
+  <name>DHIS Web API</name>
+
+  <build>
+    <finalName>dhis-web-api</finalName>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-commons</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-commons-resources</artifactId>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-webmvc</artifactId>
+    </dependency>
+  </dependencies>
+
+  <properties>
+    <rootDir>../../</rootDir>
+  </properties>
+</project>

=== added directory 'dhis-2/dhis-web/dhis-web-api/src'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller'
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndexController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndexController.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/IndexController.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,18 @@
+package org.hisp.dhis.api.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+@RequestMapping( value = "/" )
+public class IndexController
+{
+    @RequestMapping( method = RequestMethod.GET )
+    @ResponseBody
+    public String index()
+    {
+        return "Nothing to see here yet.";
+    }
+}

=== removed directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api'
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/HtmlPromotingUriConnegFilter.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/HtmlPromotingUriConnegFilter.java	2011-09-16 10:22:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/HtmlPromotingUriConnegFilter.java	1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-package org.hisp.dhis.web.api;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.core.MediaType;
-
-import com.sun.jersey.api.container.filter.UriConnegFilter;
-import com.sun.jersey.spi.container.ContainerRequest;
-
-public class HtmlPromotingUriConnegFilter
-    extends UriConnegFilter
-{
-    private static final String ACCEPT = "Accept";
-
-    private static Map<String, MediaType> mediaExtentions;
-
-    static
-    {
-        mediaExtentions = new HashMap<String, MediaType>();
-        mediaExtentions.put( "xml", MediaType.APPLICATION_XML_TYPE );
-        mediaExtentions.put( "html", MediaType.TEXT_HTML_TYPE );
-        mediaExtentions.put( "json", MediaType.APPLICATION_JSON_TYPE );
-        mediaExtentions.put( "jsonp", new MediaType( "application", "javascript" ) );
-    }
-
-    public HtmlPromotingUriConnegFilter()
-    {
-        super( mediaExtentions );
-    }
-
-    @Override
-    public ContainerRequest filter( ContainerRequest request )
-    {
-        String accept = request.getHeaderValue( ACCEPT );
-
-        if ( accept == null || accept.trim().isEmpty() )
-        {
-            request.getRequestHeaders().putSingle( ACCEPT, MediaType.TEXT_HTML );
-        }
-        else
-        {
-            accept = preferHtml( accept );
-            request.getRequestHeaders().putSingle( ACCEPT, accept );
-        }
-
-        request = super.filter( request );
-
-        return request;
-    }
-
-    public static String preferHtml( String accept )
-    {
-        int i = accept.indexOf( "text/html" );
-
-        if ( i == -1 )
-        {
-            if ( accept.trim().equals( "" ) )
-            {
-                return "text/html";
-            }
-            return "text/html," + accept;
-        }
-
-        int start = accept.substring( 0, i ).lastIndexOf( ',' );
-
-        String result = "";
-
-        if ( start != -1 )
-        {
-            result = accept.substring( 0, start );
-        }
-
-        int end = accept.indexOf( ',', i );
-
-        if ( end != -1 )
-        {
-            if ( result.equals( "" ) )
-            {
-                result = accept.substring( end + 1 );
-            }
-            else
-            {
-                result = result + accept.substring( end );
-            }
-        }
-
-        if ( result.trim().equals( "" ) )
-        {
-            return "text/html";
-        }
-
-        return "text/html," + result;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/ResponseUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/ResponseUtils.java	2011-10-07 10:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/ResponseUtils.java	1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
-package org.hisp.dhis.web.api;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-
-import org.hisp.dhis.system.util.DateUtils;
-
-public class ResponseUtils
-{
-    public static final String TEMPLATE_PATH = "dhis-web-api/";
-    
-    public static ResponseBuilder response( boolean disallowCache,
-        String filename, boolean attachment )
-    {
-        ResponseBuilder builder = Response.ok();
-        
-        if ( disallowCache )
-        {
-            builder.header( "Cache-Control", "no-cache" );
-            builder.header( "Expires", DateUtils.getExpiredHttpDateString() );
-        }
-
-        if ( filename != null )
-        {
-            String type = attachment ? "attachment" : "inline";
-            builder.header( "Content-Disposition", type + "; filename=\"" + filename + "\"" );
-        }
-        
-        return builder;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/UrlResourceListener.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/UrlResourceListener.java	2011-09-12 08:29:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/UrlResourceListener.java	1970-01-01 00:00:00 +0000
@@ -1,83 +0,0 @@
-package org.hisp.dhis.web.api;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.core.UriInfo;
-import javax.xml.bind.Marshaller.Listener;
-
-import org.hisp.dhis.importexport.dxf2.model.DataSet;
-import org.hisp.dhis.importexport.dxf2.model.DataSetLinks;
-import org.hisp.dhis.importexport.dxf2.model.Link;
-import org.hisp.dhis.importexport.dxf2.model.OrgUnit;
-import org.hisp.dhis.importexport.dxf2.model.OrgUnitLinks;
-
-public class UrlResourceListener
-    extends Listener
-{
-    private UriInfo uriInfo;
-
-    private Map<Class<?>, String> mapping;
-
-    public UrlResourceListener( UriInfo uriInfo )
-    {
-        super();
-        this.uriInfo = uriInfo;
-
-        mapping = new HashMap<Class<?>, String>();
-        mapping.put( OrgUnit.class, "orgUnits/{id}" );
-        mapping.put( DataSet.class, "dataSets/{id}" );
-    }
-
-    @Override
-    public void beforeMarshal( Object source )
-    {
-        if ( source instanceof DataSet )
-        {
-            addUrls( ((DataSet) source).getOrgUnitLinks(), OrgUnit.class );
-        }
-        else if ( source instanceof DataSetLinks )
-        {
-            addUrls( ((DataSetLinks) source).getDataSet(), DataSet.class );
-        }
-        else if ( source instanceof OrgUnit )
-        {
-            OrgUnit unit = (OrgUnit) source;
-            addUrls( unit.getChildren(), OrgUnit.class );
-            addUrl( unit.getParent(), OrgUnit.class );
-            addUrls( unit.getDataSets(), DataSet.class );
-        }
-        else if ( source instanceof OrgUnitLinks )
-        {
-            addUrls( ((OrgUnitLinks) source).getOrgUnit(), OrgUnit.class );
-        }
-    }
-
-    private void addUrls( List<Link> links, Class<?> clazz )
-    {
-        if ( links == null )
-        {
-            return;
-        }
-
-        for ( Link link : links )
-        {
-            addUrl( link, clazz );
-        }
-    }
-
-    private void addUrl( Link link, Class<?> clazz )
-    {
-        if ( link == null )
-        {
-            return;
-        }
-
-        String id = link.getId();
-        String path = mapping.get( clazz );
-        String url = uriInfo.getBaseUriBuilder().path( path ).build( id ).toString();
-
-        link.setHref( url );
-    }
-}

=== removed directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/action'
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/action/ImportDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/action/ImportDataValueAction.java	2011-09-12 08:29:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/action/ImportDataValueAction.java	1970-01-01 00:00:00 +0000
@@ -1,222 +0,0 @@
-package org.hisp.dhis.web.api.action;
-
-/*
- * Copyright (c) 2004-2010, 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.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.interceptor.ServletRequestAware;
-import org.apache.struts2.interceptor.ServletResponseAware;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.patientdatavalue.PatientDataValue;
-import org.hisp.dhis.patientdatavalue.PatientDataValueService;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-
-import com.opensymphony.xwork2.Action;
-
-public class ImportDataValueAction
-    implements ServletRequestAware, ServletResponseAware, Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private ProgramStageInstanceService programStageInstanceService;
-
-    private PatientDataValueService patientDataValueService;
-
-    private DataElementService dataElementService;
-
-    private HttpServletRequest request;
-
-    private HttpServletResponse response;
-
-    private OrganisationUnitService orgUnitService;
-
-    private DataElementCategoryService dataElementCategoryService;
-
-    // -------------------------------------------------------------------------
-    // Set and get methods
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void setServletResponse( HttpServletResponse response )
-    {
-        this.response = response;
-    }
-
-    @Override
-    public void setServletRequest( HttpServletRequest request )
-    {
-        this.request = request;
-    }
-
-    public HttpServletRequest getServletRequest()
-    {
-        return request;
-    }
-
-    public HttpServletResponse getServletResponse()
-    {
-        return response;
-    }
-
-    public ProgramStageInstanceService getProgramStageInstanceService()
-    {
-        return programStageInstanceService;
-    }
-
-    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
-    {
-        this.programStageInstanceService = programStageInstanceService;
-    }
-
-    public PatientDataValueService getPatientDataValueService()
-    {
-        return patientDataValueService;
-    }
-
-    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
-    {
-        this.patientDataValueService = patientDataValueService;
-    }
-
-    public DataElementService getDataElementService()
-    {
-        return dataElementService;
-    }
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    public OrganisationUnitService getOrgUnitService()
-    {
-        return orgUnitService;
-    }
-
-    public void setOrgUnitService( OrganisationUnitService orgUnitService )
-    {
-        this.orgUnitService = orgUnitService;
-    }
-
-    public DataElementCategoryService getDataElementCategoryService()
-    {
-        return dataElementCategoryService;
-    }
-
-    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
-    {
-        this.dataElementCategoryService = dataElementCategoryService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Output
-    // -------------------------------------------------------------------------
-
-    private InputStream inputStream;
-
-    public InputStream getInputStream()
-    {
-        return inputStream;
-    }
-
-    public void setInputStream( InputStream inputStream )
-    {
-        this.inputStream = inputStream;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    @Override
-    public String execute()
-        throws Exception
-    {
-        String message = "Upload Successfully!";
-        request = ServletActionContext.getRequest();
-        response = ServletActionContext.getResponse();
-        this.setInputStream( new ByteArrayInputStream( message.getBytes() ) );
-
-        InputStream clientInput = request.getInputStream();
-        DataInputStream dis = new DataInputStream( clientInput );
-
-        if ( clientInput.available() > -1 )
-        {
-            int numOfDataValue = dis.readInt();
-            OrganisationUnit orgUnit = orgUnitService.getOrganisationUnit( dis.readInt() );
-            this.setInputStream( new ByteArrayInputStream( message.getBytes() ) );
-            try
-            {
-                for ( int i = 0; i < numOfDataValue; i++ )
-                {
-                    this.saveDataValue( dis, orgUnit );
-                }
-            }
-            catch ( Exception ex )
-            {
-                message = "Upload failed!";
-                this.setInputStream( new ByteArrayInputStream( message.getBytes() ) );
-            }
-        }
-
-        return SUCCESS;
-    }
-
-    private void saveDataValue( DataInputStream dis, OrganisationUnit orgUnit )
-        throws IOException
-    {
-        DataElement dataElement = dataElementService.getDataElement( dis.readInt() );
-        ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( dis.readInt() );
-        DataElementCategoryOptionCombo optionCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( 1 );
-
-        PatientDataValue patientDataValue = new PatientDataValue();
-        patientDataValue.setDataElement( dataElement );
-        patientDataValue.setOptionCombo( optionCombo );
-        patientDataValue.setOrganisationUnit( orgUnit );
-        patientDataValue.setProgramStageInstance( programStageInstance );
-        patientDataValue.setTimestamp( new Date() );
-        patientDataValue.setProvidedByAnotherFacility( false );
-        patientDataValue.setValue( dis.readUTF() );
-
-        patientDataValueService.savePatientDataValue( patientDataValue );
-    }
-}

=== removed directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/mapping'
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/mapping/IllegalArgumentExceptionMapper.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/mapping/IllegalArgumentExceptionMapper.java	2011-09-12 08:29:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/mapping/IllegalArgumentExceptionMapper.java	1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-package org.hisp.dhis.web.api.mapping;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import com.sun.jersey.spi.resource.Singleton;
-
-@Provider
-@Singleton
-public class IllegalArgumentExceptionMapper
-    implements ExceptionMapper<IllegalArgumentException>
-{
-    @Override
-    public Response toResponse( IllegalArgumentException e )
-    {
-        return Response.status( Status.CONFLICT ).entity( "Problem with input: " + e.getMessage() ).type( MediaType.TEXT_PLAIN ).build();
-    }
-}

=== removed directory 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources'
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ApiResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ApiResource.java	2011-10-07 10:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ApiResource.java	1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-import java.io.IOException;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.hisp.dhis.system.velocity.VelocityManager;
-import org.hisp.dhis.web.api.ResponseUtils;
-import org.springframework.beans.factory.annotation.Required;
-
-import com.sun.jersey.api.view.ImplicitProduces;
-
-@Path( "/" )
-@ImplicitProduces( MediaType.TEXT_HTML )
-public class ApiResource
-{
-    private VelocityManager velocityManager;
-
-    @GET
-    @Produces( MediaType.TEXT_HTML )
-    public String getDescription()
-        throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, IOException, Exception
-    {
-        return velocityManager.render( null, ResponseUtils.TEMPLATE_PATH + "index" );
-    }
-    
-    @Required
-    public void setVelocityManager( VelocityManager velocityManager )
-    {
-        this.velocityManager = velocityManager;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ChartResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ChartResource.java	2011-10-23 12:24:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ChartResource.java	1970-01-01 00:00:00 +0000
@@ -1,140 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.StreamingOutput;
-
-import org.hisp.dhis.chart.Chart;
-import org.hisp.dhis.chart.ChartService;
-import org.hisp.dhis.i18n.I18nManager;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.system.util.CodecUtils;
-import org.hisp.dhis.util.ContextUtils;
-import org.hisp.dhis.web.api.ResponseUtils;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-
-@Path( "/chart" )
-public class ChartResource
-{
-    private ChartService chartService;
-
-    public void setChartService( ChartService chartService )
-    {
-        this.chartService = chartService;
-    }
-    
-    private IndicatorService indicatorService;
-
-    public void setIndicatorService( IndicatorService indicatorService )
-    {
-        this.indicatorService = indicatorService;
-    }
-    
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    private I18nManager i18nManager;
-
-    public void setI18nManager( I18nManager manager )
-    {
-        i18nManager = manager;
-    }
-
-    @GET
-    @Path( "/{id}/{width}/{height}" )
-    @Produces( ContextUtils.CONTENT_TYPE_PNG )
-    public Response getChart( @PathParam("id") Integer id, @PathParam("width") final Integer width, @PathParam("height") final Integer height )
-        throws Exception
-    {
-        final JFreeChart jFreeChart = chartService.getJFreeChart( id, i18nManager.getI18nFormat() );
-        
-        final Chart chart = chartService.getChart( id );
-        
-        final String filename = CodecUtils.filenameEncode( chart.getTitle() + ".png" );
-        
-        return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
-        {
-            @Override
-            public void write( OutputStream out )
-                throws IOException, WebApplicationException
-            {
-                ChartUtilities.writeChartAsPNG( out, jFreeChart, width, height, true, 0 );
-            }
-        } ).build();
-    }
-    
-    @GET
-    @Path( "/period/{indicator}/{orgUnit}/{width}/{height}/{title}" )
-    @Produces( ContextUtils.CONTENT_TYPE_PNG )
-    public Response getPeriodChart( @PathParam("indicator") String indicatorUuid, @PathParam("orgUnit") String orgUnitUuid, 
-        @PathParam("width") final Integer width, @PathParam("height") final Integer height, @PathParam("title") Boolean title ) 
-            throws Exception
-    {
-        final Indicator indicator = indicatorService.getIndicator( indicatorUuid );
-        
-        final OrganisationUnit unit = organisationUnitService.getOrganisationUnit( orgUnitUuid );
-        
-        if ( indicator == null || unit == null )
-        {
-            return null;
-        }
-        
-        final String filename = CodecUtils.filenameEncode( indicator.getName() + ".png" );
-        
-        final JFreeChart jFreeChart = chartService.getJFreePeriodChart( indicator, unit, title, i18nManager.getI18nFormat() );
-        
-        return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
-        {
-            public void write( OutputStream out )
-                throws IOException, WebApplicationException
-            {
-                ChartUtilities.writeChartAsPNG( out, jFreeChart, width, height, true, 0 );
-            }
-        } ).build();
-    }
-
-    @GET
-    @Path( "/orgUnit/{indicator}/{orgUnit}/{width}/{height}/{title}" )
-    @Produces( ContextUtils.CONTENT_TYPE_PNG )
-    public Response getOrganisationUnitChart( @PathParam("indicator") String indicatorUuid, @PathParam("orgUnit") String orgUnitUuid, 
-        @PathParam("width") final Integer width, @PathParam("height") final Integer height, @PathParam("title") Boolean title ) 
-            throws Exception
-    {
-        final Indicator indicator = indicatorService.getIndicator( indicatorUuid );
-        
-        final OrganisationUnit unit = organisationUnitService.getOrganisationUnit( orgUnitUuid );
-        
-        if ( indicator == null || unit == null )
-        {
-            return null;
-        }
-        
-        final String filename = CodecUtils.filenameEncode( indicator.getName() + ".png" );
-        
-        final JFreeChart jFreeChart = chartService.getJFreeOrganisationUnitChart( indicator, unit, title, i18nManager.getI18nFormat() );
-        
-        return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
-        {
-            public void write( OutputStream out )
-                throws IOException, WebApplicationException
-            {
-                ChartUtilities.writeChartAsPNG( out, jFreeChart, width, height, true, 0 );
-            }
-        } ).build();
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java	2011-10-07 10:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java	1970-01-01 00:00:00 +0000
@@ -1,99 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.importexport.dxf2.service.DataSetMapper;
-import org.hisp.dhis.system.velocity.VelocityManager;
-import org.hisp.dhis.web.api.ResponseUtils;
-import org.hisp.dhis.web.api.UrlResourceListener;
-import org.springframework.beans.factory.annotation.Required;
-
-import com.sun.jersey.api.json.JSONWithPadding;
-
-@Path( "dataSets/{uuid}" )
-public class DataSetResource
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataSetService dataSetService;
-
-    @Required
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-    
-    @Required
-    public void setVelocityManager( VelocityManager velocityManager )
-    {
-        this.velocityManager = velocityManager;
-    }
-    
-    private VelocityManager velocityManager;
-
-    @Context
-    private UriInfo uriInfo;
-
-    // -------------------------------------------------------------------------
-    // Resource Impl
-    // -------------------------------------------------------------------------
-
-    @GET
-    @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
-    public org.hisp.dhis.importexport.dxf2.model.DataSet getDataSetXml( @PathParam( "uuid" ) String uuid )
-    {
-        DataSet dataSet = dataSetService.getDataSet( uuid );
-
-        if ( dataSet == null )
-        {
-            throw new IllegalArgumentException( "No dataset with uuid " + uuid );
-        }
-        
-        org.hisp.dhis.importexport.dxf2.model.DataSet dxfDataSet = new DataSetMapper().convert( dataSet );
-        new UrlResourceListener( uriInfo ).beforeMarshal( dxfDataSet );
-        return dxfDataSet;
-    }
-
-    @GET
-    @Produces( { "application/javascript" } )
-    public JSONWithPadding getDataSet( @PathParam("uuid") String uuid, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
-    {
-        DataSet dataSet = dataSetService.getDataSet( uuid );
-
-        if ( dataSet == null )
-        {
-            throw new IllegalArgumentException( "No dataset with uuid " + uuid );
-        }
-
-        org.hisp.dhis.importexport.dxf2.model.DataSet dxfDataSet = new DataSetMapper().convert( dataSet );
-        new UrlResourceListener( uriInfo ).beforeMarshal( dxfDataSet );
-        
-        return new JSONWithPadding( dxfDataSet, callback );
-    }
-
-    @GET
-    @Produces( MediaType.TEXT_HTML )
-    public String getDataSet( @PathParam( "uuid" ) String uuid )
-    {
-        DataSet dataSet = dataSetService.getDataSet( uuid );
-
-        if ( dataSet == null )
-        {
-            throw new IllegalArgumentException( "No dataset with uuid " + uuid );
-        }
-
-        return velocityManager.render( dataSet, ResponseUtils.TEMPLATE_PATH + "dataSet" );
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResource.java	2011-10-07 10:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResource.java	1970-01-01 00:00:00 +0000
@@ -1,105 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.importexport.dxf2.model.DataSetLinks;
-import org.hisp.dhis.importexport.dxf2.service.LinkBuilder;
-import org.hisp.dhis.importexport.dxf2.service.LinkBuilderImpl;
-import org.hisp.dhis.system.velocity.VelocityManager;
-import org.hisp.dhis.util.ContextUtils;
-import org.hisp.dhis.web.api.ResponseUtils;
-import org.hisp.dhis.web.api.UrlResourceListener;
-import org.springframework.beans.factory.annotation.Required;
-
-import com.sun.jersey.api.json.JSONWithPadding;
-
-@Path( "dataSets" )
-public class DataSetsResource
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataSetService dataSetService;
-
-    @Required
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-
-    private VelocityManager velocityManager;
-
-    @Required
-    public void setVelocityManager( VelocityManager velocityManager )
-    {
-        this.velocityManager = velocityManager;
-    }
-
-    private LinkBuilder linkBuilder = new LinkBuilderImpl();
-
-    @Context
-    private UriInfo uriInfo;
-
-    // -------------------------------------------------------------------------
-    // Resource Impl
-    // -------------------------------------------------------------------------
-
-    @GET
-    @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
-    public DataSetLinks getDataSetLinks()
-    {
-        DataSetLinks dataSetLinks = new DataSetLinks( linkBuilder.getLinks( dataSetService.getAllDataSets() ) );
-        new UrlResourceListener( uriInfo ).beforeMarshal( dataSetLinks );
-        return dataSetLinks;
-    }
-
-    @GET
-    @Produces( ContextUtils.CONTENT_TYPE_JAVASCRIPT )
-    public JSONWithPadding getDataSets( @QueryParam( "callback" ) @DefaultValue( "callback" )
-    String callback )
-    {
-        Collection<DataSet> dataSets = dataSetService.getAllDataSets();
-        Map<String, Object> dataSetOutput = new HashMap<String, Object>();
-
-        List<Map<String, Object>> dataSetsArray = new ArrayList<Map<String, Object>>();
-
-        for ( DataSet dataSet : dataSets )
-        {
-            Map<String, Object> dataSetMap = new HashMap<String, Object>();
-            dataSetMap.put( "id", dataSet.getUuid() );
-            dataSetMap.put( "href", uriInfo.getAbsolutePath().toASCIIString() + "/" + dataSet.getUuid() );
-            dataSetMap.put( "name", dataSet.getName() );
-
-            dataSetsArray.add( dataSetMap );
-        }
-
-        dataSetOutput.put( "dataSets", dataSetsArray );
-
-        return new JSONWithPadding( dataSetOutput, callback );
-    }
-
-    @GET
-    @Produces( MediaType.TEXT_HTML )
-    public String getDataSetList()
-    {
-        DataSetLinks dataSetLinks = new DataSetLinks( linkBuilder.getLinks( dataSetService.getAllDataSets() ) );
-        new UrlResourceListener( uriInfo ).beforeMarshal( dataSetLinks );
-        return velocityManager.render( dataSetLinks.getDataSet(), ResponseUtils.TEMPLATE_PATH + "dataSets" );
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataValueSetsResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataValueSetsResource.java	2011-10-07 10:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataValueSetsResource.java	1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-import java.net.URI;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
-import org.hisp.dhis.importexport.dxf2.model.DataValueSet;
-import org.hisp.dhis.importexport.dxf2.service.DataValueSetService;
-import org.hisp.dhis.system.velocity.VelocityManager;
-import org.hisp.dhis.web.api.ResponseUtils;
-import org.springframework.beans.factory.annotation.Required;
-
-@Path( "dataValueSets" )
-public class DataValueSetsResource
-{
-    private DataValueSetService dataValueSetService;
-
-    private VelocityManager velocityManager;
-
-    @Context
-    private UriInfo uriInfo;
-    
-    @GET
-    @Produces( MediaType.TEXT_HTML )
-    public String getDescription()
-    {
-        URI uri = uriInfo.getBaseUriBuilder().path( DataSetsResource.class ).build( );
-        return velocityManager.render( uri, ResponseUtils.TEMPLATE_PATH + "dataValueSets" );
-    }
-     
-    @POST
-    @Consumes( MediaType.APPLICATION_XML )
-    public void storeDataValueSet( DataValueSet dataValueSet )
-    {
-        dataValueSetService.saveDataValueSet( dataValueSet );
-    }
-
-    @Required
-    public void setDataValueSetService( DataValueSetService dataValueSetService )
-    {
-        this.dataValueSetService = dataValueSetService;
-    }
-
-    @Required
-    public void setVelocityManager( VelocityManager velocityManager )
-    {
-        this.velocityManager = velocityManager;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DhisMediaType.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DhisMediaType.java	2011-09-12 08:29:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DhisMediaType.java	1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-/*
- * Copyright (c) 2004-2010, 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.
- */
-
-public class DhisMediaType
-{
-    public static final String DXF = "application/vnd.org.dhis2.dxf";
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java	2011-09-13 11:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java	1970-01-01 00:00:00 +0000
@@ -1,78 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-/*
- * Copyright (c) 2004-2010, 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 javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
-import org.hisp.dhis.importexport.dxf2.model.OrgUnit;
-import org.hisp.dhis.importexport.dxf2.service.OrgUnitMapper;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.web.api.UrlResourceListener;
-
-@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
-@Consumes( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
-@Path( "/orgUnits/{id}" )
-public class OrgUnitResource
-{
-    private OrganisationUnitService organisationUnitService;
-
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    @PathParam( "id" )
-    private String id;
-
-    @Context
-    private UriInfo uriInfo;
-
-    @GET
-    @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
-    public OrgUnit getOrgUnit()
-    {
-        OrganisationUnit unit = organisationUnitService.getOrganisationUnit( id );
-
-        if ( unit == null )
-        {
-            return null;
-        }
-
-        OrgUnit orgUnit = new OrgUnitMapper().get( unit );
-        new UrlResourceListener( uriInfo ).beforeMarshal( orgUnit );
-        return orgUnit;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitsResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitsResource.java	2011-10-07 10:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitsResource.java	1970-01-01 00:00:00 +0000
@@ -1,60 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
-import org.hisp.dhis.importexport.dxf2.model.OrgUnitLinks;
-import org.hisp.dhis.importexport.dxf2.service.LinkBuilder;
-import org.hisp.dhis.importexport.dxf2.service.LinkBuilderImpl;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.system.velocity.VelocityManager;
-import org.hisp.dhis.web.api.ResponseUtils;
-import org.hisp.dhis.web.api.UrlResourceListener;
-import org.springframework.beans.factory.annotation.Required;
-
-@Path( "orgUnits" )
-public class OrgUnitsResource
-{
-    private OrganisationUnitService organisationUnitService;
-
-    private VelocityManager velocityManager;
-
-    private LinkBuilder linkBuilder = new LinkBuilderImpl();
-
-    @Context
-    private UriInfo uriInfo;
-    
-    @GET
-    @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
-    public OrgUnitLinks getOrgUnits()
-    {
-        OrgUnitLinks orgUnitLinks = new OrgUnitLinks( linkBuilder.getLinks( organisationUnitService.getAllOrganisationUnits() ) );
-        new UrlResourceListener( uriInfo ).beforeMarshal( orgUnitLinks );
-        return orgUnitLinks;
-    }
-
-    @GET
-    @Produces( MediaType.TEXT_HTML )
-    public String getOrgUnitsHtml()
-    {
-        OrgUnitLinks orgUnitLinks = new OrgUnitLinks( linkBuilder.getLinks( organisationUnitService.getAllOrganisationUnits() ) );
-        new UrlResourceListener( uriInfo ).beforeMarshal( orgUnitLinks );
-        return velocityManager.render( orgUnitLinks.getOrgUnit(), ResponseUtils.TEMPLATE_PATH + "orgUnits" );
-    }
-
-    @Required
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-    
-    @Required
-    public void setVelocityManager( VelocityManager velocityManager )
-    {
-        this.velocityManager = velocityManager;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ReportResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ReportResource.java	2011-10-23 13:02:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ReportResource.java	1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-import static java.util.Calendar.MONTH;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.StreamingOutput;
-
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.i18n.I18nManager;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Cal;
-import org.hisp.dhis.report.Report;
-import org.hisp.dhis.report.ReportService;
-import org.hisp.dhis.system.util.CodecUtils;
-import org.hisp.dhis.util.ContextUtils;
-import org.hisp.dhis.web.api.ResponseUtils;
-
-@Path( "/report/{report}/{orgUnit}" )
-public class ReportResource
-{
-    private ReportService reportService;
-
-    public void setReportService( ReportService reportService )
-    {
-        this.reportService = reportService;
-    }
-
-    private OrganisationUnitService organisationUnitService;
-    
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-
-    private I18nManager i18nManager;
-
-    public void setI18nManager( I18nManager manager )
-    {
-        i18nManager = manager;
-    }
-    
-    @GET
-    @Produces(ContextUtils.CONTENT_TYPE_PDF)
-    public Response renderReport( @PathParam("report") final Integer reportId,
-        @PathParam("orgUnit") final String orgUnitUuid )
-            throws Exception
-    {
-        final Report report = reportService.getReport( reportId );
-        
-        final OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUuid );
-        
-        if ( report == null || organisationUnit == null )
-        {
-            return null;
-        }
-        
-        final int organisationUnitId = organisationUnit.getId();
-        
-        final I18nFormat format = i18nManager.getI18nFormat();
-        
-        final String filename = CodecUtils.filenameEncode( report.getName() ) + "." + ReportService.REPORTTYPE_PDF;
-        
-        return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
-        {
-            public void write( OutputStream out )
-                throws IOException, WebApplicationException
-            {
-                reportService.renderReport( out, report, new Cal().now().subtract( MONTH, 1 ).time(), 
-                    organisationUnitId, ReportService.REPORTTYPE_PDF, format );
-            }
-        } ).build();
-    }
-}

=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/resources'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis'
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml	2011-11-02 11:14:35 +0000
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd";>
+
+  <!-- Root Context: defines shared resources visible to all other web components -->
+
+</beans>

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/servlet.xml'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/servlet.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/servlet.xml	2011-11-02 11:14:35 +0000
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:beans="http://www.springframework.org/schema/beans";
+  xmlns:context="http://www.springframework.org/schema/context"; xmlns:mvc="http://www.springframework.org/schema/mvc";
+  xmlns:p="http://www.springframework.org/schema/p";
+  xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
+    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd";>
+
+  <mvc:annotation-driven />
+  <mvc:resources mapping="/resources/**" location="/resources/" />
+
+  <context:component-scan base-package="org.hisp.dhis.api" />
+
+</beans:beans>

=== removed directory 'dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api'
=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataSet.vm'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataSet.vm	2011-09-13 11:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataSet.vm	1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<body>
-<h1>Data sets available for reporting</h1> 
-<p>See the <a href="${object.id}">xml version</a></p>
-<p>UUID: ${object.id}</p>
-<p>Period type: ${object.periodType} - ${object.periodType.isoFormat}</p>
-
-<h2>Org units reporting data set</h2>
-
-<ul>
-#foreach( $unit in $object.sources )
-<li>${unit.name} - ${unit.uuid}</li>
-#end
-</ul>
-
-<h2>Data elements in data set</h2>
-
-<ul>
-#foreach( $dataElement in $object.dataElements )
-<li>${dataElement.name} - ${dataElement.type} - ${dataElement.uuid}
-#set( $optionCombos = $dataElement.categoryCombo.optionCombos )
-#if( $optionCombos && $optionCombos.size() > 0 )
-<ul>
-#foreach( $optionCombo in $optionCombos )
-<li>${optionCombo.name} - ${optionCombo.uuid}</li>
-#end
-</ul>
-#end
-</li>
-#end
-</ul>
-</body>
-</html>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataSets.vm'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataSets.vm	2011-09-13 11:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataSets.vm	1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<body>
-<h1>Data sets available for reporting</h1> 
-<p>See the <a href="dataSets.xml">xml version</a></p>
-<ul>
-#foreach( $link in $object )
-<li><a href="${link.href}">${link.name}</a></li>
-#end
-</ul>
-</body>
-</html>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataValueSets.vm'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataValueSets.vm	2011-09-13 11:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/dataValueSets.vm	1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<body>
-    <p>This resource is the place to post data value sets. Take a look at the 
-    <a href="${object}">data sets</a> to see what to post.</p>
-
-	<pre>&lt;dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0-SNAPSHOT";
-    dataSet="dataSet UUID"
-    period="periodInIsoFormat"
-    orgUnit="unit UUID"&gt;
-    &lt;dataValue dataElement="data element UUID" categoryOptionCombo="UUID, only specify if used" storedBy="string" value="value" /&gt;
-    &lt;/dataValueSet&gt;</pre>
-</body>
-</html>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/index.vm'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/index.vm	2011-09-13 11:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/index.vm	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-  <head>
-    <title>DHIS2 Web API</title>
-  </head>
-  <body>
-    <h1>DHIS2 Web API</h1>
-  
-    <p><b>Warning: This API is in no way ready for public consumption. Radical changes must be expected at any time!</b></p>
-
-	<p>The api currently supports a specific pilot use case for posting of data value sets.
-
-	<h2>Posting data value sets</h2>
-	<p>To find the needed information about the data sets you want to post data about, go to <a href="dataSets">the data set list</a>.</p>
-
-	<p>If you don't want org units listed by data set, there is also the <a href="orgUnits">full list of org units</a></p> 
-
-    <p>Post according to the following template <a href="/api/dataValueSets/">/api/dataValueSets/</a></p>
-	<pre>&lt;dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0-SNAPSHOT";
-    dataSet="dataSet UUID"
-    period="periodInIsoFormat"
-    orgUnit="unit UUID"&gt;
-    &lt;dataValue dataElement="data element UUID" categoryOptionCombo="UUID, only specify if used" storedBy="string" value="value" /&gt;
-    &lt;/dataValueSet&gt;</pre>
-  </body>
-</html>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/orgUnits.vm'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/orgUnits.vm	2011-09-13 11:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/dhis-web-api/orgUnits.vm	1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<body>
-<h1>Organisation units</h1> 
-<p>See the <a href="orgUnits.xml">xml version</a></p>
-<ul>
-#foreach( $link in $object )
-<li><a href="${link.href}">${link.name}</a></li>
-#end
-</ul>
-</body>
-</html>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/struts.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/struts.xml	2011-11-02 11:14:35 +0000
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts PUBLIC
+"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+"http://struts.apache.org/dtds/struts-2.0.dtd";>
+<struts>
+  <include file="dhis-web-commons.xml" />
+
+  <package name="dhis-web-api" extends="dhis-web-commons" namespace="/dhis-web-api">
+  </package>
+
+</struts>

=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/webapp'
=== added directory 'dhis-2/dhis-web/dhis-web-api/src/main/webapp/WEB-INF'
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/webapp/WEB-INF/web.xml'
--- dhis-2/dhis-web/dhis-web-api/src/main/webapp/WEB-INF/web.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/webapp/WEB-INF/web.xml	2011-11-02 11:14:35 +0000
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+  "http://java.sun.com/dtd/web-app_2_3.dtd";>
+<web-app>
+  <display-name>DHIS Web API</display-name>
+
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>classpath*:/META-INF/dhis/beans.xml</param-value>
+  </context-param>
+
+  <context-param>
+    <param-name>automaticAccessType</param-name>
+    <param-value>ghostAdmin</param-value>
+  </context-param>
+
+  <filter>
+    <filter-name>RedirectFilter</filter-name>
+    <filter-class>org.hisp.dhis.servlet.filter.HttpRedirectFilter</filter-class>
+    <init-param>
+      <param-name>redirectPath</param-name>
+      <param-value>api/</param-value>
+    </init-param>
+  </filter>
+
+  <filter>
+    <filter-name>OpenSessionInViewFilter</filter-name>
+    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
+  </filter>
+
+  <filter>
+    <filter-name>springSecurityFilterChain</filter-name>
+    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+  </filter>
+
+  <filter>
+    <filter-name>Struts</filter-name>
+    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
+  </filter>
+
+  <filter>
+    <filter-name>encodingFilter</filter-name>
+    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
+    <init-param>
+      <param-name>encoding</param-name>
+      <param-value>UTF-8</param-value>
+    </init-param>
+    <init-param>
+      <param-name>forceEncoding</param-name>
+      <param-value>true</param-value>
+    </init-param>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>RedirectFilter</filter-name>
+    <url-pattern>/</url-pattern>
+  </filter-mapping>
+
+  <filter-mapping>
+    <filter-name>OpenSessionInViewFilter</filter-name>
+    <url-pattern>*.action</url-pattern>
+  </filter-mapping>
+
+  <filter-mapping>
+    <filter-name>springSecurityFilterChain</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <filter-mapping>
+    <filter-name>Struts</filter-name>
+    <url-pattern>*.action</url-pattern>
+  </filter-mapping>
+
+  <filter-mapping>
+    <filter-name>encodingFilter</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <listener>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
+
+  <listener>
+    <listener-class>org.hisp.dhis.system.startup.StartupListener</listener-class>
+  </listener>
+
+  <!-- Processes application requests -->
+  <servlet>
+    <servlet-name>webapiServlet</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <init-param>
+      <param-name>contextConfigLocation</param-name>
+      <param-value>classpath*:/META-INF/dhis/servlet.xml</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>webapiServlet</servlet-name>
+    <url-pattern>/api</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+    <servlet-name>webapiServlet</servlet-name>
+    <url-pattern>/api/*</url-pattern>
+  </servlet-mapping>
+</web-app>

=== renamed directory 'dhis-2/dhis-web/dhis-web-api' => 'dhis-2/dhis-web/dhis-web-api2'
=== modified file 'dhis-2/dhis-web/dhis-web-api2/pom.xml'
--- dhis-2/dhis-web/dhis-web-api/pom.xml	2011-10-14 16:54:27 +0000
+++ dhis-2/dhis-web/dhis-web-api2/pom.xml	2011-11-02 11:14:35 +0000
@@ -8,12 +8,12 @@
     <version>2.6-SNAPSHOT</version>
   </parent>
 
-  <artifactId>dhis-web-api</artifactId>
+  <artifactId>dhis-web-api2</artifactId>
   <packaging>war</packaging>
-  <name>DHIS Web API</name>
+  <name>DHIS Web API2</name>
 
   <build>
-    <finalName>dhis-web-api</finalName>
+    <finalName>dhis-web-api2</finalName>
   </build>
 
   <dependencies>
@@ -84,3 +84,4 @@
     <rootDir>../../</rootDir>
   </properties>
 </project>
+

=== added directory 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2'
=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/HtmlPromotingUriConnegFilter.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/HtmlPromotingUriConnegFilter.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/HtmlPromotingUriConnegFilter.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.web.api2;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+
+import com.sun.jersey.api.container.filter.UriConnegFilter;
+import com.sun.jersey.spi.container.ContainerRequest;
+
+public class HtmlPromotingUriConnegFilter
+    extends UriConnegFilter
+{
+    private static final String ACCEPT = "Accept";
+
+    private static Map<String, MediaType> mediaExtentions;
+
+    static
+    {
+        mediaExtentions = new HashMap<String, MediaType>();
+        mediaExtentions.put( "xml", MediaType.APPLICATION_XML_TYPE );
+        mediaExtentions.put( "html", MediaType.TEXT_HTML_TYPE );
+        mediaExtentions.put( "json", MediaType.APPLICATION_JSON_TYPE );
+        mediaExtentions.put( "jsonp", new MediaType( "application", "javascript" ) );
+    }
+
+    public HtmlPromotingUriConnegFilter()
+    {
+        super( mediaExtentions );
+    }
+
+    @Override
+    public ContainerRequest filter( ContainerRequest request )
+    {
+        String accept = request.getHeaderValue( ACCEPT );
+
+        if ( accept == null || accept.trim().isEmpty() )
+        {
+            request.getRequestHeaders().putSingle( ACCEPT, MediaType.TEXT_HTML );
+        }
+        else
+        {
+            accept = preferHtml( accept );
+            request.getRequestHeaders().putSingle( ACCEPT, accept );
+        }
+
+        request = super.filter( request );
+
+        return request;
+    }
+
+    public static String preferHtml( String accept )
+    {
+        int i = accept.indexOf( "text/html" );
+
+        if ( i == -1 )
+        {
+            if ( accept.trim().equals( "" ) )
+            {
+                return "text/html";
+            }
+            return "text/html," + accept;
+        }
+
+        int start = accept.substring( 0, i ).lastIndexOf( ',' );
+
+        String result = "";
+
+        if ( start != -1 )
+        {
+            result = accept.substring( 0, start );
+        }
+
+        int end = accept.indexOf( ',', i );
+
+        if ( end != -1 )
+        {
+            if ( result.equals( "" ) )
+            {
+                result = accept.substring( end + 1 );
+            }
+            else
+            {
+                result = result + accept.substring( end );
+            }
+        }
+
+        if ( result.trim().equals( "" ) )
+        {
+            return "text/html";
+        }
+
+        return "text/html," + result;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/ResponseUtils.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/ResponseUtils.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/ResponseUtils.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,30 @@
+package org.hisp.dhis.web.api2;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import org.hisp.dhis.system.util.DateUtils;
+
+public class ResponseUtils
+{
+    public static final String TEMPLATE_PATH = "dhis-web-api2/";
+
+    public static ResponseBuilder response( boolean disallowCache, String filename, boolean attachment )
+    {
+        ResponseBuilder builder = Response.ok();
+
+        if ( disallowCache )
+        {
+            builder.header( "Cache-Control", "no-cache" );
+            builder.header( "Expires", DateUtils.getExpiredHttpDateString() );
+        }
+
+        if ( filename != null )
+        {
+            String type = attachment ? "attachment" : "inline";
+            builder.header( "Content-Disposition", type + "; filename=\"" + filename + "\"" );
+        }
+
+        return builder;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/UrlResourceListener.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/UrlResourceListener.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/UrlResourceListener.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,83 @@
+package org.hisp.dhis.web.api2;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.Marshaller.Listener;
+
+import org.hisp.dhis.importexport.dxf2.model.DataSet;
+import org.hisp.dhis.importexport.dxf2.model.DataSetLinks;
+import org.hisp.dhis.importexport.dxf2.model.Link;
+import org.hisp.dhis.importexport.dxf2.model.OrgUnit;
+import org.hisp.dhis.importexport.dxf2.model.OrgUnitLinks;
+
+public class UrlResourceListener
+    extends Listener
+{
+    private UriInfo uriInfo;
+
+    private Map<Class<?>, String> mapping;
+
+    public UrlResourceListener( UriInfo uriInfo )
+    {
+        super();
+        this.uriInfo = uriInfo;
+
+        mapping = new HashMap<Class<?>, String>();
+        mapping.put( OrgUnit.class, "orgUnits/{id}" );
+        mapping.put( DataSet.class, "dataSets/{id}" );
+    }
+
+    @Override
+    public void beforeMarshal( Object source )
+    {
+        if ( source instanceof DataSet )
+        {
+            addUrls( ((DataSet) source).getOrgUnitLinks(), OrgUnit.class );
+        }
+        else if ( source instanceof DataSetLinks )
+        {
+            addUrls( ((DataSetLinks) source).getDataSet(), DataSet.class );
+        }
+        else if ( source instanceof OrgUnit )
+        {
+            OrgUnit unit = (OrgUnit) source;
+            addUrls( unit.getChildren(), OrgUnit.class );
+            addUrl( unit.getParent(), OrgUnit.class );
+            addUrls( unit.getDataSets(), DataSet.class );
+        }
+        else if ( source instanceof OrgUnitLinks )
+        {
+            addUrls( ((OrgUnitLinks) source).getOrgUnit(), OrgUnit.class );
+        }
+    }
+
+    private void addUrls( List<Link> links, Class<?> clazz )
+    {
+        if ( links == null )
+        {
+            return;
+        }
+
+        for ( Link link : links )
+        {
+            addUrl( link, clazz );
+        }
+    }
+
+    private void addUrl( Link link, Class<?> clazz )
+    {
+        if ( link == null )
+        {
+            return;
+        }
+
+        String id = link.getId();
+        String path = mapping.get( clazz );
+        String url = uriInfo.getBaseUriBuilder().path( path ).build( id ).toString();
+
+        link.setHref( url );
+    }
+}

=== added directory 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/action'
=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/action/ImportDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/action/ImportDataValueAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/action/ImportDataValueAction.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,222 @@
+package org.hisp.dhis.web.api2.action;
+
+/*
+ * Copyright (c) 2004-2010, 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.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.apache.struts2.interceptor.ServletResponseAware;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ImportDataValueAction
+    implements ServletRequestAware, ServletResponseAware, Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ProgramStageInstanceService programStageInstanceService;
+
+    private PatientDataValueService patientDataValueService;
+
+    private DataElementService dataElementService;
+
+    private HttpServletRequest request;
+
+    private HttpServletResponse response;
+
+    private OrganisationUnitService orgUnitService;
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    // -------------------------------------------------------------------------
+    // Set and get methods
+    // -------------------------------------------------------------------------
+
+    @Override
+    public void setServletResponse( HttpServletResponse response )
+    {
+        this.response = response;
+    }
+
+    @Override
+    public void setServletRequest( HttpServletRequest request )
+    {
+        this.request = request;
+    }
+
+    public HttpServletRequest getServletRequest()
+    {
+        return request;
+    }
+
+    public HttpServletResponse getServletResponse()
+    {
+        return response;
+    }
+
+    public ProgramStageInstanceService getProgramStageInstanceService()
+    {
+        return programStageInstanceService;
+    }
+
+    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+    {
+        this.programStageInstanceService = programStageInstanceService;
+    }
+
+    public PatientDataValueService getPatientDataValueService()
+    {
+        return patientDataValueService;
+    }
+
+    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+    {
+        this.patientDataValueService = patientDataValueService;
+    }
+
+    public DataElementService getDataElementService()
+    {
+        return dataElementService;
+    }
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    public OrganisationUnitService getOrgUnitService()
+    {
+        return orgUnitService;
+    }
+
+    public void setOrgUnitService( OrganisationUnitService orgUnitService )
+    {
+        this.orgUnitService = orgUnitService;
+    }
+
+    public DataElementCategoryService getDataElementCategoryService()
+    {
+        return dataElementCategoryService;
+    }
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private InputStream inputStream;
+
+    public InputStream getInputStream()
+    {
+        return inputStream;
+    }
+
+    public void setInputStream( InputStream inputStream )
+    {
+        this.inputStream = inputStream;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        String message = "Upload Successfully!";
+        request = ServletActionContext.getRequest();
+        response = ServletActionContext.getResponse();
+        this.setInputStream( new ByteArrayInputStream( message.getBytes() ) );
+
+        InputStream clientInput = request.getInputStream();
+        DataInputStream dis = new DataInputStream( clientInput );
+
+        if ( clientInput.available() > -1 )
+        {
+            int numOfDataValue = dis.readInt();
+            OrganisationUnit orgUnit = orgUnitService.getOrganisationUnit( dis.readInt() );
+            this.setInputStream( new ByteArrayInputStream( message.getBytes() ) );
+            try
+            {
+                for ( int i = 0; i < numOfDataValue; i++ )
+                {
+                    this.saveDataValue( dis, orgUnit );
+                }
+            }
+            catch ( Exception ex )
+            {
+                message = "Upload failed!";
+                this.setInputStream( new ByteArrayInputStream( message.getBytes() ) );
+            }
+        }
+
+        return SUCCESS;
+    }
+
+    private void saveDataValue( DataInputStream dis, OrganisationUnit orgUnit )
+        throws IOException
+    {
+        DataElement dataElement = dataElementService.getDataElement( dis.readInt() );
+        ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( dis.readInt() );
+        DataElementCategoryOptionCombo optionCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( 1 );
+
+        PatientDataValue patientDataValue = new PatientDataValue();
+        patientDataValue.setDataElement( dataElement );
+        patientDataValue.setOptionCombo( optionCombo );
+        patientDataValue.setOrganisationUnit( orgUnit );
+        patientDataValue.setProgramStageInstance( programStageInstance );
+        patientDataValue.setTimestamp( new Date() );
+        patientDataValue.setProvidedByAnotherFacility( false );
+        patientDataValue.setValue( dis.readUTF() );
+
+        patientDataValueService.savePatientDataValue( patientDataValue );
+    }
+}

=== added directory 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/mapping'
=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/mapping/IllegalArgumentExceptionMapper.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/mapping/IllegalArgumentExceptionMapper.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/mapping/IllegalArgumentExceptionMapper.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,22 @@
+package org.hisp.dhis.web.api2.mapping;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+import com.sun.jersey.spi.resource.Singleton;
+
+@Provider
+@Singleton
+public class IllegalArgumentExceptionMapper
+    implements ExceptionMapper<IllegalArgumentException>
+{
+    @Override
+    public Response toResponse( IllegalArgumentException e )
+    {
+        return Response.status( Status.CONFLICT ).entity( "Problem with input: " + e.getMessage() )
+            .type( MediaType.TEXT_PLAIN ).build();
+    }
+}

=== added directory 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources'
=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ApiResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ApiResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ApiResource.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,38 @@
+package org.hisp.dhis.web.api2.resources;
+
+import java.io.IOException;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.hisp.dhis.system.velocity.VelocityManager;
+import org.hisp.dhis.web.api2.ResponseUtils;
+import org.springframework.beans.factory.annotation.Required;
+
+import com.sun.jersey.api.view.ImplicitProduces;
+
+@Path( "/" )
+@ImplicitProduces( MediaType.TEXT_HTML )
+public class ApiResource
+{
+    private VelocityManager velocityManager;
+
+    @GET
+    @Produces( MediaType.TEXT_HTML )
+    public String getDescription()
+        throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, IOException, Exception
+    {
+        return velocityManager.render( null, ResponseUtils.TEMPLATE_PATH + "index" );
+    }
+    
+    @Required
+    public void setVelocityManager( VelocityManager velocityManager )
+    {
+        this.velocityManager = velocityManager;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ChartResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ChartResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ChartResource.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,140 @@
+package org.hisp.dhis.web.api2.resources;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+
+import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.chart.ChartService;
+import org.hisp.dhis.i18n.I18nManager;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.system.util.CodecUtils;
+import org.hisp.dhis.util.ContextUtils;
+import org.hisp.dhis.web.api2.ResponseUtils;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+
+@Path( "/chart" )
+public class ChartResource
+{
+    private ChartService chartService;
+
+    public void setChartService( ChartService chartService )
+    {
+        this.chartService = chartService;
+    }
+    
+    private IndicatorService indicatorService;
+
+    public void setIndicatorService( IndicatorService indicatorService )
+    {
+        this.indicatorService = indicatorService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    private I18nManager i18nManager;
+
+    public void setI18nManager( I18nManager manager )
+    {
+        i18nManager = manager;
+    }
+
+    @GET
+    @Path( "/{id}/{width}/{height}" )
+    @Produces( ContextUtils.CONTENT_TYPE_PNG )
+    public Response getChart( @PathParam("id") Integer id, @PathParam("width") final Integer width, @PathParam("height") final Integer height )
+        throws Exception
+    {
+        final JFreeChart jFreeChart = chartService.getJFreeChart( id, i18nManager.getI18nFormat() );
+        
+        final Chart chart = chartService.getChart( id );
+        
+        final String filename = CodecUtils.filenameEncode( chart.getTitle() + ".png" );
+        
+        return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
+        {
+            @Override
+            public void write( OutputStream out )
+                throws IOException, WebApplicationException
+            {
+                ChartUtilities.writeChartAsPNG( out, jFreeChart, width, height, true, 0 );
+            }
+        } ).build();
+    }
+    
+    @GET
+    @Path( "/period/{indicator}/{orgUnit}/{width}/{height}/{title}" )
+    @Produces( ContextUtils.CONTENT_TYPE_PNG )
+    public Response getPeriodChart( @PathParam("indicator") String indicatorUuid, @PathParam("orgUnit") String orgUnitUuid, 
+        @PathParam("width") final Integer width, @PathParam("height") final Integer height, @PathParam("title") Boolean title ) 
+            throws Exception
+    {
+        final Indicator indicator = indicatorService.getIndicator( indicatorUuid );
+        
+        final OrganisationUnit unit = organisationUnitService.getOrganisationUnit( orgUnitUuid );
+        
+        if ( indicator == null || unit == null )
+        {
+            return null;
+        }
+        
+        final String filename = CodecUtils.filenameEncode( indicator.getName() + ".png" );
+        
+        final JFreeChart jFreeChart = chartService.getJFreePeriodChart( indicator, unit, title, i18nManager.getI18nFormat() );
+        
+        return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
+        {
+            public void write( OutputStream out )
+                throws IOException, WebApplicationException
+            {
+                ChartUtilities.writeChartAsPNG( out, jFreeChart, width, height, true, 0 );
+            }
+        } ).build();
+    }
+
+    @GET
+    @Path( "/orgUnit/{indicator}/{orgUnit}/{width}/{height}/{title}" )
+    @Produces( ContextUtils.CONTENT_TYPE_PNG )
+    public Response getOrganisationUnitChart( @PathParam("indicator") String indicatorUuid, @PathParam("orgUnit") String orgUnitUuid, 
+        @PathParam("width") final Integer width, @PathParam("height") final Integer height, @PathParam("title") Boolean title ) 
+            throws Exception
+    {
+        final Indicator indicator = indicatorService.getIndicator( indicatorUuid );
+        
+        final OrganisationUnit unit = organisationUnitService.getOrganisationUnit( orgUnitUuid );
+        
+        if ( indicator == null || unit == null )
+        {
+            return null;
+        }
+        
+        final String filename = CodecUtils.filenameEncode( indicator.getName() + ".png" );
+        
+        final JFreeChart jFreeChart = chartService.getJFreeOrganisationUnitChart( indicator, unit, title, i18nManager.getI18nFormat() );
+        
+        return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
+        {
+            public void write( OutputStream out )
+                throws IOException, WebApplicationException
+            {
+                ChartUtilities.writeChartAsPNG( out, jFreeChart, width, height, true, 0 );
+            }
+        } ).build();
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataSetResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataSetResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataSetResource.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,99 @@
+package org.hisp.dhis.web.api2.resources;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.importexport.dxf2.service.DataSetMapper;
+import org.hisp.dhis.system.velocity.VelocityManager;
+import org.hisp.dhis.web.api2.ResponseUtils;
+import org.hisp.dhis.web.api2.UrlResourceListener;
+import org.springframework.beans.factory.annotation.Required;
+
+import com.sun.jersey.api.json.JSONWithPadding;
+
+@Path( "dataSets/{uuid}" )
+public class DataSetResource
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataSetService dataSetService;
+
+    @Required
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+    
+    @Required
+    public void setVelocityManager( VelocityManager velocityManager )
+    {
+        this.velocityManager = velocityManager;
+    }
+    
+    private VelocityManager velocityManager;
+
+    @Context
+    private UriInfo uriInfo;
+
+    // -------------------------------------------------------------------------
+    // Resource Impl
+    // -------------------------------------------------------------------------
+
+    @GET
+    @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
+    public org.hisp.dhis.importexport.dxf2.model.DataSet getDataSetXml( @PathParam( "uuid" ) String uuid )
+    {
+        DataSet dataSet = dataSetService.getDataSet( uuid );
+
+        if ( dataSet == null )
+        {
+            throw new IllegalArgumentException( "No dataset with uuid " + uuid );
+        }
+        
+        org.hisp.dhis.importexport.dxf2.model.DataSet dxfDataSet = new DataSetMapper().convert( dataSet );
+        new UrlResourceListener( uriInfo ).beforeMarshal( dxfDataSet );
+        return dxfDataSet;
+    }
+
+    @GET
+    @Produces( { "application/javascript" } )
+    public JSONWithPadding getDataSet( @PathParam("uuid") String uuid, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback )
+    {
+        DataSet dataSet = dataSetService.getDataSet( uuid );
+
+        if ( dataSet == null )
+        {
+            throw new IllegalArgumentException( "No dataset with uuid " + uuid );
+        }
+
+        org.hisp.dhis.importexport.dxf2.model.DataSet dxfDataSet = new DataSetMapper().convert( dataSet );
+        new UrlResourceListener( uriInfo ).beforeMarshal( dxfDataSet );
+        
+        return new JSONWithPadding( dxfDataSet, callback );
+    }
+
+    @GET
+    @Produces( MediaType.TEXT_HTML )
+    public String getDataSet( @PathParam( "uuid" ) String uuid )
+    {
+        DataSet dataSet = dataSetService.getDataSet( uuid );
+
+        if ( dataSet == null )
+        {
+            throw new IllegalArgumentException( "No dataset with uuid " + uuid );
+        }
+
+        return velocityManager.render( dataSet, ResponseUtils.TEMPLATE_PATH + "dataSet" );
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataSetsResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataSetsResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataSetsResource.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,105 @@
+package org.hisp.dhis.web.api2.resources;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.importexport.dxf2.model.DataSetLinks;
+import org.hisp.dhis.importexport.dxf2.service.LinkBuilder;
+import org.hisp.dhis.importexport.dxf2.service.LinkBuilderImpl;
+import org.hisp.dhis.system.velocity.VelocityManager;
+import org.hisp.dhis.util.ContextUtils;
+import org.hisp.dhis.web.api2.ResponseUtils;
+import org.hisp.dhis.web.api2.UrlResourceListener;
+import org.springframework.beans.factory.annotation.Required;
+
+import com.sun.jersey.api.json.JSONWithPadding;
+
+@Path( "dataSets" )
+public class DataSetsResource
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataSetService dataSetService;
+
+    @Required
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
+    private VelocityManager velocityManager;
+
+    @Required
+    public void setVelocityManager( VelocityManager velocityManager )
+    {
+        this.velocityManager = velocityManager;
+    }
+
+    private LinkBuilder linkBuilder = new LinkBuilderImpl();
+
+    @Context
+    private UriInfo uriInfo;
+
+    // -------------------------------------------------------------------------
+    // Resource Impl
+    // -------------------------------------------------------------------------
+
+    @GET
+    @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
+    public DataSetLinks getDataSetLinks()
+    {
+        DataSetLinks dataSetLinks = new DataSetLinks( linkBuilder.getLinks( dataSetService.getAllDataSets() ) );
+        new UrlResourceListener( uriInfo ).beforeMarshal( dataSetLinks );
+        return dataSetLinks;
+    }
+
+    @GET
+    @Produces( ContextUtils.CONTENT_TYPE_JAVASCRIPT )
+    public JSONWithPadding getDataSets( @QueryParam( "callback" ) @DefaultValue( "callback" )
+    String callback )
+    {
+        Collection<DataSet> dataSets = dataSetService.getAllDataSets();
+        Map<String, Object> dataSetOutput = new HashMap<String, Object>();
+
+        List<Map<String, Object>> dataSetsArray = new ArrayList<Map<String, Object>>();
+
+        for ( DataSet dataSet : dataSets )
+        {
+            Map<String, Object> dataSetMap = new HashMap<String, Object>();
+            dataSetMap.put( "id", dataSet.getUuid() );
+            dataSetMap.put( "href", uriInfo.getAbsolutePath().toASCIIString() + "/" + dataSet.getUuid() );
+            dataSetMap.put( "name", dataSet.getName() );
+
+            dataSetsArray.add( dataSetMap );
+        }
+
+        dataSetOutput.put( "dataSets", dataSetsArray );
+
+        return new JSONWithPadding( dataSetOutput, callback );
+    }
+
+    @GET
+    @Produces( MediaType.TEXT_HTML )
+    public String getDataSetList()
+    {
+        DataSetLinks dataSetLinks = new DataSetLinks( linkBuilder.getLinks( dataSetService.getAllDataSets() ) );
+        new UrlResourceListener( uriInfo ).beforeMarshal( dataSetLinks );
+        return velocityManager.render( dataSetLinks.getDataSet(), ResponseUtils.TEMPLATE_PATH + "dataSets" );
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataValueSetsResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataValueSetsResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DataValueSetsResource.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,56 @@
+package org.hisp.dhis.web.api2.resources;
+
+import java.net.URI;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.hisp.dhis.importexport.dxf2.model.DataValueSet;
+import org.hisp.dhis.importexport.dxf2.service.DataValueSetService;
+import org.hisp.dhis.system.velocity.VelocityManager;
+import org.hisp.dhis.web.api2.ResponseUtils;
+import org.springframework.beans.factory.annotation.Required;
+
+@Path( "dataValueSets" )
+public class DataValueSetsResource
+{
+    private DataValueSetService dataValueSetService;
+
+    private VelocityManager velocityManager;
+
+    @Context
+    private UriInfo uriInfo;
+    
+    @GET
+    @Produces( MediaType.TEXT_HTML )
+    public String getDescription()
+    {
+        URI uri = uriInfo.getBaseUriBuilder().path( DataSetsResource.class ).build( );
+        return velocityManager.render( uri, ResponseUtils.TEMPLATE_PATH + "dataValueSets" );
+    }
+     
+    @POST
+    @Consumes( MediaType.APPLICATION_XML )
+    public void storeDataValueSet( DataValueSet dataValueSet )
+    {
+        dataValueSetService.saveDataValueSet( dataValueSet );
+    }
+
+    @Required
+    public void setDataValueSetService( DataValueSetService dataValueSetService )
+    {
+        this.dataValueSetService = dataValueSetService;
+    }
+
+    @Required
+    public void setVelocityManager( VelocityManager velocityManager )
+    {
+        this.velocityManager = velocityManager;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DhisMediaType.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DhisMediaType.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/DhisMediaType.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,33 @@
+package org.hisp.dhis.web.api2.resources;
+
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+
+public class DhisMediaType
+{
+    public static final String DXF = "application/vnd.org.dhis2.dxf";
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/OrgUnitResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/OrgUnitResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/OrgUnitResource.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,78 @@
+package org.hisp.dhis.web.api2.resources;
+
+/*
+ * Copyright (c) 2004-2010, 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 javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.hisp.dhis.importexport.dxf2.model.OrgUnit;
+import org.hisp.dhis.importexport.dxf2.service.OrgUnitMapper;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.web.api2.UrlResourceListener;
+
+@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
+@Consumes( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
+@Path( "/orgUnits/{id}" )
+public class OrgUnitResource
+{
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    @PathParam( "id" )
+    private String id;
+
+    @Context
+    private UriInfo uriInfo;
+
+    @GET
+    @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
+    public OrgUnit getOrgUnit()
+    {
+        OrganisationUnit unit = organisationUnitService.getOrganisationUnit( id );
+
+        if ( unit == null )
+        {
+            return null;
+        }
+
+        OrgUnit orgUnit = new OrgUnitMapper().get( unit );
+        new UrlResourceListener( uriInfo ).beforeMarshal( orgUnit );
+        return orgUnit;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/OrgUnitsResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/OrgUnitsResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/OrgUnitsResource.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,60 @@
+package org.hisp.dhis.web.api2.resources;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.hisp.dhis.importexport.dxf2.model.OrgUnitLinks;
+import org.hisp.dhis.importexport.dxf2.service.LinkBuilder;
+import org.hisp.dhis.importexport.dxf2.service.LinkBuilderImpl;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.system.velocity.VelocityManager;
+import org.hisp.dhis.web.api2.ResponseUtils;
+import org.hisp.dhis.web.api2.UrlResourceListener;
+import org.springframework.beans.factory.annotation.Required;
+
+@Path( "orgUnits" )
+public class OrgUnitsResource
+{
+    private OrganisationUnitService organisationUnitService;
+
+    private VelocityManager velocityManager;
+
+    private LinkBuilder linkBuilder = new LinkBuilderImpl();
+
+    @Context
+    private UriInfo uriInfo;
+    
+    @GET
+    @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
+    public OrgUnitLinks getOrgUnits()
+    {
+        OrgUnitLinks orgUnitLinks = new OrgUnitLinks( linkBuilder.getLinks( organisationUnitService.getAllOrganisationUnits() ) );
+        new UrlResourceListener( uriInfo ).beforeMarshal( orgUnitLinks );
+        return orgUnitLinks;
+    }
+
+    @GET
+    @Produces( MediaType.TEXT_HTML )
+    public String getOrgUnitsHtml()
+    {
+        OrgUnitLinks orgUnitLinks = new OrgUnitLinks( linkBuilder.getLinks( organisationUnitService.getAllOrganisationUnits() ) );
+        new UrlResourceListener( uriInfo ).beforeMarshal( orgUnitLinks );
+        return velocityManager.render( orgUnitLinks.getOrgUnit(), ResponseUtils.TEMPLATE_PATH + "orgUnits" );
+    }
+
+    @Required
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+    
+    @Required
+    public void setVelocityManager( VelocityManager velocityManager )
+    {
+        this.velocityManager = velocityManager;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ReportResource.java'
--- dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ReportResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/java/org/hisp/dhis/web/api2/resources/ReportResource.java	2011-11-02 11:14:35 +0000
@@ -0,0 +1,82 @@
+package org.hisp.dhis.web.api2.resources;
+
+import static java.util.Calendar.MONTH;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.i18n.I18nManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Cal;
+import org.hisp.dhis.report.Report;
+import org.hisp.dhis.report.ReportService;
+import org.hisp.dhis.system.util.CodecUtils;
+import org.hisp.dhis.util.ContextUtils;
+import org.hisp.dhis.web.api2.ResponseUtils;
+
+@Path( "/report/{report}/{orgUnit}" )
+public class ReportResource
+{
+    private ReportService reportService;
+
+    public void setReportService( ReportService reportService )
+    {
+        this.reportService = reportService;
+    }
+
+    private OrganisationUnitService organisationUnitService;
+    
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    private I18nManager i18nManager;
+
+    public void setI18nManager( I18nManager manager )
+    {
+        i18nManager = manager;
+    }
+    
+    @GET
+    @Produces(ContextUtils.CONTENT_TYPE_PDF)
+    public Response renderReport( @PathParam("report") final Integer reportId,
+        @PathParam("orgUnit") final String orgUnitUuid )
+            throws Exception
+    {
+        final Report report = reportService.getReport( reportId );
+        
+        final OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitUuid );
+        
+        if ( report == null || organisationUnit == null )
+        {
+            return null;
+        }
+        
+        final int organisationUnitId = organisationUnit.getId();
+        
+        final I18nFormat format = i18nManager.getI18nFormat();
+        
+        final String filename = CodecUtils.filenameEncode( report.getName() ) + "." + ReportService.REPORTTYPE_PDF;
+        
+        return ResponseUtils.response( true, filename, false ).entity( new StreamingOutput()
+        {
+            public void write( OutputStream out )
+                throws IOException, WebApplicationException
+            {
+                reportService.renderReport( out, report, new Cal().now().subtract( MONTH, 1 ).time(), 
+                    organisationUnitId, ReportService.REPORTTYPE_PDF, format );
+            }
+        } ).build();
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-api2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml	2011-10-07 10:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/resources/META-INF/dhis/beans.xml	2011-11-02 11:14:35 +0000
@@ -5,39 +5,39 @@
 
   <!-- Resources -->
 
-  <bean id="org.hisp.dhis.web.api.resources.ApiResource" class="org.hisp.dhis.web.api.resources.ApiResource">
+  <bean id="org.hisp.dhis.web.api2.resources.ApiResource" class="org.hisp.dhis.web.api2.resources.ApiResource">
     <property name="velocityManager" ref="org.hisp.dhis.system.velocity.VelocityManager" />
   </bean>
 
-  <bean id="org.hisp.dhis.web.api.resources.DataSetsResource" class="org.hisp.dhis.web.api.resources.DataSetsResource"
-    scope="prototype">
-    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-	<property name="velocityManager" ref="org.hisp.dhis.system.velocity.VelocityManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.web.api.resources.DataSetResource" class="org.hisp.dhis.web.api.resources.DataSetResource"
-    scope="prototype">
-    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-	<property name="velocityManager" ref="org.hisp.dhis.system.velocity.VelocityManager" />
-  </bean>
-
-  <bean id="org.hisp.dhis.web.api.resources.DataValueSetResource" class="org.hisp.dhis.web.api.resources.DataValueSetsResource">
+  <bean id="org.hisp.dhis.web.api2.resources.DataSetsResource" class="org.hisp.dhis.web.api2.resources.DataSetsResource"
+    scope="prototype">
+    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+	<property name="velocityManager" ref="org.hisp.dhis.system.velocity.VelocityManager" />
+  </bean>
+
+  <bean id="org.hisp.dhis.web.api2.resources.DataSetResource" class="org.hisp.dhis.web.api2.resources.DataSetResource"
+    scope="prototype">
+    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+	<property name="velocityManager" ref="org.hisp.dhis.system.velocity.VelocityManager" />
+  </bean>
+
+  <bean id="org.hisp.dhis.web.api2.resources.DataValueSetResource" class="org.hisp.dhis.web.api2.resources.DataValueSetsResource">
     <property name="dataValueSetService" ref="org.hisp.dhis.importexport.dxf2.service.DataValueSetService" />
 	<property name="velocityManager" ref="org.hisp.dhis.system.velocity.VelocityManager" />
   </bean>
 
-  <bean id="org.hisp.dhis.web.api.resources.OrgUnitsResource" class="org.hisp.dhis.web.api.resources.OrgUnitsResource"
+  <bean id="org.hisp.dhis.web.api2.resources.OrgUnitsResource" class="org.hisp.dhis.web.api2.resources.OrgUnitsResource"
     scope="prototype">
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	<property name="velocityManager" ref="org.hisp.dhis.system.velocity.VelocityManager" />
   </bean>
 
-  <bean id="org.hisp.dhis.web.api.resources.OrgUnitResource" class="org.hisp.dhis.web.api.resources.OrgUnitResource"
+  <bean id="org.hisp.dhis.web.api2.resources.OrgUnitResource" class="org.hisp.dhis.web.api2.resources.OrgUnitResource"
     scope="prototype">
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
-  <bean id="org.hisp.dhis.web.api.resources.ChartResource" class="org.hisp.dhis.web.api.resources.ChartResource"
+  <bean id="org.hisp.dhis.web.api2.resources.ChartResource" class="org.hisp.dhis.web.api2.resources.ChartResource"
 	scope="prototype">
 	<property name="chartService" ref="org.hisp.dhis.chart.ChartService"/>
 	<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService"/>
@@ -45,7 +45,7 @@
 	<property name="i18nManager" ref="org.hisp.dhis.i18n.I18nManager"/>
   </bean>
   
-  <bean id="org.hisp.dhis.web.api.resources.ReportResource" class="org.hisp.dhis.web.api.resources.ReportResource"
+  <bean id="org.hisp.dhis.web.api2.resources.ReportResource" class="org.hisp.dhis.web.api2.resources.ReportResource"
 	scope="prototype">
 	<property name="reportService" ref="org.hisp.dhis.report.ReportService"/>
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
@@ -58,7 +58,7 @@
 
   <!-- ImportDataValue -->
 
-  <bean id="org.hisp.dhis.web.api.action.ImportDataValueAction" class="org.hisp.dhis.web.api.action.ImportDataValueAction">
+  <bean id="org.hisp.dhis.web.api2.action.ImportDataValueAction" class="org.hisp.dhis.web.api2.action.ImportDataValueAction">
     <property name="programStageInstanceService" ref="org.hisp.dhis.program.ProgramStageInstanceService" />
     <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />

=== added directory 'dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2'
=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataSet.vm'
--- dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataSet.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataSet.vm	2011-11-02 11:14:35 +0000
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<h1>Data sets available for reporting</h1> 
+<p>See the <a href="${object.id}">xml version</a></p>
+<p>UUID: ${object.id}</p>
+<p>Period type: ${object.periodType} - ${object.periodType.isoFormat}</p>
+
+<h2>Org units reporting data set</h2>
+
+<ul>
+#foreach( $unit in $object.sources )
+<li>${unit.name} - ${unit.uuid}</li>
+#end
+</ul>
+
+<h2>Data elements in data set</h2>
+
+<ul>
+#foreach( $dataElement in $object.dataElements )
+<li>${dataElement.name} - ${dataElement.type} - ${dataElement.uuid}
+#set( $optionCombos = $dataElement.categoryCombo.optionCombos )
+#if( $optionCombos && $optionCombos.size() > 0 )
+<ul>
+#foreach( $optionCombo in $optionCombos )
+<li>${optionCombo.name} - ${optionCombo.uuid}</li>
+#end
+</ul>
+#end
+</li>
+#end
+</ul>
+</body>
+</html>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataSets.vm'
--- dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataSets.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataSets.vm	2011-11-02 11:14:35 +0000
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<h1>Data sets available for reporting</h1> 
+<p>See the <a href="dataSets.xml">xml version</a></p>
+<ul>
+#foreach( $link in $object )
+<li><a href="${link.href}">${link.name}</a></li>
+#end
+</ul>
+</body>
+</html>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataValueSets.vm'
--- dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataValueSets.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/dataValueSets.vm	2011-11-02 11:14:35 +0000
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+    <p>This resource is the place to post data value sets. Take a look at the 
+    <a href="${object}">data sets</a> to see what to post.</p>
+
+	<pre>&lt;dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0-SNAPSHOT";
+    dataSet="dataSet UUID"
+    period="periodInIsoFormat"
+    orgUnit="unit UUID"&gt;
+    &lt;dataValue dataElement="data element UUID" categoryOptionCombo="UUID, only specify if used" storedBy="string" value="value" /&gt;
+    &lt;/dataValueSet&gt;</pre>
+</body>
+</html>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/index.vm'
--- dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/index.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/index.vm	2011-11-02 11:14:35 +0000
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html>
+  <head>
+    <title>DHIS2 Web API</title>
+  </head>
+  <body>
+    <h1>DHIS2 Web API</h1>
+  
+    <p><b>Warning: This API is in no way ready for public consumption. Radical changes must be expected at any time!</b></p>
+
+	<p>The api currently supports a specific pilot use case for posting of data value sets.
+
+	<h2>Posting data value sets</h2>
+	<p>To find the needed information about the data sets you want to post data about, go to <a href="dataSets">the data set list</a>.</p>
+
+	<p>If you don't want org units listed by data set, there is also the <a href="orgUnits">full list of org units</a></p> 
+
+    <p>Post according to the following template <a href="/api2/dataValueSets/">/api2/dataValueSets/</a></p>
+	<pre>&lt;dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0-SNAPSHOT";
+    dataSet="dataSet UUID"
+    period="periodInIsoFormat"
+    orgUnit="unit UUID"&gt;
+    &lt;dataValue dataElement="data element UUID" categoryOptionCombo="UUID, only specify if used" storedBy="string" value="value" /&gt;
+    &lt;/dataValueSet&gt;</pre>
+  </body>
+</html>
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/orgUnits.vm'
--- dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/orgUnits.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/resources/dhis-web-api2/orgUnits.vm	2011-11-02 11:14:35 +0000
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<h1>Organisation units</h1> 
+<p>See the <a href="orgUnits.xml">xml version</a></p>
+<ul>
+#foreach( $link in $object )
+<li><a href="${link.href}">${link.name}</a></li>
+#end
+</ul>
+</body>
+</html>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-api2/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/struts.xml	2011-06-23 14:44:17 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/resources/struts.xml	2011-11-02 11:14:35 +0000
@@ -5,7 +5,7 @@
 <struts>
 
   <include file="dhis-web-commons.xml" />
-  <package name="dhis-web-api" extends="dhis-web-commons" namespace="/dhis-web-api">
+  <package name="dhis-web-api2" extends="dhis-web-commons" namespace="/dhis-web-api2">
 
     <action name="importDataValue" class="org.hisp.dhis.web.api.action.ImportDataValueAction">
       <result name="success" type="stream">

=== modified file 'dhis-2/dhis-web/dhis-web-api2/src/main/webapp/WEB-INF/web.xml'
--- dhis-2/dhis-web/dhis-web-api/src/main/webapp/WEB-INF/web.xml	2011-03-02 19:07:04 +0000
+++ dhis-2/dhis-web/dhis-web-api2/src/main/webapp/WEB-INF/web.xml	2011-11-02 11:14:35 +0000
@@ -2,7 +2,7 @@
 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 	"http://java.sun.com/dtd/web-app_2_3.dtd";>
 <web-app>
-  <display-name>DHIS Case Entry</display-name>
+  <display-name>DHIS Web API2</display-name>
 
   <context-param>
     <param-name>contextConfigLocation</param-name>
@@ -19,24 +19,21 @@
       org.hisp.dhis.servlet.filter.HttpRedirectFilter</filter-class>
     <init-param>
       <param-name>redirectPath</param-name>
-      <param-value>api/</param-value>
+      <param-value>api2/</param-value>
     </init-param>
   </filter>
   <filter>
     <filter-name>OpenSessionInViewFilter</filter-name>
-    <filter-class>
-      org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
+    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
   </filter>
   <filter>
     <filter-name>springSecurityFilterChain</filter-name>
-    <filter-class>
-      org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
   </filter>
 
   <filter>
     <filter-name>Struts</filter-name>
-    <filter-class>
-      org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
+    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
   </filter>
 
   <filter-mapping>
@@ -49,7 +46,7 @@
   </filter-mapping>
   <filter-mapping>
     <filter-name>OpenSessionInViewFilter</filter-name>
-    <url-pattern>/api/*</url-pattern>
+    <url-pattern>/api2/*</url-pattern>
   </filter-mapping>
   <filter-mapping>
     <filter-name>springSecurityFilterChain</filter-name>
@@ -61,12 +58,10 @@
   </filter-mapping>
 
   <listener>
-    <listener-class>
-      org.springframework.web.context.ContextLoaderListener</listener-class>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
   <listener>
-    <listener-class>
-      org.hisp.dhis.system.startup.StartupListener</listener-class>
+    <listener-class>org.hisp.dhis.system.startup.StartupListener</listener-class>
   </listener>
 
   <servlet>
@@ -78,8 +73,7 @@
     </init-param>
     <init-param>
       <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
-      <param-value>
-        com.sun.jersey.api.container.filter.LoggingFilter, org.hisp.dhis.web.api.HtmlPromotingUriConnegFilter</param-value>
+      <param-value>com.sun.jersey.api.container.filter.LoggingFilter, org.hisp.dhis.web.api.HtmlPromotingUriConnegFilter</param-value>
     </init-param>
     <!-- <init-param> -->
     <!-- <param-name> -->
@@ -91,10 +85,10 @@
   </servlet>
   <servlet-mapping>
     <servlet-name>web-api</servlet-name>
-    <url-pattern>/api/*</url-pattern>
+    <url-pattern>/api2/*</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>web-api</servlet-name>
-    <url-pattern>/api</url-pattern>
+    <url-pattern>/api2</url-pattern>
   </servlet-mapping>
 </web-app>

=== modified file 'dhis-2/dhis-web/dhis-web-portal/pom.xml'
--- dhis-2/dhis-web/dhis-web-portal/pom.xml	2011-10-18 20:23:09 +0000
+++ dhis-2/dhis-web/dhis-web-portal/pom.xml	2011-11-02 11:14:35 +0000
@@ -146,6 +146,12 @@
     </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-api2</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-web-light</artifactId>
       <version>${project.version}</version>
       <type>war</type>

=== modified file 'dhis-2/dhis-web/dhis-web-portal/src/main/webapp/WEB-INF/web.xml'
--- dhis-2/dhis-web/dhis-web-portal/src/main/webapp/WEB-INF/web.xml	2011-10-18 20:23:09 +0000
+++ dhis-2/dhis-web/dhis-web-portal/src/main/webapp/WEB-INF/web.xml	2011-11-02 11:14:35 +0000
@@ -38,18 +38,22 @@
     <filter-name>RedirectFilter</filter-name>
     <url-pattern>/</url-pattern>
   </filter-mapping>
+
   <filter-mapping>
     <filter-name>OpenSessionInViewFilter</filter-name>
     <url-pattern>*.action</url-pattern>
   </filter-mapping>
+
   <filter-mapping>
     <filter-name>OpenSessionInViewFilter</filter-name>
-    <url-pattern>/api/*</url-pattern>
+    <url-pattern>/api2/*</url-pattern>
   </filter-mapping>
+
   <filter-mapping>
     <filter-name>springSecurityFilterChain</filter-name>
     <url-pattern>/*</url-pattern>
   </filter-mapping>
+
   <filter-mapping>
     <filter-name>Struts</filter-name>
     <url-pattern>*.action</url-pattern>
@@ -63,9 +67,8 @@
   </listener>
 
   <!-- For the dhis-web-api module -->
-
   <servlet>
-    <servlet-name>web-api</servlet-name>
+    <servlet-name>jerseyServlet</servlet-name>
     <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
     <init-param>
       <param-name>com.sun.jersey.config.property.packages</param-name>
@@ -78,8 +81,23 @@
     <load-on-startup>1</load-on-startup>
   </servlet>
 
-  <servlet-mapping>
-    <servlet-name>web-api</servlet-name>
+  <servlet>
+    <servlet-name>webapiServlet</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <init-param>
+      <param-name>contextConfigLocation</param-name>
+      <param-value>classpath*:/META-INF/dhis/servlet.xml</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>jerseyServlet</servlet-name>
+    <url-pattern>/api2/*</url-pattern>
+  </servlet-mapping>
+
+  <servlet-mapping>
+    <servlet-name>webapiServlet</servlet-name>
     <url-pattern>/api/*</url-pattern>
   </servlet-mapping>
 

=== modified file 'dhis-2/dhis-web/pom.xml'
--- dhis-2/dhis-web/pom.xml	2011-10-14 16:54:27 +0000
+++ dhis-2/dhis-web/pom.xml	2011-11-02 11:14:35 +0000
@@ -25,6 +25,7 @@
     <module>dhis-web-dashboard-integration</module>
     <module>dhis-web-caseentry</module>
     <module>dhis-web-api</module>
+    <module>dhis-web-api2</module>
     <module>dhis-web-light</module>
     <module>dhis-web-portal</module>
   </modules>

=== modified file 'dhis-2/pom.xml'
--- dhis-2/pom.xml	2011-10-14 16:54:27 +0000
+++ dhis-2/pom.xml	2011-11-02 11:14:35 +0000
@@ -42,11 +42,11 @@
   </distributionManagement>
 
   <repositories>
-      <repository>
+    <repository>
       <id>amplecode_maven2_repo</id>
       <name>AmpleCode Maven 2 repository</name>
       <url>http://www.amplecode.org/maven2</url>
-      </repository>
+    </repository>
     <repository>
       <id>dhis.uio.no</id>
       <name>Dhis2 External Dependencies Repository</name>
@@ -247,8 +247,6 @@
       </dependency>
       <dependency>
         <groupId>org.hisp.dhis</groupId>
-
-
         <artifactId>dhis-support-hibernate</artifactId>
         <version>${project.version}</version>
       </dependency>
@@ -330,6 +328,11 @@
         <version>${spring.version}</version>
       </dependency>
       <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-webmvc</artifactId>
+        <version>${spring.version}</version>
+      </dependency>
+      <dependency>
         <groupId>org.aspectj</groupId>
         <artifactId>aspectjrt</artifactId>
         <version>1.6.4</version>