Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 20960 invoked from network); 23 Nov 2008 15:28:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Nov 2008 15:28:56 -0000 Received: (qmail 78855 invoked by uid 500); 23 Nov 2008 15:29:04 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 78839 invoked by uid 500); 23 Nov 2008 15:29:04 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 78828 invoked by uid 99); 23 Nov 2008 15:29:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Nov 2008 07:29:04 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=MSGID_MULTIPLE_AT,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [89.238.68.219] (HELO www.eiswind.de) (89.238.68.219) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Nov 2008 15:27:39 +0000 Received: by eiswind (Postfix, from userid 500) id AE7A9F0E0B; Sun, 23 Nov 2008 16:49:53 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on eiswind.eiswind.de X-Spam-Level: * Received: from ThomasLT (ppp-88-217-103-217.dynamic.mnet-online.de [88.217.103.217]) by eiswind (Postfix) with ESMTP id 0F785F0DFA for ; Sun, 23 Nov 2008 16:49:53 +0100 (CET) From: "Thomas Kratz" To: Subject: WG: WG: Still Stuck with Versioning Date: Sun, 23 Nov 2008 16:27:50 +0100 Message-ID: <008101c94d80$0bbc6b20$23354160$@kratz@eiswind.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AclNgKxhWA4SbCk/Sna5RJC91KIsoAAAoSjw Content-Language: de X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=1.3 required=5.0 tests=AWL,BAYES_00, MSGID_MULTIPLE_AT autolearn=no version=3.1.1 This is how I store the new version, from the comments you can see what = I ve been trying: public void persistDocumentAsNewVersion(Long userId, byte[] file, DocumentPath path) throws Exception { if (path.getKeyNodeUuid() =3D=3D null) { throw new UnsupportedOperationException( "Document cant have new version"); } Repository repository =3D Server.getRepository(); Session session =3D repository.login(new SimpleCredentials("system", "" .toCharArray())); try { Node key =3D null; key =3D session.getNodeByUUID(path.getKeyNodeUuid()); key.checkout(); User user =3D userDAO.findUserById(userId); key.setProperty("user", user.getLogin()); key.setProperty("userid", userId); Node fileNode =3D null; try { fileNode =3D key.getNode(path.getFilename()); } catch (PathNotFoundException x) { throw new IllegalStateException("File Not found in node", x); } // fileNode.checkout(); Node resNode =3D fileNode.getNode("jcr:content"); // resNode.checkout(); resNode.setProperty("jcr:data", new ByteArrayInputStream(file)); Calendar lastModified =3D Calendar.getInstance(); resNode.setProperty("jcr:lastModified", lastModified); session.save(); // resNode.checkin(); // fileNode.checkin(); key.checkin(); } catch (Exception x) { log.error("Adding Version", x); throw x; } finally { session.logout(); } } I can get a versioned node of the nt:unstructured, but when I access the nt:file like VersionHistory h =3D keynode.getVersionHistory(); VersionIterator ito =3D h.getAllVersions(); ito.nextVersion(); while (ito.hasNext()) { Version v =3D ito.nextVersion(); NodeIterator ito2 =3D v.getNodes("jcr:frozenNode"); if (ito2.hasNext()) { Node nextNode =3D ito2.nextNode(); =09 System.out.println(v.getCreated().getTime()); try { =09 System.out.println(nextNode.getName()); =09 System.out.println(nextNode.getProperty("user") =09 .getString()); =09 System.out.println(nextNode.getNodes() =09 .nextNode().getPrimaryNodeType().getName()); I get an nt:file as child of the frozen node that has no content and no uuid. Regards Thomas -----Urspr=FCngliche Nachricht----- Von: Julian Reschke [mailto:julian.reschke@gmx.de]=20 Gesendet: Sonntag, 23. November 2008 16:09 An: users@jackrabbit.apache.org Betreff: Re: WG: Still Stuck with Versioning Thomas Kratz wrote: > I investigated somewhat further. >=20 > =20 >=20 > Now I have made the nt:file child versionable, the versioned parent = node of > nt:unstructured truly has a child of nt:file but I don't get it right. = The > nt:file child has no neither a uuid (as the original node has) and is = not > of nt:frozenNode (what I would have expected). I would expect to see > frozenNodes as children of my VersionHistory node ??? >=20 > ... The nt:versionHistory node should have child nodes of type nt:version. BR, Julian