@@ -71,7 +71,7 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
71
71
72
72
override def getInstance (id : Long ) : Option [Instance ] = {
73
73
if (hasInstance(id)) {
74
- var result = Await .result(db.run(instances.filter(_.id === id).result.headOption), Duration .Inf )
74
+ val result = Await .result(db.run(instances.filter(_.id === id).result.headOption), Duration .Inf )
75
75
Some (dataToObjectInstance(result))
76
76
} else {
77
77
None
@@ -331,23 +331,6 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
331
331
InstanceLink .apply(eventType, payload, getLinkStateFromString(state))
332
332
}
333
333
334
- private def addLinksToInstance (instance : Instance ): Instance = {
335
- val linksTo = getLinksTo(instance.id.getOrElse(- 1 ))
336
- val linksFrom = getLinksFrom(instance.id.getOrElse(- 1 ))
337
-
338
- Instance (
339
- instance.id,
340
- instance.host,
341
- instance.portNumber,
342
- instance.name,
343
- instance.componentType,
344
- instance.dockerId,
345
- instance.instanceState,
346
- instance.labels,
347
- linksTo,
348
- linksFrom
349
- )
350
- }
351
334
352
335
private [daos] def clearData () : Unit = {
353
336
removeAllInstances()
@@ -356,7 +339,7 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
356
339
removeAllInstanceLinks()
357
340
}
358
341
359
- private def getComponetTypeFromString (componentType : String ): ComponentType = {
342
+ private def getComponentTypeFromString (componentType : String ): ComponentType = {
360
343
val result = componentType match {
361
344
case " Crawler" => ComponentType .Crawler
362
345
case " WebApi" => ComponentType .WebApi
@@ -410,7 +393,7 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
410
393
411
394
private def dataToObjectInstance (options : Option [(Long , String , Long , String , String , Option [String ], String , String )]): Instance = {
412
395
val optionValue = options.get
413
- val componentTypeObj = getComponetTypeFromString (optionValue._5)
396
+ val componentTypeObj = getComponentTypeFromString (optionValue._5)
414
397
val instanceStateObj = getInstanceStateFromString(optionValue._7)
415
398
val labelsList = getListFromString(optionValue._8)
416
399
val linksTo = getLinksTo(optionValue._1)
@@ -432,7 +415,7 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
432
415
433
416
private def removeInstanceEventsWithId (id : Long ): Unit = {
434
417
val resultAll = Await .result(db.run(eventMaps.filter(_.instanceId === id).result), Duration .Inf )
435
- resultAll.map (c => removeEvents(c._3))
418
+ resultAll.foreach (c => removeEvents(c._3))
436
419
437
420
val q = eventMaps.filter(_.instanceId === id)
438
421
val action = q.delete
0 commit comments