Example usage for java.util Locale GERMANY

List of usage examples for java.util Locale GERMANY

Introduction

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

Prototype

Locale GERMANY

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:eu.ggnet.dwoss.redtape.DocumentSupporterOperation.java

private Map<String, Object> toTemplateParameters(Document document, DocumentViewType viewType) {

    double nettoPrice = 0;
    double bruttoPrice = 0;

    for (Position position : document.getPositions().values()) {
        nettoPrice += position.getPrice() * position.getAmount();
        bruttoPrice += position.getAfterTaxPrice() * position.getAmount();
    }/*from   www  .ja  v  a 2s  .c  o m*/

    // Setting Defaults.
    Map<String, Object> reportParameter = new HashMap<>();
    Dossier dossier = document.getDossier();
    reportParameter.put(REF_ID,
            "K" + dossier.getCustomerId() + (dossier.getIdentifier() == null ? "-" : dossier.getIdentifier()));
    reportParameter.put(CUSTOMER_ID, dossier.getCustomerId());
    reportParameter.put(IDENTIFIER_TYPE, document.getType().getName());
    reportParameter.put(IDENTIFIER_ID,
            document.getIdentifier() == null ? (dossier.getIdentifier() == null ? "-" : dossier.getIdentifier())
                    : document.getIdentifier());
    // The two \n are a workaround for Windows/Remote Client. Otherwise the last line of an address is not shown.
    reportParameter.put(INVOICE_ADDRESS, document.getInvoiceAddress().getDescription() + "\n");
    reportParameter.put(SHIPPING_ADDRESS, document.getShippingAddress().getDescription() + "\n");
    reportParameter.put(SUM_NETTO, nettoPrice);
    reportParameter.put(SUM_BRUTTO, bruttoPrice);
    reportParameter.put(SUM_TAX, bruttoPrice - nettoPrice);
    reportParameter.put(TAX, GlobalConfig.TAX * 100);
    reportParameter.put(ACTUAL, document.getActual());
    reportParameter.put(COMPANY, mandator.getCompany().toSingleLine());
    reportParameter.put(COMPANY_LOGO, mandator.getCompany().getLogo().toURL());
    reportParameter.put(FOOTER, mandator.getDocumentIntermix().getFooter() + "\n");
    reportParameter.put(PERFOMANCE_ON, document.getActual());
    reportParameter.put(PAYMENT_TEXT, "");

    for (FreeDocumentTemplateParameter parameter : FreeDocumentTemplateParameter.values()) {
        reportParameter.put(parameter.name(),
                mandator.getDocumentIntermix().getFreeTexts(parameter, viewType, document.getType()));
    }

    if (documentService.isAmbiguous() || documentService.isUnsatisfied()) {
        //default
        if (document.getType() == DocumentType.ORDER)
            reportParameter.put(PAYMENT_TEXT, dossier.getPaymentMethod().getOrderText());
        if (document.getType() == DocumentType.INVOICE)
            reportParameter.put(PAYMENT_TEXT, dossier.getPaymentMethod().getInvoiceText(0));
    } else {
        reportParameter.put(PAYMENT_TEXT,
                documentService.get().paymentInstructionText(document.getType(), dossier.getPaymentMethod()));
    }

    // Depending dates in PERFORMANCE_ON, like a CreditMemo depends on the date of the invoice.
    List<Document> invoices = dossier.getActiveDocuments(DocumentType.INVOICE);
    if (!invoices.isEmpty()) {
        reportParameter.put(PERFOMANCE_ON, invoices.get(0).getActual());
    }

    if (viewType != null && viewType != DocumentViewType.DEFAULT)
        reportParameter.put(IDENTIFIER_TYPE, viewType.getDocumentTitle());
    // TODO: Should be somethere else, but keep it here for now.
    else if (document.getType() == DocumentType.ORDER)
        reportParameter.put(IDENTIFIER_TYPE, "Auftragsbesttigung/Proformarechnung");

    reportParameter.put(JRParameter.REPORT_LOCALE, Locale.GERMANY);

    return reportParameter;
}

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

@Test
public void testGetCarrierNameForNumber() {

    assertEquals(StringUtils.EMPTY,//from  w ww  .  j  av a  2  s . c o m
            phoneNumberHandlerBase.getCarrierNameForNumber(CN_NUM_1, REGCODE_CN, Locale.SIMPLIFIED_CHINESE));
    assertEquals("China Unicom", //$NON-NLS-1$
            phoneNumberHandlerBase.getCarrierNameForNumber(CN_NUM_1, REGCODE_CN, Locale.UK));
    assertEquals("China Mobile", //$NON-NLS-1$
            phoneNumberHandlerBase.getCarrierNameForNumber(CN_NUM_2, REGCODE_CN, Locale.UK));

    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getCarrierNameForNumber(FR_NUM_3, REGCODE_FR, Locale.UK));
    assertEquals("Bouygues", phoneNumberHandlerBase.getCarrierNameForNumber(FR_NUM_5, REGCODE_FR, Locale.UK)); //$NON-NLS-1$
    assertEquals("Bouygues", //$NON-NLS-1$
            phoneNumberHandlerBase.getCarrierNameForNumber(FR_NUM_5, REGCODE_FR, Locale.FRENCH));

    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getCarrierNameForNumber(US_NUM_1, REGCODE_US, Locale.UK));

    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getCarrierNameForNumber(DE_NUM_1, REGCODE_DE, Locale.UK));
    assertEquals(StringUtils.EMPTY,
            phoneNumberHandlerBase.getCarrierNameForNumber(DE_NUM_1, REGCODE_DE, Locale.GERMANY));

}

From source file:de.mendelson.comm.as2.client.AS2Gui.java

/**
 * Initialized a help set by a given name
 *///from   w  w w. j  ava  2s.com
private void initializeJavaHelp() {
    try {
        //At the moment only english and german help systems are implemented.
        String filename = null;
        //If the found default is none of them, set the english help as
        //default!
        if (!Locale.getDefault().getLanguage().equals(Locale.GERMANY.getLanguage())
                && !Locale.getDefault().getLanguage().equals(Locale.US.getLanguage())) {
            this.getLogger().warning("Sorry, there is no specific HELPSET available for your language, ");
            this.getLogger().warning("the english help will be displayed.");
            filename = "as2help/as2_en.hs";
        } else {
            filename = "as2help/as2_" + Locale.getDefault().getLanguage() + ".hs";
        }

        File helpSetFile = new File(filename);
        URL helpURL = helpSetFile.toURI().toURL();
        this.helpSet = new HelpSet(helpURL);
        this.help = new Help(true, false, true);
        Help.setHelpLocale(Locale.getDefault());
        help.setIconImage(
                new ImageIcon(getClass().getResource("/de/mendelson/comm/as2/client/questionmark16x16.gif"))
                        .getImage());
        help.addBook(helpSet);
        help.setDefaultTopicID("as2_main");
        try {
            URL url = new File("./as2_help_favories.xml").toURI().toURL();
            help.enableFavoritesNavigator(url);
        } catch (MalformedURLException ignore) {
        }
    } catch (Exception e) {
        // could not find it! Disable menu item
        this.getLogger().warning("Helpset not found, helpsystem is disabled!");
        this.jMenuItemHelpSystem.setEnabled(false);
    }

}

From source file:net.sf.sze.model.zeugnis.Zeugnis.java

/**
 * Fllt die Zeugnisdaten in die Map.//  ww  w.j  av  a2  s  .  c  o  m
 * @param printMap die Map die die Daten enthlt.
 */
public void toPrintMap(final Map<String, Object> printMap) {
    // Schuler, ergnzen
    schueler.toPrintMap(printMap);
    // Klasse ergnzen
    printMap.put("klasse", formular.getKlassenname());

    // schulhalbjahr
    getSchulhalbjahr().toPrintMap(printMap);

    // formular
    final SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy", Locale.GERMANY);
    printMap.put("titel", zeugnisArt.getTitel());
    printMap.put("abschlussGrad", zeugnisArt.getAbschlussGrad());

    if (StringUtils.isNotBlank(individuellerLeitspruch)) {
        printMap.put("leitspruch", individuellerLeitspruch);
    } else {
        printMap.put("leitspruch", formular.getLeitspruch());
    }

    if (StringUtils.isNotBlank(quelleIndividuellerLeitspruch)) {
        printMap.put("quelleLeitspruch", quelleIndividuellerLeitspruch);
    } else {
        printMap.put("quelleLeitspruch", formular.getQuelleLeitspruch());
    }

    if (StringUtils.isNotBlank(individuellerLeitspruch2)) {
        printMap.put("leitspruch2", individuellerLeitspruch2);
    } else {
        printMap.put("leitspruch2", formular.getLeitspruch2());
    }

    if (StringUtils.isNotBlank(quelleIndividuellerLeitspruch2)) {
        printMap.put("quelleLeitspruch2", quelleIndividuellerLeitspruch2);
    } else {
        printMap.put("quelleLeitspruch2", formular.getQuelleLeitspruch2());
    }

    final String keyAusgabeDatum = "ausgabeDatum";
    if (individuellesAusgabeDatum != null) {
        printMap.put(keyAusgabeDatum, formatter.format(individuellesAusgabeDatum));
    } else if (formular.getAusgabeDatum() != null) {
        printMap.put(keyAusgabeDatum, formatter.format(formular.getAusgabeDatum()));
    } else if (formular.getSchulhalbjahr().getAusgabeDatum() != null) {
        printMap.put(keyAusgabeDatum, formatter.format(formular.getSchulhalbjahr().getAusgabeDatum()));
    } else {
        printMap.put(keyAusgabeDatum, "??.??.????");
    }

    printMap.put("arbeitsgruppen", createArbeitsgruppenSatz());
    printMap.put("anzahlFehltageGesamt", dayToString(anzahlFehltageGesamt));
    printMap.put("anzahlFehltageUnentschuldigt", dayToString(anzahlFehltageUnentschuldigt));
    printMap.put("anzahlVerspaetungen",
            ((anzahlVerspaetungen == null) || (anzahlVerspaetungen.intValue() == 0))
                    ? VariableUtility.PLATZHALTER_LEER
                    : anzahlVerspaetungen.toString());

    final String versetzungsBemerkung = buildVersetzungsBemerkung();

    printMap.put("bemerkung_versetzung", versetzungsBemerkung);
    printMap.put("buBewertungsText", getBuBewertungsPrintText());

    if (soLBewertungsText != null && StringUtils.isNotEmpty(soLBewertungsText.getText())) {
        printMap.put("soLBewertungsTextFix", soLBewertungsText.getText());
    } else {
        printMap.put("soLBewertungsTextFix", VariableUtility.PLATZHALTER_LEER);
    }

    final List<String> schwachAusreichendFaecher = new ArrayList<String>();
    Collections.sort(bewertungen);
    for (Bewertung bw : bewertungen) {
        bw.toPrintMap(printMap, zeugnisArt.getNoteAlsTextDarstellen().booleanValue());

        if (bw.getLeistungNurSchwachAusreichend().booleanValue()) {
            schwachAusreichendFaecher.add(bw.getSchulfach().getName());
        }
    }

    Collections.sort(avSvBewertungen);
    for (AvSvBewertung avSvBewertung : avSvBewertungen) {
        avSvBewertung.toPrintMap(printMap);
    }

    final String schwachausreichendBemerkung = buildSchwachAusreichendBemerkung(schwachAusreichendFaecher);

    printMap.put("bemerkung_schwachausreichend", schwachausreichendBemerkung);

    final StringBuffer allgemeineBemerkungen = new StringBuffer("");
    Collections.sort(bemerkungen);

    for (AbstractBemerkung aBemerkung : bemerkungen) {
        allgemeineBemerkungen.append(aBemerkung.createPrintText(schueler,
                formular.findNachteilsAusgleichsDatum(), (String) printMap.get("shj_jahr")));
    }

    printMap.put("bemerkung_allgemein", allgemeineBemerkungen.toString());

    StringBuffer schulamtsBemerkungsText = new StringBuffer("");
    Collections.sort(schulamtsBemerkungen);

    for (SchulamtsBemerkung aBemerkung : schulamtsBemerkungen) {
        schulamtsBemerkungsText
                .append(aBemerkung.createPrintText(schueler, null, (String) printMap.get("shj_jahr")));
    }

    printMap.put("bemerkung_schulamt", schulamtsBemerkungsText.length() > 0 ? schulamtsBemerkungsText.toString()
            : VariableUtility.PLATZHALTER_LEER);
}

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,/* w  w w . jav a  2s  .co  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.openestate.io.is24_csv.Is24CsvRecord.java

public String getKontaktLand() {
    String value = this.get(FIELD_KONTAKT_LAND);
    return (value != null) ? value : Locale.GERMANY.getISO3Country();
}

From source file:org.openestate.io.is24_csv.Is24CsvRecord.java

public String getObjektLand() {
    String value = this.get(FIELD_OBJEKT_LAND);
    return (value != null) ? value : Locale.GERMANY.getISO3Country();
}

From source file:org.goobi.production.flow.statistics.hibernate.FilterHelper.java

/**
 * This method builds a criteria depending on a filter string and some other
 * parameters passed on along the initial criteria. The filter is parsed and
 * depending on which data structures are used for applying filtering
 * restrictions conjunctions are formed and collect the restrictions and
 * then will be applied on the corresponding criteria. A criteria is only
 * added if needed for the presence of filters applying to it.
 *
 * @param inFilter//ww w . j  a v a 2s.  co  m
 *            String
 * @param crit
 *            PaginatingCriteria object
 * @param isTemplate
 *            Boolean
 * @param returnParameters
 *            Object containing values which need to be set and returned to
 *            UserDefinedFilter
 * @param userAssignedStepsOnly
 *            Boolean
 * @param stepOpenOnly
 *            boolean
 * @return String used to pass on error messages about errors in the filter
 *         expression
 */
public static String criteriaBuilder(Session session, String inFilter, PaginatingCriteria crit,
        Boolean isTemplate, Parameters returnParameters, Boolean stepOpenOnly, Boolean userAssignedStepsOnly,
        boolean clearSession) {

    if (ConfigCore.getBooleanParameter("DatabaseAutomaticRefreshList", true) && clearSession) {
        session.clear();
    }
    // for ordering the lists there are some
    // criteria, which needs to be added even no
    // restrictions apply, to avoid multiple analysis
    // of the criteria it is only done here once and
    // to set flags which are subsequently used
    Boolean flagSteps = false;
    Boolean flagProcesses = false;
    @SuppressWarnings("unused")
    Boolean flagSetCritProjects = false;
    String filterPrefix = "";
    if (crit.getClassName().equals(Process.class.getName())) {
        flagProcesses = true;
        filterPrefix = "steps.";
    }

    if (crit.getClassName().equals(Task.class.getName())) {
        flagSteps = true;
    }

    // keeping a reference to the passed criteria
    Criteria inCrit = crit;
    @SuppressWarnings("unused")
    Criteria critProject = null;
    Criteria critProcess = null;

    // to collect and return feedback about erroneous use of filter
    // expressions
    String message = "";

    StrTokenizer tokenizer = new StrTokenizer(inFilter, ' ', '\"');

    // conjunctions collecting conditions
    Conjunction conjWorkPiece = null;
    Conjunction conjProjects = null;
    Conjunction conjSteps = null;
    Conjunction conjProcesses = null;
    Conjunction conjTemplates = null;
    Conjunction conjUsers = null;
    Conjunction conjProcessProperties = null;
    Conjunction conjBatches = null;

    // this is needed if we filter processes
    if (flagProcesses) {
        conjProjects = Restrictions.conjunction();
        limitToUserAccessRights(conjProjects);
        // in case nothing is set here it needs to be removed again
        // happens if user has admin rights
        if (conjProjects.toString().equals("()")) {
            conjProjects = null;
            flagSetCritProjects = true;
        }
    }

    // this is needed if we filter steps
    if (flagSteps) {
        conjSteps = Restrictions.conjunction();
        limitToUserAssignedSteps(conjSteps, stepOpenOnly, userAssignedStepsOnly);
        // in case nothing is set here conjunction needs to be set to null
        // again
        if (conjSteps.toString().equals("()")) {
            conjSteps = null;
        }
    }

    // this is needed for the template filter (true) and the undefined
    // processes filter (false) in any other case it needs to be null
    if (isTemplate != null) {
        conjProcesses = Restrictions.conjunction();
        if (!isTemplate) {
            conjProcesses.add(Restrictions.eq("template", Boolean.FALSE));
        } else {
            conjProcesses.add(Restrictions.eq("template", Boolean.TRUE));
        }
    }

    // this is needed for evaluating a filter string
    while (tokenizer.hasNext()) {
        String tok = tokenizer.nextToken().trim();
        String tokLowerCase = tok.toLowerCase(Locale.GERMANY);

        if (tokLowerCase.startsWith(FilterString.PROCESSPROPERTY)
                || tokLowerCase.startsWith(FilterString.PROZESSEIGENSCHAFT)) {
            if (conjProcessProperties == null) {
                conjProcessProperties = Restrictions.conjunction();
            }
            FilterHelper.filterProcessProperty(conjProcessProperties, tok, false);
        }
        // search over steps
        // original filter, is left here for compatibility reason
        // doesn't fit into new keyword scheme
        else if (tokLowerCase.startsWith(FilterString.STEP) || tokLowerCase.startsWith(FilterString.SCHRITT)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + createHistoricFilter(conjSteps, tok, flagSteps);

        } else if (tokLowerCase.startsWith(FilterString.STEPINWORK)
                || tokLowerCase.startsWith(FilterString.SCHRITTINARBEIT)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + (createStepFilters(returnParameters, conjSteps, tok, TaskStatus.INWORK, false,
                    filterPrefix));

            // new keyword stepLocked implemented
        } else if (tokLowerCase.startsWith(FilterString.STEPLOCKED)
                || tokLowerCase.startsWith(FilterString.SCHRITTINARBEIT)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + (createStepFilters(returnParameters, conjSteps, tok, TaskStatus.LOCKED, false,
                    filterPrefix));

            // new keyword stepOpen implemented
        } else if (tokLowerCase.startsWith(FilterString.STEPOPEN)
                || tokLowerCase.startsWith(FilterString.SCHRITTOFFEN)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + (createStepFilters(returnParameters, conjSteps, tok, TaskStatus.OPEN, false,
                    filterPrefix));

            // new keyword stepDone implemented
        } else if (tokLowerCase.startsWith(FilterString.STEPDONE)
                || tokLowerCase.startsWith(FilterString.SCHRITTABGESCHLOSSEN)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + (createStepFilters(returnParameters, conjSteps, tok, TaskStatus.DONE, false,
                    filterPrefix));

            // new keyword stepDoneTitle implemented, replacing so far
            // undocumented
        } else if (tokLowerCase.startsWith(FilterString.STEPDONETITLE)
                || tokLowerCase.startsWith(FilterString.ABGESCHLOSSENERSCHRITTTITEL)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            String stepTitel = tok.substring(tok.indexOf(":") + 1);
            FilterHelper.filterStepName(conjSteps, stepTitel, TaskStatus.DONE, false, filterPrefix);

        } else if ((tokLowerCase.startsWith(FilterString.STEPDONEUSER)
                || tokLowerCase.startsWith(FilterString.ABGESCHLOSSENERSCHRITTBENUTZER))
                && ConfigCore.getBooleanParameter("withUserStepDoneSearch")) {
            if (conjUsers == null) {
                conjUsers = Restrictions.conjunction();
            }
            FilterHelper.filterStepDoneUser(conjUsers, tok);
        } else if (tokLowerCase.startsWith(FilterString.STEPAUTOMATIC)
                || tokLowerCase.startsWith(FilterString.SCHRITTAUTOMATISCH)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            FilterHelper.filterAutomaticSteps(conjSteps, tok, flagSteps);
        } else if (tokLowerCase.startsWith(FilterString.PROJECT)
                || tokLowerCase.startsWith(FilterString.PROJEKT)) {
            if (conjProjects == null) {
                conjProjects = Restrictions.conjunction();
            }
            FilterHelper.filterProject(conjProjects, tok, false);

        } else if (tokLowerCase.startsWith(FilterString.TEMPLATE)
                || tokLowerCase.startsWith(FilterString.VORLAGE)) {
            if (conjTemplates == null) {
                conjTemplates = Restrictions.conjunction();
            }
            FilterHelper.filterScanTemplate(conjTemplates, tok, false);

        } else if (tokLowerCase.startsWith(FilterString.ID)) {
            if (conjProcesses == null) {
                conjProcesses = Restrictions.conjunction();
            }
            FilterHelper.filterIds(conjProcesses, tok);

        } else if (tokLowerCase.startsWith(FilterString.PROCESS)
                || tokLowerCase.startsWith(FilterString.PROZESS)) {
            if (conjProcesses == null) {
                conjProcesses = Restrictions.conjunction();
            }
            conjProcesses
                    .add(Restrictions.like("title", "%" + "proc:" + tok.substring(tok.indexOf(":") + 1) + "%"));
        } else if (tokLowerCase.startsWith(FilterString.BATCH)
                || tokLowerCase.startsWith(FilterString.GRUPPE)) {
            if (conjBatches == null) {
                conjBatches = Restrictions.conjunction();
            }
            int value = Integer.parseInt(tok.substring(tok.indexOf(":") + 1));
            conjBatches.add(Restrictions.eq("bat.id", value));
        } else if (tokLowerCase.startsWith(FilterString.WORKPIECE)
                || tokLowerCase.startsWith(FilterString.WERKSTUECK)) {
            if (conjWorkPiece == null) {
                conjWorkPiece = Restrictions.conjunction();
            }
            FilterHelper.filterWorkpiece(conjWorkPiece, tok, false);

        } else if (tokLowerCase.startsWith("-" + FilterString.PROCESSPROPERTY)
                || tokLowerCase.startsWith("-" + FilterString.PROZESSEIGENSCHAFT)) {
            if (conjProcessProperties == null) {
                conjProcessProperties = Restrictions.conjunction();
            }
            FilterHelper.filterProcessProperty(conjProcessProperties, tok, true);
        }

        else if (tokLowerCase.startsWith("-" + FilterString.STEPINWORK)
                || tokLowerCase.startsWith("-" + FilterString.SCHRITTINARBEIT)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + (createStepFilters(returnParameters, conjSteps, tok, TaskStatus.INWORK, true,
                    filterPrefix));

            // new keyword stepLocked implemented
        } else if (tokLowerCase.startsWith("-" + FilterString.STEPLOCKED)
                || tokLowerCase.startsWith("-" + FilterString.SCHRITTGESPERRT)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + (createStepFilters(returnParameters, conjSteps, tok, TaskStatus.LOCKED, true,
                    filterPrefix));

            // new keyword stepOpen implemented
        } else if (tokLowerCase.startsWith("-" + FilterString.STEPOPEN)
                || tokLowerCase.startsWith("-" + FilterString.SCHRITTOFFEN)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + (createStepFilters(returnParameters, conjSteps, tok, TaskStatus.OPEN, true,
                    filterPrefix));

            // new keyword stepDone implemented
        } else if (tokLowerCase.startsWith("-" + FilterString.STEPDONE)
                || tokLowerCase.startsWith("-" + FilterString.SCHRITTABGESCHLOSSEN)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            message = message + (createStepFilters(returnParameters, conjSteps, tok, TaskStatus.DONE, true,
                    filterPrefix));

            // new keyword stepDoneTitle implemented, replacing so far
            // undocumented
        } else if (tokLowerCase.startsWith("-" + FilterString.STEPDONETITLE)
                || tokLowerCase.startsWith("-" + FilterString.ABGESCHLOSSENERSCHRITTTITEL)) {
            if (conjSteps == null) {
                conjSteps = Restrictions.conjunction();
            }
            String stepTitel = tok.substring(tok.indexOf(":") + 1);
            FilterHelper.filterStepName(conjSteps, stepTitel, TaskStatus.DONE, true, filterPrefix);

        } else if (tokLowerCase.startsWith("-" + FilterString.PROJECT)
                || tokLowerCase.startsWith("-" + FilterString.PROJEKT)) {
            if (conjProjects == null) {
                conjProjects = Restrictions.conjunction();
            }
            FilterHelper.filterProject(conjProjects, tok, true);

        } else if (tokLowerCase.startsWith("-" + FilterString.TEMPLATE)
                || tokLowerCase.startsWith("-" + FilterString.VORLAGE)) {
            if (conjTemplates == null) {
                conjTemplates = Restrictions.conjunction();
            }
            FilterHelper.filterScanTemplate(conjTemplates, tok, true);

        } else if (tokLowerCase.startsWith("-" + FilterString.WORKPIECE)
                || tokLowerCase.startsWith("-" + FilterString.WERKSTUECK)) {
            if (conjWorkPiece == null) {
                conjWorkPiece = Restrictions.conjunction();
            }
            FilterHelper.filterWorkpiece(conjWorkPiece, tok, true);

        } else if (tokLowerCase.startsWith("-")) {

            if (conjProcesses == null) {
                conjProcesses = Restrictions.conjunction();
            }

            conjProcesses.add(Restrictions.not(Restrictions.like("title", "%" + tok.substring(1) + "%")));

        } else {

            /* standard-search parameter */
            if (conjProcesses == null) {
                conjProcesses = Restrictions.conjunction();
            }

            conjProcesses.add(IlikeExpression.ilike("title", "*" + tok + "*", '!'));
        }
    }

    if (conjProcesses != null || flagSteps) {
        if (!flagProcesses) {

            critProcess = crit.createCriteria("process", "proc");

            if (conjProcesses != null) {
                critProcess.add(conjProcesses);
            }
        } else {
            if (conjProcesses != null) {
                inCrit.add(conjProcesses);
            }
        }
    }

    if (flagSteps) {

        critProject = critProcess.createCriteria("project", "proj");

        if (conjProjects != null) {
            inCrit.add(conjProjects);
        }
    } else {
        inCrit.createCriteria("project", "proj");
        if (conjProjects != null) {
            inCrit.add(conjProjects);
        }
    }

    if (conjSteps != null) {
        if (!flagSteps) {
            crit.createCriteria("tasks", "steps");
            crit.add(conjSteps);
        } else {
            inCrit.add(conjSteps);
        }
    }

    if (conjTemplates != null) {
        if (flagSteps) {
            critProcess.createCriteria("templates", "vorl");
            critProcess.createAlias("vorl.eigenschaften", "vorleig");
            critProcess.add(conjTemplates);
        } else {
            crit.createCriteria("templates", "vorl");
            crit.createAlias("vorl.eigenschaften", "vorleig");
            inCrit.add(conjTemplates);
        }
    }

    if (conjProcessProperties != null) {
        if (flagSteps) {
            critProcess.createAlias("proc.eigenschaften", "prozesseig");
            critProcess.add(conjProcessProperties);
        } else {

            inCrit.createAlias("properties", "prozesseig");
            inCrit.add(conjProcessProperties);
        }
    }

    if (conjWorkPiece != null) {
        if (flagSteps) {
            critProcess.createCriteria("workpiece", "werk");
            critProcess.createAlias("werk.eigenschaften", "werkeig");
            critProcess.add(conjWorkPiece);
        } else {
            inCrit.createCriteria("workpiece", "werk");
            inCrit.createAlias("werk.eigenschaften", "werkeig");
            inCrit.add(conjWorkPiece);
        }
    }
    if (conjUsers != null) {
        if (flagSteps) {
            critProcess.createCriteria("processingUser", "processingUser");
            critProcess.add(conjUsers);
        } else {
            inCrit.createAlias("steps.processingUser", "processingUser");
            inCrit.add(conjUsers);
        }
    }
    if (conjBatches != null) {
        if (flagSteps) {
            critProcess.createCriteria("batches", "bat");
            critProcess.add(conjBatches);
        } else {
            crit.createCriteria("batches", "bat");
            inCrit.add(conjBatches);
        }
    }
    return message;
}

From source file:views.MetadataUploadView.java

protected void checkForNumberConsistency(String headline, DataTypeCode dType) {
    boolean consistent = true;
    boolean needsDelimiterChange = false;
    String moreInfo = "Not a number.";
    String barcode = "";
    for (Object item : getActiveTable().getItemIds()) {
        int id = (int) item;
        if (id != -1) {
            String val = parseLabelCell(id, headline);
            if (!val.isEmpty()) {
                if (dType.equals(DataTypeCode.INTEGER)) {
                    try {
                        Integer.parseInt(val);
                    } catch (NumberFormatException e) {
                        consistent = false;
                    }/* w w  w .j a  v  a  2s .  c  o  m*/
                }
                if (dType.equals(DataTypeCode.REAL)) {
                    // try normal parse
                    try {
                        Double.parseDouble(val);
                    } catch (NumberFormatException e) {
                        // normal parse unsuccessful, check for different delimiter
                        NumberFormat format = NumberFormat.getInstance(Locale.GERMANY);
                        try {
                            format.parse(val);
                            // worked, needs different delimiter
                            needsDelimiterChange = true;
                        } catch (ParseException e1) {
                            // didn't work, not a double value
                            barcode = getBarcodeInRow(id);
                            consistent = false;
                        }
                    }
                }
            }
        }
    }
    if (consistent) {
        if (needsDelimiterChange)
            createDelimiterChangeDialogue(headline);
    } else {
        createNotRightTypeDialogue(headline, moreInfo, barcode);
    }
}

From source file:sos.settings.SOSSettingsDialog.java

/**
 * @param locale/*from  w  ww  .  java  2s. c om*/
 *            The locale to set.
 */
public void setLanguage(String language) throws Exception {

    if (language != null && language.length() != 0) {
        if (language.equalsIgnoreCase("en")) {
            this.locale = Locale.UK;
        } else if (language.equalsIgnoreCase("de")) {
            this.locale = Locale.GERMANY;
        }
    }

    if (this.locale == null) {
        this.locale = Locale.UK;
    }

    if (this.rb == null) {
        this.rb = new SOSResourceBundle();
    }

    this.rb.setBundle(this.bundleName, this.locale);
    SOSDate.locale = this.locale;
    this.sosLang = this.locale.getLanguage().toLowerCase();

}