CHOP-44. Coverts Java code to Scala.

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