Пример #1
0
  /** @param userId */
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public String addOneAppForUser(Long userId, int appId) {

    User user = getUser(userId);
    String ownAppIds = user.getOwnApps();
    if (ownAppIds.contains(",")) {
      ownAppIds = ownAppIds + "," + appId;

    } else {
      ownAppIds = String.valueOf(appId);
    }
    user.setOwnApps(ownAppIds);
    userDao.update(user);

    return ownAppIds;
  }
Пример #2
0
  /** @param userId */
  @Override
  @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
  public String addOneAppForUser(Long userId, Long appId) {

    User user = getUser(userId);
    String ownAppIds = user.getOwnApps();
    if (!StringUtils.isBlank(ownAppIds)) {
      ownAppIds = ownAppIds + "," + appId;

    } else {
      ownAppIds = String.valueOf(appId);
    }
    user.setOwnApps(ownAppIds);
    Visitor visitor = ThreadContext.getSessionVisitor();
    visitor.setAppIds(user.getOwnApps());
    userDao.update(user);
    return ownAppIds;
  }