2015-11-09 39 views
1

我一直致力于在远程门户中创建JournalArticle。我成功创建了这篇文章。但是,当我尝试通过Web内容显示进行搜索时,它不可用。Liferay - 远程创建JournalArticle不可用于显示直到发布

只有当我手动去远程门户发布文章时它才可用。

有没有办法让文章可用于显示而无需手动发布?

请按照下面的图像进行澄清。

新标题1是我在远程portlet中创建的JournalArticle。下图显示了创建后的文章。

enter image description here

我尽量选择这篇文章将网站内容的显示。

enter image description here

enter image description here

enter image description here

正如你可以在上面看到,我无法找到的文章。 我回去手动发布文章。

enter image description here

然后我可以找到网站内容搜索的文章。

enter image description here

这实在是痛苦的,因为我们需要尽快,因为它是在门户网站创建找到那本杂志。有谁知道为什么会出现这个问题?有什么可以解决这个问题?

编辑:添加了在远程门户中创建JournalArticle的代码。

journalArticleSoap = journalSoap.addArticle(
    remoteGroupId, 
    journalFolderSoap.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(), 
    remoteTemplateKey, 
    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对象的远程门户。 remoteGroupId是远程门户的全局组标识 journalFolderSoap是远程创建的JournalFolderSoap对象文件夹。 article是本地门户中的JournalArticle。 remoteTemplateKey是创建的远程模板的templateKey。

+0

如何创建文章?你能告诉我们一些代码吗?这似乎是一个工作流程状态问题,也许直到手动发布文章处于Pending状态? –

+0

@MarcoMercuri用代码创建文章更新。 –

回答

2

我不明白为什么这个问题已在形成。但是当我执行管理控制面板下的“重新索引所有搜索索引”时,我发现问题得到解决。

所以我写了一个代码来自动执行它,如下所示。

try { 
    String[] companyIdArray = new String[1]; 
    companyIdArray[0] = ""+PortalUtil.getDefaultCompanyId(); 
    Indexer indexer=IndexerRegistryUtil.getIndexer(JournalArticle.class); 
    indexer.reindex(companyIdArray); 
} catch (PortalException e) { 
    e.printStackTrace(); 
} 

我在远程portlet控制器中提供了上述代码,并对其进行了REST调用。创建JournalArticle后,在远程环境中执行此操作可解决问题。

3

试试这个:

journalArticleSoap = journalSoap.addArticle(
    //your code 
); 

journalSoap.updateStatus(journalArticleSoap.getGroupId(), 
    journalArticleSoap.getArticleId(), 1, WorkflowConstants.STATUS_APPROVED, 
    journalArticleSoap.getUrlTitle(), serviceContext); 
+0

它似乎正在工作..我会测试更多,并接受你的答案。谢谢:-) –

+0

很高兴我可以帮忙! –

+0

嗨..我很抱歉,但它似乎不工作.. :-( –

相关问题