jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "E.W. van der Steen" <e.w.van.der.st...@rug.nl>
Subject Structured mixin-types added to a nt:unstructured node
Date Fri, 13 Mar 2009 14:15:59 GMT
Hi all,

We're preparing for a migration to JCR and have read up on David's Model
on content modelling. We are going to embrace "Data first, structure
later (maybe)", but we want to be prepared for the "structure later", so
we did some testing. We're looking into what happens if you add a mixin
to already stored nodes, and I came across some unexpected behaviour.

When adding a mixin-type to a node of type nt:unstructured, it seems
that no type validation is done on the properties that are defined in
the mixin-type.

I could not clearly read in the specification whether this is as it
should be. I guess nt:unstructured means that even if you add a
mixin-type which requires structure, that will not really happen?

Could someone clarify this for me for better understanding of the model?
And if nt:unstructured nodes cannot be partly structured using mixin
types, how would do "Data first, structure later?".

I added my actions below as a reference.

Thanks in advance,

My actions:

I uploaded a XML-file through WEBDav in a newly created repository using
the 1.5 Jackrabbit webapp release. This creates a node of type nt:file,
with a childnode jcr:content of type nt:unstructured.

Then I defined the following mixin-type:

<rugcms = 'http://webplatform.rug.nl/jcr'>
- rugcms:type (long) mandatory
- rugcms:status (long) = '5' mandatory

and added this mixin to the jcr:content node:

testNode.setProperty("rugcms:type", Calendar.getInstance());
testNode.setProperty("rugcms:status", "published");

followed by a save(). The properties are added without exceptions.

But if I add it to the file node (type nt:file), this fails on the
setProperty() with the following error as expected:

javax.jcr.ValueFormatException: conversion failed: String to Long:
conversion to long failed: For input string: "published": conversion to
long failed: For input string: "published": For input string: "published"

drs. Eric Wout van der Steen
Rijksuniversiteit Groningen / CIT
tel. (050) 3639299

View raw message