Liferay - 无法将文档库项目附加到远程门户中的 JournalArticle

Liferay - Not able to attach a Document Library item to JournalArticle in Remote portal

我一直在尝试在远程门户中创建本地 JournalArticle 的副本。但是即使我在文章的 content 部分提供了正确的 URL,它也不会出现在门户中。我已经被这个问题卡住了好几天了。

我创建文章如下。

JournalArticleSoap journalArticleSoap = journalSoap.addArticle(
    remoteGroupId,
    article.getFolderId(),
    article.getClassNameId(),
    article.getClassPK(),
    "",
    true,
    LocalizationUtil.getAvailableLanguageIds(article.getTitle()),
    titleMapValues.toArray(new String[titleMapValues.size()]),
    LocalizationUtil.getAvailableLanguageIds(article.getDescription()),
    descriptionMapValues.toArray(new String[descriptionMapValues.size()]),
    content,
    article.getType(),
    article.getStructureId(),
    newRemoteTemplate.getTemplateKey(),
    article.getLayoutUuid(),
    displayDate.get(Calendar.MONTH),
    displayDate.get(Calendar.DAY_OF_MONTH),
    displayDate.get(Calendar.YEAR),
    displayDate.get(Calendar.HOUR),
    displayDate.get(Calendar.MINUTE),
    0, 0, 0, 0, 0, //expirationDate
    article.getExpirationDate() == null,
    0, 0, 0, 0, 0,
    true,
    article.isIndexable(),
    article.getUrlTitle(),
    serviceContext);

其中 journalSoap 是远程门户的 JournalArticleServiceSoap,article 是本地 JournalArticle。

内容如下

<?xml version="1.0"?>

<root available-locales="en_US" default-locale="en_US">
    <dynamic-element name="Text2001" type="text" index-type="keyword" index="0">
        <dynamic-content language-id="en_US"><![CDATA[Desert image]]></dynamic-content>
    </dynamic-element>
    <dynamic-element name="Documents_and_Media2051" type="document_library" index-type="keyword" index="0">
        <dynamic-content language-id="en_US"><![CDATA[/documents/20101/20201/Photo1]]></dynamic-content>
    </dynamic-element>
</root>

上述url(/documents/20101/20201/Photo1)中,20101为远程门户的全局组ID,20201为创建Photo1的远程文档库中文件夹的id。当我转到 http://host:port/documents/20101/20201/Photo1 时,我下载了文件。但是,远程门户中的文章仍然如下所示。

如您所见,我正在获取远程文章中的文本动态元素 "Desert image"。但是我没有从文档库中获取动态元素到远程文章中。谁能告诉我我做错了什么。

只需从前端创建一个结构化的(仅包含 D&M 上传者字段)文章并在数据库中检查 XML,您就会发现到底出了什么问题。

问题是我从 url 中删除了 uuid 和创建时间戳。

当我用 /documents/20101/20201/Photo1/uuid?t=timestamp 替换 /documents/20101/20201/Photo1 时,它开始工作了。这里uuid是uuid,timestamp是文件Photo1的创建时间(long型)