← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 16802
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-09-24 16:26:12 +0200
message:
  Code style
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/DefaultObjectFilterService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.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-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2014-09-12 15:26:18 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2014-09-24 14:26:12 +0000
@@ -402,14 +402,12 @@
             {
                 if ( IdentifiableObject.IdentifiableProperty.CODE.toString().toLowerCase().equals( ouScheme.toLowerCase() ) )
                 {
-                    simpleNode = complexNode.addChild( new SimpleNode( "orgUnit",
-                        organisationUnit.getCode() == null ? "" : organisationUnit.getCode() ) );
+                    simpleNode = complexNode.addChild( new SimpleNode( "orgUnit", organisationUnit.getCode() == null ? "" : organisationUnit.getCode() ) );
                     simpleNode.setAttribute( true );
                 }
                 else
                 {
-                    simpleNode = complexNode.addChild( new SimpleNode( "orgUnit",
-                        organisationUnit.getUid() == null ? "" : organisationUnit.getUid() ) );
+                    simpleNode = complexNode.addChild( new SimpleNode( "orgUnit", organisationUnit.getUid() == null ? "" : organisationUnit.getUid() ) );
                     simpleNode.setAttribute( true );
                 }
             }
@@ -513,50 +511,44 @@
         IdentifiableProperty dataElementIdScheme = dataValueSet.getDataElementIdScheme() != null ?
             IdentifiableProperty.valueOf( dataValueSet.getDataElementIdScheme().toUpperCase() ) :
             importOptions.getDataElementIdScheme();
+            
         IdentifiableProperty orgUnitIdScheme = dataValueSet.getOrgUnitIdScheme() != null ?
             IdentifiableProperty.valueOf( dataValueSet.getOrgUnitIdScheme().toUpperCase() ) :
             importOptions.getOrgUnitIdScheme();
+            
         boolean dryRun = dataValueSet.getDryRun() != null ? dataValueSet.getDryRun() : importOptions.isDryRun();
+        
         ImportStrategy strategy = dataValueSet.getStrategy() != null ?
             ImportStrategy.valueOf( dataValueSet.getStrategy() ) :
             importOptions.getImportStrategy();
+            
         boolean skipExistingCheck = importOptions.isSkipExistingCheck();
 
         Map<String, DataElement> dataElementMap = identifiableObjectManager.getIdMap( DataElement.class, dataElementIdScheme );
-        Map<String, OrganisationUnit> orgUnitMap = orgUnitIdScheme == UUID ?
-            getUuidOrgUnitMap() :
-            identifiableObjectManager.getIdMap( OrganisationUnit.class, orgUnitIdScheme );
-        Map<String, DataElementCategoryOptionCombo> categoryOptionComboMap = identifiableObjectManager
-            .getIdMap( DataElementCategoryOptionCombo.class, IdentifiableProperty.UID );
+        Map<String, OrganisationUnit> orgUnitMap = orgUnitIdScheme == UUID ? getUuidOrgUnitMap() : identifiableObjectManager.getIdMap( OrganisationUnit.class, orgUnitIdScheme );
+        Map<String, DataElementCategoryOptionCombo> categoryOptionComboMap = identifiableObjectManager.getIdMap( DataElementCategoryOptionCombo.class, IdentifiableProperty.UID );
         Map<String, Period> periodMap = new HashMap<>();
 
-        DataSet dataSet = dataValueSet.getDataSet() != null ?
-            identifiableObjectManager.getObject( DataSet.class, IdentifiableProperty.UID, dataValueSet.getDataSet() ) :
-            null;
+        DataSet dataSet = dataValueSet.getDataSet() != null ? identifiableObjectManager.getObject( DataSet.class, IdentifiableProperty.UID, dataValueSet.getDataSet() ) : null;
         Date completeDate = getDefaultDate( dataValueSet.getCompleteDate() );
 
         Period outerPeriod = PeriodType.getPeriodFromIsoString( trimToNull( dataValueSet.getPeriod() ) );
 
         OrganisationUnit outerOrgUnit;
 
-        DataElementCategoryOptionCombo fallbackCategoryOptionCombo = categoryService
-            .getDefaultDataElementCategoryOptionCombo();
+        DataElementCategoryOptionCombo fallbackCategoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
 
         if ( orgUnitIdScheme.equals( IdentifiableProperty.UUID ) )
         {
-            outerOrgUnit = dataValueSet.getOrgUnit() == null ?
-                null :
-                organisationUnitService.getOrganisationUnitByUuid( dataValueSet.getOrgUnit() );
+            outerOrgUnit = dataValueSet.getOrgUnit() == null ? null : organisationUnitService.getOrganisationUnitByUuid( dataValueSet.getOrgUnit() );
         }
         else
         {
-            outerOrgUnit = dataValueSet.getOrgUnit() != null ?
-                identifiableObjectManager.getObject( OrganisationUnit.class, orgUnitIdScheme, dataValueSet.getOrgUnit() ) : null;
+            outerOrgUnit = dataValueSet.getOrgUnit() != null ? identifiableObjectManager.getObject( OrganisationUnit.class, orgUnitIdScheme, dataValueSet.getOrgUnit() ) : null;
         }
 
         DataElementCategoryOptionCombo outerAttrOptionCombo = dataValueSet.getAttributeOptionCombo() != null ?
-            identifiableObjectManager.getObject( DataElementCategoryOptionCombo.class, IdentifiableProperty.UID,
-                trimToNull( dataValueSet.getAttributeOptionCombo() ) ) : null;
+            identifiableObjectManager.getObject( DataElementCategoryOptionCombo.class, IdentifiableProperty.UID, trimToNull( dataValueSet.getAttributeOptionCombo() ) ) : null;
 
         if ( dataSet != null && completeDate != null )
         {
@@ -570,8 +562,7 @@
 
         String currentUser = currentUserService.getCurrentUsername();
 
-        BatchHandler<DataValue> batchHandler = batchHandlerFactory.createBatchHandler( DataValueBatchHandler.class )
-            .init();
+        BatchHandler<DataValue> batchHandler = batchHandlerFactory.createBatchHandler( DataValueBatchHandler.class ).init();
 
         int importCount = 0;
         int updateCount = 0;
@@ -593,21 +584,15 @@
             totalCount++;
 
             DataElement dataElement = dataElementMap.get( trimToNull( dataValue.getDataElement() ) );
-            DataElementCategoryOptionCombo categoryOptionCombo = categoryOptionComboMap
-                .get( trimToNull( dataValue.getCategoryOptionCombo() ) );
-            Period period = outerPeriod != null ?
-                outerPeriod :
-                PeriodType.getPeriodFromIsoString( trimToNull( dataValue.getPeriod() ) );
-            OrganisationUnit orgUnit =
-                outerOrgUnit != null ? outerOrgUnit : orgUnitMap.get( trimToNull( dataValue.getOrgUnit() ) );
-            DataElementCategoryOptionCombo attrOptionCombo = outerAttrOptionCombo != null ?
-                outerAttrOptionCombo :
+            DataElementCategoryOptionCombo categoryOptionCombo = categoryOptionComboMap.get( trimToNull( dataValue.getCategoryOptionCombo() ) );
+            Period period = outerPeriod != null ? outerPeriod : PeriodType.getPeriodFromIsoString( trimToNull( dataValue.getPeriod() ) );
+            OrganisationUnit orgUnit = outerOrgUnit != null ? outerOrgUnit : orgUnitMap.get( trimToNull( dataValue.getOrgUnit() ) );
+            DataElementCategoryOptionCombo attrOptionCombo = outerAttrOptionCombo != null ? outerAttrOptionCombo : 
                 categoryOptionComboMap.get( trimToNull( dataValue.getAttributeOptionCombo() ) );
 
             if ( dataElement == null )
             {
-                summary.getConflicts()
-                    .add( new ImportConflict( DataElement.class.getSimpleName(), dataValue.getDataElement() ) );
+                summary.getConflicts().add( new ImportConflict( DataElement.class.getSimpleName(), dataValue.getDataElement() ) );
                 continue;
             }
 
@@ -619,8 +604,7 @@
 
             if ( orgUnit == null )
             {
-                summary.getConflicts()
-                    .add( new ImportConflict( OrganisationUnit.class.getSimpleName(), dataValue.getOrgUnit() ) );
+                summary.getConflicts().add( new ImportConflict( OrganisationUnit.class.getSimpleName(), dataValue.getOrgUnit() ) );
                 continue;
             }
 

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/DefaultObjectFilterService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/DefaultObjectFilterService.java	2014-07-04 03:18:31 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/objectfilter/DefaultObjectFilterService.java	2014-09-24 14:26:12 +0000
@@ -164,9 +164,11 @@
         return true;
     }
 
+    /**
+     * Filters through every operator treating multiple of same operator as OR.
+     */
     private boolean evaluateFilterOps( Object value, FilterOps filterOps )
     {
-        // filter through every operator treating multiple of same operator as OR
         for ( String operator : filterOps.getFilters().keySet() )
         {
             boolean include = false;

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2014-09-23 15:47:39 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2014-09-24 14:26:12 +0000
@@ -259,8 +259,6 @@
 
         SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
 
-        int cols = rs.getMetaData().getColumnCount();
-
         Collection<SchedulingProgramObject> schedulingProgramObjects = new HashSet<>();
 
         while ( rs.next() )