Example usage for com.liferay.portal.kernel.util Portal TEMP_OBFUSCATION_VALUE

List of usage examples for com.liferay.portal.kernel.util Portal TEMP_OBFUSCATION_VALUE

Introduction

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

Prototype

String TEMP_OBFUSCATION_VALUE

To view the source code for com.liferay.portal.kernel.util Portal TEMP_OBFUSCATION_VALUE.

Click Source Link

Usage

From source file:com.liferay.dynamic.data.mapping.data.provider.web.internal.display.context.DDMDataProviderDisplayContext.java

License:Open Source License

protected void obfuscateDDMFormFieldValue(DDMFormFieldValue ddmFormFieldValue) {

    Value value = ddmFormFieldValue.getValue();

    for (Locale availableLocale : value.getAvailableLocales()) {
        value.addString(availableLocale, Portal.TEMP_OBFUSCATION_VALUE);
    }/*from   w w  w  . jav  a  2s .co m*/
}

From source file:com.liferay.dynamic.data.mapping.data.provider.web.internal.portlet.action.UpdateDataProviderMVCActionCommand.java

License:Open Source License

protected void restoreDDMFormFieldValue(DDMFormFieldValue ddmFormFieldValue,
        DDMFormFieldValue storedDDMFormFieldValue) {

    Value value = ddmFormFieldValue.getValue();

    Value storedValue = storedDDMFormFieldValue.getValue();

    for (Locale availableLocale : value.getAvailableLocales()) {
        if (Objects.equals(value.getString(availableLocale), Portal.TEMP_OBFUSCATION_VALUE)) {

            value.addString(availableLocale, storedValue.getString(availableLocale));
        }/* w  w w  . ja va 2s  .  c o  m*/
    }
}

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

License:Open Source License

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

    String advancedProperties = ParamUtil.getString(actionRequest, "advancedProperties");
    String pop3Host = ParamUtil.getString(actionRequest, "pop3Host");
    String pop3Password = ParamUtil.getString(actionRequest, "pop3Password");
    int pop3Port = ParamUtil.getInteger(actionRequest, "pop3Port");
    boolean pop3Secure = ParamUtil.getBoolean(actionRequest, "pop3Secure");
    String pop3User = ParamUtil.getString(actionRequest, "pop3User");
    String smtpHost = ParamUtil.getString(actionRequest, "smtpHost");
    String smtpPassword = ParamUtil.getString(actionRequest, "smtpPassword");
    int smtpPort = ParamUtil.getInteger(actionRequest, "smtpPort");
    boolean smtpSecure = ParamUtil.getBoolean(actionRequest, "smtpSecure");
    String smtpUser = ParamUtil.getString(actionRequest, "smtpUser");

    String storeProtocol = Account.PROTOCOL_POP;

    if (pop3Secure) {
        storeProtocol = Account.PROTOCOL_POPS;
    }//from w  w  w  .  j a va  2 s .co  m

    String transportProtocol = Account.PROTOCOL_SMTP;

    if (smtpSecure) {
        transportProtocol = Account.PROTOCOL_SMTPS;
    }

    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL, "true");
    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_ADVANCED_PROPERTIES, advancedProperties);
    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_POP3_HOST, pop3Host);

    if (!pop3Password.equals(Portal.TEMP_OBFUSCATION_VALUE)) {
        portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_POP3_PASSWORD, pop3Password);
    }

    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_POP3_PORT, String.valueOf(pop3Port));
    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_POP3_USER, pop3User);
    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_SMTP_HOST, smtpHost);

    if (!smtpPassword.equals(Portal.TEMP_OBFUSCATION_VALUE)) {
        portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_SMTP_PASSWORD, smtpPassword);
    }

    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_SMTP_PORT, String.valueOf(smtpPort));
    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_SMTP_USER, smtpUser);
    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_STORE_PROTOCOL, storeProtocol);
    portletPreferences.setValue(PropsKeys.MAIL_SESSION_MAIL_TRANSPORT_PROTOCOL, transportProtocol);

    portletPreferences.store();

    _mailService.clearSession();
}