class ChecksumUtil {

   public static void updateChecksum(ChangeSet changeSet) {
      if(changeSet.getCommands().isEmpty()) {
         return;
      }

      MessageDigest checksum = DigestUtils.getMd5Digest();

      for(Command command : changeSet.getCommands()) {
         if(command instanceof CQLCommand) {
            DigestUtils.updateDigest(checksum, ((CQLCommand) command).getUpdateCql());
            DigestUtils.updateDigest(checksum, ((CQLCommand) command).getRollbackCql());
         } else if(command instanceof JavaCommand) {
            DigestUtils.updateDigest(checksum, ((JavaCommand) command).getClassName());
         }
      }

      byte[] bytes = checksum.digest();

      changeSet.setChecksum(Hex.encodeHexString(bytes));
   }

   private  ChecksumUtil();

}