Created
July 2, 2012 22:03
-
-
Save rjenkins/3036017 to your computer and use it in GitHub Desktop.
AbstractRiakEntityDAO.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
abstract class AbstractRiakEntityDAO[K, T](storageDriver: RiakStorageDriver[K, | |
T]) extends GenericKeyValueDAO[K, T] | |
with Logging with Converter[T] { | |
val stringIndexes = new ListBuffer[String] | |
val integerIndexes = new ListBuffer[String] | |
// Retrieve Entity by Key | |
def getByKey(key: K): Option[T] = { | |
storageDriver.getByKey(key, this) | |
} | |
// For a given key and type persist entity | |
def persist(key: K, t: T): T = { | |
storageDriver.persist(key, t, this) | |
} | |
def findFor2i(index: String, value: String): List[T] = { | |
storageDriver.findFor2i(index, value, this) | |
} | |
def findFor2i(index: String, value: Int): List[T] = { | |
storageDriver.findFor2i(index, value, this) | |
} | |
def delete(t: T) { | |
storageDriver.delete(t) | |
} | |
def deleteByKey(key: K) { | |
storageDriver.deleteByKey(key) | |
} | |
def deleteFor2i(index: String, value: String) { | |
storageDriver.deleteFor2i(index, value) | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment