Example usage for com.liferay.portal.kernel.util StringUtil read

List of usage examples for com.liferay.portal.kernel.util StringUtil read

Introduction

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

Prototype

public static String read(ClassLoader classLoader, String name, boolean all) throws IOException 

Source Link

Usage

From source file:com.liferay.blogs.demo.data.creator.internal.CreativeCommonsBlogsEntryDemoDataCreatorImpl.java

License:Open Source License

private String _getRandomContent(int index) throws IOException {
    Class<?> clazz = getClass();

    String titlePath = StringBundler.concat("com/liferay/blogs/demo/data/creator/internal/dependencies",
            "/creative/commons/content_", String.valueOf(index), ".txt");

    return StringUtil.read(clazz.getClassLoader(), titlePath, false);
}

From source file:com.liferay.blogs.demo.data.creator.internal.CreativeCommonsBlogsEntryDemoDataCreatorImpl.java

License:Open Source License

private String _getRandomSubtitle(int index) throws IOException {
    Class<?> clazz = getClass();

    String titlePath = StringBundler.concat("com/liferay/blogs/demo/data/creator/internal/dependencies",
            "/creative/commons/subtitle_", String.valueOf(index), ".txt");

    return StringUtil.read(clazz.getClassLoader(), titlePath, false);
}

From source file:com.liferay.blogs.demo.data.creator.internal.CreativeCommonsBlogsEntryDemoDataCreatorImpl.java

License:Open Source License

private String _getRandomTitle(int index) throws IOException {
    Class<?> clazz = getClass();

    String titlePath = StringBundler.concat("com/liferay/blogs/demo/data/creator/internal/dependencies",
            "/creative/commons/title_", String.valueOf(index), ".txt");

    return StringUtil.read(clazz.getClassLoader(), titlePath, false);
}

From source file:com.liferay.journal.demo.data.creator.internal.JournalArticleDemoDataCreatorImpl.java

License:Open Source License

private String _getContent(int index) throws IOException {
    Class<?> clazz = getClass();

    String contentPath = StringBundler.concat("com/liferay/journal/demo/data/creator/internal/dependencies",
            "/article", String.valueOf(index), "/content.txt");

    String content = StringUtil.read(clazz.getClassLoader(), contentPath, false);

    return _getStructuredContent(content);
}

From source file:com.liferay.journal.demo.data.creator.internal.JournalArticleDemoDataCreatorImpl.java

License:Open Source License

private Map<Locale, String> _getDescriptionMap(int index) throws IOException {

    Class<?> clazz = getClass();

    String descriptionPath = StringBundler.concat("com/liferay/journal/demo/data/creator/internal/dependencies",
            "/article", String.valueOf(index), "/description.txt");

    String description = StringUtil.read(clazz.getClassLoader(), descriptionPath, false);

    Map<Locale, String> descriptionMap = new HashMap<>();

    descriptionMap.put(LocaleUtil.getSiteDefault(), description);

    return descriptionMap;
}

From source file:com.liferay.journal.demo.data.creator.internal.JournalArticleDemoDataCreatorImpl.java

License:Open Source License

private Map<Locale, String> _getTitleMap(int index) throws IOException {
    Class<?> clazz = getClass();

    String titlePath = StringBundler.concat("com/liferay/journal/demo/data/creator/internal/dependencies",
            "/article", String.valueOf(index), "/title.txt");

    String title = StringUtil.read(clazz.getClassLoader(), titlePath, false);

    Map<Locale, String> titleMap = new HashMap<>();

    titleMap.put(LocaleUtil.getSiteDefault(), title);

    return titleMap;
}

From source file:com.liferay.petra.content.ContentUtil.java

License:Open Source License

private String _get(ClassLoader classLoader, String location, boolean all) {
    String content = _contentPool.get(location);

    if (content == null) {
        try {//from w w  w.  j a  v  a 2s. c o m
            content = StringUtil.read(classLoader, location, all);

            _put(location, content);
        } catch (IOException ioe) {
            _log.error(ioe, ioe);
        }
    }

    return content;
}

From source file:com.liferay.sample.adt.hook.events.StartupAction.java

License:Open Source License

public List<Element> getSampleTemplateElements() throws Exception {
    Class<?> clazz = getClass();

    String xml = StringUtil.read(clazz.getClassLoader(), _TEMPLATES_CONFIG_PATH, false);

    Document document = SAXReaderUtil.read(xml);

    Element rootElement = document.getRootElement();

    return rootElement.elements("template");
}