← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2862: Rename "registered" property of Orgunit to "hasPatients".

 

------------------------------------------------------------
revno: 2862
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-02-17 09:14:36 +0700
message:
  Rename "registered" property of Orgunit to "hasPatients".
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.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/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2011-02-16 02:55:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2011-02-17 02:14:36 +0000
@@ -91,7 +91,7 @@
     
     private transient String type;
     
-    private Boolean registered;
+    private Boolean hasPatients;
     
     // -------------------------------------------------------------------------
     // Constructors
@@ -522,17 +522,17 @@
     {
         this.phoneNumber = phoneNumber;
     }
-
-    public Boolean getRegistered()
-    {
-        return registered;
-    }
-
-    public void setRegistered( Boolean registered )
-    {
-        this.registered = registered;
-    }
     
+    public Boolean getHasPatients()
+    {
+        return hasPatients;
+    }
+
+    public void setHasPatients( Boolean hasPatients )
+    {
+        this.hasPatients = hasPatients;
+    }
+
     public int getLevel()
     {
         return level;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2011-02-16 02:55:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2011-02-17 02:14:36 +0000
@@ -309,5 +309,5 @@
     
     void updateOrganisationUnits( Collection<OrganisationUnit> units );
     
-    Collection<OrganisationUnit> getOrganisationUnits( Boolean registered );
+    Collection<OrganisationUnit> getOrganisationUnits( Boolean hasPatients );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java	2011-02-16 02:55:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java	2011-02-17 02:14:36 +0000
@@ -182,5 +182,5 @@
     
     void update( Collection<OrganisationUnit> units );
     
-    Collection<OrganisationUnit> get( Boolean registered );
+    Collection<OrganisationUnit> get( Boolean hasPatients );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-02-16 02:55:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-02-17 02:14:36 +0000
@@ -601,8 +601,8 @@
     }
     
     @Override
-    public Collection<OrganisationUnit> getOrganisationUnits( Boolean registered )
+    public Collection<OrganisationUnit> getOrganisationUnits( Boolean hasPatients )
     {
-        return organisationUnitStore.get(registered);
+        return organisationUnitStore.get(hasPatients);
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java	2011-02-16 02:55:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java	2011-02-17 02:14:36 +0000
@@ -275,21 +275,21 @@
         }
         ids += "0";
         
-        final String sqlUpdateTrue = "UPDATE organisationunit SET registered=true WHERE organisationunitid in ( " + ids +" );";
+        final String sqlUpdateTrue = "UPDATE organisationunit SET hasPatients=true WHERE organisationunitid in ( " + ids +" );";
 
         jdbcTemplate.execute( sqlUpdateTrue );
         
-        final String sqlUpdateFalse = "UPDATE organisationunit SET registered=false WHERE organisationunitid not in ( " + ids +" );";
+        final String sqlUpdateFalse = "UPDATE organisationunit SET hasPatients=false WHERE organisationunitid not in ( " + ids +" );";
         
         jdbcTemplate.execute( sqlUpdateFalse );
     }
     
     
     @SuppressWarnings("unchecked")
-    public Collection<OrganisationUnit> get( Boolean registered )
+    public Collection<OrganisationUnit> get( Boolean hasPatients )
     {
         Criteria criteria = sessionFactory.getCurrentSession().createCriteria( OrganisationUnit.class );
         
-        return criteria.add( Restrictions.eq( "registered", registered ) ).list();
+        return criteria.add( Restrictions.eq( "hasPatients", hasPatients ) ).list();
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2011-02-16 02:55:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2011-02-17 02:14:36 +0000
@@ -66,9 +66,9 @@
 	
 	<property name="phoneNumber" length="150"/>
 	
-	<!-- Register -->
+	<!-- hasPatients -->
 	
-	<property name="registered"/>
+	<property name="hasPatients"/>
 	
   </joined-subclass>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2011-01-21 04:33:28 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2011-02-17 02:14:36 +0000
@@ -86,6 +86,7 @@
         
         executeSql( "UPDATE patient SET isdead=false WHERE isdead IS NULL" );
 
+        executeSql( "UPDATE patient SET hasPatients=false WHERE hasPatients IS NULL" );
     }
 
     private void updatePatientOrgunitAssociation()