dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42566
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21765: Removed redundant UID generator code which also produced invalid UIDs (10 chars instead of 11)
------------------------------------------------------------
revno: 21765
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2016-01-15 17:31:09 +0100
message:
Removed redundant UID generator code which also produced invalid UIDs (10 chars instead of 11)
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-12 13:06:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2016-01-15 16:31:09 +0000
@@ -33,6 +33,7 @@
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;
@@ -1160,7 +1161,7 @@
}
executeSql( "insert into dataapprovalworkflow ( workflowid, uid, created, lastupdated, name, periodtypeid, userid, publicaccess ) "
- + "select " + statementBuilder.getAutoIncrementValue() + ", " + statementBuilder.getUid() + ", now(), now(), ds.name, ds.periodtypeid, ds.userid, ds.publicaccess "
+ + "select " + statementBuilder.getAutoIncrementValue() + ", " + CodeGenerator.generateCode() + ", 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-04 02:27:49 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2016-01-15 16:31:09 +0000
@@ -162,15 +162,6 @@
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-04 02:27:49 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/AbstractStatementBuilder.java 2016-01-15 16:31:09 +0000
@@ -92,23 +92,6 @@
}
@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