Example usage for com.liferay.portal.kernel.util PropsUtil get

List of usage examples for com.liferay.portal.kernel.util PropsUtil get

Introduction

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

Prototype

public static String get(String key) 

Source Link

Usage

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static String getEmailMessageUpdatedSignature(PortletPreferences preferences) {

    String emailMessageUpdatedSignature = preferences.getValue("emailMessageUpdatedSignature",
            StringPool.BLANK);//from  w ww.  j  av a  2  s.  com

    if (Validator.isNotNull(emailMessageUpdatedSignature)) {
        return emailMessageUpdatedSignature;
    } else {
        return ContentUtil.get(PropsUtil.get(PropsKeys.MESSAGE_BOARDS_EMAIL_MESSAGE_UPDATED_SIGNATURE));
    }
}

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static String getEmailMessageUpdatedSubject(PortletPreferences preferences) {

    String emailMessageUpdatedSubject = preferences.getValue("emailMessageUpdatedSubject", StringPool.BLANK);

    if (Validator.isNotNull(emailMessageUpdatedSubject)) {
        return emailMessageUpdatedSubject;
    } else {//  ww w  .ja  v  a  2s  . c  om
        return ContentUtil.get(PropsUtil.get(PropsKeys.MESSAGE_BOARDS_EMAIL_MESSAGE_UPDATED_SUBJECT));
    }
}

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static String getReplyToAddress(long categoryId, long messageId, String mx,
        String defaultMailingListAddress) {

    if (PropsUtil.get(PropsKeys.POP_SERVER_SUBDOMAIN).length() <= 0) {
        return defaultMailingListAddress;
    }/*w w  w  . j  a v  a 2s. co m*/

    StringBundler sb = new StringBundler(8);

    sb.append(MESSAGE_POP_PORTLET_PREFIX);
    sb.append(categoryId);
    sb.append(StringPool.PERIOD);
    sb.append(messageId);
    sb.append(StringPool.AT);
    sb.append(PropsUtil.get(PropsKeys.POP_SERVER_SUBDOMAIN));
    sb.append(StringPool.PERIOD);
    sb.append(mx);

    return sb.toString();
}

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static boolean hasMailIdHeader(Message message) throws Exception {
    String[] messageIds = message.getHeader("Message-ID");

    if (messageIds == null) {
        return false;
    }/*w w w  .  j av a  2  s.  c  o  m*/

    for (String messageId : messageIds) {
        if (Validator.isNotNull(PropsUtil.get(PropsKeys.POP_SERVER_SUBDOMAIN))
                && messageId.contains(PropsUtil.get(PropsKeys.POP_SERVER_SUBDOMAIN))) {

            return true;
        }
    }

    return false;
}

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static boolean isAllowAnonymousPosting(PortletPreferences preferences) {

    return GetterUtil.getBoolean(preferences.getValue("allowAnonymousPosting", null),
            GetterUtil.getBoolean(PropsUtil.get(PropsKeys.MESSAGE_BOARDS_ANONYMOUS_POSTING_ENABLED)));
}

From source file:com.cd.learning.hook.MBUtil.java

License:Open Source License

public static boolean isValidMessageFormat(String messageFormat) {
    String editorImpl = PropsUtil.get(BB_CODE_EDITOR_WYSIWYG_IMPL_KEY);

    if (messageFormat.equals("bbcode")
            && !(editorImpl.equals("bbcode") || editorImpl.equals("ckeditor_bbcode"))) {

        return false;
    }/*from  www.j  av a  2  s.  com*/

    return true;
}

From source file:com.celamanzi.liferay.portlets.rails286.Rails286PortletFunctions.java

License:Open Source License

/**
 * The getTempPath method will search for LIFERAY_PORTAL_TEMP variable on environment,
 * if the method not find our variable the catalina.base property will be used. The last attempt is
 * the path '../temp' that will work if you have started the server inside the bin folder.
 *//*from w  ww  .j a v  a  2  s.c  o m*/
public static String getTempPath() {
    if (tempPath != null) {
        log.debug("TempPath: " + tempPath);
        return tempPath;
    }

    tempPath = System.getenv("LIFERAY_PORTAL_TEMP");
    if (tempPath != null && tempPath.length() > 0) {
        tempPath = tempPath.replaceAll("/\\Z", "");
        log.info("Using LIFERAY_PORTAL_TEMP variable for tempPath, defined path: " + tempPath);
        return tempPath;
    }

    // In case of catalina (tomcat)
    try {
        String catalinaDir = PropsUtil.get("catalina.base");
        if (catalinaDir != null && catalinaDir.length() > 0) {
            catalinaDir = catalinaDir.replaceAll("/\\Z", "");
            tempPath = catalinaDir + "/temp";
            log.info("Using catalina.base for tempPath, defined path: " + tempPath);
            return tempPath;
        }
    } catch (Exception e) {
        log.error(e.getMessage());
    }

    // default one
    // XXX: maybe use /tmp ?
    tempPath = "../temp";
    log.info("Using '../temp' as tempPath, this is a not very good aproach. Be aware");
    return tempPath;
}

From source file:com.cmc.gateway.domain.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//from w w w  .j ava2s  . c  o  m

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "cmc-gateway-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("cmc-gateway-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "cmc-gateway-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.cmcti.cmts.domain.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }// w w  w .ja va  2s.com

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "cmts-mo-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil.get("cmts-mo-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "cmts-mo-portlet";
        }

        return _servletContextName;
    }
}

From source file:com.colors.themes.service.ClpSerializer.java

License:Open Source License

public static String getServletContextName() {
    if (Validator.isNotNull(_servletContextName)) {
        return _servletContextName;
    }//from www. j  a  v  a  2 s . c  o  m

    synchronized (ClpSerializer.class) {
        if (Validator.isNotNull(_servletContextName)) {
            return _servletContextName;
        }

        try {
            ClassLoader classLoader = ClpSerializer.class.getClassLoader();

            Class<?> portletPropsClass = classLoader.loadClass("com.liferay.util.portlet.PortletProps");

            Method getMethod = portletPropsClass.getMethod("get", new Class<?>[] { String.class });

            String portletPropsServletContextName = (String) getMethod.invoke(null,
                    "customfunctions-portlet-deployment-context");

            if (Validator.isNotNull(portletPropsServletContextName)) {
                _servletContextName = portletPropsServletContextName;
            }
        } catch (Throwable t) {
            if (_log.isInfoEnabled()) {
                _log.info("Unable to locate deployment context from portlet properties");
            }
        }

        if (Validator.isNull(_servletContextName)) {
            try {
                String propsUtilServletContextName = PropsUtil
                        .get("customfunctions-portlet-deployment-context");

                if (Validator.isNotNull(propsUtilServletContextName)) {
                    _servletContextName = propsUtilServletContextName;
                }
            } catch (Throwable t) {
                if (_log.isInfoEnabled()) {
                    _log.info("Unable to locate deployment context from portal properties");
                }
            }
        }

        if (Validator.isNull(_servletContextName)) {
            _servletContextName = "customfunctions-portlet";
        }

        return _servletContextName;
    }
}