CHOP-41. Coverts Java code to Scala.

Signed-off-by: Kiyan Ahmadizadeh <kiyan@wibidata.com>