← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18204: Renamed ValidationResult.source to orgUnit to keep things consistent

 

------------------------------------------------------------
revno: 18204
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-02-09 15:52:38 +0100
message:
  Renamed ValidationResult.source to orgUnit to keep things consistent
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm


--
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/validation/ValidationResult.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java	2015-02-09 14:52:38 +0000
@@ -45,7 +45,7 @@
      */
     private static final long serialVersionUID = -4118317796752962296L;
 
-    private OrganisationUnit source;
+    private OrganisationUnit orgUnit;
 
     private Period period;
 
@@ -65,11 +65,11 @@
     {
     }
 
-    public ValidationResult( Period period, OrganisationUnit source,
+    public ValidationResult( Period period, OrganisationUnit orgUnit,
         DataElementCategoryOptionCombo attributeOptionCombo, ValidationRule validationRule,
         Double leftsideValue, Double rightsideValue )
     {
-        this.source = source;
+        this.orgUnit = orgUnit;
         this.period = period;
         this.attributeOptionCombo = attributeOptionCombo;
         this.validationRule = validationRule;
@@ -89,7 +89,7 @@
         int result = 1;
 
         result = PRIME * result + ((period == null) ? 0 : period.hashCode());
-        result = PRIME * result + ((source == null) ? 0 : source.hashCode());
+        result = PRIME * result + ((orgUnit == null) ? 0 : orgUnit.hashCode());
         result = PRIME * result + ((validationRule == null) ? 0 : validationRule.hashCode());
 
         return result;
@@ -144,14 +144,14 @@
             return false;
         }
 
-        if ( source == null )
+        if ( orgUnit == null )
         {
-            if ( other.source != null )
+            if ( other.orgUnit != null )
             {
                 return false;
             }
         }
-        else if ( !source.equals( other.source ) )
+        else if ( !orgUnit.equals( other.orgUnit ) )
         {
             return false;
         }
@@ -211,7 +211,7 @@
     @Override
     public int compareTo( ValidationResult other )
     {
-    	int result = source.getName().compareTo( other.source.getName() );
+    	int result = orgUnit.getName().compareTo( other.orgUnit.getName() );
     	
     	if ( result != 0 )
     	{
@@ -292,7 +292,7 @@
     @Override
     public String toString()
     {
-        return "[Source: " + source + 
+        return "[Org unit: " + orgUnit + 
             ", period: " + period + 
             ", validation rule: " + validationRule + 
             ", left side value: " + leftsideValue + 
@@ -303,14 +303,14 @@
     // Set and get methods
     // -------------------------------------------------------------------------     
 
-    public OrganisationUnit getSource()
+    public OrganisationUnit getOrgUnit()
     {
-        return source;
+        return orgUnit;
     }
 
-    public void setSource( OrganisationUnit source )
+    public void setOrgUnit( OrganisationUnit orgUnit )
     {
-        this.source = source;
+        this.orgUnit = orgUnit;
     }
 
     public Period getPeriod()

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2015-02-09 14:52:38 +0000
@@ -442,7 +442,7 @@
                     {
                         for ( User user : userGroup.getMembers() )
                         {
-                            if ( !ruleGroup.isAlertByOrgUnits() || canUserAccessSource( user, result.getSource() ) )
+                            if ( !ruleGroup.isAlertByOrgUnits() || canUserAccessSource( user, result.getOrgUnit() ) )
                             {
                                 SortedSet<ValidationResult> resultSet = userResults.get ( user );
 
@@ -511,7 +511,7 @@
         {
             ValidationRule rule = result.getValidationRule();
             
-            builder.append( result.getSource().getName() ).append( " " ).append( result.getPeriod().getName() ).
+            builder.append( result.getOrgUnit().getName() ).append( " " ).append( result.getPeriod().getName() ).
             append( result.getAttributeOptionCombo().isDefault() ? "" : " " + result.getAttributeOptionCombo().getName() ).append( LN ).
             append( rule.getName() ).append( " (" ).append( rule.getImportance() ).append( ") " ).append( LN ).
             append( rule.getLeftSide().getDescription() ).append( ": " ).append( result.getLeftsideValue() ).append( LN ).

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java	2015-02-09 14:52:38 +0000
@@ -152,7 +152,7 @@
 
         for ( ValidationResult validationResult : results )
         {
-            OrganisationUnit unit = validationResult.getSource();
+            OrganisationUnit unit = validationResult.getOrgUnit();
             Period period = validationResult.getPeriod();
 
             grid.addRow();

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm	2014-05-18 00:49:40 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm	2015-02-09 14:52:38 +0000
@@ -99,7 +99,7 @@
 	<tbody>
 		#foreach( $result in $validationResults )
 		<tr id="tr${result.id}">
-		  <td>$encoder.htmlEncode( $!result.source.name )</td>
+		  <td>$encoder.htmlEncode( $!result.orgUnit.name )</td>
 		  <td>$!format.formatPeriod( $result.period )</td>
           #if( $showAttributeCombos )
               <td>#if($result.attributeOptionCombo.isDefault()=='false') $encoder.htmlEncode( $!result.attributeOptionCombo.name ) #end</td>
@@ -110,7 +110,7 @@
 		  <td style="text-align:center">$encoder.htmlEncode( $i18n.getString( $!result.validationRule.operator.mathematicalOperator ) )</td>
 		  <td>$encoder.htmlEncode( $!result.rightsideValue )</td>
 		  <td style="text-align:center">
-		    <a href="#" onclick="viewValidationResultDetails( $result.validationRule.id, $result.source.id, $result.period.id )" title="$i18n.getString( 'show_details' )">
+		    <a href="#" onclick="viewValidationResultDetails( $result.validationRule.id, $result.orgUnit.id, $result.period.id )" title="$i18n.getString( 'show_details' )">
 		      <img src="../images/information.png" alt="$i18n.getString( 'show_details' )">
 			</a>
 		  </td>