Example usage for com.liferay.portal.kernel.util PrefsPropsUtil getPreferences

List of usage examples for com.liferay.portal.kernel.util PrefsPropsUtil getPreferences

Introduction

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

Prototype

public static PortletPreferences getPreferences() 

Source Link

Usage

From source file:com.crafter.configuration.CrafterConfigurationPortlet.java

License:Open Source License

public void submitPreferencesAction(ActionRequest actionRequest, ActionResponse actionResponse)
        throws IOException, PortletException {

    String searchServerURL = ParamUtil.getString(actionRequest, "search_server_url");
    String crafterEndPoint = ParamUtil.getString(actionRequest, "crafter_end_point");
    try {/*from ww w .j  a v a  2s . c  o  m*/
        if (Validator.isNotNull(searchServerURL)) {
            PortletPreferences preferences = PrefsPropsUtil.getPreferences();
            preferences.setValue("search.server.url", searchServerURL);
            preferences.setValue("crafter.end.point", crafterEndPoint);
            preferences.store();
        }
    } catch (SystemException e) {
        e.printStackTrace();
    }
}

From source file:com.crafter.configuration.CrafterConfigurationPortlet.java

License:Open Source License

public void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException {

    try {/* ww w . j  a  va  2s. co  m*/
        PortletPreferences preferences = PrefsPropsUtil.getPreferences();
        request.setAttribute("search_server_url", preferences.getValue("search.server.url", "empty"));
        request.setAttribute("crafter_end_point", preferences.getValue("crafter.end.point", "empty"));
    } catch (SystemException e) {
        e.printStackTrace();
    }

    include(viewTemplate, request, response);
}

From source file:com.liferay.pushnotifications.portlet.AdminPortlet.java

License:Open Source License

public void updatePortletPreferences(ActionRequest actionRequest, ActionResponse actionResponse)
        throws Exception {

    PortletPreferences portletPreferences = PrefsPropsUtil.getPreferences();

    String androidApiKey = ParamUtil.getString(actionRequest, "androidApiKey");

    portletPreferences.setValue(PortletPropsKeys.ANDROID_API_KEY, androidApiKey);

    int androidRetries = ParamUtil.getInteger(actionRequest, "androidRetries");

    portletPreferences.setValue(PortletPropsKeys.ANDROID_RETRIES, String.valueOf(androidRetries));

    String appleCertificatePassword = ParamUtil.getString(actionRequest, "appleCertificatePassword");

    portletPreferences.setValue(PortletPropsKeys.APPLE_CERTIFICATE_PASSWORD, appleCertificatePassword);

    String appleCertificatePath = ParamUtil.getString(actionRequest, "appleCertificatePath");

    portletPreferences.setValue(PortletPropsKeys.APPLE_CERTIFICATE_PATH, appleCertificatePath);

    boolean appleSandbox = ParamUtil.getBoolean(actionRequest, "appleSandbox");

    portletPreferences.setValue(PortletPropsKeys.APPLE_SANDBOX, String.valueOf(appleSandbox));

    portletPreferences.store();/*from   ww w.j a  v a  2s.  co m*/

    PushNotificationsDeviceLocalServiceUtil.resetPushNotificationSenders();
}

From source file:com.rivetlogic.crafter.configuration.CrafterConfigurationPortlet.java

License:Open Source License

/**
 * Submit preferences action.//from   ww  w  .  j ava 2 s.  c  o  m
 * 
 * @param actionRequest
 *            the action request
 * @param actionResponse
 *            the action response
 * @throws IOException
 *             the IO exception
 * @throws PortletException
 *             the portlet exception
 */
public void submitPreferencesAction(final ActionRequest actionRequest, final ActionResponse actionResponse)
        throws IOException, PortletException {

    String searchServerURL = ParamUtil.getString(actionRequest, ConfigurationConstants.PARAMUTIL_SEARCH_URL);
    String crafterEndPoint = ParamUtil.getString(actionRequest, ConfigurationConstants.PARAMUTIL_END_POINT);
    try {
        if (Validator.isNotNull(searchServerURL)) {
            PortletPreferences preferences = PrefsPropsUtil.getPreferences();
            preferences.setValue(ConfigurationConstants.PREFERENCES_SEARCH_URL, searchServerURL);
            preferences.setValue(ConfigurationConstants.PREFERENCES_END_POINT, crafterEndPoint);
            preferences.store();
        }
    } catch (SystemException e) {
        LOG.error("Error while storing preferences:" + e.getMessage());
    }
}

From source file:com.rivetlogic.crafter.configuration.CrafterConfigurationPortlet.java

License:Open Source License

public void doView(final RenderRequest request, final RenderResponse response)
        throws IOException, PortletException {

    try {//from   w  ww  .  ja va  2 s .  co  m
        PortletPreferences preferences = PrefsPropsUtil.getPreferences();
        request.setAttribute(ConfigurationConstants.PARAMUTIL_SEARCH_URL, preferences
                .getValue(ConfigurationConstants.PREFERENCES_SEARCH_URL, ConfigurationConstants._EMPTY));
        request.setAttribute(ConfigurationConstants.PARAMUTIL_END_POINT, preferences
                .getValue(ConfigurationConstants.PREFERENCES_END_POINT, ConfigurationConstants._EMPTY));
    } catch (SystemException e) {
        LOG.error("Error while rendering:" + e.getMessage());
    }

    include(viewTemplate, request, response);
}

From source file:it.sysdata.mqtt.service.impl.MqttLocalServiceImpl.java

License:Open Source License

private void _noRetry() {

    try {/*from  www .  j ava 2  s. c  om*/
        PortletPreferences portletPreferences = PrefsPropsUtil.getPreferences();

        portletPreferences.setValue(PortletPropsKeys.MQTT_ERRORS_RETRY_CONNECT, String.valueOf(false));

        portletPreferences.store();
    } catch (Exception e1) {
        _log.error(e1);
    }
}

From source file:it.sysdata.mqtt.service.impl.MqttLocalServiceImpl.java

License:Open Source License

private void _setupRetry(Throwable e) {

    try {// ww  w . j a v  a  2s  .co  m
        PortletPreferences portletPreferences = PrefsPropsUtil.getPreferences();

        portletPreferences.setValue(PortletPropsKeys.MQTT_ERRORS_RETRY_CONNECT, String.valueOf(true));

        portletPreferences.store();
    } catch (Exception e1) {
        _log.error(e);
    }
}