← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20203: Set max characters to 230 for names in UI to be consistent with hibernate mapping

 

------------------------------------------------------------
revno: 20203
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-17 10:47:06 +0200
message:
  Set max characters to 230 for names in UI to be consistent with hibernate mapping
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntity.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstanceReminder.hbm.xml
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js


--
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-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-15 23:17:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2015-09-17 08:47:06 +0000
@@ -42,6 +42,8 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import com.google.inject.internal.Lists;
+
 import java.sql.ResultSet;
 import java.sql.Statement;
 import java.util.ArrayList;
@@ -886,6 +888,8 @@
         upgradeAggregationType( "chart" );
 
         updateRelativePeriods();
+        updateNameColumnLengths();
+        
         organisationUnitService.updatePaths();
 
         log.info( "Tables updated" );
@@ -1016,6 +1020,19 @@
         executeSql( "update relativeperiods set lastsixmonth = false where lastsixmonth is null" );
         executeSql( "update relativeperiods set lastweek = false where lastweek is null" );
     }
+    
+    private void updateNameColumnLengths()
+    {
+        List<String> tables = Lists.newArrayList( "user", "usergroup", "organisationunit", "orgunitgroup", "orgunitgroupset", 
+            "section", "dataset", "sqlview", "dataelement", "dataelementgroup", "dataelementgroupset", "categorycombo", 
+            "dataelementcategory", "indicator", "indicatorgroup", "indicatorgroupset", "indicatortype", 
+            "validationrule", "validationrulegroup", "constant", "attribute", "attributegroup" );
+        
+        for ( String table : tables )
+        {
+            executeSql( "alter table " + table + " alter column name type character varying(230)" );
+        }
+    }
 
     private void upgradeDataValuesWithAttributeOptionCombo()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntity.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntity.hbm.xml	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntity.hbm.xml	2015-09-17 08:47:06 +0000
@@ -13,8 +13,7 @@
     </id>
     &identifiableProperties;
 
-    <property name="name" column="name" not-null="true" unique="true"
-      length="230" />
+    <property name="name" column="name" not-null="true" unique="true" length="230" />
 
     <property name="description" type="text" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstanceReminder.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstanceReminder.hbm.xml	2015-06-23 15:59:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityInstanceReminder.hbm.xml	2015-09-17 08:47:06 +0000
@@ -10,11 +10,10 @@
 
     <id name="id" column="trackedentityinstancereminderid">
       <generator class="native" />
-    </id>
-     
+    </id>     
      &identifiableProperties;
     
-    <property name="name" />
+    <property name="name" column="name" length="230" />
 
     <property name="daysAllowedSendMessage" />
      

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js	2015-04-19 11:38:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js	2015-09-17 08:47:06 +0000
@@ -64,7 +64,7 @@
     "userGroup" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 210 ],
+            "rangelength" : [ 2, 230 ],
             "alphanumericwithbasicpuncspaces" : true
         },
         "usersSelected" : {
@@ -74,7 +74,7 @@
     "organisationUnit" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "shortName" : {
             "required" : true,
@@ -119,7 +119,7 @@
     "organisationUnitGroup" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "shortName" : {
             "required" : true,
@@ -135,7 +135,7 @@
     "organisationUnitGroupSet" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         }
     },
     "dataEntry" : {
@@ -147,14 +147,14 @@
     "section" : {
         "sectionName" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         }
     },
     "dataSet" : {
         "name" : {
             "required" : true,
             "alphanumericwithbasicpuncspaces" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "shortName" : {
             "required" : true,
@@ -176,7 +176,7 @@
     "sqlView" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 50 ]
+            "rangelength" : [ 2, 230 ]
         },
         "sqlquery" : {
             "required" : true
@@ -212,7 +212,7 @@
     "dataElement" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ],
+            "rangelength" : [ 2, 230 ],
             "alphanumericwithbasicpuncspaces" : true,
             "notOnlyDigits" : true
         },
@@ -240,7 +240,7 @@
     "dateElementCategoryCombo" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "selectedList" : {
             "required" : true
@@ -249,7 +249,7 @@
     "dateElementCategory" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "memberValidator" : {
             "required" : true
@@ -260,7 +260,7 @@
             "required" : true,
             "alphanumericwithbasicpuncspaces" : true,
             "notOnlyDigits" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "shortName" : {
             "required" : true,
@@ -277,13 +277,13 @@
     "dataElementGroupSet" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         }
     },
     "indicator" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ],
+            "rangelength" : [ 2, 230 ],
             "alphanumericwithbasicpuncspaces" : true,
             "nostartwhitespace" : true
         },
@@ -311,20 +311,20 @@
     "indicatorGroup" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ],
+            "rangelength" : [ 2, 230 ],
             "alphanumericwithbasicpuncspaces" : true
         }
     },
     "indicatorGroupSet" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         }
     },
     "indicatorType" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ],
+            "rangelength" : [ 2, 230 ],
             "alphanumericwithbasicpuncspaces" : true
         },
         "factor" : {
@@ -336,7 +336,7 @@
     "validationRule" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "importance" : {
             "required" : true
@@ -385,7 +385,7 @@
     "validationRuleGroup" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2, 160 ]
+            "rangelength" : [ 2, 230 ]
         }
     },
     "constant" : {
@@ -414,7 +414,7 @@
     "trackedEntityAttribute" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2,160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "shortName" : {
             "required" : true,
@@ -424,7 +424,7 @@
     "trackedEntityAttributeGroup" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2,160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "attributeList" : {
             "required" : true
@@ -433,7 +433,7 @@
     "relationshipType" : {
         "aIsToB" : {
             "required" : true,
-            "rangelength" : [ 2,160 ]
+            "rangelength" : [ 2, 160 ]
         },
         "bIsToA" : {
             "required" : true,
@@ -453,7 +453,7 @@
     "program" : {
         "name" : {
             "required" : true,
-            "rangelength" : [ 2,160 ]
+            "rangelength" : [ 2, 230 ]
         },
         "trackedEntityId" : {
             "required" : true
@@ -477,7 +477,7 @@
     "programStage" : {
         "name" : {
             "required" : true,
-            "rangelength" : [2,160]
+            "rangelength" : [2,230]
         },
         "description" : {
             "required" : true
@@ -500,21 +500,21 @@
     "programRule" : {
         "name" : {
             "required" : true,
+            "rangelength" : [ 2,230 ]
+        },
+        "description" : {
+            "required" : true,
             "rangelength" : [ 2,160 ]
         },
-        "description" : {
-            "required" : true,
-            "rangelength" : [ 2, 160 ]
-        },
         "condition" : {
             "required" : true,
-            "rangelength" : [ 2, 255 ]
+            "rangelength" : [ 2,255 ]
         }
     },
 	"trackedEntityInstanceReminder" : {
         "name" : {
             "required" : true,
-            "rangelength" : [2,160]
+            "rangelength" : [2,230]
         },
         "days" : {
             "required": true,
@@ -534,7 +534,7 @@
     "programIndicator" : {
         "name" : {
             "required" : true,
-            "rangelength" : [2,160]
+            "rangelength" : [2,230]
         },
         "shortName" : {
             "required" : true,
@@ -556,7 +556,7 @@
     "caseAggregation" : {
         "name" : {
             "required" : true,
-            "rangelength" : [2,160]
+            "rangelength" : [2,230]
         },
         "aggregationDataElementId" : {
             "required" : true
@@ -572,7 +572,7 @@
     "programStageSection" : {
         "name" : {
             "required" : true,
-            "rangelength" : [2,160]
+            "rangelength" : [2,230]
         },
         "dataElementList" : {
             "required" : true
@@ -581,7 +581,7 @@
     "programValidation" : {
         "name" : {
             "required" : true,
-            "rangelength" : [2,160]
+            "rangelength" : [2,230]
         },
         "operator" : {
             "required" : true
@@ -596,7 +596,7 @@
     "validationCriteria" : {
         "name" : {
             "required" : true,
-            "rangelength" : [2,160]
+            "rangelength" : [2,230]
         },
         "description" : {
             "required" : true,