【发布时间】:2019-07-05 15:28:41
【问题描述】:
我是 hippo cms 的新手,如果我没有使用正确的术语,我深表歉意。
我已点击此链接并获得了第一个查询 cms hippo docs
我分别有 2 个文档类型 Master 和 Servant。
主doctype java和yaml文件如下
@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
Master 已经获得了linkedbean 来链接到如上所示的servant doctype。
现在我想在仆人文档类型中显示主详细信息,所以我添加了一个如下所示的查询,它按预期工作。
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 的新化合物中。
Master 只是为了让多个组合的 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
所以我的问题是现在应该如何查询?
任何帮助将不胜感激。提前致谢
【问题讨论】:
标签: content-management-system hippocms