jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Brosius" <dbros...@mebigfatguy.com>
Subject Re: non versioned attributes on versioned nodes?
Date Sat, 16 Feb 2008 13:33:39 GMT
Thanks for the reply.

I have achieved partial success storing audit info in a child node's stream 
property. As this stream is a serialized object, it is easy to append audit 
information to it.

One associated problem, is that sometimes i receive a UUID of the parent 
document object to perform operations on, and sometimes i receive a UUID of 
a version of that parent document (by design). In either case, i want to add 
audit information regarding this operation. The problem is the audit object 
is hanging off the parent document, not the version, and so if passed a UUID 
of a version, i need to find the owning document and then navigate to the 
child audit object.

If i do

Node n = session.getNodeByUUID(uuid);

how do i determine if n is a Node or a Version, and more importantly how do 
i find the Node from the Version if n is a Version.

I see that if i do

if (n.getParent() instanceof Version)

that seems to determine the first, altho that seems odd to me.

how to I go from the Version to the Node?

Thanks again,

----- Original Message ----- 
From: "Jukka Zitting" <jukka.zitting@gmail.com>
To: <users@jackrabbit.apache.org>
Sent: Saturday, February 16, 2008 5:43 AM
Subject: Re: non versioned attributes on versioned nodes?

> Hi,
> On Feb 15, 2008 8:36 PM, Dave Brosius <dbrosius@mebigfatguy.com> wrote:
>>     I am trying to add a stream attribute to a versionable node that 
>> represents
>> auditing information regarding access to the node. To that end, i would 
>> prefer
>> that the these updates are not done in a checkout()/checkin() scenario as
>> i don't want these changes to be represented in the version history.
>> When i try to set this property however, i get an exception
>> javax.jcr.nodetype.ConstraintViolationException: cannot set the value of 
>> a protected property 
>> /jcr:system/jcr:versionStorage/9b/7f/44/9b7f44aa-8299-417f-98c7-29080e7968d7/1.0/jcr:frozenNode/AUDIT
>> Am I doing something wrong, or is it not possible to update properties 
>> outside
>> of versioning, or am i barking up the wrong tree, and there is a better 
>> way to do this?
> The version storage is write-protected, you can't modify checked in
> versions. You should rather modify the checked out copy in your
> workspace.
> If you don't want the AUDIT property copied to the version storage
> during checkin(), you can define it in a node type like the following:
>    <my=your namespace>
>    [my:auditable] mixin
>    - my:audit (BINARY) IGNORE
> Also, would something like a multivalued string property or even a set
> of more complex child nodes be more convenient for storing audit
> trails? Note that binary properties are not appendable in JCR.
> BR,
> Jukka Zitting 

View raw message