Package org.hoteia.qalingo.core.domain

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


    String maxConnectionToLog = engineSettingService.getEngineSettingDefaultValueByCode(EngineSettingService.ENGINE_SETTING_MAX_CUSTOMER_CONNECTION_LOG);
    final Long customerId = customerConnectionLog.getCustomerId();
    final String appCode = customerConnectionLog.getAppCode();
    List<CustomerConnectionLog> customerConnectionLogs  = customerConnectionLogDao.findCustomerConnectionLogsByCustomerIdAndAppCode(customerId, appCode);
    if(customerConnectionLogs.size() >= new Integer(maxConnectionToLog)){
      CustomerConnectionLog customerConnectionLogToUpdate = customerConnectionLogs.get(0);
      customerConnectionLogToUpdate.setAddress(customerConnectionLog.getAddress());
      customerConnectionLogToUpdate.setHost(customerConnectionLog.getHost());
      customerConnectionLogToUpdate.setLoginDate(customerConnectionLog.getLoginDate());
      customerConnectionLogDao.saveOrUpdateCustomerConnectionLog(customerConnectionLogToUpdate);
    } else {
      customerConnectionLogDao.saveOrUpdateCustomerConnectionLog(customerConnectionLog);
    }
  }
View Full Code Here


                }
            }
           
            final Set<CustomerConnectionLog> connectionLogs = customer.getConnectionLogs();
            if (connectionLogs != null && Hibernate.isInitialized(connectionLogs) && connectionLogs.size() > 0) {
                CustomerConnectionLog customerConnectionLog = connectionLogs.iterator().next();
                if (customerConnectionLog.getLoginDate() != null) {
                    customerViewBean.setLastConnectionDate(dateFormat.format(customerConnectionLog.getLoginDate()));
                } else {
                    customerViewBean.setLastConnectionDate(Constants.NOT_AVAILABLE);
                }
            }
           
View Full Code Here

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

  public CustomerConnectionLog getCustomerConnectionLogById(final Long customerConnectionLogId, Object... params) {
        Criteria criteria = createDefaultCriteria(CustomerConnectionLog.class);
        criteria.add(Restrictions.eq("id", customerConnectionLogId));
        CustomerConnectionLog customerConnectionLog = (CustomerConnectionLog) criteria.uniqueResult();
        return customerConnectionLog;
  }
View Full Code Here

  public CustomerConnectionLog saveOrUpdateCustomerConnectionLog(CustomerConnectionLog customerConnectionLog) {
        if (customerConnectionLog.getId() != null) {
            if(em.contains(customerConnectionLog)){
                em.refresh(customerConnectionLog);
            }
            CustomerConnectionLog mergedCustomerConnectionLog = em.merge(customerConnectionLog);
            em.flush();
            return mergedCustomerConnectionLog;
        } else {
            em.persist(customerConnectionLog);
            return customerConnectionLog;
View Full Code Here

            final RequestData requestData = requestUtil.getRequestData(request);
            // CUSTOMER
            Customer customer = customerService.getCustomerByLoginOrEmail(authentication.getName());

            // Persit the new CustomerConnectionLog
            CustomerConnectionLog customerConnectionLog = new CustomerConnectionLog();
            customerConnectionLog.setCustomerId(customer.getId());
            customerConnectionLog.setLoginDate(new Date());
            customerConnectionLog.setAppCode(Constants.APP_NAME_FO_MCOMMERCE_CODE);
            customerConnectionLog.setHost(request.getRemoteHost());
            customerConnectionLog.setAddress(requestUtil.getRemoteAddr(request));
            customer.getConnectionLogs().add(customerConnectionLog);
            customerConnectionLogService.saveOrUpdateCustomerConnectionLog(customerConnectionLog);

            requestUtil.updateCurrentCustomer(request, customer);
View Full Code Here

TOP

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

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.