Skip to content

Instantly share code, notes, and snippets.

Avatar

Hongwei hongwei1

View GitHub Profile
@hongwei1
hongwei1 / lift-json-trait.sc
Created Oct 20, 2017
lift-web- json , trait
View lift-json-trait.sc
import net.liftweb.json._
//implicit val formats = net.liftweb.json.DefaultFormats
trait InternalCaseClassTrait{
def text: String
}
case class InternalCaseClass(
text: String
) extends InternalCaseClassTrait
@hongwei1
hongwei1 / List[String] -- Liftweb-mapped
Created Oct 16, 2017
object mPinResets extends MappedOneToMany(PinReset, PinReset.card, OrderBy(PinReset.id, Ascending))
View List[String] -- Liftweb-mapped
object mPinResets extends MappedOneToMany(PinReset, PinReset.card, OrderBy(PinReset.id, Ascending))
View AllTransferCases.sc
import net.liftweb.json._
import scala.text.Document
implicit val formats = net.liftweb.json.DefaultFormats
case class InternalCaseClass(
text: String
)
@hongwei1
hongwei1 / ObpJvmMappedConnector.scala
Created Mar 12, 2017
do not know what is it doing ??
View ObpJvmMappedConnector.scala
def updateUserAccountViews( user: ResourceUser ) = {
val accounts = getBanks.flatMap { bank => {
val bankId = bank.bankId.value
logger.debug(s"ObpJvm updateUserAccountViews for user.email ${user.email} user.name ${user.name} at bank ${bankId}")
val parameters = new JHashMap
parameters.put("userId", user.name)
parameters.put("bankId", bankId)
val response = jvmNorth.get("getAccounts", Transport.Target.accounts, parameters)
// todo response.error().isPresent
View APIMethods210.scala
successJsonResponse(Extraction.decompose(json)(formats = new Formats {
import java.text.{ParseException, SimpleDateFormat}
val dateFormat = new DateFormat {
def parse(s: String) = try {
Some(formatter.parse(s))
} catch {
case e: ParseException => None
}
View exceptionTest.sc
import net.liftweb.common.{Box, Empty, Failure, Full}
import net.liftweb.util.Helpers.tryo
//val option: Option[Null] = Option(null)
val box1 = Full(null)
val box2 = Full("")
val box3 = Empty
val box4 = None
val box5 = Failure("hongwei")
View box.sc
import net.liftweb.common.{Box, Empty, Failure, Full}
//val option: Option[Null] = Option(null)
val box1 = Full(null)
val box2 = Full("")
val box3 = Empty
val box4 = None
val box5 = Failure("hongwei")
You can’t perform that action at this time.