Example usage for org.apache.commons.lang StringUtils abbreviate

List of usage examples for org.apache.commons.lang StringUtils abbreviate

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils abbreviate.

Prototype

public static String abbreviate(String str, int maxWidth) 

Source Link

Document

Abbreviates a String using ellipses.

Usage

From source file:org.devproof.portal.core.module.common.model.ShortenModel.java

@Override
public String getObject() {
    String str = model.getObject();
    return StringUtils.abbreviate(str, maxSize);
}

From source file:org.devproof.portal.module.article.service.ArticleFeedProviderImpl.java

protected List<SyndEntry> generateFeedEntries(RequestCycle rc, Iterator<? extends Article> iterator) {
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    while (iterator.hasNext()) {
        Article article = iterator.next();
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(article.getTitle());
        entry.setLink(getUrl(rc, article));
        entry.setPublishedDate(article.getModifiedAt());
        entry.setAuthor(article.getModifiedBy());
        String content = article.getTeaser();
        content = content != null ? content : "";
        content = content.replaceAll("<(.|\n)*?>", "");
        SyndContent description = new SyndContentImpl();
        description.setType("text/plain");
        description.setValue(StringUtils.abbreviate(content, 200));
        entry.setDescription(description);
        entries.add(entry);//from ww w  .jav a 2s. c o  m
    }
    return entries;
}

From source file:org.devproof.portal.module.blog.service.BlogFeedProviderImpl.java

protected List<SyndEntry> generateFeedEntries(RequestCycle rc, Iterator<? extends Blog> iterator) {
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    while (iterator.hasNext()) {
        Blog blog = iterator.next();//from ww  w . j  a v a 2s . c  om
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(blog.getHeadline());
        entry.setLink(getUrl(rc, blog));
        entry.setPublishedDate(blog.getModifiedAt());
        entry.setAuthor(blog.getModifiedBy());
        String content = blog.getContent().replaceAll("<(.|\n)*?>", "");
        SyndContent description = new SyndContentImpl();
        description.setType("text/plain");
        description.setValue(StringUtils.abbreviate(content, 200));
        entry.setDescription(description);
        entries.add(entry);
    }
    return entries;
}

From source file:org.devproof.portal.module.bookmark.service.BookmarkFeedProviderImpl.java

protected List<SyndEntry> generateFeedEntries(RequestCycle rc, Iterator<? extends Bookmark> iterator) {
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    while (iterator.hasNext()) {
        Bookmark bookmark = iterator.next();
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(bookmark.getTitle());
        entry.setLink(getUrl(rc, bookmark));
        entry.setPublishedDate(bookmark.getModifiedAt());
        entry.setAuthor(bookmark.getModifiedBy());
        String content = bookmark.getDescription();
        content = content != null ? content : "";
        content = content.replaceAll("<(.|\n)*?>", "");
        SyndContent description = new SyndContentImpl();
        description.setType("text/plain");
        description.setValue(StringUtils.abbreviate(content, 200));
        entry.setDescription(description);
        entries.add(entry);//from  w ww  . j  a  v a  2  s  .c  o  m
    }
    return entries;
}

From source file:org.devproof.portal.module.download.service.DownloadFeedProviderImpl.java

protected List<SyndEntry> generateFeedEntries(RequestCycle rc, Iterator<? extends Download> iterator) {
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    while (iterator.hasNext()) {
        Download download = iterator.next();
        SyndEntry entry = new SyndEntryImpl();
        entry.setTitle(download.getTitle());
        entry.setLink(getUrl(rc, download));
        entry.setPublishedDate(download.getModifiedAt());
        entry.setAuthor(download.getModifiedBy());
        String content = download.getDescription();
        content = content != null ? content : "";
        content = content.replaceAll("<(.|\n)*?>", "");
        SyndContent description = new SyndContentImpl();
        description.setType("text/plain");
        description.setValue(StringUtils.abbreviate(content, 200));
        entry.setDescription(description);
        entries.add(entry);//from  w  w  w  . j a  v a  2 s.com
    }
    return entries;
}

From source file:org.drools.guvnor.server.builder.pagerow.CategoryRuleListPageRowBuilder.java

private CategoryPageRow makeCategoryPageRow(AssetItem assetItem) {
    CategoryPageRow row = new CategoryPageRow();
    //REVISIT: get a Path instance from drools-repository-vfs
    Path path = new PathImpl();
    path.setUUID(assetItem.getUUID());//from  w  ww .  jav  a2 s.co m
    row.setPath(path);
    row.setFormat(assetItem.getFormat());
    row.setName(assetItem.getName());
    row.setDescription(assetItem.getDescription());
    row.setAbbreviatedDescription(StringUtils.abbreviate(assetItem.getDescription(), 80));
    row.setLastModified(assetItem.getLastModified().getTime());
    row.setStateName(assetItem.getState().getName());
    row.setPackageName(assetItem.getModuleName());
    return row;
}

From source file:org.drools.guvnor.server.builder.pagerow.StatePageRowBuilder.java

private StatePageRow makeStatePageRow(AssetItem assetItem) {
    StatePageRow row = new StatePageRow();
    //REVISIT: get a Path instance from drools-repository-vfs
    Path path = new PathImpl();
    path.setUUID(assetItem.getUUID());//from w  ww . jav  a2 s  .c  om
    row.setPath(path);
    row.setFormat(assetItem.getFormat());
    row.setName(assetItem.getName());
    row.setDescription(assetItem.getDescription());
    row.setAbbreviatedDescription(StringUtils.abbreviate(assetItem.getDescription(), 80));
    row.setLastModified(assetItem.getLastModified().getTime());
    row.setStateName(assetItem.getState().getName());
    row.setPackageName(assetItem.getModuleName());
    return row;
}

From source file:org.drools.guvnor.server.util.AssetPageRowPopulator.java

public AssetPageRow populateFrom(AssetItem assetItem) {
    AssetPageRow row = new AssetPageRow();
    //REVISIT: get a Path instance from drools-repository-vfs
    Path path = new PathImpl();
    path.setUUID(assetItem.getUUID());/* w ww.j  av a  2s.  c  o  m*/
    row.setPath(path);
    row.setFormat(assetItem.getFormat());
    row.setName(assetItem.getName());
    row.setDescription(assetItem.getDescription());
    row.setAbbreviatedDescription(StringUtils.abbreviate(assetItem.getDescription(), 80));
    row.setStateName(assetItem.getStateDescription());
    row.setCreator(assetItem.getCreator());
    row.setCreatedDate(assetItem.getCreatedDate().getTime());
    row.setLastContributor(assetItem.getLastContributor());
    row.setLastModified(assetItem.getLastModified().getTime());
    row.setCategorySummary(assetItem.getCategorySummary());
    row.setExternalSource(assetItem.getExternalSource());
    row.setDisabled(assetItem.getDisabled());
    row.setValid(assetItem.getValid());
    return row;
}

From source file:org.drools.guvnor.server.util.AssetPageRowPopulator.java

public AssetPageRow populateFrom(Asset asset) {
    AssetPageRow row = new AssetPageRow();
    row.setPath(asset.getPath());//from   ww  w  .j av a 2  s .  com
    row.setFormat(asset.getFormat());
    row.setName(asset.getName());
    row.setDescription(asset.getDescription());
    row.setAbbreviatedDescription(StringUtils.abbreviate(asset.getDescription(), 80));
    row.setStateName(asset.getState());
    row.setCreator(asset.getLastContributor());
    row.setCreatedDate(asset.getDateCreated());
    row.setLastContributor(asset.getLastContributor());
    row.setLastModified(asset.getLastModified());
    //TODO:
    //row.setCategorySummary( asset.getMetaData().getCategories() );
    row.setExternalSource(asset.getMetaData().getExternalSource());
    row.setDisabled(asset.getMetaData().isDisabled());
    row.setValid(asset.getMetaData().getValid());
    return row;
}

From source file:org.drools.guvnor.server.util.QueryPageRowCreator.java

public static QueryPageRow makeQueryPageRow(AssetItem assetItem) {
    QueryPageRow row = new QueryPageRow();
    //REVISIT: get a Path instance from drools-repository-vfs
    Path path = new PathImpl();
    path.setUUID(assetItem.getUUID());//from w  w w  .  j  av a 2 s . c  o m
    row.setPath(path);
    row.setFormat(assetItem.getFormat());
    row.setName(assetItem.getName());
    row.setDescription(assetItem.getDescription());
    row.setAbbreviatedDescription(StringUtils.abbreviate(assetItem.getDescription(), 80));
    row.setPackageName(assetItem.getModuleName());
    row.setCreatedDate(assetItem.getCreatedDate().getTime());
    row.setLastModified(assetItem.getLastModified().getTime());
    return row;
}