@Override
 @Transactional
 public void finish(String activationCodeAsString) throws ActivationCodeException {
   ActivationCode code =
       activationCodeDao.findOneByExample(
           new ActivationCode(activationCodeAsString, ActivationCode.REGISTER));
   if (code == null) {
     throw new ActivationCodeException(ActivationCodeException.Type.notexist);
   }
   if (code.getUsed() != null && code.getUsed()) {
     throw new ActivationCodeException(ActivationCodeException.Type.used);
   }
   code.setUsed(true);
   userManager.unlockUser(code.getUserId());
   activationCodeDao.save(code);
 }