Example usage for org.apache.commons.collections4 MapUtils unmodifiableMap

List of usage examples for org.apache.commons.collections4 MapUtils unmodifiableMap

Introduction

In this page you can find the example usage for org.apache.commons.collections4 MapUtils unmodifiableMap.

Prototype

public static <K, V> Map<K, V> unmodifiableMap(final Map<? extends K, ? extends V> map) 

Source Link

Document

Returns an unmodifiable map backed by the given map.

Usage

From source file:com.github.sevntu.checkstyle.ordering.MethodOrder.java

public MethodOrder(Dependencies dependencies) {
    this.methods = MapUtils.unmodifiableMap(getAllMethods(dependencies));
    this.initialOrdering = ListUtils.unmodifiableList(getInitialMethodOrdering(methods));
    this.currentOrdering = this.initialOrdering;
    final Map<ResolvedCall, MethodInvocation> callsToInvocations = getAllInvocations(dependencies, methods);
    this.invocations = SetUtils.unmodifiableSet(new HashSet<>(callsToInvocations.values()));
    this.invocationNesting = MultiMapUtils
            .unmodifiableMultiValuedMap(getMethodInvocationsNesting(callsToInvocations));
}

From source file:com.haulmont.cuba.desktop.sys.JXErrorPaneExt.java

private void sendSupportEmail(ErrorInfo jXErrorPaneInfo) {

    Configuration configuration = AppBeans.get(Configuration.NAME);
    ExceptionReportService reportService = AppBeans.get(ExceptionReportService.NAME);
    ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
    TopLevelFrame mainFrame = App.getInstance().getMainFrame();
    Messages messages = AppBeans.get(Messages.NAME);
    Locale locale = App.getInstance().getLocale();

    try {/*www  .  ja  v a2  s. c  om*/
        TimeSource timeSource = AppBeans.get(TimeSource.NAME);
        String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeSource.currentTimestamp());

        UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
        User user = userSessionSource.getUserSession().getUser();

        Map<String, Object> binding = new HashMap<>();
        binding.put("timestamp", date);
        binding.put("errorMessage", jXErrorPaneInfo.getBasicErrorMessage());
        binding.put("stacktrace", getStackTrace(jXErrorPaneInfo.getErrorException()));
        binding.put("systemId", clientConfig.getSystemID());
        binding.put("userLogin", user.getLogin());

        if (MapUtils.isNotEmpty(additionalExceptionReportBinding)) {
            binding.putAll(additionalExceptionReportBinding);
        }

        reportService.sendExceptionReport(clientConfig.getSupportEmail(), MapUtils.unmodifiableMap(binding));

        mainFrame.showNotification(messages.getMainMessage("errorPane.emailSent", locale),
                Frame.NotificationType.TRAY);
    } catch (Throwable e) {
        mainFrame.showNotification(messages.getMainMessage("errorPane.emailSendingErr", locale),
                Frame.NotificationType.ERROR);
    }
}

From source file:com.haulmont.cuba.web.exception.ExceptionDialog.java

public void sendSupportEmail(String message, String stackTrace) {
    try {/*w  w  w .j a  v a 2  s  .c  o m*/
        User user = userSessionSource.getUserSession().getUser();
        String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeSource.currentTimestamp());

        Map<String, Object> binding = new HashMap<>();
        binding.put("timestamp", date);
        binding.put("errorMessage", message);
        binding.put("stacktrace", stackTrace);
        binding.put("systemId", clientConfig.getSystemID());
        binding.put("userLogin", user.getLogin());

        if (MapUtils.isNotEmpty(additionalExceptionReportBinding)) {
            binding.putAll(additionalExceptionReportBinding);
        }

        reportService.sendExceptionReport(clientConfig.getSupportEmail(), MapUtils.unmodifiableMap(binding));

        Notification.show(messages.getMainMessage("exceptionDialog.emailSent"));
    } catch (Throwable e) {
        log.error("Error sending exception report", e);
        Notification.show(messages.getMainMessage("exceptionDialog.emailSendingErr"));
    }
}

From source file:org.efaps.admin.AbstractAdminObject.java

/**
 * @return unmodifiable map of properties
 */
public Map<String, String> getPropertyMap() {
    return MapUtils.unmodifiableMap(evalProperties());
}

From source file:org.efaps.util.MsgFormat.java

/**
 * Getter method for the instance variable {@link #registry}.
 *
 * @return value of instance variable {@link #registry}
 *///from  w  w w.  j  av  a 2s .c om
public Map<String, FormatFactory> getRegistry() {
    return MapUtils.unmodifiableMap(this.registry);
}