Example usage for java.util TimeZone getAvailableIDs

List of usage examples for java.util TimeZone getAvailableIDs

Introduction

In this page you can find the example usage for java.util TimeZone getAvailableIDs.

Prototype

public static synchronized String[] getAvailableIDs() 

Source Link

Document

Gets all the available IDs supported.

Usage

From source file:org.apache.openmeetings.web.pages.install.TestInstall.java

@Test
public void testInstall() {
    InstallWizardPage page = tester.startPage(InstallWizardPage.class);
    tester.assertRenderedPage(InstallWizardPage.class);
    InstallWizard wiz = (InstallWizard) page.get(WIZARD_PATH);
    assertNull("Model should be null", wiz.getWizardModel().getActiveStep());
    tester.executeBehavior((AbstractAjaxBehavior) page.getBehaviorById(0)); //welcome step
    assertNotNull("Model should NOT be null", wiz.getWizardModel().getActiveStep());

    ButtonAjaxBehavior prev = getButtonBehavior(tester, WIZARD_PATH, "PREV");
    //check enabled, add check for other buttons on other steps
    assertFalse("Prev button should be disabled", prev.getButton().isEnabled());
    ButtonAjaxBehavior next = getButtonBehavior(tester, WIZARD_PATH, "NEXT");
    ButtonAjaxBehavior finish = getButtonBehavior(tester, WIZARD_PATH, SUBMIT);
    tester.executeBehavior(next); //DB step
    FormTester wizardTester = tester.newFormTester("wizard:form");
    wizardTester.select("view:form:dbType", 1);
    checkErrors(tester, 0);//w w  w.j a  v a  2s. c o m
    tester.executeBehavior(next); //user step
    checkErrors(tester, 0);
    wizardTester.setValue("view:username", adminUsername);
    wizardTester.setValue("view:password", userpass);
    wizardTester.setValue("view:email", email);
    String[] tzIds = TimeZone.getAvailableIDs();
    wizardTester.select("view:timeZone", rnd.nextInt(tzIds.length));
    wizardTester.setValue("view:group", group);
    tester.executeBehavior(next); //cfg+smtp step
    checkErrors(tester, 0);
    wizardTester.setValue("view:smtpPort", "25");
    wizardTester.select("view:defaultLangId", 0);
    tester.executeBehavior(next); //converters step
    checkErrors(tester, 0);
    wizardTester.setValue("view:docDpi", "150");
    wizardTester.setValue("view:docQuality", "90");
    tester.executeBehavior(next); //crypt step
    // not checking errors
    if (countErrors(tester) > 0) {
        tester.cleanupFeedbackMessages();
        wizardTester.setValue("view:docDpi", "150");
        wizardTester.setValue("view:docQuality", "90");
        tester.executeBehavior(next); //skip errors
    }
    wizardTester.setValue("view:cryptClassName", SCryptImplementation.class.getName());
    tester.executeBehavior(next); //install step
    checkErrors(tester, 0);
    tester.executeBehavior(finish);
    checkErrors(tester, 0);
}

From source file:org.jini.commands.utils.TimeInZone.java

private void listZones() {

    TablePrinter zoneTableHead = new TablePrinter("", "Time Zone");

    String[] timeZones = TimeZone.getAvailableIDs();

    for (int x = 0; x < timeZones.length; x++) {
        zoneTableHead.addRow(x + "", timeZones[x]);
    }//  w  ww.  j av  a 2  s  .c o m
    zoneTableHead.print();

    this.done = true;
}

From source file:org.springframework.xd.shell.command.ConfigCommands.java

/**
 * Retrieve a list of available {@link TimeZone} Ids via a Spring XD Shell command.
 *//*  w ww.  j a  v  a  2 s. co m*/
@CliCommand(value = "admin config timezone list", help = "List all timezones")
public String listTimeZones() {
    final StringBuilder timeZones = new StringBuilder();

    for (String timeZone : TimeZone.getAvailableIDs()) {
        timeZones.append(timeZone + "\n");
    }

    return timeZones.toString();
}

From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderRequestRenderer.java

private void orderRequestDownload(final MarketplaceStoreModel model) {
    if (null == model.getRequestStartTime()) {
        NotificationUtils//from ww w .  j  av  a2 s . c  o  m
                .notifyUserVia(
                        Localization.getLocalizedString(
                                "type.Marketplacestore." + MarketplaceStoreModel.REQUESTSTARTTIME + ".name")
                                + " " + Labels.getLabel("backoffice.field.notfilled"),
                        NotificationEvent.Type.WARNING, "");
        LOG.warn("Order request start time is not filled!");
        return;
    } else if (null == model.getRequestEndTime()) {
        NotificationUtils.notifyUserVia(Localization
                .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.REQUESTENDTIME + ".name")
                + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, "");
        LOG.warn("Order request end time is not filled!");
        return;
    } else if (model.getRequestStartTime().after(model.getRequestEndTime())) {
        NotificationUtils.notifyUserVia(Labels.getLabel("backoffice.field.timerange.error"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("start time is greater than end time!");
        return;
    }

    if (!StringUtils.isBlank(model.getIntegrationId()) && !model.getAuthorized().booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("authorization is expired!");
        return;
    }
    //in order to avoid this value out of date, we only get it from database
    final Boolean isAuth = ((MarketplaceStoreModel) modelService.get(model.getPk())).getAuthorized();
    final String integrationId = ((MarketplaceStoreModel) modelService.get(model.getPk())).getIntegrationId();
    model.setIntegrationId(integrationId);
    model.setAuthorized(isAuth);
    if (null == isAuth || !isAuth.booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.unauthed"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("marketplace store do not authorized, download refund/return order failed!");
        return;
    }

    String urlStr = "";
    final String logUUID = logUtil.getUUID();
    final MarketplaceSellerModel seller = model.getMarketplaceSeller();
    final MarketplaceModel marketPlace = seller.getMarketplace();

    try {
        // Configure and open a connection to the site you will send the
        urlStr = marketPlace.getAdapterUrl() + Config.getParameter(MARKETPLACE_REFUND_SYCHRONIZE_PATH)
                + Config.getParameter(MARKETPLACE_REFUND_REQUEST_PATH) + integrationId
                + Config.getParameter(MARKETPLACE_REFUND_REQUEST_LOGUUID) + logUUID;
        final JSONObject jsonObj = new JSONObject();
        jsonObj.put("batchSize", BATCH_SIZE);

        //set the correct timezone
        final String configTimezone = model.getMarketplace().getTimezone();
        boolean isValidTimezone = false;
        for (final String vaildTimezone : TimeZone.getAvailableIDs()) {
            if (vaildTimezone.equals(configTimezone)) {
                isValidTimezone = true;
                break;
            }
        }

        if (!isValidTimezone) {
            final String[] para = { configTimezone == null ? "" : configTimezone,
                    model.getMarketplace().getName() };
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.wrongtimezone", para),
                    NotificationEvent.Type.WARNING, "");
            LOG.warn("wrong timezone or missing timezone configed in market:"
                    + model.getMarketplace().getName());
            return;
        }

        final SimpleDateFormat format = new SimpleDateFormat(Config.getParameter(BACKOFFICE_FORMAT_DATEFORMAT));
        format.setTimeZone(TimeZone.getTimeZone(configTimezone));

        final String startTimeWithCorrectZone = format.format(model.getRequestStartTime()).toString();
        final String endTimeWithCorrectZone = format.format(model.getRequestEndTime()).toString();

        logUtil.addMarketplaceLog("PENDING", integrationId,
                Labels.getLabel("marketplace.order.requestorder.action"), model.getItemtype(), marketPlace,
                model, logUUID);

        jsonObj.put("startCreated", startTimeWithCorrectZone);
        jsonObj.put("endCreated", endTimeWithCorrectZone);
        jsonObj.put("productCatalogVersion",
                model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion());
        jsonObj.put("currency", model.getCurrency().getIsocode());
        marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString());
    } catch (final HttpClientErrorException httpError) {
        if (httpError.getStatusCode().is4xxClientError()) {
            LOG.error("=========================================================================");
            LOG.error("Order Request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Tmall service URL is not correct!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        if (httpError.getStatusCode().is5xxServerError()) {
            LOG.error("=========================================================================");
            LOG.error("Order Request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Json Ojbect is not correct!");
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        LOG.error(httpError.toString());
        return;
    } catch (final ResourceAccessException raError) {
        LOG.error("=========================================================================");
        LOG.error("Order Request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Order Request server access failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + raError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final HttpServerErrorException serverError) {
        LOG.error("=========================================================================");
        LOG.error("Order Request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Order Request server process failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + serverError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final Exception e) {
        LOG.error("=========================================================================");
        LOG.error("Order Request failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Order Request server process failed!");
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Detail error info: " + e.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.fail"),
                NotificationEvent.Type.FAILURE, "");
        return;
    }
    NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.refund.requestorder.success"),
            NotificationEvent.Type.SUCCESS, "");
}

From source file:org.kalypso.ui.wizard.sensor.ImportObservationSelectionWizardPage.java

public void createControlSource(final Composite parent) {
    final Group group = new Group(parent, SWT.NONE);
    group.setLayout(new GridLayout(3, false));
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    group.setText(Messages.getString("org.kalypso.ui.wizard.sensor.ImportObservationSelectionWizardPage2")); //$NON-NLS-1$

    // line 1//from  w  w  w  .  j a  v  a  2  s  . c  o  m
    final Label label = new Label(group, SWT.NONE);
    label.setText(Messages.getString("org.kalypso.ui.wizard.sensor.ImportObservationSelectionWizardPage3")); //$NON-NLS-1$

    final Text textFileSource = new Text(group, SWT.BORDER);
    textFileSource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    textFileSource.setText(StringUtils.EMPTY);
    textFileSource.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            handleSourcePathModified(textFileSource.getText());
        }
    });

    final Button button = new Button(group, SWT.PUSH);
    button.setText(Messages.getString("org.kalypso.ui.wizard.sensor.ImportObservationSelectionWizardPage4")); //$NON-NLS-1$
    button.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));

    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            chooseSourceFile(textFileSource);
        }
    });

    // line 2
    final Label formatLabel = new Label(group, SWT.NONE);
    formatLabel
            .setText(Messages.getString("org.kalypso.ui.wizard.sensor.ImportObservationSelectionWizardPage5")); //$NON-NLS-1$

    m_formatCombo = new ComboViewer(group, SWT.DROP_DOWN | SWT.READ_ONLY);
    m_formatCombo.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    m_formatCombo.setContentProvider(new ArrayContentProvider());
    m_formatCombo.setLabelProvider(new LabelProvider());
    m_formatCombo.setInput(m_adapter);

    m_formatCombo.addSelectionChangedListener(this);

    if (m_adapter.length > 0)
        m_formatCombo.setSelection(new StructuredSelection(m_adapter[0]));

    new Label(group, SWT.NONE);

    // TimeZone
    /* time zone selection */
    final Label timezoneLabel = new Label(group, SWT.NONE);
    timezoneLabel.setText(Messages.getString("ImportObservationSelectionWizardPage.0")); //$NON-NLS-1$

    final String[] tz = TimeZone.getAvailableIDs();
    Arrays.sort(tz);

    final ComboViewer comboTimeZones = new ComboViewer(group, SWT.BORDER | SWT.SINGLE);
    comboTimeZones.getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

    comboTimeZones.setContentProvider(new ArrayContentProvider());
    comboTimeZones.setLabelProvider(new LabelProvider());
    comboTimeZones.setInput(tz);

    comboTimeZones.addFilter(new TimezoneEtcFilter());

    comboTimeZones.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            final IStructuredSelection selection = (IStructuredSelection) comboTimeZones.getSelection();
            updateTimeZone((String) selection.getFirstElement());
        }
    });

    comboTimeZones.getCombo().addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            updateTimeZone(comboTimeZones.getCombo().getText());
        }
    });

    if (m_timezone != null) {
        final String id = m_timezone.getID();
        if (ArrayUtils.contains(tz, id))
            comboTimeZones.setSelection(new StructuredSelection(id));
        else
            comboTimeZones.getCombo().setText(id);
    }
}

From source file:org.b3log.solo.processor.console.AdminConsole.java

/**
 * Shows administrator preference function with the specified context.
 * //from   w  w w  .  j ava2 s .  c o  m
 * @param request the specified request
 * @param context the specified context
 */
@RequestProcessing(value = "/admin-preference.do", method = HTTPRequestMethod.GET)
public void showAdminPreferenceFunction(final HttpServletRequest request, final HTTPRequestContext context) {
    final AbstractFreeMarkerRenderer renderer = new ConsoleRenderer();
    context.setRenderer(renderer);

    final String templateName = "admin-preference.ftl";
    renderer.setTemplateName(templateName);

    final Locale locale = Latkes.getLocale();
    final Map<String, String> langs = langPropsService.getAll(locale);
    final Map<String, Object> dataModel = renderer.getDataModel();
    dataModel.putAll(langs);

    dataModel.put(Preference.LOCALE_STRING, locale.toString());

    JSONObject preference = null;

    try {
        preference = preferenceQueryService.getPreference();
    } catch (final ServiceException e) {
        LOGGER.log(Level.SEVERE, "Loads preference failed", e);
    }

    final StringBuilder timeZoneIdOptions = new StringBuilder();
    final String[] availableIDs = TimeZone.getAvailableIDs();
    for (int i = 0; i < availableIDs.length; i++) {
        final String id = availableIDs[i];
        String option;
        if (id.equals(preference.optString(Preference.TIME_ZONE_ID))) {
            option = "<option value=\"" + id + "\" selected=\"true\">" + id + "</option>";
        } else {
            option = "<option value=\"" + id + "\">" + id + "</option>";
        }

        timeZoneIdOptions.append(option);
    }

    dataModel.put("timeZoneIdOptions", timeZoneIdOptions.toString());

    fireFreeMarkerActionEvent(templateName, dataModel);
}

From source file:de.hybris.platform.marketplaceintegrationbackoffice.renderer.MarketplaceIntegrationOrderInitialRenderer.java

private void initialOrderDownload(final MarketplaceStoreModel model) {
    if (null == model.getOrderStartTime()) {
        NotificationUtils.notifyUserVia(Localization
                .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.ORDERSTARTTIME + ".name")
                + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, "");
        LOG.warn("get order start time is not filled!");
        return;//from   w  w  w  .  j a v a 2  s. c  om
    } else if (null == model.getOrderEndTime()) {
        NotificationUtils.notifyUserVia(Localization
                .getLocalizedString("type.Marketplacestore." + MarketplaceStoreModel.ORDERENDTIME + ".name")
                + " " + Labels.getLabel("backoffice.field.notfilled"), NotificationEvent.Type.WARNING, "");
        LOG.warn("get order end time is not filled!");
        return;
    } else if (model.getOrderStartTime().after(model.getOrderEndTime())) {
        NotificationUtils.notifyUserVia(Labels.getLabel("backoffice.field.timerange.error"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("start time is greate than end time!");
        return;
    } else if (model.getMarketplace().getTmallOrderStatus().isEmpty()
            || null == model.getMarketplace().getTmallOrderStatus()) {
        NotificationUtils.notifyUserVia(
                Localization
                        .getLocalizedString("type.Marketplace." + MarketplaceModel.TMALLORDERSTATUS + ".name")
                        + " " + Labels.getLabel("backoffice.field.notfilled"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("order status field is not filled!");
        return;
    }
    if (!StringUtils.isBlank(model.getIntegrationId()) && !model.getAuthorized().booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("authorization is expired!");
        return;
    }
    // in order to avoid this value out of date, we only get it from
    // database
    final Boolean isAuth = ((MarketplaceStoreModel) modelService.get(model.getPk())).getAuthorized();
    final String integrationId = ((MarketplaceStoreModel) modelService.get(model.getPk())).getIntegrationId();
    model.setIntegrationId(integrationId);
    model.setAuthorized(isAuth);
    if (null == isAuth || !isAuth.booleanValue()) {
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.unauthed"),
                NotificationEvent.Type.WARNING, "");
        LOG.warn("marketplace store do not authorized, initial download failed!");
        return;
    }

    String urlStr = "";
    final String logUUID = logUtil.getUUID();
    final MarketplaceSellerModel seller = model.getMarketplaceSeller();
    final MarketplaceModel marketPlace = seller.getMarketplace();
    try {

        // Configure and open a connection to the site you will send the
        urlStr = marketPlace.getAdapterUrl() + Config.getParameter(MARKETPLACE_ORDER_SYCHRONIZE_PATH)
                + Config.getParameter(MARKETPLACE_ORDER_INITIAL_PATH) + integrationId
                + Config.getParameter(MARKETPLACE_ORDER_INITIAL_LOGUUID) + logUUID;
        final JSONObject jsonObj = new JSONObject();
        jsonObj.put("batchSize", BATCH_SIZE);
        jsonObj.put("status", getOrderStatus(model.getMarketplace().getTmallOrderStatus()));
        //jsonObj.put("marketplaceLogId", marketplacelogUUID);
        // set the correct timezone
        final String configTimezone = model.getMarketplace().getTimezone();
        boolean isValidTimezone = false;
        for (final String vaildTimezone : TimeZone.getAvailableIDs()) {
            if (vaildTimezone.equals(configTimezone)) {
                isValidTimezone = true;
                break;
            }
        }

        if (!isValidTimezone) {
            final String[] para = { configTimezone == null ? "" : configTimezone,
                    model.getMarketplace().getName() };
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.wrongtimezone", para),
                    NotificationEvent.Type.WARNING, "");
            LOG.warn("wrong timezone or missing timezone configed in market:"
                    + model.getMarketplace().getName());
            return;
        }

        final SimpleDateFormat format = new SimpleDateFormat(Config.getParameter(BACKOFFICE_FORMAT_DATEFORMAT));
        format.setTimeZone(TimeZone.getTimeZone(configTimezone));

        final String startTimeWithCorrectZone = format.format(model.getOrderStartTime()).toString();
        final String endTimeWithCorrectZone = format.format(model.getOrderEndTime()).toString();

        jsonObj.put("startCreated", startTimeWithCorrectZone);
        jsonObj.put("endCreated", endTimeWithCorrectZone);
        jsonObj.put("productCatalogVersion",
                model.getCatalogVersion().getCatalog().getId() + ":" + model.getCatalogVersion().getVersion());
        jsonObj.put("currency", model.getCurrency().getIsocode());

        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.initorder.success"),
                NotificationEvent.Type.SUCCESS, "");

        final JSONObject results = marketplaceHttpUtil.post(urlStr, jsonObj.toJSONString());

        final String msg = results.toJSONString();
        final String responseCode = results.get("code").toString();

        if ("401".equals(responseCode)) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + responseCode);
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Authentication was failed, please re-authenticate again!");
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.order.authorization.fail"),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("Authentication was failed, please re-authenticate again!");
            return;
        } else if (!("0".equals(responseCode))) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + responseCode);
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("A known issue occurs in tmall, error details :" + msg);
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(
                    Labels.getLabel("marketplace.tmallapp.known.issues", new Object[] { msg }),
                    NotificationEvent.Type.FAILURE, "");
            LOG.warn("A known issue occurs in tmall, error details :" + msg);
            return;
        }

    } catch (final HttpClientErrorException httpError) {
        if (httpError.getStatusCode().is4xxClientError()) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Tmall service URL is not correct!");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.request.post.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        if (httpError.getStatusCode().is5xxServerError()) {
            LOG.error("=========================================================================");
            LOG.error("Order initial download request post to Tmall failed!");
            LOG.error("Marketplacestore Code: " + model.getName());
            LOG.error("Error Status Code: " + httpError.getStatusCode().toString());
            LOG.error("Request path: " + urlStr);
            LOG.error("-------------------------------------------------------------------------");
            LOG.error("Failed Reason:");
            LOG.error("Requested Json Ojbect is not correct!");
            LOG.error("Detail error info: " + httpError.getMessage());
            LOG.error("=========================================================================");
            NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                    NotificationEvent.Type.FAILURE, "");
        }
        LOG.error(httpError.toString());
        return;
    } catch (final ResourceAccessException raError) {
        LOG.error("=========================================================================");
        LOG.error("Order initial download request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order download request server access failed!");
        LOG.error("Detail error info: " + raError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.access.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final HttpServerErrorException serverError) {
        LOG.error("=========================================================================");
        LOG.error("Order initial download request post to Tmall failed!");
        LOG.error("Marketplacestore Code: " + model.getName());
        LOG.error("Request path: " + urlStr);
        LOG.error("-------------------------------------------------------------------------");
        LOG.error("Failed Reason:");
        LOG.error("Marketplace order download request server process failed!");
        LOG.error("Detail error info: " + serverError.getMessage());
        LOG.error("=========================================================================");
        NotificationUtils.notifyUserVia(Labels.getLabel("marketplace.error.server.process.error"),
                NotificationEvent.Type.FAILURE, "");
        return;
    } catch (final Exception e) {
        final String errorMsg = e.getClass().toString() + ":" + e.getMessage();
        NotificationUtils.notifyUserVia(
                Labels.getLabel("marketplace.runtime.issues", new Object[] { errorMsg }),
                NotificationEvent.Type.FAILURE, "");
        LOG.warn(e.getMessage() + e.getStackTrace());
        return;
    }
    LOG.info("=========================================================================");
    LOG.info("Order initial download request post to Tmall suceessfully!");
    LOG.info("-------------------------------------------------------------------------");
    LOG.info("Marketplacestore Code: " + model.getName());
    LOG.info("Request path: " + urlStr);
    LOG.info("=========================================================================");

    //      logUtil.addMarketplaceLog("PENDING", model.getIntegrationId(), Labels.getLabel("marketplace.order.initial.action"),
    //            Labels.getLabel("marketplace.order.initial.object.type"), marketPlace, model, logUUID);
}

From source file:com.haulmont.cuba.web.app.ui.core.settings.SettingsWindow.java

protected void initTimeZoneFields() {
    Map<String, Object> options = new TreeMap<>();
    for (String id : TimeZone.getAvailableIDs()) {
        TimeZone timeZone = TimeZone.getTimeZone(id);
        options.put(timeZones.getDisplayNameLong(timeZone), id);
    }//  w  w  w. j  a v a2s. com
    timeZoneLookup.setOptionsMap(options);

    timeZoneAutoField.setCaption(messages.getMainMessage("timeZone.auto"));
    timeZoneAutoField.setDescription(messages.getMainMessage("timeZone.auto.descr"));
    timeZoneAutoField
            .addValueChangeListener(e -> timeZoneLookup.setEnabled(!Boolean.TRUE.equals(e.getValue())));

    UserTimeZone userTimeZone = userManagementService.loadOwnTimeZone();
    timeZoneLookup.setValue(userTimeZone.name);
    timeZoneAutoField.setValue(userTimeZone.auto);
}

From source file:org.webguitoolkit.ui.controls.util.TextService.java

/**
 * fill given Select with available timezones if used this way persisting compound data needs to mark the timezone-containing
 * object as changed in persist()//from  w  w  w . j  ava 2  s  . co  m
 */
public void loadTimeZones(Select tzSelect) {
    String[] timezoneArray = TimeZone.getAvailableIDs();
    Arrays.sort(timezoneArray);
    List tzList = new ArrayList();

    for (int i = 0; i <= timezoneArray.length - 1; i++) {
        String[] toAdd = { timezoneArray[i], timezoneArray[i] };
        tzList.add(toAdd);
    }
    tzSelect.getDefaultModel().setOptions(tzList);
    tzSelect.loadList();
}

From source file:cc.kune.core.server.manager.impl.SiteManagerDefault.java

/**
 * Load init data.//w w w  . j  a v  a2 s .c  om
 *
 * @return the inits the data
 */
private InitData loadInitData() {
    data = new InitData();
    data.setSiteUrl(kuneProperties.get(KuneProperties.SITE_URL));
    data.setLicenses(licenseManager.getAll());
    data.setLanguages(languageManager.getAll());
    data.setFullTranslatedLanguages(languageManager
            .findByCodes(kuneProperties.getList(KuneProperties.UI_TRANSLATOR_FULL_TRANSLATED_LANGS)));
    data.setCountries(countryManager.getAll());
    data.setTimezones(TimeZone.getAvailableIDs());
    data.setChatHttpBase(chatProperties.getHttpBase());
    data.setChatDomain(chatProperties.getDomain());
    data.setChatRoomHost(chatProperties.getRoomHost());
    data.setDefaultLicense(licenseManager.getDefLicense());
    data.setCurrentCCversion(this.kuneProperties.get(KuneProperties.CURRENT_CC_VERSION));
    data.setDefaultWsTheme(this.kuneProperties.get(KuneProperties.WS_THEMES_DEF));
    data.setGalleryPermittedExtensions(kuneProperties.get(KuneProperties.UPLOAD_GALLERY_PERMITTED_EXTS));
    data.setMaxFileSizeInMb(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE));
    data.setUserTools(serverToolRegistry.getToolsAvailableForUsers());
    data.setGroupTools(serverToolRegistry.getToolsAvailableForGroups());
    data.setImgResizewidth(kuneProperties.getInteger(KuneProperties.IMAGES_RESIZEWIDTH));
    data.setImgThumbsize(kuneProperties.getInteger(KuneProperties.IMAGES_THUMBSIZE));
    data.setImgCropsize(kuneProperties.getInteger(KuneProperties.IMAGES_CROPSIZE));
    data.setImgIconsize(kuneProperties.getInteger(KuneProperties.IMAGES_ICONSIZE));
    data.setKuneEmbedTemplate(kuneProperties.get(KuneProperties.KUNE_DOC_EMBEDED_TEMPLATE));
    data.setFlvEmbedObject(kuneProperties.get(KuneProperties.FLV_EMBEDED_OBJECT));
    data.setMp3EmbedObject(kuneProperties.get(KuneProperties.MP3_EMBEDED_OBJECT));
    data.setOggEmbedObject(kuneProperties.get(KuneProperties.OGG_EMBEDED_OBJECT));
    data.setAviEmbedObject(kuneProperties.get(KuneProperties.AVI_EMBEDED_OBJECT));
    data.setFeedbackEnabled(kuneProperties.getBoolean(KuneProperties.FEEDBACK_ENABLED));
    data.setSiteShortName(kuneProperties.get(KuneProperties.SITE_SHORTNAME));
    data.setSiteCommonName(kuneProperties.get(KuneProperties.SITE_COMMON_NAME));
    data.setTranslatorEnabled(kuneProperties.getBoolean(KuneProperties.UI_TRANSLATOR_ENABLED));
    data.setUseClientContentCache(kuneProperties.getBoolean(KuneProperties.USE_CLIENT_CONTENT_CACHE));
    data.setDefTutorialLanguage(kuneProperties.get(KuneProperties.KUNE_TUTORIALS_DEFLANG));
    data.setTutorialLanguages(kuneProperties.getList(KuneProperties.KUNE_TUTORIALS_LANGS));
    data.setPublicSpaceVisible(kuneProperties.getBoolean(KuneProperties.PUBLIC_SPACE_VISIBLE));
    data.setShowInDevelFeatures(kuneProperties.getBoolean(KuneProperties.SHOW_DEVEL_FEATURES));

    return data;
}