Example usage for com.liferay.portal.kernel.util PropsKeys IMAGEMAGICK_RESOURCE_LIMIT

List of usage examples for com.liferay.portal.kernel.util PropsKeys IMAGEMAGICK_RESOURCE_LIMIT

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys IMAGEMAGICK_RESOURCE_LIMIT.

Prototype

String IMAGEMAGICK_RESOURCE_LIMIT

To view the source code for com.liferay.portal.kernel.util PropsKeys IMAGEMAGICK_RESOURCE_LIMIT.

Click Source Link

Usage

From source file:com.liferay.server.admin.web.internal.portlet.action.EditServerMVCActionCommand.java

License:Open Source License

protected void updateExternalServices(ActionRequest actionRequest, PortletPreferences portletPreferences)
        throws Exception {

    boolean imageMagickEnabled = ParamUtil.getBoolean(actionRequest, "imageMagickEnabled");
    String imageMagickPath = ParamUtil.getString(actionRequest, "imageMagickPath");
    boolean xugglerEnabled = ParamUtil.getBoolean(actionRequest, "xugglerEnabled");

    portletPreferences.setValue(PropsKeys.IMAGEMAGICK_ENABLED, String.valueOf(imageMagickEnabled));
    portletPreferences.setValue(PropsKeys.IMAGEMAGICK_GLOBAL_SEARCH_PATH, imageMagickPath);
    portletPreferences.setValue(PropsKeys.XUGGLER_ENABLED, String.valueOf(xugglerEnabled));

    Enumeration<String> enu = actionRequest.getParameterNames();

    while (enu.hasMoreElements()) {
        String name = enu.nextElement();

        if (name.startsWith("imageMagickLimit")) {
            String key = StringUtil.toLowerCase(name.substring(16));
            String value = ParamUtil.getString(actionRequest, name);

            portletPreferences.setValue(PropsKeys.IMAGEMAGICK_RESOURCE_LIMIT + key, value);
        }/*w ww.jav  a  2s.co m*/
    }

    portletPreferences.store();

    GhostscriptUtil.reset();
    ImageMagickUtil.reset();
}