Skip to content

Instantly share code, notes, and snippets.

@rjurney rjurney/test.scala
Created Jun 17, 2014

What would you like to do?
Trying to build a Map inside a map operation
import{QueryParam, GET, Produces, Path}
import scala.Array
import{Response, MediaType}
import org.slf4j.{LoggerFactory, Logger}
import org.joda.time.format.{ISODateTimeFormat, DateTimeFormatter}
import org.joda.time.DateTimeZone
import com.securityx.modelfeature.dao.BeaconsDao
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.securityx.modelfeature.FeatureServiceConfiguration
import org.joda.time.MutableDateTime
import collection.mutable.ListBuffer
import collection.parallel.mutable
val conf = new FeatureServiceConfiguration
val beaconsDao = new BeaconsDao(conf)
val tableName = "DEV_BEACONS"
val buf = beaconsDao.getBeaconingSeries("2014-06-14T00:00:00.000Z", "2014-06-15T00:00:00.000Z", 3600)
// Need to group by source and dest
val groups = buf.groupBy(x => Map[String, Any]
("sourceNameOrIp" -> x.get("sourceNameOrIp"),
"destinationNameOrIp" -> x.get("destinationNameOrIp")
)) {case(key, value) => ({case(key2, value2) => (value)})} {case(key, value) => ({_.get("risk")})}
// Help me, I am trying to return a Map with fields "risk" and "eventTime" {case(key, value) => ({val x = Map()})}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.