Permalink
Browse files

Ported counter interation methods to Java.

  • Loading branch information...
1 parent 3d6dca1 commit eaa87dbedd80c7fc0b4fefcc208f5a5df7ac0b4a @bflorian committed Dec 11, 2012
@@ -20,7 +20,7 @@ import com.reachlocal.grails.plugins.cassandra.uuid.UuidDynamicMethods
class CassandraOrmGrailsPlugin
{
// the plugin version
- def version = "0.3.2"
+ def version = "0.3.3"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "2.0.0 > *"
View
@@ -1,4 +1,4 @@
-<plugin name='cassandra-orm' version='0.3.2' grailsVersion='2.0.0 &gt; *'>
+<plugin name='cassandra-orm' version='0.3.3' grailsVersion='2.0.0 &gt; *'>
<author>Bob Florian</author>
<authorEmail>bob.florian@reachlocal.com</authorEmail>
<title>Cassandra Object Persistence Framework</title>
@@ -231,7 +231,7 @@ class CounterUtils
def groupKeys = KeyHelper.makeGroupKeyList(groupBy, 'yyyy-MM')
def rowKey = KeyHelper.counterRowKey(findBy, groupKeys, filter)
- columnsList(persistence.getColumnRange(
+ CounterHelper.columnsList(persistence.getColumnRange(
ks,
cf,
rowKey,
@@ -247,7 +247,7 @@ class CounterUtils
def groupKeys = KeyHelper.makeGroupKeyList(groupBy, 'yyyy-MM-dd')
def rowKey = KeyHelper.counterRowKey(findBy, groupKeys, filter)
- columnsList(persistence.getColumnRange(
+ CounterHelper.columnsList(persistence.getColumnRange(
ks,
cf,
rowKey,
@@ -263,7 +263,7 @@ class CounterUtils
def groupKeys = groupBy //makeGroupKeyList(groupBy, "yyyy-MM-dd'T'HH")
def rowKey = KeyHelper.counterRowKey(findBy, groupKeys, filter)
- columnsList(persistence.getColumnRange(
+ CounterHelper.columnsList(persistence.getColumnRange(
ks,
cf,
rowKey,
@@ -293,7 +293,7 @@ class CounterUtils
cal.add(Calendar.YEAR, 1)
}
- columnsListFromRowList(persistence.getRowsColumnRange(
+ CounterHelper.columnsListFromRowList(persistence.getRowsColumnRange(
ks,
cf,
rowKeys,
@@ -322,7 +322,7 @@ class CounterUtils
cal.add(Calendar.MONTH, 1)
}
- columnsListFromRowList(persistence.getRowsColumnRange(
+ CounterHelper.columnsListFromRowList(persistence.getRowsColumnRange(
ks,
cf,
rowKeys,
@@ -342,28 +342,6 @@ class CounterUtils
cols?.size() ? persistence.name(persistence.getColumnByIndex(cols, 0)) : null
}
- static columnsList(columnsIterator)
- {
- // TODO - performance!
- def cols = []
- columnsIterator.each {
- cols << it
- }
- cols
- }
-
- static columnsListFromRowList(rowList, persistence)
- {
- // TODO - performance!
- def cols = []
- rowList.each {row ->
- persistence.getColumns(row).each {
- cols << it
- }
- }
- cols
- }
-
static rollUpCounterDates(Map map, DateFormat fromFormat, grain, timeZone, toFormatArg)
{
def toFormat = CounterHelper.toDateFormat(grain, timeZone, toFormatArg)
@@ -64,9 +64,9 @@
void execute(mutationBatch);
Object getRow(rows, key);
-
- Object getColumns(row);
-
+ */
+ Iterable getColumns(Object row);
+ /*
Object getColumn(row, name);
Object getColumnByIndex(row, index);
@@ -676,4 +676,25 @@ static public boolean filterPassed(List<Integer>matchIndexes, List<String>keyVal
return columnKeys;
}
}
+
+ static public List columnsList(Iterable columnsIterator)
+ {
+ List<Object> cols = new ArrayList<Object>();
+ for (Object it: columnsIterator) {
+ cols.add(it);
+ }
+ return cols;
+ }
+
+ static public List columnsListFromRowList(Iterable rowList, PersistenceProvider persistence)
+ {
+ // TODO - performance!
+ List<Object> cols = new ArrayList<Object>();
+ for (Object row: rowList) {
+ for (Object it: persistence.getColumns(row)) {
+ cols.add(it);
+ }
+ }
+ return cols;
+ }
}

0 comments on commit eaa87db

Please sign in to comment.