Я новичок в бегемоте cms, поэтому извинения, если я не использую правильные терминологии.
Я перешел по этой ссылке и получил первый запрос, работающий cms hippo docs
У меня есть 2 типа докторов Master и Servant соответственно.
Ниже приведены файлы java и yaml Master doctype
@HippoEssentialsGenerated(internalName = "website:link")
public List<HippoBean> getLink() {
return getLinkedBeans("website:link", HippoBean.class);
}
код yaml
/link:
/cluster.options:
base.path: /content/documents
jcr:primaryType: frontend:pluginconfig
last.visited.enabled: true
nodetypes:
- website:servant
caption: Link
field: link
hint: ''
jcr:primaryType: frontend:plugin
plugin.class: org.hippoecm.frontend.editor.plugins.field.NodeFieldPlugin
wicket.id: ${cluster.id}.field
/link:
hipposysedit:mandatory: false
hipposysedit:multiple: true
hipposysedit:ordered: false
hipposysedit:path: website:link
hipposysedit:primary: false
hipposysedit:type: hippo:mirror
hipposysedit:validators:
- optional
jcr:primaryType: hipposysedit:field
Мастер получил связанное имячтобы связать с doctype серванта, как показано выше.
Теперь в doctype Servant я хотел бы показать основные данные, поэтому я добавил запрос, как показано ниже, и он работает, как и ожидалось.
public Master getParentDetails() {
final HstRequestContext context = RequestContextProvider.get();
try {
HstQuery linkedBeanQuery = ContentBeanUtils.createIncomingBeansQuery(
this.getCanonicalBean(), context.getSiteContentBaseBean(),
"*/website:link/@hippo:docbase",
Master.class, false);
linkedBeanQuery.setLimit(1);
return (Master) linkedBeanQuery.execute().getHippoBeans().nextHippoBean();
} catch (QueryException queryException) {
log.warn("QueryException ", queryException);
}
return null;
}
Проблема в том, что когда я изменяю класс плагина в Master на plugin.class: org.onehippo.forge.contentblocks.ContentBlocksFieldPlugin
и добавляю составной список compoundList: website:junior
, вещи перестают работать и выдают ошибку.
Обратите внимание, что теперь метод getlink () и link
Код yaml, показанный выше, перемещен в новый состав под названием junior.
Мастер предназначен только для разрешения нескольких соединений младшего с соответствующим кодом, как показано ниже.
@HippoEssentialsGenerated(internalName = "website:servantlink");
public List<HippoBean> getServantlink() {
return getLinkedBeans("website:servantlink", HippoBean.class);
}
код yaml
/servantlink:
/cluster.options:
jcr:primaryType: frontend:pluginconfig
nodetypes:
- website:servant
caption: groups
compoundList: website:junior
contentPickerType: links
field: servantlink
hint: ''
jcr:primaryType: frontend:plugin
plugin.class: org.onehippo.forge.contentblocks.ContentBlocksFieldPlugin
wicket.id: ${cluster.id}.field
wicket.skin: skin/content-blocks.css
/servantlink:
hipposysedit:mandatory: false
hipposysedit:multiple: true
hipposysedit:ordered: false
hipposysedit:path: website:servantlink
hipposysedit:type: hippo:compound
hipposysedit:validators:
- contentblocks-validator
jcr:primaryType: hipposysedit:fiel
Так что мой вопрос заключается в том, как запрос долженбыть сейчас?
Любая помощь будет принята с благодарностью.Заранее спасибо