From users-return-15495-apmail-jackrabbit-users-archive=jackrabbit.apache.org@jackrabbit.apache.org Thu Jul 01 13:13:01 2010 Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 9318 invoked from network); 1 Jul 2010 13:13:01 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Jul 2010 13:13:01 -0000 Received: (qmail 213 invoked by uid 500); 1 Jul 2010 13:13:00 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 99925 invoked by uid 500); 1 Jul 2010 13:12:57 -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 99909 invoked by uid 99); 1 Jul 2010 13:12:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jul 2010 13:12:56 +0000 X-ASF-Spam-Status: No, hits=0.9 required=10.0 tests=RCVD_NUMERIC_HELO,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [194.116.198.209] (HELO gse-mta-10.emailfiltering.com) (194.116.198.209) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Jul 2010 13:12:48 +0000 Received: from 92.42.145.164 ([92.42.145.164]) by gse-mta-10.emailfiltering.com with emfmta (version 4.5.0.261) by TLS id 2472531452 for users@jackrabbit.apache.org;68c23d030d1771b2; Thu, 01 Jul 2010 14:10:28 +0100 Received: from mail.thisisnumero.com ([10.23.10.20]) by mail.thisisnumero.com ([10.23.10.20]) with mapi; Thu, 1 Jul 2010 14:13:09 +0100 From: Benjamin Brown To: "users@jackrabbit.apache.org" Date: Thu, 1 Jul 2010 14:11:55 +0100 Subject: RE: ImportXML and checked-in nodes Thread-Topic: ImportXML and checked-in nodes Thread-Index: AcsUbOcxTAX8Z4JHS4mNY1Hcm0DoJAEsQ2qw Message-ID: <3D1AC8CA263470468F17F7A8B9D1472F3EABB24847@mail.thisisnumero.com> References: <3D1AC8CA263470468F17F7A8B9D1472F3EABB24730@mail.thisisnumero.com> In-Reply-To: <3D1AC8CA263470468F17F7A8B9D1472F3EABB24730@mail.thisisnumero.com> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org In response to my own post and in case anyone else notices the (seeming) la= ck of feature for importing versioned nodes the following methods should ha= ndle the problem (where the path argument is the parent path of the root no= de being imported). There may still be other issues with it such as referen= ces which I've not dealt with. private void checkOutNodesPreImport(Session session, String path) throws P= athNotFoundException, RepositoryException { Node n =3D (Node)session.getItem(path); if (!n.isCheckedOut()) { n.checkout(); }=20 NodeIterator iter =3D n.getNodes(); if (iter !=3D null && iter.hasNext()) { Node subNode =3D iter.nextNode(); checkOutNodesPreImport(session, subNode.getPath()); } } private void checkInNodesPostImport(Session session, String path) throws P= athNotFoundException, RepositoryException { Node n =3D (Node)session.getItem(path); if (n.isModified()) { n.save(); } if (n.isCheckedOut()) { n.checkin(); }=20 NodeIterator iter =3D n.getNodes(); if (iter !=3D null && iter.hasNext()) { Node subNode =3D iter.nextNode(); checkInNodesPostImport(session, subNode.getPath()); } } All the best, Benjamin -----Original Message----- From: Benjamin Brown [mailto:benjamin.brown@thisisnumero.com]=20 Sent: 25 June 2010 14:47 To: users@jackrabbit.apache.org Subject: ImportXML and checked-in nodes Hi, I'm trying to get importXML working for a system view export and it fails w= ith exceptions (message wording changes depending on whether workspace/ses= sion) that the node I am trying to add to is checked in (I am using IMPORT= _UUID_COLLISION_REPLACE_EXISTING) . Now I know that in order to add nodes I= need to ensure they are checked out however I expected the importXML metho= d to do this automagically for me. If I need to do this manually before imp= ort does anyone have some example recursive code that will avoid the system= nodes and/or just alter the paths in an import? Many thanks, Benjamin ______________________________________________________________________ This email has been scanned for viruses by www.epagency.net If you consider this email spam, please forward it to spam@epagency.net ______________________________________________________________________