dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20204
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9128: Added method to TextUtils
------------------------------------------------------------
revno: 9128
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-11-26 13:54:18 +0100
message:
Added method to TextUtils
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.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/period/PeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java 2012-11-25 20:18:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java 2012-11-26 12:54:18 +0000
@@ -80,7 +80,7 @@
};
/**
- * Returns all available PeriodTypes in their natural order.
+ * Returns an immutable list of all available PeriodTypes in their natural order.
*
* @return all available PeriodTypes in their natural order.
*/
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java 2012-11-25 21:24:19 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java 2012-11-26 12:54:18 +0000
@@ -244,7 +244,7 @@
for ( PeriodType periodType : PeriodType.PERIOD_TYPES )
{
- sql += ", " + periodType.getName().toLowerCase() + " VARCHAR(100)";
+ sql += ", " + periodType.getName().toLowerCase() + " VARCHAR(10)";
}
sql += ")";
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java 2012-11-13 08:00:12 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/TextUtils.java 2012-11-26 12:54:18 +0000
@@ -173,6 +173,30 @@
return null;
}
+
+ /**
+ * Transforms a collection of strings into a comma delimited string, where
+ * each component get single-quoted.
+ *
+ * @param elements the collection of Integers
+ * @return a comma delimited String.
+ */
+ public static String getQuotedCommaDelimitedString( Collection<String> elements )
+ {
+ if ( elements != null && elements.size() > 0 )
+ {
+ final StringBuffer buffer = new StringBuffer();
+
+ for ( String element : elements )
+ {
+ buffer.append( "'" ).append( element.toString() ).append( "', " );
+ }
+
+ return buffer.substring( 0, buffer.length() - ", ".length() );
+ }
+
+ return null;
+ }
/**
* Returns null if the given string is not null and contains no charachters,