← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21769: Reverted R 21765

 

------------------------------------------------------------
revno: 21769
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2016-01-15 21:47:27 +0100
message:
  Reverted R 21765
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.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-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	2016-01-15 16:31:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2016-01-15 20:47:27 +0000
@@ -33,7 +33,6 @@
 import org.amplecode.quick.StatementManager;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.CodeGenerator;
 import org.hisp.dhis.dataelement.CategoryOptionComboStore;
 import org.hisp.dhis.jdbc.StatementBuilder;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -1161,7 +1160,7 @@
         }
 
         executeSql( "insert into dataapprovalworkflow ( workflowid, uid, created, lastupdated, name, periodtypeid, userid, publicaccess ) "
-            + "select " + statementBuilder.getAutoIncrementValue() + ", " + CodeGenerator.generateCode() + ", now(), now(), ds.name, ds.periodtypeid, ds.userid, ds.publicaccess "
+            + "select " + statementBuilder.getAutoIncrementValue() + ", " + statementBuilder.getUid() + ", now(), now(), ds.name, ds.periodtypeid, ds.userid, ds.publicaccess "
             + "from (select datasetid from dataset where approvedata = true union select distinct datasetid from dataapproval) as a "
             + "join dataset ds on ds.datasetid = a.datasetid" );
 

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java	2016-01-15 16:31:09 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java	2016-01-15 20:47:27 +0000
@@ -162,6 +162,15 @@
     String getCharAt( String str, String n );
 
     /**
+     * Generates a random 11-character UID where the first character is an
+     * upper/lower case letter and the remaining 10 characters are a digit
+     * or an upper/lower case letter.
+     *
+     * @return randomly-generated UID.
+     */
+    String getUid();
+
+    /**
      * Creates a SELECT statement returning the identifier of the given Period.
      * 
      * @param period the Period to use in the statement. 

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java	2016-01-15 16:31:09 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java	2016-01-15 20:47:27 +0000
@@ -92,6 +92,23 @@
     }
 
     @Override
+    public String getUid()
+    {
+        return concatenate(
+            getCharAt( AZaz, "1 + " + getRandom( AZaz.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ),
+            getCharAt( AZaz09, "1 + " + getRandom( AZaz09.length() ) ) );
+    }
+
+    @Override
     public String getPeriodIdentifierStatement( Period period )
     {
         return