← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6539: fixes for stupid code from yesterday

 

------------------------------------------------------------
revno: 6539
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-04-11 07:56:20 +0300
message:
  fixes for stupid code from yesterday
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/Document.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.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/attribute/Attribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java	2012-04-10 22:32:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java	2012-04-11 04:56:20 +0000
@@ -186,13 +186,13 @@
         {
             Attribute attribute = (Attribute) other;
 
-            valueType = valueType != null ? valueType : attribute.getValueType();
+            valueType = attribute.getValueType() == null ? valueType : attribute.getValueType();
             dataElementAttribute = attribute.isDataElementAttribute();
             indicatorAttribute = attribute.isIndicatorAttribute();
             organisationUnitAttribute = attribute.isOrganisationUnitAttribute();
             userAttribute = attribute.isUserAttribute();
             mandatory = attribute.isMandatory();
-            sortOrder = sortOrder != null ? sortOrder : attribute.getSortOrder();
+            sortOrder = attribute.getSortOrder() == null ? sortOrder : attribute.getSortOrder();
 
             for ( AttributeValue attributeValue : attribute.getAttributeValues() )
             {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2012-04-10 22:32:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2012-04-11 04:56:20 +0000
@@ -657,43 +657,28 @@
         {
             Chart chart = (Chart) other;
 
-            domainAxisLabel = domainAxisLabel != null ? domainAxisLabel : chart.getDomainAxisLabel();
-            rangeAxisLabel = rangeAxisLabel != null ? rangeAxisLabel : chart.getRangeAxisLabel();
-            type = type != null ? type : chart.getType();
-            series = series != null ? series : chart.getSeries();
-            category = category != null ? category : chart.getCategory();
-            filter = filter != null ? filter : chart.getFilter();
+            domainAxisLabel = chart.getDomainAxisLabel() == null ? domainAxisLabel : chart.getDomainAxisLabel();
+            rangeAxisLabel = chart.getRangeAxisLabel() == null ? rangeAxisLabel : chart.getRangeAxisLabel();
+            type = chart.getType() == null ? type : chart.getType();
+            series = chart.getSeries() == null ? series : chart.getSeries();
+            category = chart.getCategory() == null ? category : chart.getCategory();
+            filter = chart.getFilter() == null ? filter : chart.getFilter();
             hideLegend = chart.isHideLegend();
             regression = chart.isRegression();
             hideSubtitle = chart.isHideSubtitle();
-            targetLineValue = targetLineValue != null ? targetLineValue : chart.getTargetLineValue();
-            targetLineLabel = targetLineLabel != null ? targetLineLabel : chart.getTargetLineLabel();
-            baseLineValue = baseLineValue != null ? baseLineValue : chart.getBaseLineValue();
-            baseLineLabel = baseLineLabel != null ? baseLineLabel : chart.getBaseLineLabel();
-            relatives = relatives != null ? relatives : chart.getRelatives();
+            targetLineValue = chart.getTargetLineValue() == null ? targetLineValue : chart.getTargetLineValue();
+            targetLineLabel = chart.getTargetLineLabel() == null ? targetLineLabel : chart.getTargetLineLabel();
+            baseLineValue = chart.getBaseLineValue() == null ? baseLineValue : chart.getBaseLineValue();
+            baseLineLabel = chart.getBaseLineLabel() == null ? baseLineLabel : chart.getBaseLineLabel();
+            relatives = chart.getRelatives() == null ? relatives : chart.getRelatives();
             userOrganisationUnit = chart.isUserOrganisationUnit();
-            user = user != null ? user : chart.getUser();
-            organisationUnitGroupSet = organisationUnitGroupSet != null ? organisationUnitGroupSet : chart.getOrganisationUnitGroupSet();
-
-            for ( Indicator indicator : chart.getIndicators() )
-            {
-                indicators.add( indicator );
-            }
-
-            for ( DataElement dataElement : chart.getDataElements() )
-            {
-                dataElements.add( dataElement );
-            }
-
-            for ( DataSet dataSet : chart.getDataSets() )
-            {
-                dataSets.add( dataSet );
-            }
-
-            for ( OrganisationUnit organisationUnit : chart.getOrganisationUnits() )
-            {
-                organisationUnits.add( organisationUnit );
-            }
+            user = chart.getUser() == null ? user : chart.getUser();
+            organisationUnitGroupSet = chart.getOrganisationUnitGroupSet() == null ? organisationUnitGroupSet : chart.getOrganisationUnitGroupSet();
+
+            indicators.addAll( chart.getIndicators() );
+            dataElements.addAll( chart.getDataElements() );
+            dataSets.addAll( chart.getDataSets() );
+            organisationUnits.addAll( chart.getOrganisationUnits() );
         }
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.java	2012-04-07 09:02:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/constant/Constant.java	2012-04-11 04:56:20 +0000
@@ -138,6 +138,7 @@
         if(other.getClass().isInstance( this ))
         {
             Constant constant = (Constant) other;
+
             this.value = constant.getValue();
         }
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/Document.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/Document.java	2012-04-10 22:32:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/Document.java	2012-04-11 04:56:20 +0000
@@ -139,8 +139,8 @@
         {
             Document document = (Document) other;
 
-            url = url != null ? url : document.getUrl();
-            contentType = contentType != null ? contentType : document.getContentType();
+            url = document.getUrl() == null ? url : document.getUrl();
+            contentType = document.getContentType() == null ? contentType : document.getContentType();
             external = document.isExternal();
         }
     }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java	2012-04-10 21:41:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java	2012-04-11 04:56:20 +0000
@@ -355,13 +355,13 @@
             Indicator indicator = (Indicator) other;
 
             annualized = indicator.isAnnualized();
-            denominator = denominator != null ? denominator : indicator.getDenominator();
-            denominatorDescription = denominatorDescription != null ? denominatorDescription : indicator.getDenominatorDescription();
-            numerator = numerator != null ? numerator : indicator.getNumerator();
-            numeratorDescription = numeratorDescription != null ? numeratorDescription : indicator.getNumeratorDescription();
-            explodedNumerator = explodedNumerator != null ? explodedNumerator : indicator.getExplodedNumerator();
-            explodedDenominator = explodedDenominator != null ? explodedDenominator : indicator.getExplodedDenominator();
-            indicatorType = indicatorType != null ? indicatorType : indicator.getIndicatorType();
+            denominator = indicator.getDenominator() == null ? denominator : indicator.getDenominator();
+            denominatorDescription = indicator.getDenominatorDescription() == null ? denominatorDescription : indicator.getDenominatorDescription();
+            numerator = indicator.getNumerator() == null ? numerator : indicator.getNumerator();
+            numeratorDescription = indicator.getNumeratorDescription() == null ? numeratorDescription : indicator.getNumeratorDescription();
+            explodedNumerator = indicator.getExplodedNumerator() == null ? explodedNumerator : indicator.getExplodedNumerator();
+            explodedDenominator = indicator.getExplodedDenominator() == null ? explodedDenominator : indicator.getExplodedDenominator();
+            indicatorType = indicator.getIndicatorType() == null ? indicatorType : indicator.getIndicatorType();
 
             for ( DataSet dataSet : indicator.getDataSets() )
             {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java	2012-04-10 21:41:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java	2012-04-11 04:56:20 +0000
@@ -262,8 +262,8 @@
         {
             IndicatorGroupSet indicatorGroupSet = (IndicatorGroupSet) other;
 
-            compulsory = compulsory != null ? compulsory : indicatorGroupSet.isCompulsory();
-            description = description != null ? description : indicatorGroupSet.getDescription();
+            compulsory = indicatorGroupSet.isCompulsory() == null ? compulsory : indicatorGroupSet.isCompulsory();
+            description = indicatorGroupSet.getDescription() == null ? description : indicatorGroupSet.getDescription();
 
             for ( IndicatorGroup indicatorGroup : indicatorGroupSet.getMembers() )
             {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2012-04-10 21:41:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2012-04-11 04:56:20 +0000
@@ -867,20 +867,20 @@
         {
             OrganisationUnit organisationUnit = (OrganisationUnit) other;
 
-            openingDate = openingDate != null ? openingDate : organisationUnit.getOpeningDate();
-            closedDate = closedDate != null ? closedDate : organisationUnit.getClosedDate();
+            openingDate = organisationUnit.getOpeningDate() == null ? openingDate : organisationUnit.getOpeningDate();
+            closedDate = organisationUnit.getClosedDate() == null ? closedDate : organisationUnit.getClosedDate();
             active = organisationUnit.isActive();
-            comment = comment != null ? comment : organisationUnit.getComment();
-            geoCode = geoCode != null ? geoCode : organisationUnit.getGeoCode();
-            featureType = featureType != null ? featureType : organisationUnit.getFeatureType();
-            coordinates = coordinates != null ? coordinates : organisationUnit.getCoordinates();
-            url = url != null ? url : organisationUnit.getUrl();
-            contactPerson = contactPerson != null ? contactPerson : organisationUnit.getContactPerson();
-            address = address != null ? address : organisationUnit.getAddress();
-            email = email != null ? email : organisationUnit.getEmail();
-            phoneNumber = phoneNumber != null ? phoneNumber : organisationUnit.getPhoneNumber();
+            comment = organisationUnit.getComment() == null ? comment : organisationUnit.getComment();
+            geoCode = organisationUnit.getGeoCode() == null ? geoCode : organisationUnit.getGeoCode();
+            featureType = organisationUnit.getFeatureType() == null ? featureType : organisationUnit.getFeatureType();
+            coordinates = organisationUnit.getFeatureType() == null ? coordinates : organisationUnit.getCoordinates();
+            url = organisationUnit.getUrl() == null ? url : organisationUnit.getUrl();
+            contactPerson = organisationUnit.getContactPerson() == null ? contactPerson : organisationUnit.getContactPerson();
+            address = organisationUnit.getAddress() == null ? address : organisationUnit.getAddress();
+            email = organisationUnit.getEmail() == null ? email : organisationUnit.getEmail();
+            phoneNumber = organisationUnit.getPhoneNumber() == null ? phoneNumber : organisationUnit.getPhoneNumber();
             hasPatients = organisationUnit.isHasPatients();
-            parent = parent != null ? parent : organisationUnit.getParent();
+            parent = organisationUnit.getParent() == null ? parent : organisationUnit.getParent();
 
             for ( DataSet dataSet : organisationUnit.getDataSets() )
             {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java	2012-04-10 21:41:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java	2012-04-11 04:56:20 +0000
@@ -239,7 +239,7 @@
             OrganisationUnitGroupSet organisationUnitGroupSet = (OrganisationUnitGroupSet) other;
 
             compulsory = organisationUnitGroupSet.isCompulsory();
-            description = description != null ? description : organisationUnitGroupSet.getDescription();
+            description = organisationUnitGroupSet.getDescription() == null ? description : organisationUnitGroupSet.getDescription();
 
             for ( OrganisationUnitGroup organisationUnitGroup : organisationUnitGroupSet.getOrganisationUnitGroups() )
             {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java	2012-04-10 22:32:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/Report.java	2012-04-11 04:56:20 +0000
@@ -178,9 +178,9 @@
         {
             Report report = (Report) other;
 
-            designContent = designContent != null ? designContent : report.getDesignContent();
-            reportTable = reportTable != null ? reportTable : report.getReportTable();
-            usingOrgUnitGroupSets = usingOrgUnitGroupSets != null ? usingOrgUnitGroupSets : report.isUsingOrganisationUnitGroupSets();
+            designContent = report.getDesignContent() == null ? designContent : report.getDesignContent();
+            reportTable = report.getReportTable() == null ? reportTable : report.getReportTable();
+            usingOrgUnitGroupSets = report.isUsingOrganisationUnitGroupSets();
         }
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2012-04-10 22:32:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2012-04-11 04:56:20 +0000
@@ -1257,44 +1257,21 @@
 
             regression = reportTable.isRegression();
             cumulative = reportTable.isCumulative();
-            categoryCombo = categoryCombo != null ? categoryCombo : reportTable.getCategoryCombo();
+            categoryCombo = reportTable.getCategoryCombo() == null ? categoryCombo : reportTable.getCategoryCombo();
             doIndicators = reportTable.isDoIndicators();
             doPeriods = reportTable.isDoPeriods();
             doUnits = reportTable.isDoUnits();
-            relatives = relatives != null ? relatives : reportTable.getRelatives();
-            reportParams = reportParams != null ? reportParams : reportTable.getReportParams();
-            sortOrder = sortOrder != null ? sortOrder : reportTable.getSortOrder();
-            topLimit = topLimit != null ? topLimit : reportTable.getTopLimit();
-
-            for ( OrganisationUnitGroup organisationUnitGroup : reportTable.getOrganisationUnitGroups() )
-            {
-                organisationUnitGroups.add( organisationUnitGroup );
-            }
-
-            for ( OrganisationUnit organisationUnit : reportTable.getUnits() )
-            {
-                units.add( organisationUnit );
-            }
-
-            for ( Period period : reportTable.getPeriods() )
-            {
-                periods.add( period );
-            }
-
-            for ( DataSet dataSet : reportTable.getDataSets() )
-            {
-                dataSets.add( dataSet );
-            }
-
-            for ( Indicator indicator : reportTable.getIndicators() )
-            {
-                indicators.add( indicator );
-            }
-
-            for ( DataElement dataElement : reportTable.getDataElements() )
-            {
-                dataElements.add( dataElement );
-            }
+            relatives = reportTable.getRelatives() == null ? relatives : reportTable.getRelatives();
+            reportParams = reportTable.getReportParams() == null ? reportParams : reportTable.getReportParams();
+            sortOrder = reportTable.getSortOrder() == null ? sortOrder : reportTable.getSortOrder();
+            topLimit = reportTable.getTopLimit() == null ? topLimit : reportTable.getTopLimit();
+
+            organisationUnitGroups.addAll( reportTable.getOrganisationUnitGroups() );
+            units.addAll( reportTable.getUnits() );
+            periods.addAll( reportTable.getPeriods() );
+            dataSets.addAll( reportTable.getDataSets() );
+            indicators.addAll( reportTable.getIndicators() );
+            dataElements.addAll( reportTable.getDataElements() );
         }
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java	2012-04-10 22:32:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sqlview/SqlView.java	2012-04-11 04:56:20 +0000
@@ -147,8 +147,8 @@
         {
             SqlView sqlView = (SqlView) other;
 
-            description = description != null ? description : sqlView.getDescription();
-            sqlQuery = sqlQuery != null ? sqlQuery : sqlView.getSqlQuery();
+            description = sqlView.getDescription() == null ? description : sqlView.getDescription();
+            sqlQuery = sqlView.getSqlQuery() == null ? sqlQuery : sqlView.getSqlQuery();
         }
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java	2012-04-10 22:32:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java	2012-04-11 04:56:20 +0000
@@ -257,12 +257,12 @@
         {
             ValidationRule validationRule = (ValidationRule) other;
 
-            description = description != null ? description : validationRule.getDescription();
-            type = type != null ? type : validationRule.getType();
-            operator = operator != null ? operator : validationRule.getOperator();
-            leftSide = leftSide != null ? leftSide : validationRule.getLeftSide();
-            rightSide = rightSide != null ? rightSide : validationRule.getRightSide();
-            periodType = periodType != null ? periodType : validationRule.getPeriodType();
+            description = validationRule.getDescription() == null ? description : validationRule.getDescription();
+            type = validationRule.getType() == null ? type : validationRule.getType();
+            operator = validationRule.getOperator() == null ? operator : validationRule.getOperator();
+            leftSide = validationRule.getLeftSide() == null ? leftSide : validationRule.getLeftSide();
+            rightSide = validationRule.getRightSide() == null ? rightSide : validationRule.getRightSide();
+            periodType = validationRule.getPeriodType() == null ? periodType : validationRule.getPeriodType();
 
             for ( ValidationRuleGroup validationRuleGroup : validationRule.getGroups() )
             {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java	2012-04-10 22:32:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java	2012-04-11 04:56:20 +0000
@@ -165,7 +165,7 @@
         {
             ValidationRuleGroup validationRuleGroup = (ValidationRuleGroup) other;
 
-            description = description != null ? description : validationRuleGroup.getDescription();
+            description = validationRuleGroup.getDescription() == null ? description : validationRuleGroup.getDescription();
 
             for ( ValidationRule validationRule : validationRuleGroup.getMembers() )
             {