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

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

Introduction

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

Prototype

String BACK_SLASH

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

Click Source Link

Usage

From source file:com.custom.portal.verify.CustomVerifyDocumentLibrary.java

License:Open Source License

protected void checkTitles() throws Exception {
    DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(DLFileEntry.class);

    Criterion criterion1 = RestrictionsFactoryUtil.like("title", "%/%");
    Criterion criterion2 = RestrictionsFactoryUtil.like("title", "%\\\\%");

    dynamicQuery.add(RestrictionsFactoryUtil.or(criterion1, criterion2));

    List<DLFileEntry> dlFileEntries = DLFileEntryLocalServiceUtil.dynamicQuery(dynamicQuery);

    for (DLFileEntry dlFileEntry : dlFileEntries) {
        TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(dlFileEntry.getModelClassName(),
                dlFileEntry.getFileEntryId());

        if (trashEntry != null) {
            continue;
        }/* w  w w .ja  v  a2s  .  co  m*/

        String title = dlFileEntry.getTitle();

        String newTitle = title.replace(StringPool.SLASH, StringPool.BLANK);

        newTitle = newTitle.replace(StringPool.BACK_SLASH, StringPool.UNDERLINE);

        dlFileEntry.setTitle(newTitle);

        DLFileEntryLocalServiceUtil.updateDLFileEntry(dlFileEntry);

        DLFileVersion dlFileVersion = dlFileEntry.getFileVersion();

        dlFileVersion.setTitle(newTitle);

        DLFileVersionLocalServiceUtil.updateDLFileVersion(dlFileVersion);

        if (_log.isDebugEnabled()) {
            _log.debug("Invalid document title " + title + "renamed to " + newTitle);
        }
    }
}

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

License:Open Source License

@Override
public String toQueryFragment() {
    boolean multipleTerms = _value.contains(StringPool.SPACE);

    StringBundler sb = new StringBundler(1 + (multipleTerms ? 4 : 0));

    if (_value.contains(StringPool.SPACE)) {
        sb.append(StringPool.BACK_SLASH);
        sb.append(StringPool.APOSTROPHE);
    }/*from ww  w . j a  va 2  s  .com*/

    sb.append(_value);

    if (_value.contains(StringPool.SPACE)) {
        sb.append(StringPool.BACK_SLASH);
        sb.append(StringPool.APOSTROPHE);
    }

    return sb.toString();
}

From source file:com.liferay.document.library.repository.search.util.KeywordsUtil.java

License:Open Source License

public static String escape(String text) {
    for (int i = SPECIAL.length - 1; i >= 0; i--) {
        text = StringUtil.replace(text, SPECIAL[i], StringPool.BACK_SLASH + SPECIAL[i]);
    }/*w  w w . ja v  a2  s.co  m*/

    return text;
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

protected boolean isValidFileName(String name) {
    if ((name == null) || name.contains(StringPool.BACK_SLASH) || name.contains(StringPool.SLASH)) {

        return false;
    }/*from   www .java 2s .  c om*/

    return true;
}

From source file:com.liferay.lotus.repository.LotusNotesRepository.java

License:Open Source License

@Override
public String getLiferayLogin(String extRepositoryLogin) {
    int index = extRepositoryLogin.lastIndexOf(StringPool.BACK_SLASH);

    return extRepositoryLogin.substring(index + 1);
}

From source file:com.liferay.resourcesimporter.messaging.HotDeployMessageListener.java

License:Open Source License

protected Properties getPluginPackageProperties(ServletContext servletContext) {

    Properties properties = new Properties();

    try {//from www . j a v a 2s.c om
        String propertiesString = StringUtil
                .read(servletContext.getResourceAsStream("/WEB-INF/liferay-plugin-package.properties"));

        if (propertiesString != null) {
            String contextPath = servletContext.getRealPath(StringPool.SLASH);

            contextPath = StringUtil.replace(contextPath, StringPool.BACK_SLASH, StringPool.SLASH);

            propertiesString = propertiesString.replace("${context.path}", contextPath);

            PropertiesUtil.load(properties, propertiesString);
        }
    } catch (IOException e) {
        _log.error(e, e);
    }

    return properties;
}

From source file:com.liferay.resourcesimporter.servlet.ResourcesImporterServletContextListener.java

License:Open Source License

protected Properties getPluginPackageProperties(ServletContext servletContext) {

    Properties properties = new Properties();

    try {/*from www . j  a va2 s  .co  m*/
        String propertiesString = StringUtil
                .read(servletContext.getResourceAsStream("/WEB-INF/liferay-plugin-package.properties"));

        if (propertiesString == null) {
            return properties;
        }

        String contextPath = servletContext.getRealPath(StringPool.SLASH);

        contextPath = StringUtil.replace(contextPath, StringPool.BACK_SLASH, StringPool.SLASH);

        propertiesString = propertiesString.replace("${context.path}", contextPath);

        PropertiesUtil.load(properties, propertiesString);
    } catch (IOException ioe) {
        _log.error(ioe, ioe);
    }

    return properties;
}

From source file:com.liferay.resourcesimporter.util.PluginPackageProperties.java

License:Open Source License

public PluginPackageProperties(ServletContext servletContext) throws IOException {

    String propertiesString = StringUtil
            .read(servletContext.getResourceAsStream("/WEB-INF/liferay-plugin-package.properties"));

    if (propertiesString == null) {
        return;/*from  w  w  w  .  j a  v a2 s. c o  m*/
    }

    String contextPath = servletContext.getRealPath(StringPool.SLASH);

    contextPath = StringUtil.replace(contextPath, StringPool.BACK_SLASH, StringPool.SLASH);

    propertiesString = propertiesString.replace("${context.path}", contextPath);

    PropertiesUtil.load(_properties, propertiesString);
}

From source file:com.liferay.rtl.servlet.filters.dynamiccss.DynamicCSSFilter.java

License:Open Source License

protected String sterilizeQueryString(String queryString) {
    return StringUtil.replace(queryString, new String[] { StringPool.SLASH, StringPool.BACK_SLASH },
            new String[] { StringPool.UNDERLINE, StringPool.UNDERLINE });
}

From source file:com.liferay.rtl.servlet.filters.dynamiccss.DynamicCSSUtil.java

License:Open Source License

private static String _getCacheFileName(String fileName, String suffix) {
    String cacheFileName = StringUtil.replace(fileName, StringPool.BACK_SLASH, StringPool.SLASH);

    int x = cacheFileName.lastIndexOf(StringPool.SLASH);
    int y = cacheFileName.lastIndexOf(StringPool.PERIOD);

    return cacheFileName.substring(0, x + 1) + ".sass-cache/" + cacheFileName.substring(x + 1, y) + suffix
            + cacheFileName.substring(y);
}