Example #1
0
 @Override
 public void updateInvitationCodeToUsed(String code) {
   NotificationWriter writer = notificationDaoManager.getWriter();
   InvitationCodeDTO dto = writer.findInvitationCodeByCode(code);
   if (dto == null) {
     LOG.warn("can't find InvitationCode by code:{}", code);
     return;
   }
   Object status = writer.begin();
   try {
     InvitationCode invitationCode = writer.getById(InvitationCode.class, dto.getId());
     invitationCode.setStatus(InvitationCodeStatus.BE_USED);
     invitationCode.setUsageTime(System.currentTimeMillis());
     writer.save(invitationCode);
     writer.commit(status);
   } finally {
     writer.rollback(status);
   }
 }
Example #2
0
 public InvitationCodeDTO findInvitationCodeByCode(String code) {
   NotificationWriter writer = notificationDaoManager.getWriter();
   return writer.findInvitationCodeByCode(code.toLowerCase());
 }