Package com.evasion.entity.geolocation

Examples of com.evasion.entity.geolocation.Country


        LOGGER.info("Import Geoloc timer step.");
        try {
            Importer geo = new Importer(em, utx);
            List<EntityJPA> countrys = defaultDAO.findAll(Country.class);
            for (EntityJPA object : countrys) {
                Country country = (Country) object;
                try {
                    utx.begin();  
                    if (geo.downloadCountryData(parametreManager.getProperty(Constante.IMPORT_FTP_DOWNLOAD_URL), country.getGeoname().getModDate().getTime(), country.getCode())) {
                        geo.importData(parametreManager.getProperty(Constante.IMPORT_FILE_FORMAT), Mode.DELTE_INSERT);
                        parametreManager.saveParametre(
                                Constante.IMPORT_LAST_UPDATE, String.valueOf(new Date().getTime()), Boolean.TRUE);
                    }
                    geo.clear();
View Full Code Here


        return false;
    }

    private void completeLocation(EntityJPA entity) {
        if (entity instanceof AdminDivision) {
            Country ct = (Country) countryDAO.findByCtCode(((AdminDivision) entity).getCountry().getCode());
            if (ct == null) {
                LOGGER.error("Country by ct code {} not found", ((AdminDivision) entity).getCountry().getCode());
            } else {
                ((AdminDivision) entity).setCountry(ct);
            }
        } else if (entity instanceof City) {
            AdminDivision adm = null;
            City city = (City) entity;
            if (city.getAdmDivision() != null && city.getAdmDivision().getCode() != null) {
                adm = (AdminDivision) regionAdmDAO.findByAdmCode(((City) entity).getAdmDivision().getCode());
            }
            ((City) entity).setAdmDivision(adm);
            Country ct = (Country) countryDAO.findByCtCode(((City) entity).getCountry().getCode());
            if (ct == null) {
                LOGGER.error("Country by ct code {} not found", ((City) entity).getCountry().getCode());
            } else {
                ((City) entity).setCountry(ct);
            }
View Full Code Here

     * serialVersionUID.
     */
    private static final long serialVersionUID = 1L;

    public Country findByCtCode(String code) {
        Country result;
        Query query = (Query) getEntityManager().
                createNamedQuery(Country.QUERY_FIND_BY_COUNTRY_CODE);
        query.setParameter(1, code);
        try {
            result = (Country) query.getSingleResult();
View Full Code Here

        LOGGER.info("Import Geoloc timer step.");
        try {
            Importer geo = new Importer(em, utx);
            List<EntityJPA> countrys = defaultDAO.findAll(Country.class);
            for (EntityJPA object : countrys) {
                Country country = (Country) object;
                try {
                    utx.begin();
                    if (geo.downloadCountryData(parametreManager.getProperty(Constante.IMPORT_FTP_DOWNLOAD_URL), country.getGeoname().getModDate().getTime(), country.getCode())) {
                        geo.importData(parametreManager.getProperty(Constante.IMPORT_FILE_FORMAT), Mode.DELETE_INSERT);
                        parametreManager.saveParametre(
                                Constante.IMPORT_LAST_UPDATE, String.valueOf(new Date().getTime()), Boolean.TRUE);
                    }
                    geo.clear();
View Full Code Here

        return false;
    }

    private void completeLocation(EntityJPA entity) {
        if (entity instanceof AdminDivision) {
            Country ct = (Country) countryDAO.findByCtCode(((AdminDivision) entity).getCountry().getCode());
            if (ct == null) {
                LOGGER.error("Country by ct code {} not found", ((AdminDivision) entity).getCountry().getCode());
            } else {
                ((AdminDivision) entity).setCountry(ct);
            }
        } else if (entity instanceof City) {
            AdminDivision adm = null;
            City city = (City) entity;
            if (city.getAdmDivision() != null && city.getAdmDivision().getCode() != null) {
                adm = (AdminDivision) regionAdmDAO.findByAdmCode(((City) entity).getAdmDivision().getCode());
            }
            ((City) entity).setAdmDivision(adm);
            Country ct = (Country) countryDAO.findByCtCode(((City) entity).getCountry().getCode());
            if (ct == null) {
                LOGGER.error("Country by ct code {} not found", ((City) entity).getCountry().getCode());
            } else {
                ((City) entity).setCountry(ct);
            }
View Full Code Here

TOP

Related Classes of com.evasion.entity.geolocation.Country

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.