Example usage for com.liferay.portal.kernel.util StringPool NEW_LINE

List of usage examples for com.liferay.portal.kernel.util StringPool NEW_LINE

Introduction

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

Prototype

String NEW_LINE

To view the source code for com.liferay.portal.kernel.util StringPool NEW_LINE.

Click Source Link

Usage

From source file:au.com.permeance.liferay.portlet.patchingtoolinfo.util.StringHelper.java

License:Open Source License

/** 
 * Strips end of line markers from a List of String lines.
 * /*from   ww w.  java  2 s .c om*/
 * @param list input List of String lines
 * @return List of trimmed String lines
 */
public static List<String> stripEolFromStringLineList(List<String> lines) {

    List<String> newLines = new ArrayList<String>();

    if (lines != null) {
        for (String line : lines) {
            String str = line;
            str = str.replace(StringPool.NEW_LINE, StringPool.BLANK);
            str = str.replace(StringPool.RETURN, StringPool.BLANK);
            String newLine = str;
            newLines.add(newLine);
        }
    }

    return newLines;
}

From source file:com.evolveum.liferay.usercreatehook.screenname.CustomScreenNameGenerator.java

License:Apache License

public String generate(long companyId, long userId, String emailAddress) throws Exception {

    String screenName = null;//from w ww.j  a va2 s.c om

    if (Validator.isNotNull(emailAddress)) {
        // XXX change 1
        // screenName = StringUtil.extractFirst(emailAddress, CharPool.AT).toLowerCase();
        screenName = emailAddress.toLowerCase();

        for (char c : screenName.toCharArray()) {
            // XXX change 2
            // if (!Validator.isChar(c) && !Validator.isDigit(c) && (c != CharPool.DASH) && (c != CharPool.PERIOD))
            // {
            if (!Validator.isChar(c) && !Validator.isDigit(c) && (c != CharPool.DASH)) {
                // XXX change 3
                // screenName = StringUtil.replace(screenName, c, CharPool.PERIOD);
                screenName = StringUtil.replace(screenName, c, CharPool.DASH);
            }
        }

        if (screenName.equals(DefaultScreenNameValidator.CYRUS)
                || screenName.equals(DefaultScreenNameValidator.POSTFIX)) {

            screenName += StringPool.PERIOD + userId;
        }
    } else {
        screenName = String.valueOf(userId);
    }

    if (!_USERS_SCREEN_NAME_ALLOW_NUMERIC && Validator.isNumber(screenName)) {

        screenName = _NON_NUMERICAL_PREFIX + screenName;
    }

    String[] reservedScreenNames = PrefsPropsUtil.getStringArray(companyId,
            PropsKeys.ADMIN_RESERVED_SCREEN_NAMES, StringPool.NEW_LINE, _ADMIN_RESERVED_SCREEN_NAMES);

    for (String reservedScreenName : reservedScreenNames) {
        if (screenName.equalsIgnoreCase(reservedScreenName)) {
            return getUnusedScreenName(companyId, screenName);
        }
    }

    try {
        UserLocalServiceUtil.getUserByScreenName(companyId, screenName);
    } catch (NoSuchUserException nsue) {
        try {
            GroupLocalServiceUtil.getFriendlyURLGroup(companyId, StringPool.SLASH + screenName);
        } catch (NoSuchGroupException nsge) {
            return screenName;
        }
    }

    return getUnusedScreenName(companyId, screenName);
}

From source file:com.fb.filter.OpenGraphFilter.java

License:Open Source License

protected String getContent(HttpServletRequest request, String content) {
    if (ArrayUtil.isEmpty(_appNamespaces)) {
        if (_companyId == 0) {
            _companyId = PortalUtil.getCompanyId(request);
        }/*ww w. j av a  2 s  .c o m*/

        try {
            _appNamespaces = PrefsPropsUtil.getStringArray(_companyId, "APP_NAMESPACES", StringPool.NEW_LINE);
        } catch (Exception e) {
            _log.error(e);
        }
    }

    if (ArrayUtil.isEmpty(_appNamespaces)) {
        StringBundler sb = new StringBundler(2 + 4 * _appNamespaces.length);

        sb.append(_START_HEAD);
        sb.append(" og:http://ogp.me/ns fb:http://ogp.me/ns/fb ");

        for (String appNamespace : _appNamespaces) {
            sb.append(appNamespace);
            sb.append(":http://ogp.me/ns/fb/");
            sb.append(appNamespace);
            sb.append(StringPool.SPACE);
        }

        content = StringUtil.replaceFirst(content, _START_HEAD, sb.toString());
    }

    return content;
}

From source file:com.liferay.adaptive.media.blogs.internal.exportimport.data.handler.test.AMBlogsEntryStagedModelDataHandlerTest.java

License:Open Source License

private String _getDynamicContent(FileEntry... fileEntries) throws Exception {

    StringBundler sb = new StringBundler(fileEntries.length);

    for (FileEntry fileEntry : fileEntries) {
        sb.append(_getImgTag(fileEntry));
        sb.append(StringPool.NEW_LINE);
    }// w  w w  .  jav a 2  s.c  o m

    return sb.toString();
}

From source file:com.liferay.adaptive.media.blogs.internal.exportimport.data.handler.test.AMBlogsEntryStagedModelDataHandlerTest.java

License:Open Source License

private String _getExpectedStaticContent(FileEntry... fileEntries) throws Exception {

    StringBundler sb = new StringBundler(fileEntries.length * 2);

    for (FileEntry fileEntry : fileEntries) {
        FileEntry importedFileEntry = _dlAppLocalService.getFileEntryByUuidAndGroupId(fileEntry.getUuid(),
                liveGroup.getGroupId());

        sb.append(_amImageHTMLTagFactory.create(_getImgTag(importedFileEntry), importedFileEntry));

        sb.append(StringPool.NEW_LINE);
    }//w ww. j  av a2  s  .co m

    return sb.toString();
}

From source file:com.liferay.adaptive.media.blogs.internal.exportimport.data.handler.test.AMBlogsEntryStagedModelDataHandlerTest.java

License:Open Source License

private String _getStaticContent(FileEntry... fileEntries) throws Exception {

    StringBundler sb = new StringBundler(fileEntries.length);

    for (FileEntry fileEntry : fileEntries) {
        sb.append(_getPictureTag(fileEntry));
        sb.append(StringPool.NEW_LINE);
    }/* ww  w  .java  2 s . com*/

    return sb.toString();
}

From source file:com.liferay.adaptive.media.image.content.transformer.internal.HtmlContentTransformerImplTest.java

License:Open Source License

private String _duplicateWithNewLine(String text) {
    return text + StringPool.NEW_LINE + text;
}

From source file:com.liferay.adaptive.media.journal.internal.exportimport.data.handler.test.AMJournalArticleStagedModelDataHandlerTest.java

License:Open Source License

private String _getDynamicContent(FileEntry... fileEntries) throws Exception {

    StringBundler sb = new StringBundler(fileEntries.length);

    for (FileEntry fileEntry : fileEntries) {
        sb.append(_getImgTag(fileEntry));
        sb.append(StringPool.NEW_LINE);
    }/* www.  ja va 2s . co m*/

    return _getContent(sb.toString());
}

From source file:com.liferay.adaptive.media.journal.internal.exportimport.data.handler.test.AMJournalArticleStagedModelDataHandlerTest.java

License:Open Source License

private String _getExpectedStaticContent(FileEntry... fileEntries) throws Exception {

    StringBundler sb = new StringBundler(fileEntries.length * 2);

    for (FileEntry fileEntry : fileEntries) {
        FileEntry importedFileEntry = _dlAppLocalService.getFileEntryByUuidAndGroupId(fileEntry.getUuid(),
                liveGroup.getGroupId());

        sb.append(_amImageHTMLTagFactory.create(_getImgTag(importedFileEntry), importedFileEntry));

        sb.append(StringPool.NEW_LINE);
    }//w w  w  .j  av  a2  s.c  om

    return _getContent(sb.toString());
}

From source file:com.liferay.adaptive.media.journal.internal.exportimport.data.handler.test.AMJournalArticleStagedModelDataHandlerTest.java

License:Open Source License

private String _getStaticContent(FileEntry... fileEntries) throws Exception {

    StringBundler sb = new StringBundler(fileEntries.length);

    for (FileEntry fileEntry : fileEntries) {
        sb.append(_getPictureTag(fileEntry));
        sb.append(StringPool.NEW_LINE);
    }/*w  w  w.  j  a  v  a 2s .c  o m*/

    return _getContent(sb.toString());
}