You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Daglian, Michael (IT)" <Mi...@morganstanley.com> on 2006/02/22 17:10:17 UTC

Automatic Mixins

Hi everyone,

I was curious if it's possible to automatically associate mixins with a
given primary node type. Using a mixin as a supertype seems to properly
associated the required properties (and responds true to
Node.isNodeType(mix:type) but does not set the jcr:mixinTypes property
nor expose nodes of that primary type when using queries of the form
//element(*, mix:type). Am I misinterpreting the spec in this regard? Is
there a recommended/possible way to achieve the above results
automatically? I am currently running a fairly old build (rev 374074
from 2/1). Thanks and apologies if this has been answered previously.

Best Regards,

-- Mike
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited.

Re: Automatic Mixins

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 2/22/06, Daglian, Michael (IT) <Mi...@morganstanley.com> wrote:
> I was curious if it's possible to automatically associate mixins with a
> given primary node type.

Yes. Your approach of adding the mixin types as supertypes of a
primary node type is the correct one.

> Using a mixin as a supertype seems to properly associated the
> required properties (and responds true to Node.isNodeType(mix:type)
> but does not set the jcr:mixinTypes property nor expose nodes of that
> primary type when using queries of the form //element(*, mix:type).

Section 6.7.5 of the JCR specification states (with the emphasis) that:

    Note that the mixin node types listed in the jcr:mixinTypes
    property are those that have been *explicitly assigned* (using
    Node.addMixin) to a node. It does not include mixin types that
    may be among the supertypes of a node's primary type.

Thus Jackrabbit is correct in not exposing such mixin types in the
jcr:mixinTypes property. However I believe that there is an error with
//element(*, mix:type). AFAIK the query should match the correct nodes
even if the given type is a (mixin) supertype. You may want to file a
bug report in Jira about this.

BR,

Jukka Zitting

--
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development