Example usage for java.util Locale FRANCE

List of usage examples for java.util Locale FRANCE

Introduction

In this page you can find the example usage for java.util Locale FRANCE.

Prototype

Locale FRANCE

To view the source code for java.util Locale FRANCE.

Click Source Link

Document

Useful constant for country.

Usage

From source file:course_generator.frmMain.java

/**
 * Creates new form frmMain ------------------------------- !!!! Everything
 * start here !!!! ------------------------
 *//*from   ww  w .j  a  va2s . c om*/
public frmMain(String args[]) {
    // Initialize data
    DataDir = Utils.GetHomeDir();
    Track = new TrackData();
    Resume = new ResumeData();
    Settings = new CgSettings();
    ModelTableMain = new TrackDataModel(Track, Settings);
    ModelTableResume = new ResumeModel(Resume, Settings);

    dataset = new XYSeriesCollection();
    // dataset = CreateDataset();
    chart = CreateChartProfil(dataset);

    // -- Load configuration
    LoadConfig();

    // -- Set the language
    if (Settings.Language.equalsIgnoreCase("FR")) {
        Locale.setDefault(Locale.FRANCE);
    } else if (Settings.Language.equalsIgnoreCase("EN")) {
        Locale.setDefault(Locale.US);
    }

    // -- Set default font
    setUIFont(new javax.swing.plaf.FontUIResource("Tahoma", // Settings.DefaultFont.getFontName(),
            // //"Tahoma"
            Font.PLAIN, // Settings.DefaultFont.getStyle(), // Font.PLAIN,
            14)); // Settings.DefaultFont.getSize())); //24));

    // -- Initialize the string resource for internationalization
    bundle = java.util.ResourceBundle.getBundle("course_generator/Bundle");

    // -- Configure the main form
    initComponents();

    // -- Set the icon of the application
    setIconImage(createImageIcon("/course_generator/images/cg.png", "").getImage());

    // -- Set the preferred column width
    for (int i = 0; i < 15; i++) {
        TableMain.getColumnModel().getColumn(i).setPreferredWidth(Settings.TableMainColWidth[i]);
    }
    RefreshTableMain();

    // -- Set the windows size and center it in the screen - Not tested on
    // multi-screen configuration
    Rectangle r = getBounds();
    r.width = Settings.MainWindowWidth;
    r.height = Settings.MainWindowHeight;
    Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize();
    r.x = (screensize.width - r.width) / 2;
    r.y = (screensize.height - r.height) / 2;
    setBounds(r);

    // -- Set the left panel width
    SplitPaneMain.setDividerLocation(Settings.VertSplitPosition);
    SplitPaneMainRight.setDividerLocation(Settings.HorizSplitPosition);

    // -- Tests - To Remove...

    // -- Configure the tile source for the map
    MapViewer.setTileSource(new Thunderforest_Outdoors());
    //TODO Switch to OpenTopomap
    //MapViewer.setTileSource(new OpenTopoMap());

    // -- Set the counter in order near the end in order to start the
    // connection test
    cmptInternetConnexion = Settings.ConnectionTimeout - 1;

    // -- Start the 1 second timer
    timer1s = new Timer(1000, new TimerActionListener());
    timer1s.start();

    // -- Refresh
    RefreshMruCGX();
    RefreshMruGPX();
    RefreshStatusbar(Track);
}

From source file:org.talend.dataquality.standardization.phone.PhoneNumberHandlerBaseTest.java

@Test
public void testgetGeocoderDescriptionForNumber() {

    assertEquals("", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(CN_NUM_3, REGCODE_CN,
                    Locale.SIMPLIFIED_CHINESE));
    assertEquals("Beijing", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(CN_NUM_3, REGCODE_CN, Locale.UK)); //
    assertEquals("??", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(CN_NUM_4, REGCODE_CN,
                    Locale.SIMPLIFIED_CHINESE));
    assertEquals("Jiujiang, Jiangxi", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(CN_NUM_4, REGCODE_CN, Locale.UK));

    assertEquals("France", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_1, REGCODE_FR, Locale.FRANCE));
    assertEquals("Paris", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_2, REGCODE_FR, Locale.FRANCE));
    assertEquals(StringUtils.EMPTY,//from   www .  j av  a2s  .c  o  m
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_3, REGCODE_FR, Locale.FRANCE));
    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_4, REGCODE_FR, Locale.FRANCE));
    assertEquals("France", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(FR_NUM_5, REGCODE_FR, Locale.FRANCE));

    assertEquals("Corvallis, OR", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_1, REGCODE_US, Locale.US));
    assertEquals("Corvallis, OR", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_2, REGCODE_US, Locale.US));
    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_3, REGCODE_US, Locale.US));
    assertEquals("Corvallis, OR", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_4, REGCODE_US, Locale.US));
    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_5, REGCODE_US, Locale.US));
    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_6, REGCODE_US, Locale.US));
    assertEquals("Pennsylvania", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(US_NUM_7, REGCODE_US, Locale.US));

    assertEquals("Mnchen", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_1, REGCODE_DE, Locale.GERMANY));
    assertEquals("Munich", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_1, REGCODE_DE, Locale.ENGLISH));
    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_2, REGCODE_DE, Locale.GERMANY));
    assertEquals("Mnchen", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_3, REGCODE_DE, Locale.GERMANY));
    assertEquals("Nubach Pfalz", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_4, REGCODE_DE, Locale.GERMANY));
    assertEquals("Nussbach Pfalz", //$NON-NLS-1$
            phoneNumberHandlerBase.getGeocoderDescriptionForNumber(DE_NUM_4, REGCODE_DE, Locale.ENGLISH));

}

From source file:org.silverpeas.migration.classified.XmlFormImagesToAttachment.java

private boolean verifFormatImage(String filename) {
    int indexPoint = filename.lastIndexOf('.');
    if (indexPoint != -1) {
        // le fichier contient une extension. On recupere l'extension
        String extension = filename.substring(indexPoint + 1);
        extension = extension.toLowerCase(Locale.FRANCE);
        if ("jpg".equals(extension) || "gif".equals(extension) || "bmp".equals(extension)
                || "tiff".equals(extension) || "tif".equals(extension) || "jpeg".equals(extension)
                || "png".equals(extension)) {
            return true;
        }/*  w ww. ja v a 2 s  .  c  o m*/
    }
    return false;
}

From source file:com.datastax.loader.CqlDelimLoad.java

private boolean parseArgs(String[] args) throws IOException, FileNotFoundException {
    String tkey;/*from  w w  w. j  av  a2  s  .co  m*/
    if (args.length == 0) {
        System.err.println("No arguments specified");
        return false;
    }
    if (0 != args.length % 2) {
        System.err.println("Not an even number of parameters");
        return false;
    }

    Map<String, String> amap = new HashMap<String, String>();
    for (int i = 0; i < args.length; i += 2)
        amap.put(args[i], args[i + 1]);

    if (null != (tkey = amap.remove("-configFile")))
        if (!processConfigFile(tkey, amap))
            return false;

    host = amap.remove("-host");
    if (null == host) { // host is required
        System.err.println("Must provide a host");
        return false;
    }

    filename = amap.remove("-f");
    if (null == filename) { // filename is required
        System.err.println("Must provide a filename/directory");
        return false;
    }

    if (null != (tkey = amap.remove("-format")))
        format = tkey;
    if (null != (tkey = amap.remove("-schema")))
        cqlSchema = tkey;
    if (null != (tkey = amap.remove("-table")))
        table = tkey;
    if (null != (tkey = amap.remove("-keyspace")))
        keyspace = tkey;

    if (null != (tkey = amap.remove("-port")))
        port = Integer.parseInt(tkey);
    if (null != (tkey = amap.remove("-user")))
        username = tkey;
    if (null != (tkey = amap.remove("-pw")))
        password = tkey;
    if (null != (tkey = amap.remove("-ssl-truststore-path")))
        truststorePath = tkey;
    if (null != (tkey = amap.remove("-ssl-truststore-pw")))
        truststorePwd = tkey;
    if (null != (tkey = amap.remove("-ssl-keystore-path")))
        keystorePath = tkey;
    if (null != (tkey = amap.remove("-ssl-keystore-pw")))
        keystorePwd = tkey;
    if (null != (tkey = amap.remove("-consistencyLevel")))
        consistencyLevel = ConsistencyLevel.valueOf(tkey);
    if (null != (tkey = amap.remove("-numFutures")))
        inNumFutures = Integer.parseInt(tkey);
    if (null != (tkey = amap.remove("-batchSize")))
        batchSize = Integer.parseInt(tkey);
    if (null != (tkey = amap.remove("-queryTimeout")))
        queryTimeout = Integer.parseInt(tkey);
    if (null != (tkey = amap.remove("-maxInsertErrors")))
        maxInsertErrors = Long.parseLong(tkey);
    if (null != (tkey = amap.remove("-numRetries")))
        numRetries = Integer.parseInt(tkey);
    if (null != (tkey = amap.remove("-maxErrors")))
        maxErrors = Long.parseLong(tkey);
    if (null != (tkey = amap.remove("-skipRows")))
        skipRows = Integer.parseInt(tkey);
    if (null != (tkey = amap.remove("-skipCols")))
        skipCols = tkey;
    if (null != (tkey = amap.remove("-maxRows")))
        maxRows = Integer.parseInt(tkey);
    if (null != (tkey = amap.remove("-badDir")))
        badDir = tkey;
    if (null != (tkey = amap.remove("-dateFormat")))
        dateFormatString = tkey;
    if (null != (tkey = amap.remove("-localDateFormat")))
        localDateFormatString = tkey;
    if (null != (tkey = amap.remove("-nullString")))
        nullString = tkey;
    if (null != (tkey = amap.remove("-comment")))
        commentString = tkey;
    if (null != (tkey = amap.remove("-delim")))
        delimiter = tkey;
    if (null != (tkey = amap.remove("-numThreads")))
        numThreads = Integer.parseInt(tkey);
    if (null != (tkey = amap.remove("-rate")))
        rate = Double.parseDouble(tkey);
    if (null != (tkey = amap.remove("-progressRate")))
        progressRate = Long.parseLong(tkey);
    if (null != (tkey = amap.remove("-rateFile")))
        rateFile = tkey;
    if (null != (tkey = amap.remove("-successDir")))
        successDir = tkey;
    if (null != (tkey = amap.remove("-failureDir")))
        failureDir = tkey;
    if (null != (tkey = amap.remove("-decimalDelim"))) {
        if (tkey.equals(","))
            locale = Locale.FRANCE;
    }
    if (null != (tkey = amap.remove("-boolStyle"))) {
        boolStyle = BooleanParser.getBoolStyle(tkey);
        if (null == boolStyle) {
            System.err.println("Bad boolean style.  Options are: " + BooleanParser.getOptions());
            return false;
        }
    }
    if (null != (tkey = amap.remove("-nullsUnset")))
        nullsUnset = Boolean.parseBoolean(tkey);
    if (null != (tkey = amap.remove("-charsPerColumn")))
        charsPerColumn = Integer.parseInt(tkey);

    if (-1 == maxRows)
        maxRows = Long.MAX_VALUE;
    if (-1 == maxErrors)
        maxErrors = Long.MAX_VALUE;
    if (-1 == maxInsertErrors)
        maxInsertErrors = Long.MAX_VALUE;

    if (!amap.isEmpty()) {
        for (String k : amap.keySet())
            System.err.println("Unrecognized option: " + k);
        return false;
    }

    if (0 < inNumFutures)
        numFutures = inNumFutures / numThreads;

    if (null != keyspace)
        keyspace = quote(keyspace);
    if (null != table)
        table = quote(table);

    return validateArgs();
}

From source file:fr.paris.lutece.plugins.directory.modules.pdfproducerarchive.web.ZipBasketJspBean.java

private String getLabelTimeBeforeNextDaemonPassage(String strI18nKeyWait, String strI18nKeyDaemonRunning,
        HttpServletRequest request, String strDaemonId) {
    DaemonEntry daemonEntry = null;/*from  w ww  . java 2 s.co m*/
    Collection<DaemonEntry> listDaemonEntries = AppDaemonService.getDaemonEntries();
    if (listDaemonEntries != null && listDaemonEntries.size() > 0) {
        for (DaemonEntry entry : listDaemonEntries) {
            if (StringUtils.equals(entry.getId(), strDaemonId)) {
                daemonEntry = entry;
            }
        }
        Locale locale = AdminUserService.getLocale(request);

        // The method getLastRunDate( ) use a deprecated method, that hard-code the format of the date.
        SimpleDateFormat formatterDateTime = new SimpleDateFormat("dd'/'MM'/'yyyy' 'HH':'mm", Locale.FRANCE);
        Date dateLastRun;
        try {
            dateLastRun = formatterDateTime.parse(daemonEntry.getLastRunDate());
        } catch (ParseException e) {
            dateLastRun = null;
        }
        if (dateLastRun != null) {
            String strLabelNextDaemonPass = StringUtils.EMPTY;
            Date currentDate = new Date();
            long lTimbeBeforeNextPassage = daemonEntry.getInterval() * 1000l
                    - (currentDate.getTime() - dateLastRun.getTime());
            if (lTimbeBeforeNextPassage > 0) {
                int nHours = (int) lTimbeBeforeNextPassage / 3600000; // We get the number of hours
                lTimbeBeforeNextPassage = lTimbeBeforeNextPassage % 3600000;
                int nMinutes = (int) lTimbeBeforeNextPassage / 60000;
                lTimbeBeforeNextPassage = lTimbeBeforeNextPassage % 60000;
                int nSeconds = (int) lTimbeBeforeNextPassage / 1000;
                Object[] args = { Integer.toString(nHours), Integer.toString(nMinutes),
                        Integer.toString(nSeconds) };
                strLabelNextDaemonPass = I18nService.getLocalizedString(strI18nKeyWait, args, locale);
            } else {
                strLabelNextDaemonPass = I18nService.getLocalizedString(strI18nKeyDaemonRunning, locale);
            }
            return strLabelNextDaemonPass;
        }
    }
    return null;
}

From source file:org.yccheok.jstock.gui.JStockOptions.java

private Object readResolve() {
    /* For backward compatible */
    if (lastSelectedPageIndex < 0) {
        lastSelectedPageIndex = 0;//from  w ww . ja  v  a2  s .  com
    }

    if (lastSelectedSellPortfolioChartIndex < 0) {
        lastSelectedSellPortfolioChartIndex = 0;
    }

    if (lastSelectedBuyPortfolioChartIndex < 0) {
        lastSelectedBuyPortfolioChartIndex = 0;
    }

    /* For backward compatible */
    if (brokingFirms == null) {
        brokingFirms = new ArrayList<>();
    }

    /* For backward compatible */
    if (country == null) {
        country = Country.UnitedState;
    } else {
        List<Country> countries = Utils.getSupportedStockMarketCountries();
        if (!countries.contains(country)) {
            country = Country.UnitedState;
        }
    }

    if (this.recentCountries == null) {
        this.recentCountries = new ArrayList<>();
    }

    Country[] countries = { Country.UnitedState, Country.Canada, Country.Malaysia, Country.UnitedKingdom,
            Country.Singapore };

    if (recentCountries.size() != DEFAULT_RECENT_COUNTRY_SIZE) {
        if (recentCountries.size() < DEFAULT_RECENT_COUNTRY_SIZE) {
            for (Country country : countries) {
                recentCountries.add(country);
            }
        }
        Set<Country> c = new HashSet<>(recentCountries);
        recentCountries = new ArrayList<>(c);
        int k = recentCountries.size();
        if (k > DEFAULT_RECENT_COUNTRY_SIZE) {
            recentCountries.subList(DEFAULT_RECENT_COUNTRY_SIZE, k).clear();
        }
    }

    if (historyDuration <= 0) {
        historyDuration = DEFAULT_HISTORY_DURATION;
    }

    if (getChatUsername() == null) {
        setChatUsername("");
    }

    if (getChatPassword() == null) {
        setChatPassword("");
    }

    if (this.getChatSystemMessageColor() == null) {
        this.setChatSystemMessageColor(DEFAULT_CHAT_SYSTEM_MESSAGE_COLOR);
    }

    if (this.getChatOwnMessageColor() == null) {
        this.setChatOwnMessageColor(DEFAULT_CHAT_OWN_MESSAGE_COLOR);
    }

    if (this.getChatOtherMessageColor() == null) {
        this.setChatOtherMessageColor(DEFAULT_CHAT_OTHER_MESSAGE_COLOR);
    }

    if (this.getFallBelowAlertForegroundColor() == null) {
        this.setFallBelowAlertForegroundColor(DEFAULT_FALL_BELOW_ALERT_FOREGROUND_COLOR);
    }

    if (this.getFallBelowAlertBackgroundColor() == null) {
        this.setFallBelowAlertBackgroundColor(DEFAULT_FALL_BELOW_ALERT_BACKGROUND_COLOR);
    }

    if (this.getRiseAboveAlertForegroundColor() == null) {
        this.setRiseAboveAlertForegroundColor(DEFAULT_RISE_ABOVE_ALERT_FOREGROUND_COLOR);
    }

    if (this.getRiseAboveAlertBackgroundColor() == null) {
        this.setRiseAboveAlertBackgroundColor(DEFAULT_RISE_ABOVE_ALERT_BACKGROUND_COLOR);
    }

    if (this.proxyAuthUserName == null) {
        this.proxyAuthUserName = "";
    }

    if (this.proxyAuthPassword == null) {
        this.proxyAuthPassword = "";
    }

    setCredentials(new NTCredentials(this.proxyAuthUserName, Utils.decrypt(this.proxyAuthPassword), "", ""));

    if (this.getLastFileIODirectory() == null) {
        this.setLastFileIODirectory("");
    }

    if (this.getLastSavedFileNameExtensionDescription() == null) {
        this.setLastFileNameExtensionDescription("CSV Documents (*.csv)");
    }

    if (this.portfolioNames == null) {
        this.portfolioNames = new EnumMap<Country, String>(Country.class);
    }

    if (this.watchlistNames == null) {
        this.watchlistNames = new EnumMap<Country, String>(Country.class);
    }

    if (this.getNewsID() == null) {
        this.setNewsID("");
    }

    if (this.yellowInformationBoxOption == null) {
        this.yellowInformationBoxOption = YellowInformationBoxOption.Follow;
    }

    if (this.stockInputSuggestionListOption == null) {
        this.stockInputSuggestionListOption = StockInputSuggestionListOption.OneColumn;
    }

    if (this.getCCEmail() == null) {
        this.setCCEmail("");
    }

    if (this.getLocale() == null) {
        this.setLocale(Locale.getDefault());
    }

    if (this.priceSources == null) {
        this.priceSources = new EnumMap<Country, PriceSource>(Country.class);
    } else {
        // Still here for xstream backward compatible. Shall be removed
        // after a while.
        if (this.priceSources.get(Country.Malaysia) == PriceSource.KLSEInfo) {
            this.priceSources.put(Country.Malaysia, PriceSource.Yahoo);
        }
    }

    if (this.currencies == null) {
        this.currencies = new EnumMap<Country, String>(Country.class);
    }

    if (this.currencyExchangeEnable == null) {
        this.currencyExchangeEnable = new EnumMap<Country, Boolean>(Country.class);
    }

    if (this.localCurrencyCountries == null) {
        this.localCurrencyCountries = new EnumMap<Country, Country>(Country.class);
    }

    //if (this.penceToPoundConversionEnabled == null) {
    //    this.penceToPoundConversionEnabled = new EnumMap<Country, Boolean>(Country.class);
    //}

    //if (false == this.penceToPoundConversionEnabled.containsKey(Country.UnitedKingdom)) {
    //    this.penceToPoundConversionEnabled.put(Country.UnitedKingdom, true);
    //}

    if (this.decimalPlaces == null) {
        this.decimalPlaces = new EnumMap<Country, DecimalPlace>(Country.class);
    }

    // Bug caused by change language menu method. We rectify it, after we 
    // fix the change language menu method.
    if (this.locale.getCountry().equals(Locale.FRANCE.getCountry())
            && this.locale.getLanguage().equals(Locale.ENGLISH.getLanguage())) {
        this.locale = Locale.FRANCE;
    }

    if (this.chartTheme == null) {
        this.chartTheme = ChartTheme.Light;
    }

    if (this.scanningSpeed <= 1000) {
        // In previous version, it is possible for scanningSpeed <= 1000.
        // This is some how wasting CPU and network resource. Let's go green.
        this.scanningSpeed = 10000;
    }

    return this;
}

From source file:fr.afcepf.atod.wine.data.parser.XmlParser.java

private static void translateProductTypes(List<ProductType> types, IDaoProductType daoProductType,
        WineService esRepository) {/*from   w ww  .  j  a v a  2 s .com*/

    try {

        for (ProductType productType : types) {
            String typefr = "";
            if (productType.getType().contains("White Wines")) {
                typefr = "Vins Blancs";
            } else if (productType.getType().contains("Red Wines")) {
                typefr = "Vins Rouges";
            } else if (productType.getType().contains("Ros Wine")) {
                typefr = "Ross";
            } else {
                typefr = "Champagne";
            }
            Locale.setDefault(Locale.FRANCE);
            productType.setType(typefr);
            daoProductType.updateObj(productType);
            List<Wine> list = esRepository.findByWineTypeId(productType.getId());
            for (Wine wine : list) {
                wine.getType().setType(typefr);
                esRepository.save(wine);
            }
            Locale.setDefault(Locale.US);
        }

    } catch (WineException paramE) {
        // TODO Auto-generated catch block
        paramE.printStackTrace();
    }
}

From source file:fr.afcepf.atod.wine.data.parser.XmlParser.java

private static void translateProductAppellation(List<ProductWine> products, IDaoProductWine daoProduct,
        WineService esRepository) {//from w  ww .j  a  va  2 s .  co m
    try {
        Locale.setDefault(Locale.FRANCE);
        for (ProductWine product : products) {
            String appelationfr = "";
            String appellation = product.getAppellation();
            if (appellation.contains("Other")) {
                appelationfr = "Autre appelation franaise";
            } else if (appellation.contains("Burgundy")) {
                appelationfr = "Bourgogne";
            } else {
                appelationfr = appellation;
            }
            product.setAppellation(appelationfr);
            daoProduct.updateWithEvictObj(product);
            Wine esWine = esRepository.getById(product.getId());
            esWine.setAppellation(appelationfr);
            esRepository.save(esWine);
        }
        Locale.setDefault(Locale.US);
    } catch (WineException paramE) {
        // TODO Auto-generated catch block
        paramE.printStackTrace();
    }
}

From source file:fr.afcepf.atod.wine.data.parser.XmlParser.java

private static void translateProductFeatures(List<ProductFeature> features,
        IDaoProductFeature daoProductFeature, WineService esRepository) {

    HashMap<String, String> featuresTrad = new HashMap<String, String>();
    try {/*from  w  w  w . j  av a2s  .  c om*/
        Locale.setDefault(Locale.FRANCE);
        featuresTrad.put("Precious Wine", "Vin rare");
        featuresTrad.put("Has Large Label", "Large tiquette");
        featuresTrad.put("Bordeaux Futures", "Bordeaux en primeurs");
        featuresTrad.put("Wine Gift Sets", "Coffrets cadeau de vin");
        featuresTrad.put("Earthy &amp; Spicy", "Vin terreux et pic");
        featuresTrad.put("Fruity &amp; Smooth", "Vin fruit et rond");
        featuresTrad.put("Birthday", "Pour anniversaire");
        featuresTrad.put("Corporate Gifts", "Cadeaux d'entreprise");
        featuresTrad.put("Sweet Wine", "Vin doux");
        featuresTrad.put("Green Wines", "Vins verts");
        featuresTrad.put("90+ Rated Wine", "Vin not 90+");
        featuresTrad.put("94+ Rated Wine", "Vin not 94+");
        featuresTrad.put("Light &amp; Fruity", "Vin lger et fruit");
        featuresTrad.put("Congratulations", "Pour clbrations");
        featuresTrad.put("Rich &amp; Creamy", "Vin riche et crmeux");
        featuresTrad.put("Light &amp; Crisp", "Vin sec lger");
        featuresTrad.put("Smooth &amp; Supple", "Vin rond et moelleux");
        featuresTrad.put("Older Vintages", "Millsimes plus anciens");
        featuresTrad.put("94+ Rated Wine Under $75", "Vin not 94+ sous les 70");
        featuresTrad.put("Screw Cap Wines", "Vin avec bouchon viss");
        featuresTrad.put("90+ Rated Wine Under $20", "Vin not 90+ sous les 20");
        featuresTrad.put("Big &amp; Bold", "Vin ample et audacieux");
        featuresTrad.put("Has Video", "Avec Vido");
        featuresTrad.put("Wedding", "Idal pour un mariage");
        featuresTrad.put("Great Bottles to Give", "Une bouteille parfaite pour offrir");
        featuresTrad.put("Boutique Wines", "Vin apprci en boutique");
        featuresTrad.put("Champagne Gifts", "Champagne parfait pour offrir");
        featuresTrad.put("Collectible Wines", "Vins de collection");
        for (ProductFeature pf : features) {
            String label_fr = featuresTrad.get(pf.getLabel());
            pf.setLabel(label_fr);
            daoProductFeature.updateObj(pf);
            List<Wine> list = esRepository.findByWineFeatureId(pf.getId());
            for (Wine wine : list) {
                for (WineFeature feat : wine.getFeatures()) {
                    if (feat.getId().equals(pf.getId())) {
                        feat.setLabel(label_fr);
                    }
                }
                esRepository.save(wine);
            }
        }
        Locale.setDefault(Locale.US);
    } catch (WineException paramE) {
        paramE.printStackTrace();
    }
}

From source file:fr.afcepf.atod.wine.data.parser.XmlParser.java

private static void translateProductVarietals(List<ProductVarietal> varietals,
        IDaoProductVarietal daoProductVarietal, WineService esRepository) {
    try {/*from  w  ww . j a v a 2s  . co m*/
        Locale.setDefault(Locale.FRANCE);
        for (ProductVarietal productVarietal : varietals) {
            String varietalfr = "";
            String desc = productVarietal.getDescription();
            if (desc.contains("Other")) {
                if (desc.contains("Blends")) {
                    varietalfr = "Autres assemblages de vins rouges";
                } else {
                    if (desc.contains("Red")) {
                        varietalfr = "Autres types de vins rouges";
                    } else {
                        varietalfr = "Autres types de vins blancs";
                    }
                }
            } else if (desc.contains("Rhone")) {
                varietalfr = "Assemblages de vins rouges du Rhne";
            } else if (desc.contains("Vintage")) {
                varietalfr = "Millesim";
            } else {
                varietalfr = desc;
            }
            productVarietal.setDescription(varietalfr);
            daoProductVarietal.updateObj(productVarietal);
            List<Wine> list = esRepository.findByWineVarietalId(productVarietal.getId());
            for (Wine wine : list) {
                wine.getVarietal().setDescription(varietalfr);
                esRepository.save(wine);
            }
        }
        Locale.setDefault(Locale.US);
    } catch (WineException paramE) {
        // TODO Auto-generated catch block
        paramE.printStackTrace();
    }
}