Skip to content

Commit 1a5182a

Browse files
author
Johannes Duesing
committed
Fixed codestyle issues
1 parent 799f4a9 commit 1a5182a

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

src/main/scala/de/upb/cs/swt/delphi/instanceregistry/daos/DatabaseInstanceDAO.scala

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
7171

7272
override def getInstance(id: Long) : Option[Instance] = {
7373
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)
7575
Some(dataToObjectInstance(result))
7676
} else {
7777
None
@@ -331,23 +331,6 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
331331
InstanceLink.apply(eventType, payload, getLinkStateFromString(state))
332332
}
333333

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-
}
351334

352335
private[daos] def clearData() : Unit = {
353336
removeAllInstances()
@@ -356,7 +339,7 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
356339
removeAllInstanceLinks()
357340
}
358341

359-
private def getComponetTypeFromString(componentType: String): ComponentType ={
342+
private def getComponentTypeFromString(componentType: String): ComponentType ={
360343
val result = componentType match {
361344
case "Crawler" => ComponentType.Crawler
362345
case "WebApi" => ComponentType.WebApi
@@ -410,7 +393,7 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
410393

411394
private def dataToObjectInstance(options : Option[(Long, String, Long, String, String, Option[String], String, String)]): Instance = {
412395
val optionValue = options.get
413-
val componentTypeObj = getComponetTypeFromString(optionValue._5)
396+
val componentTypeObj = getComponentTypeFromString(optionValue._5)
414397
val instanceStateObj = getInstanceStateFromString(optionValue._7)
415398
val labelsList = getListFromString(optionValue._8)
416399
val linksTo = getLinksTo(optionValue._1)
@@ -432,7 +415,7 @@ class DatabaseInstanceDAO (configuration : Configuration) extends InstanceDAO wi
432415

433416
private def removeInstanceEventsWithId(id: Long): Unit ={
434417
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))
436419

437420
val q = eventMaps.filter(_.instanceId === id)
438421
val action = q.delete

0 commit comments

Comments
 (0)