def setAliasPathIsRemovedFlag()

in path-manager/app/services/PathStore.scala [183:208]


  def setAliasPathIsRemovedFlag(path: String, isRemoved: Boolean): Option[Iterable[PathRecord]] = {
    try {
      val updatedRecord = PathRecord(
        Dynamo.pathsTable.updateItem(new UpdateItemSpec()
          .withPrimaryKey("path", path)
          .withConditionExpression(s"#type = :pathType")
          .withUpdateExpression("SET isRemoved = :isRemoved")
          .withNameMap(Map("#type" -> "type").asJava)
          .withValueMap(new ValueMap()
            .withString(":pathType", ALIAS_PATH_TYPE)
            .withBoolean(":isRemoved", isRemoved)
          )
          .withReturnValues(ReturnValue.ALL_NEW) // this means we can call getItem below
        ).getItem
      )

      Some(
        Dynamo.pathsTable.getIndex("id-index")
        .query(new KeyAttribute("identifier", updatedRecord.identifier)).asScala.map{ PathRecord(_) }
        .filter(_.`type` == ALIAS_PATH_TYPE)
      )
    } catch {
      case _: ConditionalCheckFailedException => None
    }

  }