protected String doExportData(
      PortletDataContext context, String portletId, PortletPreferences preferences)
      throws Exception {

    context.addPermissions("com.liferay.portlet.journal", context.getScopeGroupId());

    String articleId = preferences.getValue("article-id", null);

    if (articleId == null) {
      if (_log.isWarnEnabled()) {
        _log.warn("No article id found in preferences of portlet " + portletId);
      }

      return StringPool.BLANK;
    }

    long articleGroupId = GetterUtil.getLong(preferences.getValue("group-id", StringPool.BLANK));

    if (articleGroupId <= 0) {
      if (_log.isWarnEnabled()) {
        _log.warn("No group id found in preferences of portlet " + portletId);
      }

      return StringPool.BLANK;
    }

    JournalArticle article = null;

    try {
      article =
          JournalArticleLocalServiceUtil.getLatestArticle(
              articleGroupId, articleId, WorkflowConstants.STATUS_APPROVED);
    } catch (NoSuchArticleException nsae) {
      if (_log.isWarnEnabled()) {
        _log.warn(
            "No approved article found with group id "
                + articleGroupId
                + " and article id "
                + articleId);
      }
    }

    if (article == null) {
      return StringPool.BLANK;
    }

    Document document = SAXReaderUtil.createDocument();

    Element rootElement = document.addElement("journal-content-data");

    String path = JournalPortletDataHandlerImpl.getArticlePath(context, article);

    Element articleElement = rootElement.addElement("article");

    articleElement.addAttribute("path", path);

    Element dlFoldersElement = rootElement.addElement("dl-folders");
    Element dlFilesElement = rootElement.addElement("dl-file-entries");
    Element dlFileRanksElement = rootElement.addElement("dl-file-ranks");
    Element igFoldersElement = rootElement.addElement("ig-folders");
    Element igImagesElement = rootElement.addElement("ig-images");

    JournalPortletDataHandlerImpl.exportArticle(
        context,
        rootElement,
        dlFoldersElement,
        dlFilesElement,
        dlFileRanksElement,
        igFoldersElement,
        igImagesElement,
        article,
        false);

    String structureId = article.getStructureId();

    if (Validator.isNotNull(structureId)) {
      JournalStructure structure =
          JournalStructureUtil.findByG_S(article.getGroupId(), structureId);

      JournalPortletDataHandlerImpl.exportStructure(context, rootElement, structure);
    }

    String templateId = article.getTemplateId();

    if (Validator.isNotNull(templateId)) {
      JournalTemplate template = JournalTemplateUtil.findByG_T(article.getGroupId(), templateId);

      JournalPortletDataHandlerImpl.exportTemplate(
          context,
          rootElement,
          dlFoldersElement,
          dlFilesElement,
          dlFileRanksElement,
          igFoldersElement,
          igImagesElement,
          template);
    }

    return document.formattedString();
  }