问题描述
我只是想知道jcr:primaryType和jcr:mixinTypes有什么区别,为什么要使用jcr:mixinTypes呢?它代表什么?如果在crx中检查/ content / dam文件夹,它将jcr:primaryType属性值显示为sling:OrderedFolder,将jcr:mixinTypes显示为mix:lockable,rep:AccessControllable,其中jcr:primaryType表示这是一个吊索文件夹,但为何使用混合类型。还浏览了这些文档 ,但对差异的了解不多。
I am just curious to know what is the difference between jcr:primaryType and jcr:mixinTypes, and why exactly does jcr:mixinTypes is used ? what does it signifies ? If you check /content/dam folder in crx it shows jcr:primaryType property value as sling:OrderedFolder and jcr:mixinTypes as mix:lockable,rep:AccessControllable where jcr:primaryType means this a sling folder but why mixin type. Also went through these docs http://www.day.com/specs/jcr/1.0/6.7.4_Primary_and_Mixin_Node_Types.html http://www.day.com/specs/jcr/1.0/6.7.5_Special_Properties_jcr_primaryType_and_jcr_mixinTypes.html but yet doesn't gives much insight to the difference.
谢谢。
推荐答案
一个节点只能具有一个jcr:primaryType,但是可以具有多个jcr:mixinTypes,因此正确地看到混合作为节点的特征或其他方面。
A Node can have only one jcr:primaryType but it can have several jcr:mixinTypes, so it is correct to see the mixins as "traits" or additional aspects of a node.
而 数据优先,结构稍后。也许 规则建议尽量少使用主节点类型,因为它们通常暗示着强大的约束力,即mixi ns的约束要少得多,对于将节点标识为具有特定用途或属性非常有用。
While http://wiki.apache.org/jackrabbit/DavidsModel "Data First, Structure Later. Maybe" rule recommends using primary node types sparingly due to the strong constraints that they usually imply, mixins are much less constraining and very useful to identify nodes as having specific uses or properties.
例如,您提到的mix:lockable mixin用于表示节点可以被锁定。根据 http://www.day.com/specs/jcr/2.0/17_Locking.html,只有具有mixin节点类型mix:lockable的节点才能持有锁。任何类型的节点都可能被锁定,因此使用那种类型的节点是行不通的。
The mix:lockable mixin that you mention, for example, is used to express that a node can be locked. As per http://www.day.com/specs/jcr/2.0/17_Locking.html, only nodes with mixin node type mix:lockable may hold locks. Any type of node can potentially be locked, so using a node type for that wouldn't work.
这篇关于jcr:primaryType和jcr:mixinTypes有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!