2017-03-28 66 views
0

AssetEntryQuery忽略我设置的所有参数,从而执行通配符查询并检索所有资产条目。Liferay 7忽略AssetEntryQuery参数

片段的我在做什么现在:

long[] classTypeIds = new long[] { 30837 }; 

AssetEntryQuery assetQuery = new AssetEntryQuery(); 
assetQuery.setClassTypeIds(classTypeIds); 

List<AssetEntry> entries = AssetEntryLocalServiceUtil.getEntries(assetQuery); 

foreach (AssetEntry entry : entries) { 
    System.out.printf("Entry with classTypeId %d expected %d", entry.getClassTypeId(), 30837); 
} 

当我执行这个代码,它的Liferay返回所有项的列表没有他们classTypeId被过滤。

输出:

[...] 
Entry with classTypeId 0 expected 30837 
Entry with classTypeId 0 expected 30837 
Entry with classTypeId 28920 expected 30837 
Entry with classTypeId 30331 expected 30837 
Entry with classTypeId 30837 expected 30837 
Entry with classTypeId 30837 expected 30837 
Entry with classTypeId 30837 expected 30837 
Entry with classTypeId 30921 expected 30837 
[...] 

我思念的东西,所以Liferay的无视我的AssetEntryQuery params中,是内Liferay的本身就是一个错误?

+0

我很好奇你的情况。该代码认识到有不同的'classTypeId's(所以它与数据库中0的值没有关系,正如我在下面的回答中提到的)。如果'classNameId'对你的用例不好,我建议尝试在Liferay论坛上发布。 https://web.liferay.com/community/forums –

回答

0

我不知道它是否有意或不可能(但可能不是),但在我的数据库的assetentry表(我只看它的开发目的,因为它从来不建议直接向数据库做任何事情),classtypeid字段为0,用于构建最新的liferay-portal主分支中的所有条目。这仅仅是一个在黑暗中拍摄,但你可以尝试调用

AssetEntryQuery.setClassNameIds

,而不是setClassTypeIds,看看如果这样做的伎俩。

+0

谢谢你的回答Russ。据我了解,classTypeId用于链接AssetEntries和DDM,而classNameId用于链接AssetEntries及其支持类(JournalArticle,DLFileEntry等),因此它不能解决问题。你知道向liferay报告错误吗?他们的问题跟踪器(http://issues.liferay.com/)已关闭注册。 – Tylerian

+0

是的,我不确定'classTypeId'是什么,但我想这是有道理的。正如你所说的,'classNameID'意在将资产入口(在这种情况下)与支持类关联起来。 –