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.cleverbus.core.common.directcall.DirectCallParams.java

@Override
public String toString() {
    return new ToStringBuilder(this).append("uri", uri).append("senderRef", senderRef)
            .append("soapAction", soapAction)
            .append("header", header != null ? StringUtils.abbreviate(header.toString(), 100) : "")
            .append("body", StringUtils.abbreviate(body.toString(), 100)).toString();
}

From source file:org.codelibs.fess.service.FailureUrlService.java

public void store(final CrawlingConfig crawlingConfig, final String errorName, final String url,
        final Throwable e) {
    final FailureUrlBhv failureUrlBhv = SingletonS2Container.getComponent(FailureUrlBhv.class);
    FailureUrl failureUrl = failureUrlBhv.selectEntity(cb -> {
        cb.query().setUrl_Equal(url);//from w w  w  . j av  a2s . c o  m
        if (crawlingConfig != null) {
            cb.query().setConfigId_Equal(crawlingConfig.getConfigId());
        }
    }).orElse(null);//TODO

    if (failureUrl != null) {
        failureUrl.setErrorCount(failureUrl.getErrorCount() + 1);
    } else {
        // new
        failureUrl = new FailureUrl();
        failureUrl.setErrorCount(1);
        failureUrl.setUrl(url);
        if (crawlingConfig != null) {
            failureUrl.setConfigId(crawlingConfig.getConfigId());
        }
    }

    failureUrl.setErrorName(errorName);
    failureUrl.setErrorLog(StringUtils.abbreviate(getStackTrace(e), 4000));
    failureUrl.setLastAccessTime(ComponentUtil.getSystemHelper().getCurrentTime());
    failureUrl.setThreadName(Thread.currentThread().getName());

    failureUrlBhv.insertOrUpdate(failureUrl);
}

From source file:org.codelibs.fess.transformer.AbstractFessFileTransformer.java

protected String abbreviate(final String str, final int maxWidth) {
    String newStr = StringUtils.abbreviate(str, maxWidth);
    try {// w w w. j  a  v a 2  s. com
        if (newStr.getBytes(Constants.UTF_8).length > maxWidth + abbreviationMarginLength) {
            newStr = StringUtils.abbreviate(str, maxWidth / 2);
        }
    } catch (final UnsupportedEncodingException e) {
        // NOP
    }
    return newStr;
}

From source file:org.codelibs.fess.transformer.AbstractFessFileTransformer.java

@Override
protected String getSite(final String url, final String encoding) {
    if (StringUtil.isBlank(url)) {
        return StringUtil.EMPTY; // empty
    }//from  w w  w.j  a va  2 s.co  m

    if (url.startsWith("file:////")) {
        final String value = decodeUrlAsName(url.substring(9), true);
        return StringUtils.abbreviate("\\\\" + value.replace('/', '\\'), maxSiteLength);
    } else if (url.startsWith("file:")) {
        final String value = decodeUrlAsName(url.substring(5), true);
        if (value.length() > 2 && value.charAt(2) == ':') {
            // Windows
            return StringUtils.abbreviate(value.substring(1).replace('/', '\\'), maxSiteLength);
        } else {
            // Unix
            return StringUtils.abbreviate(value, maxSiteLength);
        }
    }

    return super.getSite(url, encoding);
}

From source file:org.codelibs.fess.transformer.AbstractFessXpathTransformer.java

protected String getSite(final String u, final String encoding) {
    if (StringUtil.isBlank(u)) {
        return StringUtil.EMPTY; // empty
    }/*from  w  w  w .j  ava  2 s  .  co  m*/

    String url = u;
    int idx = url.indexOf("://");
    if (idx >= 0) {
        url = url.substring(idx + 3);
    }

    idx = url.indexOf('?');
    if (idx >= 0) {
        url = url.substring(0, idx);
    }

    if (encoding != null) {
        String enc;
        if (siteEncoding != null) {
            if (replaceSiteEncodingWhenEnglish) {
                if ("ISO-8859-1".equalsIgnoreCase(encoding) || "US-ASCII".equalsIgnoreCase(encoding)) {
                    enc = siteEncoding;
                } else {
                    enc = encoding;
                }
            } else {
                enc = siteEncoding;
            }
        } else {
            enc = encoding;
        }

        try {
            url = URLDecoder.decode(url, enc);
        } catch (final Exception e) {
        }
    }

    return StringUtils.abbreviate(url, maxSiteLength);
}

From source file:org.codelibs.fess.transformer.FessXpathTransformer.java

protected String getDocumentDigest(final ResponseData responseData, final Document document) {
    final String digest = getSingleNodeValue(document, digestXpath, false);
    if (StringUtil.isNotBlank(digest)) {
        return digest;
    }// w  w w.j  a va2  s . c  om

    final String body = normalizeContent(
            removeCommentTag(getSingleNodeValue(document, contentXpath, prunedCacheContent)));
    return StringUtils.abbreviate(body, maxDigestLength);
}

From source file:org.codelibs.fess.web.admin.WizardAction.java

protected String crawlingConfigInternal(final String crawlingConfigName, final String crawlingConfigPath) {

    String configName = crawlingConfigName;
    String configPath = crawlingConfigPath.trim();
    if (StringUtil.isBlank(configName)) {
        configName = StringUtils.abbreviate(configPath, 30);
    }/* w  w  w  .j a v a2 s.  c  o  m*/

    // normalize
    final StringBuilder buf = new StringBuilder();
    for (int i = 0; i < configPath.length(); i++) {
        final char c = configPath.charAt(i);
        if (c == '\\') {
            buf.append('/');
        } else if (c == ' ') {
            buf.append("%20");
        } else if (CharUtil.isUrlChar(c)) {
            buf.append(c);
        } else {
            try {
                buf.append(URLEncoder.encode(String.valueOf(c), Constants.UTF_8));
            } catch (final UnsupportedEncodingException e) {
            }
        }
    }
    configPath = convertCrawlingPath(buf.toString());

    final String username = systemHelper.getUsername();
    final LocalDateTime now = systemHelper.getCurrentTime();

    try {
        if (isWebCrawlingPath(configPath)) {
            // web
            final WebCrawlingConfig wConfig = new WebCrawlingConfig();
            wConfig.setAvailable(Constants.T);
            wConfig.setBoost(BigDecimal.ONE);
            wConfig.setCreatedBy(username);
            wConfig.setCreatedTime(now);
            if (StringUtil.isNotBlank(wizardForm.depth)) {
                wConfig.setDepth(Integer.parseInt(wizardForm.depth));
            }
            wConfig.setExcludedDocUrls(
                    getDefaultString("default.config.web.excludedDocUrls", StringUtil.EMPTY));
            wConfig.setExcludedUrls(getDefaultString("default.config.web.excludedUrls", StringUtil.EMPTY));
            wConfig.setIncludedDocUrls(
                    getDefaultString("default.config.web.includedDocUrls", StringUtil.EMPTY));
            wConfig.setIncludedUrls(getDefaultString("default.config.web.includedUrls", StringUtil.EMPTY));
            wConfig.setIntervalTime(getDefaultInteger("default.config.web.intervalTime",
                    Constants.DEFAULT_INTERVAL_TIME_FOR_WEB));
            if (StringUtil.isNotBlank(wizardForm.maxAccessCount)) {
                wConfig.setMaxAccessCount(Long.parseLong(wizardForm.maxAccessCount));
            }
            wConfig.setName(configName);
            wConfig.setNumOfThread(getDefaultInteger("default.config.web.numOfThread",
                    Constants.DEFAULT_NUM_OF_THREAD_FOR_WEB));
            wConfig.setSortOrder(getDefaultInteger("default.config.web.sortOrder", 1));
            wConfig.setUpdatedBy(username);
            wConfig.setUpdatedTime(now);
            wConfig.setUrls(configPath);
            wConfig.setUserAgent(
                    getDefaultString("default.config.web.userAgent", ComponentUtil.getUserAgentName()));

            webCrawlingConfigService.store(wConfig);

        } else {
            // file
            final FileCrawlingConfig fConfig = new FileCrawlingConfig();
            fConfig.setAvailable(Constants.T);
            fConfig.setBoost(BigDecimal.ONE);
            fConfig.setCreatedBy(username);
            fConfig.setCreatedTime(now);
            if (StringUtil.isNotBlank(wizardForm.depth)) {
                fConfig.setDepth(Integer.parseInt(wizardForm.depth));
            }
            fConfig.setExcludedDocPaths(
                    getDefaultString("default.config.file.excludedDocPaths", StringUtil.EMPTY));
            fConfig.setExcludedPaths(getDefaultString("default.config.file.excludedPaths", StringUtil.EMPTY));
            fConfig.setIncludedDocPaths(
                    getDefaultString("default.config.file.includedDocPaths", StringUtil.EMPTY));
            fConfig.setIncludedPaths(getDefaultString("default.config.file.includedPaths", StringUtil.EMPTY));
            fConfig.setIntervalTime(getDefaultInteger("default.config.file.intervalTime",
                    Constants.DEFAULT_INTERVAL_TIME_FOR_FS));
            if (StringUtil.isNotBlank(wizardForm.maxAccessCount)) {
                fConfig.setMaxAccessCount(Long.parseLong(wizardForm.maxAccessCount));
            }
            fConfig.setName(configName);
            fConfig.setNumOfThread(getDefaultInteger("default.config.file.numOfThread",
                    Constants.DEFAULT_NUM_OF_THREAD_FOR_FS));
            fConfig.setSortOrder(getDefaultInteger("default.config.file.sortOrder", 1));
            fConfig.setUpdatedBy(username);
            fConfig.setUpdatedTime(now);
            fConfig.setPaths(configPath);

            fileCrawlingConfigService.store(fConfig);
        }
        return configName;
    } catch (final Exception e) {
        logger.error("Failed to create crawling config: " + wizardForm.crawlingConfigPath, e);
        throw new SSCActionMessagesException(e, "errors.failed_to_create_crawling_config_at_wizard",
                wizardForm.crawlingConfigPath);
    }
}

From source file:org.codelibs.fess.web.IndexAction.java

protected String doSearchInternal() {
    final StringBuilder queryBuf = new StringBuilder(255);
    if (StringUtil.isNotBlank(indexForm.query)) {
        queryBuf.append(indexForm.query);
    }/* w  w  w  .  j a v  a  2s  .c o  m*/
    if (StringUtil.isNotBlank(indexForm.op)) {
        request.setAttribute(Constants.DEFAULT_OPERATOR, indexForm.op);
    }
    if (queryBuf.indexOf(" OR ") >= 0) {
        queryBuf.insert(0, '(').append(')');
    }
    if (indexForm.additional != null) {
        final Set<String> fieldSet = new HashSet<String>();
        for (final String additional : indexForm.additional) {
            if (StringUtil.isNotBlank(additional) && additional.length() < 1000
                    && !hasFieldInQuery(fieldSet, additional)) {
                queryBuf.append(' ').append(additional);
            }
        }
    }
    if (!indexForm.fields.isEmpty()) {
        for (final Map.Entry<String, String[]> entry : indexForm.fields.entrySet()) {
            final List<String> valueList = new ArrayList<String>();
            final String[] values = entry.getValue();
            if (values != null) {
                for (final String v : values) {
                    valueList.add(v);
                }
            }
            if (valueList.size() == 1) {
                queryBuf.append(' ').append(entry.getKey()).append(":\"").append(valueList.get(0)).append('\"');
            } else if (valueList.size() > 1) {
                queryBuf.append(" (");
                for (int i = 0; i < valueList.size(); i++) {
                    if (i != 0) {
                        queryBuf.append(" OR");
                    }
                    queryBuf.append(' ').append(entry.getKey()).append(":\"").append(valueList.get(i))
                            .append('\"');
                }
                queryBuf.append(')');
            }

        }
    }
    if (StringUtil.isNotBlank(indexForm.sort)) {
        queryBuf.append(" sort:").append(indexForm.sort);
    }
    if (indexForm.lang != null) {
        final Set<String> langSet = new HashSet<>();
        for (final String lang : indexForm.lang) {
            if (StringUtil.isNotBlank(lang) && lang.length() < 1000) {
                if (Constants.ALL_LANGUAGES.equalsIgnoreCase(lang)) {
                    langSet.add(Constants.ALL_LANGUAGES);
                } else {
                    final String normalizeLang = systemHelper.normalizeLang(lang);
                    if (normalizeLang != null) {
                        langSet.add(normalizeLang);
                    }
                }
            }
        }
        if (langSet.size() > 1 && langSet.contains(Constants.ALL_LANGUAGES)) {
            langSet.clear();
            indexForm.lang = new String[] { Constants.ALL_LANGUAGES };
        } else {
            langSet.remove(Constants.ALL_LANGUAGES);
        }
        appendLangQuery(queryBuf, langSet);
    } else if (Constants.TRUE.equals(
            crawlerProperties.getProperty(Constants.USE_BROWSER_LOCALE_FOR_SEARCH_PROPERTY, Constants.FALSE))) {
        final Set<String> langSet = new HashSet<>();
        final Enumeration<Locale> locales = request.getLocales();
        if (locales != null) {
            while (locales.hasMoreElements()) {
                final Locale locale = locales.nextElement();
                final String normalizeLang = systemHelper.normalizeLang(locale.toString());
                if (normalizeLang != null) {
                    langSet.add(normalizeLang);
                }
            }
            if (!langSet.isEmpty()) {
                appendLangQuery(queryBuf, langSet);
            }
        }
    }

    final String query = queryBuf.toString().trim();

    // init pager
    if (StringUtil.isBlank(indexForm.start)) {
        indexForm.start = String.valueOf(DEFAULT_START_COUNT);
    } else {
        try {
            Long.parseLong(indexForm.start);
        } catch (final NumberFormatException e) {
            indexForm.start = String.valueOf(DEFAULT_START_COUNT);
        }
    }
    if (StringUtil.isBlank(indexForm.num)) {
        indexForm.num = String.valueOf(getDefaultPageSize());
    }
    normalizePageNum();

    final int pageStart = Integer.parseInt(indexForm.start);
    final int pageNum = Integer.parseInt(indexForm.num);
    try {
        documentItems = searchService.getDocumentList(query, pageStart, pageNum, indexForm.facet, indexForm.geo,
                indexForm.mlt, queryHelper.getResponseFields(), queryHelper.getResponseDocValuesFields());
    } catch (final SolrLibQueryException e) {
        if (logger.isDebugEnabled()) {
            logger.debug(e.getMessage(), e);
        }
        throw new SSCActionMessagesException(e, "errors.invalid_query_unknown");
    } catch (final InvalidQueryException e) {
        if (logger.isDebugEnabled()) {
            logger.debug(e.getMessage(), e);
        }
        throw new SSCActionMessagesException(e, e.getMessageCode());
    } catch (final ResultOffsetExceededException e) {
        if (logger.isDebugEnabled()) {
            logger.debug(e.getMessage(), e);
        }
        throw new SSCActionMessagesException(e, "errors.result_size_exceeded");
    }
    // search
    final QueryResponseList queryResponseList = (QueryResponseList) documentItems;
    facetResponse = queryResponseList.getFacetResponse();
    moreLikeThisResponse = queryResponseList.getMoreLikeThisResponse();
    final NumberFormat nf = NumberFormat.getInstance(RequestUtil.getRequest().getLocale());
    nf.setMaximumIntegerDigits(2);
    nf.setMaximumFractionDigits(2);
    try {
        execTime = nf.format((double) queryResponseList.getExecTime() / 1000);
    } catch (final Exception e) {
        // ignore
    }

    final Clock clock = Clock.systemDefaultZone();
    indexForm.rt = Long.toString(clock.millis());

    // favorite
    if (favoriteSupport || screenShotManager != null) {
        indexForm.queryId = userInfoHelper.generateQueryId(query, documentItems);
        if (screenShotManager != null) {
            screenShotManager.storeRequest(indexForm.queryId, documentItems);
            screenShotSupport = true;
        }
    }

    // search log
    if (searchLogSupport) {
        final LocalDateTime now = systemHelper.getCurrentTime();

        final SearchLogHelper searchLogHelper = ComponentUtil.getSearchLogHelper();
        final SearchLog searchLog = new SearchLog();

        String userCode = null;
        if (Constants.TRUE
                .equals(crawlerProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE))) {
            userCode = userInfoHelper.getUserCode();
            if (StringUtil.isNotBlank(userCode)) {
                final UserInfo userInfo = new UserInfo();
                userInfo.setCode(userCode);
                userInfo.setCreatedTime(now);
                userInfo.setUpdatedTime(now);
                searchLog.setUserInfo(OptionalEntity.of(userInfo));
            }
        }

        searchLog.setHitCount(queryResponseList.getAllRecordCount());
        searchLog.setResponseTime(Integer.valueOf((int) queryResponseList.getExecTime()));
        searchLog.setSearchWord(StringUtils.abbreviate(query, 1000));
        searchLog.setSearchQuery(StringUtils.abbreviate(queryResponseList.getSearchQuery(), 1000));
        searchLog.setSolrQuery(StringUtils.abbreviate(queryResponseList.getSolrQuery(), 1000));
        searchLog.setRequestedTime(now);
        searchLog.setQueryOffset(pageStart);
        searchLog.setQueryPageSize(pageNum);

        searchLog.setClientIp(StringUtils.abbreviate(request.getRemoteAddr(), 50));
        searchLog.setReferer(StringUtils.abbreviate(request.getHeader("referer"), 1000));
        searchLog.setUserAgent(StringUtils.abbreviate(request.getHeader("user-agent"), 255));
        if (userCode != null) {
            searchLog.setUserSessionId(userCode);
        }
        final Object accessType = request.getAttribute(Constants.SEARCH_LOG_ACCESS_TYPE);
        if (accessType instanceof CDef.AccessType) {
            switch ((CDef.AccessType) accessType) {
            case Json:
                searchLog.setAccessType_Json();
                searchLog.setAccessType_Others();
                searchLog.setAccessType_Xml();
                break;
            case Xml:
                searchLog.setAccessType_Xml();
                break;
            case Others:
                searchLog.setAccessType_Others();
                break;
            default:
                searchLog.setAccessType_Web();
                break;
            }
        } else {
            searchLog.setAccessType_Web();
        }

        @SuppressWarnings("unchecked")
        final Map<String, List<String>> fieldLogMap = (Map<String, List<String>>) request
                .getAttribute(Constants.FIELD_LOGS);
        if (fieldLogMap != null) {
            for (final Map.Entry<String, List<String>> logEntry : fieldLogMap.entrySet()) {
                for (final String value : logEntry.getValue()) {
                    searchLog.addSearchFieldLogValue(logEntry.getKey(), StringUtils.abbreviate(value, 1000));
                }
            }
        }

        searchLogHelper.addSearchLog(searchLog);
    }

    final String[] highlightQueries = (String[]) request.getAttribute(Constants.HIGHLIGHT_QUERIES);
    if (highlightQueries != null) {
        final StringBuilder buf = new StringBuilder(100);
        for (final String q : highlightQueries) {
            buf.append("&hq=").append(q);
        }
        appendHighlightQueries = buf.toString();
    }

    Beans.copy(documentItems, this)
            .includes("pageSize", "currentPageNumber", "allRecordCount", "allPageCount", "existNextPage",
                    "existPrevPage", "currentStartRecordNumber", "currentEndRecordNumber", "pageNumberList",
                    "partialResults", "queryTime", "searchTime")
            .execute();

    return query;
}

From source file:org.davidmendoza.esu.service.impl.ArticuloServiceImpl.java

@Override
public void enviarArticulosDelMes(Date date) {
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    List<ReporteArticulo> articulos = this.articulosDelMes(date);

    StringBuilder sb = new StringBuilder();
    sb.append("<style>");
    sb.append("@import url(http://fonts.googleapis.com/css?family=Ubuntu);");
    sb.append("body {");
    sb.append("font: 16px/1.625em 'Ubuntu',Tahoma,sans-serif;");
    sb.append("font-size-adjust:none;");
    sb.append("font-style:normal;");
    sb.append("font-variant:normal;");
    sb.append("font-weight:normal;");
    sb.append("text-rendering: optimizeLegibility;");
    sb.append("}");
    sb.append("tbody tr:nth-child(odd) {background-color: #f9f9f9;}");
    sb.append("thead tr th, tbody tr td {padding: 8px;}");
    sb.append("tbody tr td{border-top: 1px solid #ddd;}");
    sb.append("</style>");
    sb.append("<h1>Vista de articulos hasta el ").append(sdf.format(date)).append("</h1>");
    sb.append("<p>Gracias por contribuir con uno o algunos de los ").append(articulos.size()).append(
            " artculos. Debajo encontrar una lista de cada artculo con cuntas vistas del mismo tenemos registradas a la fecha y 3 meses anteriores para que pueda ver el comportamiento que ha tenido ltimamente su artculo.</p>");
    sb.append(/*w  w  w  .  j av  a2 s . co m*/
            "<p>Los instamos a seguir contribuyendo con nuevos artculos, promocionar los artculos ya existentes en facebook, twitter, instagram, etc. y, con la ayuda del Espritu Santo, estos seguirn ayudando a difundir el mensaje de la Segunda Venida de nuestro Seor Jesucristo.</p>");
    sb.append(
            "<p>Si no desea recibir estos correos, al final del correo hay una liga para ser eliminado de la lista.</p>");
    sb.append("<table>");
    sb.append("<thead>");
    sb.append("<tr>");
    sb.append("<th style='text-align:left;'>").append("Artculo").append("</th>");
    sb.append("<th style='text-align:left;'>").append("Autor").append("</th>");
    sb.append("<th style='text-align:right;'>").append("Vistas").append("</th>");
    sb.append("<th style='text-align:right;'>").append("Hace 1 mes").append("</th>");
    sb.append("<th style='text-align:right;'>").append("Hace 2 meses").append("</th>");
    sb.append("<th style='text-align:right;'>").append("Hace 3 meses").append("</th>");
    sb.append("</tr>");
    sb.append("</thead>");
    sb.append("<tbody>");
    for (ReporteArticulo a : articulos) {
        String nombre = StringUtils.abbreviate(a.getNombre(), 40);
        sb.append("<tr>");
        sb.append("<td>").append("<a href='").append(a.getUrl()).append("'>").append(nombre)
                .append("</a></td>");
        sb.append("<td>").append(a.getAutor()).append("</td>");
        sb.append("<td style='text-align:right;'>").append(a.getVistas1()).append("</td>");
        sb.append("<td style='text-align:right;'>").append(a.getVistas2()).append("</td>");
        sb.append("<td style='text-align:right;'>").append(a.getVistas3()).append("</td>");
        sb.append("<td style='text-align:right;'>").append(a.getVistas4()).append("</td>");
        sb.append("</tr>");
    }
    sb.append("</tbody>");
    sb.append("</table>");

    try {
        log.debug("Creando correo");

        for (Usuario usuario : usuarioRepository.findAll()) {
            if (usuario.getUsername().equals("editor@um.edu.mx")
                    || usuario.getUsername().equals("autor@um.edu.mx")
                    || usuario.getUsername().equals("usuario@um.edu.mx")
                    || usuario.getUsername().equals("admin@um.edu.mx")) {
                continue;
            }
            SendGrid.Email email = new SendGrid.Email();
            email.addTo(usuario.getUsername());
            email.setFrom("contactoesu@um.edu.mx");
            email.setSubject("ESU:Vista de artculos hasta el " + sdf.format(date));
            email.setHtml(sb.toString());

            sendgrid.send(email);
        }
    } catch (Exception e) {
        log.error("No se pudo enviar correo", e);
        throw new RuntimeException("No se pudo enviar el correo: " + e.getMessage(), e);
    }

}

From source file:org.davidmendoza.esu.service.impl.PublicacionServiceImpl.java

@Cacheable(value = "popularesCache")
@Override/*from w  w  w. ja  va2  s .c  o  m*/
public List<Publicacion> populares(Pageable pageable) {

    Page<Popular> page = popularRepository.findAll(pageable);
    List<Publicacion> publicaciones = new ArrayList<>();
    for (Popular popular : page.getContent()) {
        publicaciones.add(popular.getPublicacion());
    }

    publicaciones.stream().forEach((z) -> {
        log.debug("{} : {} : {} : {} : {} : {}", z.getAnio(), z.getTrimestre(), z.getLeccion(), z.getTipo(),
                z.getDia(), z.getTema());
        if (StringUtils.isNotBlank(z.getArticulo().getDescripcion())) {
            String descripcion = z.getArticulo().getDescripcion();
            if (StringUtils.isNotBlank(descripcion) && !StringUtils.contains(descripcion, "iframe")) {
                descripcion = new HtmlToPlainText().getPlainText(Jsoup.parse(descripcion));
                z.getArticulo().setDescripcion(StringUtils.abbreviate(descripcion, 280));
            } else if (StringUtils.isNotBlank(descripcion)) {
                StringBuilder sb = new StringBuilder();
                sb.append("<div class='embed-responsive embed-responsive-16by9'>");
                sb.append(descripcion);
                sb.append("</div>");
                z.getArticulo().setDescripcion(sb.toString());
            }
        } else {
            Articulo articulo = articuloRepository.findOne(z.getArticulo().getId());
            String contenido = articulo.getContenido();
            if (StringUtils.isNotBlank(contenido) && !StringUtils.contains(contenido, "iframe")) {
                contenido = new HtmlToPlainText().getPlainText(Jsoup.parse(contenido));
                z.getArticulo().setDescripcion(StringUtils.abbreviate(contenido, 280));
            } else if (StringUtils.isNotBlank(contenido)) {
                StringBuilder sb = new StringBuilder();
                sb.append("<div class='embed-responsive embed-responsive-16by9'>");
                sb.append(contenido);
                sb.append("</div>");
                z.getArticulo().setDescripcion(sb.toString());
            }
        }
    });
    return publicaciones;
}