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

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

Introduction

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

Prototype

String DASH

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

Click Source Link

Usage

From source file:com.liferay.blade.samples.tagdynamicinclude.SampleFormTagDynamicIdFactory.java

License:Apache License

public String getTagDynamicId(HttpServletRequest request, HttpServletResponse response, Object tag) {

    String portletId = _portal.getPortletId(request);

    if (Validator.isNull(portletId)) {
        return null;
    }// w  w w  . j a v a 2 s . c o m

    String name = BeanPropertiesUtil.getStringSilent(tag, "name");

    if (Validator.isNull(name)) {
        return null;
    }

    return portletId.concat(StringPool.DASH).concat(name);
}

From source file:com.liferay.blogs.service.impl.BlogsEntryLocalServiceImpl.java

License:Open Source License

protected String getUniqueUrlTitle(long entryId, long groupId, String title) {

    String urlTitle = BlogsUtil.getUrlTitle(entryId, title);

    for (int i = 1;; i++) {
        BlogsEntry entry = blogsEntryPersistence.fetchByG_UT(groupId, urlTitle);

        if ((entry == null) || (entryId == entry.getEntryId())) {
            break;
        } else {//  w w  w.j a va2s  .c om
            String suffix = StringPool.DASH + i;

            String prefix = urlTitle;

            if (urlTitle.length() > suffix.length()) {
                prefix = urlTitle.substring(0, urlTitle.length() - suffix.length());
            }

            urlTitle = prefix + suffix;
        }
    }

    return urlTitle;
}

From source file:com.liferay.calendar.search.test.CalendarFieldsFixture.java

License:Open Source License

public void populateGroupRoleId(Map<String, String> fieldValues) throws PortalException {

    Role role = _roleLocalService.getDefaultGroupRole(_group.getGroupId());

    fieldValues.put(Field.GROUP_ROLE_ID, _group.getGroupId() + StringPool.DASH + role.getRoleId());
}

From source file:com.liferay.ci.jenkins.processor.DefaultJobNameProcessorImpl.java

License:Open Source License

@Override
public String process(String jobName) {
    if (Validator.isNull(jobName)) {
        return StringPool.BLANK;
    }//w  w w .  jav  a2  s  . com

    String processedJobName = jobName.replace("liferay", StringPool.BLANK);

    processedJobName = processedJobName.replace(StringPool.DASH, StringPool.SPACE);

    return processedJobName.trim();
}

From source file:com.liferay.document.library.repository.cmis.search.CMISContainsNotExpression.java

License:Open Source License

@Override
public String toQueryFragment() {
    return StringPool.DASH.concat(_cmisCriterion.toQueryFragment());
}

From source file:com.liferay.faces.bridge.context.map.internal.MultiPartFormDataProcessorImpl.java

License:Open Source License

protected String stripIllegalCharacters(String fileName) {

    // FACES-64: Need to strip out invalid characters.
    // http://technet.microsoft.com/en-us/library/cc956689.aspx
    String strippedFileName = fileName;

    if (fileName != null) {

        int pos = fileName.lastIndexOf(StringPool.PERIOD);
        strippedFileName = fileName.replaceAll("[\\\\/\\[\\]:|<>+;=.?\"]", StringPool.DASH);

        if (pos > 0) {
            strippedFileName = strippedFileName.substring(0, pos) + StringPool.PERIOD
                    + strippedFileName.substring(pos + 1);
        }//from  w ww .j a v a  2s  .  c  o m
    }

    return strippedFileName;
}

From source file:com.liferay.frontend.taglib.aui.form.extension.sample.internal.SampleFormTagDynamicIdFactory.java

License:Open Source License

@Override
public String getTagDynamicId(HttpServletRequest request, HttpServletResponse response, Object tag) {

    String portletId = _portal.getPortletId(request);

    if (Validator.isNull(portletId)) {
        return null;
    }/*from   w w w .  ja  va  2  s  .c o  m*/

    String name = BeanPropertiesUtil.getStringSilent(tag, "name");

    if (Validator.isNull(name)) {
        return null;
    }

    return portletId.concat(StringPool.DASH).concat(name);
}

From source file:com.liferay.jbpm.util.TaskFormElement.java

License:Open Source License

public String getDateName() {
    if (Validator.isNotNull(_displayName)) {
        return StringUtil.replace(_displayName, StringPool.DASH, StringPool.UNDERLINE);
    } else {// w  ww . j  a v a 2 s .  c  o m
        return _displayName;
    }
}

From source file:com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.java

License:Open Source License

/**
 * Returns the web content article's unique URL title.
 *
 * @param  groupId the primary key of the web content article's group
 * @param  articleId the primary key of the web content article
 * @param  urlTitle the web content article's accessible URL title
 * @return the web content article's unique URL title
 *//*from   w  ww . jav a 2s .  c  om*/
@Override
public String getUniqueUrlTitle(long groupId, String articleId, String urlTitle) throws PortalException {

    for (int i = 1;; i++) {
        JournalArticle article = fetchArticleByUrlTitle(groupId, urlTitle);

        if ((article == null) || articleId.equals(article.getArticleId())) {
            break;
        } else {
            String suffix = StringPool.DASH + i;

            String prefix = urlTitle;

            if (urlTitle.length() > suffix.length()) {
                prefix = urlTitle.substring(0, urlTitle.length() - suffix.length());
            }

            urlTitle = prefix + suffix;
        }
    }

    return urlTitle;
}

From source file:com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.java

License:Open Source License

private int _getUniqueUrlTitleCount(long groupId, String articleId, String urlTitle) throws PortalException {

    for (int i = 1;; i++) {
        JournalArticle article = fetchArticleByUrlTitle(groupId, urlTitle);

        if ((article == null) || Objects.equals(articleId, article.getArticleId())) {

            return i - 1;
        } else {/*w  w w . ja  va  2s .  c  o  m*/
            String suffix = StringPool.DASH + i;

            String prefix = urlTitle;

            if (urlTitle.length() > suffix.length()) {
                prefix = urlTitle.substring(0, urlTitle.length() - suffix.length());
            }

            urlTitle = prefix + suffix;
        }
    }
}