Skip to content

Commit f85ffd4

Browse files
committed
bugfix/UpdateLinks
1 parent 8614fc7 commit f85ffd4

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

src/main/scala/de/upb/cs/swt/delphi/instanceregistry/RequestHandler.scala

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,13 @@ class RequestHandler(configuration: Configuration, authDao: AuthDAO, instanceDao
256256
}
257257
log.debug(s"Applied matching result $matchingSuccess to instance with id $matchedInstanceId.")
258258

259-
//santosh
260-
261259
//Update link state
262260
if (!matchingSuccess) {
263-
264261
val link = InstanceLink(callerId, matchedInstanceId, LinkState.Failed)
265-
266262
instanceDao.updateLink(link) match {
267263
case Success(_) =>
268264
fireLinkStateChangedEvent(link)
269-
handleMultipleList(matchedInstanceId)
265+
handleLinksUpdate(matchedInstanceId)
270266
OperationResult.Ok
271267
case Failure(_) => OperationResult.InternalError //Should not happen
272268
}
@@ -278,17 +274,17 @@ class RequestHandler(configuration: Configuration, authDao: AuthDAO, instanceDao
278274
}
279275

280276

281-
def handleMultipleList(matchedInstanceId: Long) = {
277+
def handleLinksUpdate(matchedInstanceId: Long): Unit = {
282278

283279
val getlinkFrom = instanceDao.getLinksTo(matchedInstanceId)
284280
for (linklist <- getlinkFrom) {
285281
if (linklist.linkState != LinkState.Failed) {
286-
log.info(s"value in new block is From: ${linklist.idFrom}, MI: $matchedInstanceId To: ${linklist.idTo}")
282+
log.debug(s"value in new block is From: ${linklist.idFrom}, MI: $matchedInstanceId To: ${linklist.idTo}")
287283
val link = InstanceLink(linklist.idFrom, matchedInstanceId, LinkState.Failed)
288284
instanceDao.updateLink(link) match {
289285
case Success(_) =>
290286
fireLinkStateChangedEvent(link)
291-
case Failure(ex) => log.warning(s"There was a failure while updating the link state ${ex.getMessage}") //Should not happen
287+
case Failure(ex) => log.warning(s"There was a failure while updating the link state ${ex.getMessage}")
292288
}
293289
}
294290
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,4 @@ trait InstanceDAO {
167167
* @return Success if instance is present and label does not exceed character limit, false otherwise.
168168
*/
169169
def addLabelFor(id: Long, label: String) : Try[Unit]
170-
171170
}

src/main/scala/de/upb/cs/swt/delphi/instanceregistry/io/swagger/client/model/InstanceLink.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ trait InstanceLinkJsonSupport extends SprayJsonSupport with DefaultJsonProtocol
4242

4343
final case class InstanceLink(idFrom: Long, idTo:Long, linkState: LinkState)
4444

45-
final case class InstanceLinkList(idFrom: List[InstanceLink], idTo:Long, linkState: LinkState)
46-
47-
4845
object LinkEnums {
4946
type LinkState = LinkState.Value
5047

0 commit comments

Comments
 (0)