← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4568: Codestyle

 

------------------------------------------------------------
revno: 4568
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-09-12 10:29:53 +0200
message:
  Codestyle
modified:
  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/UrlResourceListener.java
  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/IllegalArgumentExceptionMapper.java
  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/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/Html.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/VelocityManager.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/VelocityProcessor.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties


--
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/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-02-25 04:16:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/HtmlPromotingUriConnegFilter.java	2011-09-12 08:29:53 +0000
@@ -11,7 +11,6 @@
 public class HtmlPromotingUriConnegFilter
     extends UriConnegFilter
 {
-
     private static final String ACCEPT = "Accept";
 
     private static Map<String, MediaType> mediaExtentions;
@@ -72,6 +71,7 @@
         }
 
         int end = accept.indexOf( ',', i );
+        
         if ( end != -1 )
         {
             if ( result.equals( "" ) )
@@ -90,7 +90,5 @@
         }
 
         return "text/html," + result;
-
     }
-
 }

=== modified 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-02-25 18:08:38 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/UrlResourceListener.java	2011-09-12 08:29:53 +0000
@@ -16,7 +16,6 @@
 public class UrlResourceListener
     extends Listener
 {
-
     private UriInfo uriInfo;
 
     private Map<Class<?>, String> mapping;
@@ -48,7 +47,6 @@
             addUrls( unit.getChildren(), OrgUnit.class );
             addUrl( unit.getParent(), OrgUnit.class );
             addUrls( unit.getDataSets(), DataSet.class );
-
         }
         else if ( source instanceof OrgUnitLinks )
         {
@@ -59,19 +57,22 @@
     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 );
@@ -79,5 +80,4 @@
 
         link.setHref( url );
     }
-
 }

=== modified 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-05-05 21:15:45 +0000
+++ 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
@@ -53,7 +53,10 @@
 public class ImportDataValueAction
     implements ServletRequestAware, ServletResponseAware, Action
 {
+    // -------------------------------------------------------------------------
     // Dependencies
+    // -------------------------------------------------------------------------
+
     private ProgramStageInstanceService programStageInstanceService;
 
     private PatientDataValueService patientDataValueService;
@@ -68,19 +71,20 @@
 
     private DataElementCategoryService dataElementCategoryService;
 
-    // Setter and Getter
+    // -------------------------------------------------------------------------
+    // 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()
@@ -143,7 +147,10 @@
         this.dataElementCategoryService = dataElementCategoryService;
     }
 
+    // -------------------------------------------------------------------------
     // Output
+    // -------------------------------------------------------------------------
+
     private InputStream inputStream;
 
     public InputStream getInputStream()
@@ -156,6 +163,10 @@
         this.inputStream = inputStream;
     }
 
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
     @Override
     public String execute()
         throws Exception
@@ -182,7 +193,7 @@
             }
             catch ( Exception ex )
             {
-                message = "Upload fail!";
+                message = "Upload failed!";
                 this.setInputStream( new ByteArrayInputStream( message.getBytes() ) );
             }
         }

=== modified 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-02-15 06:53:26 +0000
+++ 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
@@ -13,11 +13,9 @@
 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();
     }
-
 }

=== modified 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-09-02 10:40:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/ApiResource.java	2011-09-12 08:29:53 +0000
@@ -20,7 +20,6 @@
 @ImplicitProduces( MediaType.TEXT_HTML )
 public class ApiResource
 {
-
     @Context
     UriInfo uriInfo;
 
@@ -31,20 +30,15 @@
         this.velocityManager = velocityManager;
     }
 
-
-
     @GET
     @Produces( MediaType.TEXT_HTML )
     public String getDescription()
         throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, IOException, Exception
     {
-
         StringWriter writer = new StringWriter();
 
         velocityManager.render( null, "index", writer );
 
         return writer.toString();
-
     }
-
 }

=== modified 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-04-22 21:04:14 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java	2011-09-12 08:29:53 +0000
@@ -23,7 +23,6 @@
 @Path( "dataSets/{uuid}" )
 public class DataSetResource
 {
-
     private DataSetService dataSetService;
 
     @Context
@@ -48,7 +47,6 @@
     @Produces( MediaType.TEXT_HTML )
     public String getDataSet( @PathParam( "uuid" ) String uuid )
     {
-
         DataSet dataSet = dataSetService.getDataSet( uuid );
 
         if ( dataSet == null )
@@ -99,14 +97,10 @@
 
         return t.toString();
     }
-
-
-
     
     @Required
     public void setDataSetService( DataSetService dataSetService )
     {
         this.dataSetService = dataSetService;
     }
-
 }

=== modified 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-02-28 02:43:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetsResource.java	2011-09-12 08:29:53 +0000
@@ -20,7 +20,6 @@
 @Path( "dataSets" )
 public class DataSetsResource
 {
-
     private LinkBuilder linkBuilder = new LinkBuilderImpl();
     
     private DataSetService dataSetService;
@@ -30,7 +29,8 @@
 
     @GET
     @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
-    public DataSetLinks getDataSetLinks() {
+    public DataSetLinks getDataSetLinks() 
+    {
         DataSetLinks dataSetLinks = new DataSetLinks( linkBuilder.getLinks( dataSetService.getAllDataSets() ) );
         new UrlResourceListener( uriInfo ).beforeMarshal( dataSetLinks );
         return dataSetLinks;
@@ -54,14 +54,11 @@
         t.append( Html.tail() );
 
         return t.toString();
-    }
-
-    
+    }    
     
     @Required
     public void setDataSetService( DataSetService dataSetService )
     {
         this.dataSetService = dataSetService;
     }
-
 }

=== modified 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-02-25 04:16:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataValueSetsResource.java	2011-09-12 08:29:53 +0000
@@ -18,7 +18,6 @@
 @Path( "dataValueSets" )
 public class DataValueSetsResource
 {
-
     private DataValueSetService dataValueSetService;
 
     @Context UriInfo uriInfo;
@@ -49,5 +48,4 @@
     {
         this.dataValueSetService = dataValueSetService;
     }
-
 }

=== modified 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-02 10:40:22 +0000
+++ 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
@@ -30,5 +30,4 @@
 public class DhisMediaType
 {
     public static final String DXF = "application/vnd.org.dhis2.dxf";
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/Html.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/Html.java	2011-02-25 04:16:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/Html.java	2011-09-12 08:29:53 +0000
@@ -6,7 +6,6 @@
 
 public class Html
 {
-
     public static StringBuilder head( String title )
     {
         StringBuilder sb = new StringBuilder(
@@ -55,5 +54,4 @@
         t.append( "\n&lt;/dataValueSet&gt;" );
         t.append( "</pre>" );
     }
-
 }

=== modified 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-02 10:40:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java	2011-09-12 08:29:53 +0000
@@ -36,8 +36,6 @@
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.UriInfo;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.importexport.dxf2.model.OrgUnit;
 import org.hisp.dhis.importexport.dxf2.service.OrgUnitMapper;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -52,13 +50,11 @@
 {
     private OrganisationUnitService organisationUnitService;
 
-    private static Log log = LogFactory.getLog( OrgUnitResource.class );
-
     @PathParam( "id" )
     private String id;
 
     @Context
-    UriInfo uriInfo;
+    private UriInfo uriInfo;
 
     @GET
     @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
@@ -67,7 +63,9 @@
         OrganisationUnit unit = organisationUnitService.getOrganisationUnit( id );
 
         if ( unit == null )
+        {
             return null;
+        }
 
         OrgUnit orgUnit = new OrgUnitMapper().get( unit );
         new UrlResourceListener( uriInfo ).beforeMarshal( orgUnit );
@@ -79,5 +77,4 @@
     {
         this.organisationUnitService = organisationUnitService;
     }
-
 }

=== modified 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-02-25 18:08:38 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitsResource.java	2011-09-12 08:29:53 +0000
@@ -22,7 +22,8 @@
 
     private LinkBuilder linkBuilder = new LinkBuilderImpl();
 
-    @Context UriInfo uriInfo;
+    @Context
+    private UriInfo uriInfo;
     
     @GET
     @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON } )
@@ -37,7 +38,6 @@
     @Produces( MediaType.TEXT_HTML )
     public String getOrgUnitsHtml()
     {
-
         StringBuilder sb = Html.head( "Org units" );
 
         sb.append( "<p>See the <a href=\"orgUnits.xml\">xml version</a></p>\n" );
@@ -58,5 +58,4 @@
     {
         this.organisationUnitService = organisationUnitService;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/VelocityManager.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/VelocityManager.java	2011-09-02 10:40:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/VelocityManager.java	2011-09-12 08:29:53 +0000
@@ -20,7 +20,6 @@
     public VelocityManager() throws Exception
     {
         velocity = new VelocityEngine();
-
         velocity.setProperty( Velocity.RESOURCE_LOADER, RESOURCE_LOADER_NAME );
         velocity.setProperty( RESOURCE_LOADER_NAME + ".resource.loader.class", ClasspathResourceLoader.class.getName() );
         velocity.init();
@@ -30,10 +29,11 @@
     {
         final VelocityContext context = new VelocityContext();
         
-        if (o != null)
+        if ( o != null )
+        {
             context.put( "object", o );
+        }
         
         velocity.getTemplate( templatePath + template + ".vm").merge( context, writer );
-
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/VelocityProcessor.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/VelocityProcessor.java	2011-09-02 10:40:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/VelocityProcessor.java	2011-09-12 08:29:53 +0000
@@ -5,8 +5,6 @@
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 
-import javax.ws.rs.ext.Provider;
-
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.Velocity;
@@ -17,7 +15,6 @@
 import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
 
 import com.sun.jersey.api.view.Viewable;
-import com.sun.jersey.spi.resource.Singleton;
 import com.sun.jersey.spi.template.ViewProcessor;
 
 //@Provider
@@ -25,7 +22,6 @@
 public class VelocityProcessor
     implements ViewProcessor<Template>
 {
-
     private static final String RESOURCE_LOADER_NAME = "class";
 
     private VelocityEngine velocity = new VelocityEngine();
@@ -55,8 +51,6 @@
     @Override
     public Template resolve( String name )
     {
-        System.out.println("*****HERE WE ARE! " + name);
-
         String templatePath = templatePrefix + name + ".vm";
 
         if ( !velocity.templateExists( templatePath ) )
@@ -79,7 +73,6 @@
     public void writeTo( Template t, Viewable viewable, OutputStream out )
         throws IOException
     {
-        System.out.println("*****HERE WE ARE!");
         final VelocityContext context = new VelocityContext();
         
         Object model = viewable.getModel();
@@ -89,7 +82,5 @@
         }
 
         t.merge( context, new OutputStreamWriter( out ) );
-
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2011-09-08 10:38:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2011-09-12 08:29:53 +0000
@@ -353,3 +353,5 @@
 assigned_to															= Assigned To
 available_attribute_options											= Available Attribute Options
 selected_attribute_options											= Selected Attribute Options
+data_element_does_not_exist											= Data element does not exist
+category_option_combo_does_not_exist								= Category option combo does not exist