IdChecker

object IdChecker

This class checks whether a Game- or Player-ID matches the old or new format. If old format is used, checks are skipped and input is returned. If new format is detected, prefix and checkDigit are checked and UUID returned.

All input is returned trimmed.

New format: G-UUID-CheckDigit for Game IDs P-UUID-CheckDigit for Player IDs

Example: 2ddb3a34-0699-4126-b7a5-38603e665928 Same ID in proposed new Player-ID format: P-2ddb3a34-0699-4126-b7a5-38603e665928-5 Same ID in proposed new Game-ID format: G-2ddb3a34-0699-4126-b7a5-38603e665928-5

Functions

checkAndReturnGameUuid
Link copied to clipboard
fun checkAndReturnGameUuid(gameId: String): String
checkAndReturnPlayerUuid
Link copied to clipboard
fun checkAndReturnPlayerUuid(playerId: String): String
checkAndReturnUuiId
Link copied to clipboard
private fun checkAndReturnUuiId(id: String, prefix: String): String
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
getCheckDigit
Link copied to clipboard
fun getCheckDigit(uuid: String): Int

Adapted from https://wiki.openmrs.org/display/docs/Check+Digit+Algorithm

hashCode
Link copied to clipboard
open fun hashCode(): Int
toString
Link copied to clipboard
open fun toString(): String

Sources

jvm source
Link copied to clipboard