← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2063: Bumped jersey version, renamed resource

 

------------------------------------------------------------
revno: 2063
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-15 23:30:33 +0530
message:
  Bumped jersey version, renamed resource
removed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResouce.java
added:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResource.java
modified:
  dhis-2/dhis-web/dhis-web-api/pom.xml
  dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.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
=== modified file 'dhis-2/dhis-web/dhis-web-api/pom.xml'
--- dhis-2/dhis-web/dhis-web-api/pom.xml	2010-10-22 09:23:05 +0000
+++ dhis-2/dhis-web/dhis-web-api/pom.xml	2010-11-15 18:00:33 +0000
@@ -42,12 +42,12 @@
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-server</artifactId>
-      <version>1.3</version>
+      <version>1.4</version>
     </dependency>
     <dependency>
       <groupId>com.sun.jersey.contribs</groupId>
       <artifactId>jersey-spring</artifactId>
-      <version>1.3</version>
+      <version>1.4</version>
       <exclusions>
         <exclusion>
           <groupId>org.springframework</groupId>

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResouce.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResouce.java	2010-11-15 08:35:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResouce.java	1970-01-01 00:00:00 +0000
@@ -1,144 +0,0 @@
-package org.hisp.dhis.web.api.resources;
-
-import java.util.Collection;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-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.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.web.api.model.Link;
-import org.hisp.dhis.web.api.model.MobileWrapper;
-import org.hisp.dhis.web.api.model.OrgUnit;
-import org.hisp.dhis.web.api.service.IActivityPlanService;
-import org.hisp.dhis.web.api.service.IDataSetService;
-import org.hisp.dhis.web.api.service.IProgramService;
-import org.springframework.beans.factory.annotation.Autowired;
-
-@Path( "/mobile" )
-public class MobileResouce
-{
-
-    private IProgramService programService;
-
-    public IProgramService getProgramService()
-    {
-        return programService;
-    }
-
-    public void setProgramService( IProgramService programService )
-    {
-        this.programService = programService;
-    }
-
-    private IActivityPlanService activityPlanService;
-
-    public IActivityPlanService getActivityPlanService()
-    {
-        return activityPlanService;
-    }
-
-    public void setActivityPlanService( IActivityPlanService activityPlanService )
-    {
-        this.activityPlanService = activityPlanService;
-    }
-
-    private IDataSetService idataSetService;
-
-    public IDataSetService getIdataSetService()
-    {
-        return idataSetService;
-    }
-
-    public void setIdataSetService( IDataSetService idataSetService )
-    {
-        this.idataSetService = idataSetService;
-    }
-
-    private CurrentUserService currentUserService;
-
-    public CurrentUserService getCurrentUserService()
-    {
-        return currentUserService;
-    }
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    @Context
-    private UriInfo uriInfo;
-
-    @GET
-    @Produces( MediaType.APPLICATION_XML )
-    public Response getOrgUnitForUser()
-    {
-        User user = currentUserService.getCurrentUser();
-
-        Collection<OrganisationUnit> units = user.getOrganisationUnits();
-
-        if ( units.isEmpty() )
-        {
-            return Response.status( Status.CONFLICT ).entity( "User is not registered to a unit." ).build();
-        }
-        else if ( units.size() > 1 )
-        {
-            StringBuilder sb = new StringBuilder( "User is registered to more than one unit: " );
-
-            int i = units.size();
-            for ( OrganisationUnit unit : units )
-            {
-                sb.append( unit.getName() );
-                if ( i-- > 1 )
-                    sb.append( ", " );
-            }
-
-            return Response.status( Status.CONFLICT ).entity( sb.toString() ).build();
-        }
-
-        OrganisationUnit unit = units.iterator().next();
-        return Response.ok( getOrgUnit( unit ) ).build();
-    }
-
-    @GET
-    @Path( "all" )
-    @Produces( "application/vnd.org.dhis2.mobileresource+serialized" )
-    public MobileWrapper getAllDataForUser( @HeaderParam( "accept-language" ) String locale )
-    {
-        MobileWrapper mobileWrapper = new MobileWrapper();
-        mobileWrapper.setActivityPlan( activityPlanService.getCurrentActivityPlan( locale ) );
-
-        mobileWrapper.setPrograms( programService.getAllProgramsForLocale( locale ) );
-
-        mobileWrapper.setDatasets( idataSetService.getAllMobileDataSetsForLocale( locale ) );
-
-        // ActivityWrapper activityWrapper = new ActivityWrapper();
-        // activityWrapper.setActivityPlan(
-        // activityPlanService.getCurrentActivityPlan( locale ) );
-        // activityWrapper.setPrograms( programService.getAllProgramsForLocale(
-        // locale ) );
-        return mobileWrapper;
-    }
-
-    private OrgUnit getOrgUnit( OrganisationUnit unit )
-    {
-        OrgUnit m = new OrgUnit();
-
-        m.setId( unit.getId() );
-        m.setName( unit.getShortName() );
-        m.setProgramFormsLink( new Link( uriInfo.getRequestUriBuilder().path( "programforms" ).build().toString() ) );
-        m.setActivitiesLink( new Link( uriInfo.getRequestUriBuilder().path( "activityplan/current" ).build().toString() ) );
-
-        return m;
-    }
-
-}

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResource.java	2010-11-15 18:00:33 +0000
@@ -0,0 +1,138 @@
+package org.hisp.dhis.web.api.resources;
+
+import java.util.Collection;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+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.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriInfo;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.web.api.model.Link;
+import org.hisp.dhis.web.api.model.MobileWrapper;
+import org.hisp.dhis.web.api.model.OrgUnit;
+import org.hisp.dhis.web.api.service.IActivityPlanService;
+import org.hisp.dhis.web.api.service.IDataSetService;
+import org.hisp.dhis.web.api.service.IProgramService;
+
+@Path( "/mobile" )
+public class MobileResource
+{
+
+    private IProgramService programService;
+
+    public IProgramService getProgramService()
+    {
+        return programService;
+    }
+
+    public void setProgramService( IProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    private IActivityPlanService activityPlanService;
+
+    public IActivityPlanService getActivityPlanService()
+    {
+        return activityPlanService;
+    }
+
+    public void setActivityPlanService( IActivityPlanService activityPlanService )
+    {
+        this.activityPlanService = activityPlanService;
+    }
+
+    private IDataSetService idataSetService;
+
+    public IDataSetService getIdataSetService()
+    {
+        return idataSetService;
+    }
+
+    public void setIdataSetService( IDataSetService idataSetService )
+    {
+        this.idataSetService = idataSetService;
+    }
+
+    private CurrentUserService currentUserService;
+
+    public CurrentUserService getCurrentUserService()
+    {
+        return currentUserService;
+    }
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    @Context
+    private UriInfo uriInfo;
+
+    @GET
+    @Produces( MediaType.APPLICATION_XML )
+    public Response getOrgUnitForUser()
+    {
+        User user = currentUserService.getCurrentUser();
+
+        Collection<OrganisationUnit> units = user.getOrganisationUnits();
+
+        if ( units.isEmpty() )
+        {
+            return Response.status( Status.CONFLICT ).entity( "User is not registered to a unit." ).build();
+        }
+        else if ( units.size() > 1 )
+        {
+            StringBuilder sb = new StringBuilder( "User is registered to more than one unit: " );
+
+            int i = units.size();
+            for ( OrganisationUnit unit : units )
+            {
+                sb.append( unit.getName() );
+                if ( i-- > 1 )
+                    sb.append( ", " );
+            }
+
+            return Response.status( Status.CONFLICT ).entity( sb.toString() ).build();
+        }
+
+        OrganisationUnit unit = units.iterator().next();
+        return Response.ok( getOrgUnit( unit ) ).build();
+    }
+
+    @GET
+    @Path( "all" )
+    @Produces( "application/vnd.org.dhis2.mobileresource+serialized" )
+    public MobileWrapper getAllDataForUser( @HeaderParam( "accept-language" ) String locale )
+    {
+        MobileWrapper mobileWrapper = new MobileWrapper();
+        mobileWrapper.setActivityPlan( activityPlanService.getCurrentActivityPlan( locale ) );
+
+        mobileWrapper.setPrograms( programService.getAllProgramsForLocale( locale ) );
+
+        mobileWrapper.setDatasets( idataSetService.getAllMobileDataSetsForLocale( locale ) );
+
+        return mobileWrapper;
+    }
+
+    private OrgUnit getOrgUnit( OrganisationUnit unit )
+    {
+        OrgUnit m = new OrgUnit();
+
+        m.setId( unit.getId() );
+        m.setName( unit.getShortName() );
+        m.setProgramFormsLink( new Link( uriInfo.getRequestUriBuilder().path( "programforms" ).build().toString() ) );
+        m.setActivitiesLink( new Link( uriInfo.getRequestUriBuilder().path( "activityplan/current" ).build().toString() ) );
+
+        return m;
+    }
+
+}

=== modified 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	2010-11-15 15:24:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml	2010-11-15 18:00:33 +0000
@@ -22,8 +22,8 @@
 		
 	<!-- Resources -->
 	
-    <bean id="org.hisp.dhis.web.api.resources.MobileResouce"
-      class="org.hisp.dhis.web.api.resources.MobileResouce" scope="prototype">
+    <bean id="org.hisp.dhis.web.api.resources.MobileResource"
+      class="org.hisp.dhis.web.api.resources.MobileResource" scope="prototype">
       	<property name="programService">
 			<ref bean="org.hisp.dhis.web.api.service.IProgramService"/>
 		</property>