From graffito-dev-return-619-apmail-incubator-graffito-dev-archive=www.apache.org@incubator.apache.org Sun Oct 23 20:27:01 2005 Return-Path: Delivered-To: apmail-incubator-graffito-dev-archive@www.apache.org Received: (qmail 63177 invoked from network); 23 Oct 2005 20:27:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Oct 2005 20:27:01 -0000 Received: (qmail 59028 invoked by uid 500); 23 Oct 2005 20:27:00 -0000 Mailing-List: contact graffito-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: graffito-dev@incubator.apache.org Delivered-To: mailing list graffito-dev@incubator.apache.org Received: (qmail 59017 invoked by uid 99); 23 Oct 2005 20:27:00 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Oct 2005 13:27:00 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [82.99.145.99] (HELO aura.cz) (82.99.145.99) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Oct 2005 13:26:58 -0700 Received: (qmail 11250 invoked from network); 23 Oct 2005 20:26:32 -0000 Received: from markoc.uvoz.aura.cz (HELO [192.168.1.183]) ([192.168.1.183]) (envelope-sender ) by aura.cz (qmail-ldap-1.03) with SMTP for ; 23 Oct 2005 20:26:32 -0000 Message-ID: <435BF102.5040204@aura.cz> Date: Sun, 23 Oct 2005 22:22:26 +0200 From: Martin Koci User-Agent: Thunderbird 1.4.1 (X11/20051006) MIME-Version: 1.0 To: graffito-dev@incubator.apache.org Subject: Re: Content Version support in Graffito References: <3b728ee90510201220l26b3d35eodc73bb506e7a2a4c@mail.gmail.com> In-Reply-To: <3b728ee90510201220l26b3d35eodc73bb506e7a2a4c@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, suggested API: void checkin(String absPath, Object versionableEntity, String[] newVersionNumbers) throws LockedException; void checkout(String absPath, Object versionableEntity) throws LockedException; String[] getVersionLabels(String absPath, Object cmsObject); void addVersionLabel(String absPath, Object entity, String versionLabel); and (maybe) working implementation: public void checkin(final String absPath, final Object versionableEntity, final String[] newVersionNumbers) throws LockedException { try { Node node = getNode(absPath); checkIfNodeLocked(absPath); Version newVersion = node.checkin(); VersionHistory versionHistory = node.getVersionHistory(); if (newVersionNumbers != null) { for (int i = 0; i < newVersionNumbers.length; i++) { String versionLabel = newVersionNumbers[i]; versionHistory.addVersionLabel(newVersion.getName(), versionLabel, false); } } } catch (UnsupportedRepositoryOperationException e) { // This catch UnsupportedRepositoryOperationException potentionally throwed with Node.checkout() // indicates that node is not versionable - it means coding bug in jcrmapping.xml/custom_nodes_types.xml throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Node is not mix:versionable. Path: " + absPath, e); } catch (RepositoryException e) { // This typically 'If another error occurs'. throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown error on checkin: ", e); } } public void checkout(final String absPath, final Object versionableEntity) throws LockedException { Node node; try { checkIfNodeLocked(absPath); node = getNode(absPath); node.checkout(); } catch (UnsupportedRepositoryOperationException e) { // This catch UnsupportedRepositoryOperationException potentionally throwed with Node.checkout() // indicates that node is not versionable - it means coding bug in jcrmapping.xml throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Node is not mix:versionable. Path: " + absPath, e); } catch (RepositoryException e) { // This eventually catch LockException e, but // this colud never happen - see upper code throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown error on checkout: ", e); } } public String[] getVersionLabels(final String absPath, final Object cmsObject) { try { Node node = getNode(absPath); VersionHistory vh = node.getVersionHistory(); VersionIterator versionIterator = vh.getAllVersions(); versionIterator.skip(1); vh.getBaseVersion(); Version version = versionIterator.nextVersion(); String[] versionLabels = vh.getVersionLabels(version); return versionLabels; } catch (UnsupportedRepositoryOperationException e) { // node.getVersionHistory() throws UnsupportedRepositoryOperationException if this node is not versionable. throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Node is not versionable: " + absPath); } catch (RepositoryException e) { throw new org.apache.portals.graffito.jcr.exception.RepositoryException(e.getMessage(), e); } } public void addVersionLabel(final String absPath, final Object entity, final String versionLabel) { try { final Node node = getNode(absPath); final VersionHistory versionHistory = node.getVersionHistory(); final boolean moveLabel = false; versionHistory.addVersionLabel(node.getBaseVersion().getName(), versionLabel, moveLabel); } catch (UnsupportedRepositoryOperationException e) { // node.getVersionHistory() throws UnsupportedRepositoryOperationException if this node is not versionable. throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Node is not versionable: " + absPath); } catch (RepositoryException e) { throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Unknown error on addVersionLabel: ", e); } } Christophe Lombart wrote: > Hi all, > > I'm still working on the JCR integration and I'm wondering what are our > needs in point of view content versionning ? > I would like to start with simple use cases but I want to know if someone > has specific requirements. > > Furthermore, how do you see the versionning API in the JCR-mapping > subproject ? > Do we create a new component (like the QueryManager) or add new methods in > the PersistenceManager ? > > All ideas, comments, thoughts are welcome. > > kind regards, > Christophe > >