Advertisement
Guest User

Untitled

a guest
Mar 12th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.65 KB | None | 0 0
  1.  def addLocation(map: Map[String, Any]): Future[mutable.Map[String, AnyRef]] = {
  2.     assert(map.contains("id"), "an id is required")
  3.     futurePool{
  4.       val g = OrientDatabase.graph
  5.       try {
  6.         val vertex: Vertex = g.addVertex("Class:Location", null)
  7.         map.foreach{
  8.           case (key, value) =>
  9.             vertex.setProperty(key, value)
  10.           case _ =>
  11.             logger.debug("wat!")
  12.         }
  13.         g.commit()
  14.         vertexPropertyMapping(vertex.asInstanceOf[OrientVertex])
  15.       } catch {
  16.         case t: Throwable =>
  17.           g.rollback()
  18.           throw t
  19.       } finally {
  20.         g.shutdown()
  21.       }
  22.     }
  23.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement