forked from finos/vuu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finos#1353 remove legacy/unused code and update tests
- Loading branch information
1 parent
b647a3b
commit d2af9d9
Showing
4 changed files
with
4 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
...apache-ignite/src/main/scala/org/finos/vuu/example/ignite/IgniteColumnValueProvider.scala
This file was deleted.
Oops, something went wrong.
62 changes: 0 additions & 62 deletions
62
vuu/src/main/scala/org/finos/vuu/core/module/typeahead/TypeAheadRpcHandler.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,8 @@ | ||
package org.finos.vuu.core.module.typeahead | ||
|
||
import com.typesafe.scalalogging.StrictLogging | ||
import org.finos.vuu.core.table.{Column, DataTable, TableContainer} | ||
import org.finos.vuu.net.RequestContext | ||
import org.finos.vuu.net.rpc.RpcHandler | ||
|
||
trait TypeAheadRpcHandler{ | ||
def getUniqueFieldValues(tableMap: Map[String, String], column: String, ctx: RequestContext): Array[String] | ||
def getUniqueFieldValuesStartingWith(tableMap: Map[String, String], column: String, starts: String, ctx: RequestContext): Array[String] | ||
} | ||
|
||
|
||
class TypeAheadRpcHandlerImpl(val tableContainer: TableContainer) extends RpcHandler with StrictLogging with TypeAheadRpcHandler { | ||
|
||
private def addUnique(dt: DataTable, c: Column, set: Set[String], key: String): Set[String] = { | ||
val row = dt.pullRow(key) | ||
row.get(c) match { | ||
case null => | ||
Set() | ||
case x: String => | ||
set.+(x) | ||
case x: Long => | ||
set.+(x.toString) | ||
case x: Double => | ||
set.+(x.toString) | ||
case x: Int => | ||
set.+(x.toString) | ||
case x => | ||
set.+(x.toString) | ||
} | ||
} | ||
|
||
|
||
override def getUniqueFieldValuesStartingWith(tableMap: Map[String, String], column: String, starts: String, ctx: RequestContext): Array[String] = { | ||
val tableName = tableMap("table") | ||
|
||
tableContainer.getTable(tableName) match { | ||
case dataTable: DataTable => | ||
dataTable.columnForName(column) match { | ||
case c: Column => | ||
dataTable.primaryKeys.foldLeft(Set[String]())(addUnique(dataTable, c, _, _)).filter(_.startsWith(starts)).toArray.sorted.take(10) | ||
case null => | ||
logger.error(s"Column ${column} not found in table ${tableName}") | ||
Array() | ||
} | ||
case null => | ||
throw new Exception("Could not find table by name:" + tableName) | ||
} | ||
} | ||
|
||
def getUniqueFieldValues(tableMap: Map[String, String], column: String, ctx: RequestContext): Array[String] = { | ||
|
||
val tableName = tableMap("table") | ||
|
||
tableContainer.getTable(tableName) match { | ||
case dataTable: DataTable => | ||
dataTable.columnForName(column) match { | ||
case c: Column => | ||
dataTable.primaryKeys.foldLeft(Set[String]())(addUnique(dataTable, c, _, _)).toArray.sorted.take(10) | ||
case null => | ||
logger.error(s"Column ${column} not found in table ${tableName}") | ||
Array() | ||
} | ||
case null => | ||
throw new Exception("Could not find table by name:" + tableName) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters