← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12486: Cleanup

 

------------------------------------------------------------
revno: 12486
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-10-07 20:38:10 +0200
message:
  Cleanup
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/DefaultExportServiceTest.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nResourceEditorGUI.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-api/src/main/java/org/hisp/dhis/common/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java	2013-10-03 14:24:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java	2013-10-07 18:38:10 +0000
@@ -211,8 +211,6 @@
      */
     public static boolean canWrite( User user, IdentifiableObject object )
     {
-        Set<String> authorities = user != null ? user.getUserCredentials().getAllAuthorities() : new HashSet<String>();
-
         //TODO ( (object instanceof User) && canCreatePrivate( user, object ) ): review possible security breaches and best way to give update access upon user import
         if ( sharingOverrideAuthority( user )
             || (object.getUser() == null && canCreatePublic( user, object ) && PRIVATE_AUTHORITIES.get( object.getClass() ) != null)

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java	2013-09-30 12:11:16 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java	2013-10-07 18:38:10 +0000
@@ -28,10 +28,19 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Date;
+import java.util.HashSet;
+
 import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dxf2.events.enrollment.EnrollmentService;
 import org.hisp.dhis.dxf2.events.event.DataValue;
 import org.hisp.dhis.dxf2.events.event.Event;
 import org.hisp.dhis.dxf2.events.event.EventService;
@@ -47,18 +56,9 @@
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.user.UserService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.Date;
-import java.util.HashSet;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java	2013-09-30 12:11:16 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java	2013-10-07 18:38:10 +0000
@@ -28,6 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Date;
+import java.util.HashSet;
+
 import org.hamcrest.CoreMatchers;
 import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.common.IdentifiableObjectManager;
@@ -46,23 +56,12 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageDataElementService;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.user.UserService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.Date;
-import java.util.HashSet;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/DefaultExportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/DefaultExportServiceTest.java	2013-09-19 12:38:33 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata/DefaultExportServiceTest.java	2013-10-07 18:38:10 +0000
@@ -28,10 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.xml.xpath.XPathExpressionException;
+
 import org.hisp.dhis.DhisConvenienceTest;
 import org.hisp.dhis.DhisTest;
 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.dataset.CompleteDataSetRegistrationService;
@@ -48,12 +54,6 @@
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import javax.xml.xpath.XPathExpressionException;
-import java.io.IOException;
-import java.util.HashMap;
-
-import static org.junit.Assert.assertEquals;
-
 /**
  * @author bobj
  */
@@ -113,8 +113,6 @@
 
     private Period peB;
 
-    private DataElementCategoryOptionCombo optionComboA;
-
     @Override
     public boolean emptyDatabaseAfterTest()
     {
@@ -132,7 +130,6 @@
         ouB = DhisConvenienceTest.createOrganisationUnit( 'B' );
         peA = DhisConvenienceTest.createPeriod( DhisConvenienceTest.getDate( 2012, 1, 1 ), DhisConvenienceTest.getDate( 2012, 1, 31 ) );
         peB = DhisConvenienceTest.createPeriod( DhisConvenienceTest.getDate( 2012, 2, 1 ), DhisConvenienceTest.getDate( 2012, 2, 29 ) );
-        optionComboA = categoryService.getDefaultDataElementCategoryOptionCombo();
 
         deA.setUid( "f7n9E0hX8qk" );
         deB.setUid( "Ix2HsbDMLea" );

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-10-07 08:50:13 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-10-07 18:38:10 +0000
@@ -1043,14 +1043,12 @@
         /*for ( ProgramStage eachProgramStage : programInstance.getProgram().getProgramStages() )*/
         for ( ProgramStageInstance eachProgramStageInstance : programInstance.getProgramStageInstances() )
         {
-            /*ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance(
-                programInstance, eachProgramStage );*/
-            ProgramStage programStage = eachProgramStageInstance.getProgramStage();
-
             // only for Mujhu database, because there is null program stage
             // instance. This condition should be removed in the future
             if ( eachProgramStageInstance != null )
             {
+                ProgramStage programStage = eachProgramStageInstance.getProgramStage();
+                
                 org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage mobileProgramStage = new org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage();
                 List<org.hisp.dhis.api.mobile.model.LWUITmodel.Section> mobileSections = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.Section>();
                 mobileProgramStage.setId( eachProgramStageInstance.getId() );

=== modified file 'tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nResourceEditorGUI.java'
--- tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nResourceEditorGUI.java	2013-09-03 15:24:51 +0000
+++ tools/dhis-i18n-resourceeditor/src/main/java/org/hisp/dhis/i18nresourceeditor/gui/I18nResourceEditorGUI.java	2013-10-07 18:38:10 +0000
@@ -65,8 +65,10 @@
 import javax.swing.JTextField;
 import javax.swing.JToolBar;
 import javax.swing.JTree;
+import javax.swing.SwingConstants;
 import javax.swing.ToolTipManager;
 import javax.swing.UIManager;
+import javax.swing.WindowConstants;
 import javax.swing.border.TitledBorder;
 import javax.swing.event.DocumentEvent;
 import javax.swing.event.DocumentListener;
@@ -275,10 +277,10 @@
         FlowLayout refFlowLayout = new FlowLayout();
         refFlowLayout.setAlignment(FlowLayout.LEFT);
         panelMainReferencesTop.setLayout(refFlowLayout);
-        lblReferenceTop.setAlignmentX(JLabel.LEFT);
+        lblReferenceTop.setAlignmentX(SwingConstants.LEFT);
         lblMainTop.setPreferredSize(new Dimension(50, 50));
         lblMainTop.setText("No data is saved until you hit the save button on the toolbar (top menu)");
-        lblMainTop.setAlignmentX(JLabel.CENTER_ALIGNMENT);
+        lblMainTop.setAlignmentX(Component.CENTER_ALIGNMENT);
         cmdSave.setIcon(getIcon("save.gif"));
         cmdSetLocale.setIcon(getIcon("locale.gif"));
 
@@ -334,7 +336,7 @@
         cmdDialogStartOkS.setEnabled(false);
         cmdDialogStartOk.addActionListener(new UpdateDHIS2dirListener());
         cmdDialogStartOkS.addActionListener(new UpdateDHIS2dirListener());
-        dialogStart.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+        dialogStart.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
 
         // Help
         txtHelp.setContentType("text/html");
@@ -374,7 +376,7 @@
         panelDialogAdvancedLookup.setBorder(new TitledBorder("Automatically updated lookups from the Java API:"));
         lblDialogAdvancedHeader.setFont(headerFont2);
         lblDialogAdvancedHeader.setPreferredSize(new Dimension(40, 40));
-        lblDialogAdvancedHeader.setHorizontalAlignment(JLabel.CENTER);
+        lblDialogAdvancedHeader.setHorizontalAlignment(SwingConstants.CENTER);
         cmdDialogAdvancedSelect.setEnabled(false);
 
         // Global