Examples of CountryCode


Examples of com.bericotech.clavin.gazetteer.CountryCode

    }
   
    public static List<CountryCode> getUniqueCountries(List<ResolvedLocation> resolvedLocations){
        List<CountryCode> countries = new ArrayList<CountryCode>();
        for(ResolvedLocation resolvedLocation: resolvedLocations){
            CountryCode country = resolvedLocation.getGeoname().getPrimaryCountryCode();
            if(country==CountryCode.NULL){  // skip things that aren't in countries (ie. "Asia")
                continue;
            }
            if( !countries.contains(country) ){
                countries.add(country);
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.CountryCode

      HashMap<String,Integer> stateCounts = new HashMap<String,Integer>();
      for (ResolvedLocation resolvedLocation: resolvedLocations){
            if(resolvedLocation.getGeoname().getPrimaryCountryCode()==CountryCode.NULL){
                continue;
            }
            CountryCode country = resolvedLocation.getGeoname().getPrimaryCountryCode();
            String adm1Code = resolvedLocation.getGeoname().getAdmin1Code();
            String key = Adm1GeoNameLookup.getKey(country, adm1Code);
            if(!Adm1GeoNameLookup.isValid(key)){    // skip things that aren't actually ADM1 codes
                continue;
            }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.CountryCode

        HashMap<CountryCode,Integer> countryCounts = new HashMap<CountryCode,Integer>();
        for (ResolvedLocation resolvedLocation: resolvedLocations){
            if(resolvedLocation.getGeoname().getPrimaryCountryCode()==CountryCode.NULL){
                continue;
            }
            CountryCode country = resolvedLocation.getGeoname().getPrimaryCountryCode();
            if(!countryCounts.containsKey(country)){
                countryCounts.put(country, 0);
            }
            countryCounts.put(country, countryCounts.get(country)+1);
        }
View Full Code Here

Examples of com.bericotech.clavin.gazetteer.CountryCode

        HashMap<CountryCode,Integer> countryCounts = FocusUtils.getCountryCounts(resolvedLocations);
        if(countryCounts.size()==0){
            return results;
        }
        // find the most mentioned
        CountryCode primaryCountry = null;       
        for(CountryCode countryCode: countryCounts.keySet()){
            if( (primaryCountry==null) || (countryCounts.get(countryCode) > countryCounts.get(primaryCountry)) ){
                primaryCountry = countryCode;
            }
        }
        logger.info("Found primary country "+primaryCountry);
        // return results
        if(primaryCountry!=null) {
            results.add( new FocusLocation(
                    CountryGeoNameLookup.lookup( primaryCountry.name()),countryCounts.get(primaryCountry) )
            );
           for(CountryCode countryCode: countryCounts.keySet()){
                if( countryCode != primaryCountry && countryCounts.get(countryCode) == countryCounts.get(primaryCountry) ){
                    results.add( new FocusLocation(
                            CountryGeoNameLookup.lookup( countryCode.name()),countryCounts.get(countryCode) )
View Full Code Here

Examples of com.neovisionaries.i18n.CountryCode

*/
public class ISO3166Utils {
   
    public static String alpha3toAlpha2(String alpha3) throws UnknownCountryException {
        if(alpha3.length()==0) return " ";
        CountryCode countryCode = CountryCode.getByCode(alpha3);
        if(null==countryCode){
            throw new UnknownCountryException("Can't find country "+alpha3, alpha3);
        }
        return countryCode.getAlpha2();
    }
View Full Code Here

Examples of de.forsthaus.backend.model.CountryCode

          // 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

Examples of de.forsthaus.backend.model.CountryCode

            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());
View Full Code Here

Examples of de.forsthaus.backend.model.CountryCode

@Repository
public class CountryCodeDAOImpl extends BasisDAO<CountryCode> implements CountryCodeDAO {

  @Override
  public CountryCode getNewCountryCode() {
    return new CountryCode();
  }
View Full Code Here

Examples of de.forsthaus.backend.model.CountryCode

  // ############################## Tests ##################################

  @Test
  @Transactional
  public void getNewCountryCode() {
    CountryCode obj = getCountryCodeDAO().getNewCountryCode();
    Assert.assertEquals("Not the expected result", Long.MIN_VALUE+1, obj.getId());
  }
View Full Code Here

Examples of de.forsthaus.backend.model.CountryCode

  }

  @Test
  @Transactional
  public void getCountryCodeById() {
    CountryCode obj = getCountryCodeDAO().getCountryCodeById(new Long(5));
    Assert.assertEquals("Not the expected result", "AD", obj.getCcdCode2());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.