Liferay 7忽略AssetEntryQuery参数

时间:2017-03-28 11:57:45

标签: liferay 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的所有条目的List,而不会过滤它们的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参数,或者它是Liferay本身的一个错误?

1 个答案:

答案 0 :(得分:0)

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

AssetEntryQuery.setClassNameIds

而不是setClassTypeIds,看看是否有诀窍。