Package de.forsthaus.backend.model

Examples of de.forsthaus.backend.model.Ip2Country


   *
   * @param log
   */
  private void saveCompleteIPDataFromLookUpHost(SecLoginlog log) {

    final Ip2Country ip2c = getIp2CountryService().getNewIp2Country();
    final IpLocator ipl = getIp2CountryService().hostIpLookUpIp(log.getLglIp());
    /** For testing on a local tomcat */
    // IpLocator ipl =
    // getIp2CountryService().hostIpLookUpIp("95.111.227.104");

    if (ipl != null) {

      ip2c.setI2cCity(ipl.getCity());
      ip2c.setI2cLatitude(ipl.getLatitude());
      ip2c.setI2cLongitude(ipl.getLongitude());
      ip2c.setCountryCode(getCountryCodeService().getCountryCodeByCode2(ipl.getCountryCode()));

      getIp2CountryService().saveOrUpdate(ip2c);

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


          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);

              // save all
              getIp2CountryService().saveOrUpdate(ip2);
              secLoginlog.setIp2Country(ip2);
              getLoginLoggingService().update(secLoginlog);
View Full Code Here

    for (final SecLoginlog secLoginlog : originList) {

      if (secLoginlog.getIp2Country() != null) {

        final Ip2Country ip2c = secLoginlog.getIp2Country();

        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()) {
            continue;
          }

          if (StringUtils.isEmpty(ip2c.getI2cCity())) {
            final IpLocator ipl = getIp2CountryService().hostIpLookUpIp(secLoginlog.getLglIp());
            // /** For testing on a local tomcat */
            // IpLocator ipl =
            // getIp2CountryService().hostIpLookUpIp("95.111.227.104");

            if (ipl != null) {

              if (logger.isDebugEnabled()) {
                logger.debug("hostLookUp resolved for : " + secLoginlog.getLglIp());
              }

              ip2c.setI2cCity(ipl.getCity());
              ip2c.setI2cLatitude(ipl.getLatitude());
              ip2c.setI2cLongitude(ipl.getLongitude());
              getIp2CountryService().saveOrUpdate(ip2c);

              secLoginlog.setIp2Country(ip2c);
              getLoginLoggingService().saveOrUpdate(secLoginlog);

              countRec = countRec + 1;
            }
          }
        } catch (final Exception e) {
          logger.warn("", e);
          continue;
        }

      } else {
        // create a new entry
        final Ip2Country ip2 = getIp2CountryService().getNewIp2Country();

        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()) {
            continue;
          }

          final IpLocator ipl = getIp2CountryService().hostIpLookUpIp(secLoginlog.getLglIp());
          // /** For testing on a local tomcat */
          // IpLocator ipl =
          // getIp2CountryService().hostIpLookUpIp("95.111.227.104");

          if (ipl != null) {

            if (logger.isDebugEnabled()) {
              logger.debug("hostLookUp resolved for : " + secLoginlog.getLglIp());
            }

            final CountryCode sysCC = getCountryCodeService().getCountryCodeByCode2(ipl.getCountryCode());
            ip2.setCountryCode(sysCC);

            ip2.setI2cCity(ipl.getCity());
            ip2.setI2cLatitude(ipl.getLatitude());
            ip2.setI2cLongitude(ipl.getLongitude());
            getIp2CountryService().saveOrUpdate(ip2);

            secLoginlog.setIp2Country(ip2);
            getLoginLoggingService().saveOrUpdate(secLoginlog);

View Full Code Here

      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 List<SecLoginlog> listSecLoginLog = getSecLoginlogDAO().getAllLogs();
    for (final SecLoginlog secLoginlog : listSecLoginLog) {

      // Fill with the related data for Ip2Country
      final Ip2Country ip2 = secLoginlog.getIp2Country();
      if (ip2 != null) {
        // Fill with the related data for CountryCode
        final CountryCode cc = ip2.getCountryCode();
        if (cc != null) {
        }

      }
    }
View Full Code Here

    final List<SecLoginlog> listSecLoginLog = getSecLoginlogDAO().getAllLogsForSuccess();

    for (final SecLoginlog secLoginlog : listSecLoginLog) {

      // Fill with the related data for Ip2Country
      final Ip2Country ip2 = secLoginlog.getIp2Country();
      if (ip2 != null) {
        // Fill with the related data for CountryCode
        final CountryCode cc = ip2.getCountryCode();
        if (cc != null) {
        }

      }
    }
View Full Code Here

    final List<SecLoginlog> listSecLoginLog = getSecLoginlogDAO().getAllLogsForFailed();

    for (final SecLoginlog secLoginlog : listSecLoginLog) {

      // Fill with the related data for Ip2Country
      final Ip2Country ip2 = secLoginlog.getIp2Country();
      if (ip2 != null) {
        // Fill with the related data for CountryCode
        final CountryCode cc = ip2.getCountryCode();
        if (cc != null) {
        }

      }
    }
View Full Code Here

@Repository
public class Ip2CountryDAOImpl extends BasisDAO<Ip2Country> implements Ip2CountryDAO {

  @Override
  public Ip2Country getNewIp2Country() {
    return new Ip2Country();
  }
View Full Code Here

    }
    lc.setParent(item);

    /* Country Code / Flag+Short+Provider-City */
    final String currentIp = log.getLglIp();
    final Ip2Country ip2 = log.getIp2Country();

    if (ip2 != null) {
      lc = new Listcell();
      final Hbox hbox = new Hbox();
      hbox.setParent(lc);

      // Fill with the related data for CountryCode
      final CountryCode cc = ip2.getCountryCode();
      if (cc != null) {
        /* Flag-image */
        final Image img = new Image();
        final String path = "/images/countrycode_flags/";
        final String flag = StringUtils.lowerCase(cc.getCcdCode2()) + ".gif";
        img.setSrc(path + flag);
        hbox.appendChild(img);

        final Separator sep = new Separator();
        hbox.appendChild(sep);

        /* Country */
        final Label label = new Label();
        label.setValue(cc.getCcdCode2());
        hbox.appendChild(label);

        // show other stuff from the Ip2Country
        /* Provider-City */
        final Label label2 = new Label();
        if (StringUtils.isNotBlank(ip2.getI2cCity())) {
          label2.setValue("(" + ip2.getI2cCity() + ")");
        } else {
          label2.setValue("");
        }

        hbox.appendChild(label2);
View Full Code Here

TOP

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

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.