"No item selector views found" 用于 JournalItemSelectorCriterion

"No item selector views found" for JournalItemSelectorCriterion

这应该是一个简单的任务,按照开发教程创建一个选择弹出窗口:https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/selecting-entities-using-the-item-selector

我遵循了这篇文章,将标准替换为 JournalItemSelectorCriterion。

RequestBackedPortletURLFactory requestBackedPortletURLFactory = RequestBackedPortletURLFactoryUtil.create( request );

List< ItemSelectorReturnType > itemSelectorReturnTypes = new ArrayList<>( );
itemSelectorReturnTypes.add( new UUIDItemSelectorReturnType( ) );

JournalItemSelectorCriterion itemSelectorCriterion = new JournalItemSelectorCriterion( );

itemSelectorCriterion.setDesiredItemSelectorReturnTypes( itemSelectorReturnTypes );

return itemSelector.getItemSelectorURL( requestBackedPortletURLFactory, selectedEventName, itemSelectorCriterion );

OSGi组件是有序的,否则我会得到一个空指针异常。

单击时,按钮确实会按预期打开对话框,但没有任何条目,只有一个大的:

Selection is not available.

日志中只有一条消息:

No item selector views found for com.liferay.journal.item.selector.criterion.JournalItemSelectorCriterion

$('#<portlet:namespace />selectJournal').on(
    'click',
    function(event) {
        var itemSelectorDialog = new A.LiferayItemSelectorDialog(
            {
                eventName: 'selectWcToSend',
                on: {
                    selectedItemChange: function(event) {
                        var selectedItem = event.newVal;

                        if (selectedItem) {
                            var itemValue = JSON.parse(
                            selectedItem.value
                        );
                        var wcUuid = itemValue.uuid;

                        $('#<portlet:namespace />uuid').val(wcUuid);
                    }
                }
                },
                title: '<liferay-ui:message key="select-web-content" />',
                url: "${journalSelectorUrl}"
            }
        );
        itemSelectorDialog.open();
    }
);

有什么想法吗?

ps: 使用 Liferay 7 GA5

ps2:同样的问题:https://web.liferay.com/community/forums/-/message_boards/view_message/104166898

有点奇怪:当我将 itemSelectorReturnTypes.add( new UUIDItemSelectorReturnType() ); 更改为 itemSelectorReturnTypes.add( new URLItemSelectorReturnType() );

时代码有效

关于此的信息不多,所以我将在这里留下我发现的内容:此特定标准不支持 UUID 作为 return 类型。

https://github.com/liferay/liferay-portal/blob/7.0.x/modules/apps/web-experience/journal/journal-item-selector-web/src/main/java/com/liferay/journal/item/selector/web/internal/JournalItemSelectorView.java

_supportedItemSelectorReturnTypes = Collections.unmodifiableList(
    ListUtil.fromArray(
        new ItemSelectorReturnType[] {
            new FileEntryItemSelectorReturnType(),
            new URLItemSelectorReturnType()
        }));