Package de.forsthaus.backend.model

Examples of de.forsthaus.backend.model.IpToCountry


    for (final SecLoginlog secLoginlog : originList) {
      count++;
      // check if no entry exists for this login
      if (secLoginlog.getIp2Country() == null) {

        IpToCountry ipToCountry = null;
        try {
          // try to get a ipToCountry for the IP from the table
          final InetAddress inetAddress = InetAddress.getByName(secLoginlog.getLglIp());

          // Skip a local ip. Therefore is no country to identify.
          if (inetAddress.isLoopbackAddress() || inetAddress.isSiteLocalAddress()) {
            localCount++;

            continue;
          }
          checkCount++;

          ipToCountry = getIpToCountryService().getIpToCountry(inetAddress);

          // if found than get the CountryCode object for it and save
          // all
          if (ipToCountry != null) {
            final String code2 = ipToCountry.getIpcCountryCode2();
            final CountryCode sysCC = getCountryCodeService().getCountryCodeByCode2(code2);

            if (sysCC != null) {
              final Ip2Country ip2 = getIp2CountryService().getNewIp2Country();
              ip2.setCountryCode(sysCC);
View Full Code Here


   */
  private void saveSimpleIPDataFromTable(SecLoginlog log) {

    // Get the Country
    // local Database for loacting the ip to a country
    IpToCountry ipToCountry = null;

    try {
      ipToCountry = getIpToCountryService().getIpToCountry(InetAddress.getByName(log.getLglIp()));

      if (ipToCountry != null) {

        // Log data for locating ip to country and geo-data
        final Ip2Country ip2c = getIp2CountryService().getNewIp2Country();
        ip2c.setI2cCity("");
        // ip2c.setSecLoginlog(log);
        ip2c.setCountryCode(getCountryCodeService().getCountryCodeByCode2(ipToCountry.getIpcCountryCode2()));

        getIp2CountryService().saveOrUpdate(ip2c);

        // update the LoginLog with a relation to Ip2Country
        log.setIp2Country(ip2c);
View Full Code Here

      final CsvBeanReader csvb = new CsvBeanReader(in, CsvPreference.STANDARD_PREFERENCE);

      // List<IpToCountry> list = new ArrayList<IpToCountry>();

      IpToCountry tmp = null;
      int id = 1;
      while (null != (tmp = csvb.read(IpToCountry.class, this.stringNameMapping))) {
        tmp.setId(id++);
        getIpToCountryDAO().saveOrUpdate(tmp);

      }
      // close the stream !!!
      in.close();
View Full Code Here

@Repository
public class IpToCountryDAOImpl extends BasisDAO<IpToCountry> implements IpToCountryDAO {

  @Override
  public IpToCountry getNewIpToCountry() {
    return new IpToCountry();
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public IpToCountry getCountry(Long ipNumber) {

    IpToCountry result = null;

    DetachedCriteria criteria = DetachedCriteria.forClass(IpToCountry.class);
    criteria.add(Restrictions.lt("ipcIpFrom", ipNumber));
    criteria.add(Restrictions.gt("ipcIpTo", ipNumber));
View Full Code Here

TOP

Related Classes of de.forsthaus.backend.model.IpToCountry

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.