← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17580: Code style

 

------------------------------------------------------------
revno: 17580
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-11-25 12:51:12 +0100
message:
  Code style
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java


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

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java	2014-11-13 20:35:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/hibernate/HibernateDataApprovalStore.java	2014-11-25 11:51:12 +0000
@@ -294,7 +294,9 @@
 
         int orgUnitLevelAbove = 0;
 
-        for ( DataApprovalLevel dal : dataApprovalLevelService.getAllDataApprovalLevels() )
+        List<DataApprovalLevel> approvalLevels = dataApprovalLevelService.getAllDataApprovalLevels();
+        
+        for ( DataApprovalLevel dal : approvalLevels )
         {
             if ( dal.getOrgUnitLevel() < orgUnitLevel )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java	2014-11-05 23:33:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java	2014-11-25 11:51:12 +0000
@@ -282,14 +282,14 @@
         User currentUser = currentUserService.getCurrentUser();
         User user = userUid != null ? userService.getUser( userUid ) : currentUser;
 
-        if( user == null )
+        if ( user == null )
         {
             response.setStatus( HttpServletResponse.SC_NOT_FOUND );
             responseNode.addChild( new SimpleNode( "message", "No user with uid: " + userUid ) );
             return responseNode;
         }
 
-        if( !canModifyUserConversation( currentUser, user ) )
+        if ( !canModifyUserConversation( currentUser, user ) )
         {
             throw new UpdateAccessDeniedException( "Not authorized to modify this object." );
         }
@@ -306,9 +306,9 @@
         CollectionNode marked = responseNode.addChild( new CollectionNode( "markedRead" ) );
         marked.setWrapping( false );
 
-        for( org.hisp.dhis.message.MessageConversation conversation : messageConversations )
+        for ( org.hisp.dhis.message.MessageConversation conversation : messageConversations )
         {
-            if( conversation.markRead( user ) )
+            if ( conversation.markRead( user ) )
             {
                 messageService.updateMessageConversation( conversation );
                 marked.addChild( new SimpleNode( "uid", conversation.getUid() ) );
@@ -333,14 +333,14 @@
         User currentUser = currentUserService.getCurrentUser();
         User user = userUid != null ? userService.getUser( userUid ) : currentUser;
 
-        if( user == null )
+        if ( user == null )
         {
             response.setStatus( HttpServletResponse.SC_NOT_FOUND );
             responseNode.addChild( new SimpleNode( "message", "No user with uid: " + userUid ) );
             return responseNode;
         }
 
-        if( !canModifyUserConversation( currentUser, user ) )
+        if ( !canModifyUserConversation( currentUser, user ) )
         {
             throw new UpdateAccessDeniedException( "Not authorized to modify this object." );
         }
@@ -357,9 +357,9 @@
         CollectionNode marked = responseNode.addChild( new CollectionNode( "markedUnread" ) );
         marked.setWrapping( false );
 
-        for( org.hisp.dhis.message.MessageConversation conversation : messageConversations )
+        for ( org.hisp.dhis.message.MessageConversation conversation : messageConversations )
         {
-            if( conversation.markUnread( user ) )
+            if ( conversation.markUnread( user ) )
             {
                 messageService.updateMessageConversation( conversation );
                 marked.addChild( new SimpleNode( "uid", conversation.getUid() ) );
@@ -403,7 +403,7 @@
 
         User user = userService.getUser( userUid );
 
-        if( user == null )
+        if ( user == null )
         {
             responseNode.addChild( new SimpleNode( "message", "No user with uid: " + userUid ) );
             response.setStatus( HttpServletResponse.SC_NOT_FOUND );
@@ -418,7 +418,7 @@
 
         org.hisp.dhis.message.MessageConversation messageConversation = messageService.getMessageConversation( mcUid );
 
-        if( messageConversation == null )
+        if ( messageConversation == null )
         {
             responseNode.addChild( new SimpleNode( "message", "No messageConversation with uid: " + mcUid ) );
             response.setStatus( HttpServletResponse.SC_NOT_FOUND );
@@ -427,7 +427,7 @@
 
         CollectionNode removed = responseNode.addChild( new CollectionNode( "removed" ) );
 
-        if( messageConversation.remove( user ) )
+        if ( messageConversation.remove( user ) )
         {
             messageService.updateMessageConversation( messageConversation );
             removed.addChild( new SimpleNode( "uid", messageConversation.getUid() ) );
@@ -453,21 +453,21 @@
 
         User user = userUid == null ? currentUser : userService.getUser( userUid ) ;
 
-        if( user == null )
+        if ( user == null )
         {
             response.setStatus( HttpServletResponse.SC_NOT_FOUND );
             responseNode.addChild( new SimpleNode( "message", "User does not exist: " + userUid ) );
             return responseNode;
         }
 
-        if( !canModifyUserConversation( currentUser, user ) )
+        if ( !canModifyUserConversation( currentUser, user ) )
         {
             throw new DeleteAccessDeniedException( "Not authorized to modify user: " + user.getUid() );
         }
 
         Collection<org.hisp.dhis.message.MessageConversation> messageConversations = messageService.getMessageConversations( mcUids );
 
-        if( messageConversations.isEmpty() )
+        if ( messageConversations.isEmpty() )
         {
             response.setStatus( HttpServletResponse.SC_NOT_FOUND );
             responseNode.addChild( new SimpleNode( "message", "No MessageConversations found for the given UIDs." ) );
@@ -476,7 +476,7 @@
 
         CollectionNode removed = responseNode.addChild( new CollectionNode( "removed" ) );
 
-        for( org.hisp.dhis.message.MessageConversation mc : messageConversations )
+        for ( org.hisp.dhis.message.MessageConversation mc : messageConversations )
         {
             if( mc.remove( user ) )
             {