Package org.hoteia.qalingo.core.domain

Examples of org.hoteia.qalingo.core.domain.UserConnectionLog


  private final Logger logger = LoggerFactory.getLogger(getClass());

  public UserConnectionLog getUserConnectionLogById(final Long userConnectionLogId, Object... params) {
        Criteria criteria = createDefaultCriteria(UserConnectionLog.class);
        criteria.add(Restrictions.eq("id", userConnectionLogId));
        UserConnectionLog userConnectionLog = (UserConnectionLog) criteria.uniqueResult();
        return userConnectionLog;
  }
View Full Code Here


  public UserConnectionLog saveOrUpdateUserConnectionLog(final UserConnectionLog userConnectionLog) {
        if (userConnectionLog.getId() != null) {
            if(em.contains(userConnectionLog)){
                em.refresh(userConnectionLog);
            }
            UserConnectionLog mergedUserConnectionLog = em.merge(userConnectionLog);
            em.flush();
            return mergedUserConnectionLog;
        } else {
            em.persist(userConnectionLog);
            return userConnectionLog;
View Full Code Here

    String maxConnectionToLog = engineSettingService.getEngineSettingDefaultValueByCode(EngineSettingService.ENGINE_SETTING_MAX_USER_CONNECTION_LOG);
    final Long userId = userConnectionLog.getUserId();
    final String appCode = userConnectionLog.getApp();
    List<UserConnectionLog> userConnectionLogs  = userConnectionLogDao.findUserConnectionLogsByUserIdAndAppCode(userId, appCode);
    if(userConnectionLogs.size() >= new Integer(maxConnectionToLog)){
      UserConnectionLog userConnectionLogToUpdate = userConnectionLogs.get(0);
      userConnectionLogToUpdate.setPrivateAddress(userConnectionLog.getPrivateAddress());
            userConnectionLogToUpdate.setPublicAddress(userConnectionLog.getPublicAddress());
      userConnectionLogToUpdate.setHost(userConnectionLog.getHost());
      userConnectionLogToUpdate.setLoginDate(userConnectionLog.getLoginDate());
            userConnectionLogToUpdate.setApp(userConnectionLog.getApp());
      userConnectionLogDao.saveOrUpdateUserConnectionLog(userConnectionLogToUpdate);
    } else {
      userConnectionLogDao.saveOrUpdateUserConnectionLog(userConnectionLog);
    }
  }
View Full Code Here

            }
        }

        final Set<UserConnectionLog> connectionLogs = user.getConnectionLogs();
        for (Iterator<UserConnectionLog> iteratorUserConnectionLog = connectionLogs.iterator(); iteratorUserConnectionLog.hasNext();) {
            UserConnectionLog connectionLog = (UserConnectionLog) iteratorUserConnectionLog.next();
            UserConnectionLogValueBean userConnectionLogValueBean = new UserConnectionLogValueBean();
            userConnectionLogValueBean.setDate(dateFormat.format(connectionLog.getLoginDate()));
            userConnectionLogValueBean.setHost(Constants.NOT_AVAILABLE);
            if (StringUtils.isNotEmpty(connectionLog.getHost())) {
                userConnectionLogValueBean.setHost(connectionLog.getHost());
            }
            userConnectionLogValueBean.setPublicAddress(Constants.NOT_AVAILABLE);
            if (StringUtils.isNotEmpty(connectionLog.getPublicAddress())) {
                userConnectionLogValueBean.setPublicAddress(connectionLog.getPublicAddress());
            }
            userConnectionLogValueBean.setPrivateAddress(Constants.NOT_AVAILABLE);
            if (StringUtils.isNotEmpty(connectionLog.getPrivateAddress())) {
                userConnectionLogValueBean.setPublicAddress(connectionLog.getPrivateAddress());
            }
            userViewBean.getUserConnectionLogs().add(userConnectionLogValueBean);
        }

        final List<String> excludedPatterns = new ArrayList<String>();
View Full Code Here

      // Find the current user
      User user = userService.getUserByLoginOrEmail(authentication.getName());

      // Persit only the new UserConnectionLog
      UserConnectionLog userConnectionLog = new UserConnectionLog();
      userConnectionLog.setUserId(user.getId());
      userConnectionLog.setLoginDate(new Date());
      userConnectionLog.setApp(Constants.APP_NAME_BO_BUSINESS_CODE);
      userConnectionLog.setHost(request.getRemoteHost());
     
      userConnectionLog.setPublicAddress(request.getRemoteAddr());
        userConnectionLog.setPrivateAddress(request.getHeader(Constants.X_FORWARDED_FOR));
     
      userConnectionLogService.saveOrUpdateUserConnectionLog(userConnectionLog);

    try {
        // Update the User in Session
View Full Code Here

TOP

Related Classes of org.hoteia.qalingo.core.domain.UserConnectionLog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.