Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D49CD939B for ; Thu, 22 Dec 2011 08:31:50 +0000 (UTC) Received: (qmail 75921 invoked by uid 500); 22 Dec 2011 08:31:50 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 75769 invoked by uid 500); 22 Dec 2011 08:31:47 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 75751 invoked by uid 99); 22 Dec 2011 08:31:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2011 08:31:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Dec 2011 08:31:42 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1F82823889D7; Thu, 22 Dec 2011 08:31:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1222093 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java Date: Thu, 22 Dec 2011 08:31:22 -0000 To: commits@chemistry.apache.org From: jens@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111222083122.1F82823889D7@eris.apache.org> Author: jens Date: Thu Dec 22 08:31:21 2011 New Revision: 1222093 URL: http://svn.apache.org/viewvc?rev=1222093&view=rev Log: set contentCopied flag properly and deal with the differences between AtomPub and WS bindings correctly Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java?rev=1222093&r1=1222092&r2=1222093&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java Thu Dec 22 08:31:21 2011 @@ -127,7 +127,9 @@ public class InMemoryVersioningServiceIm DocumentVersion pwc = verDoc.checkOut(content, user); objectId.setValue(pwc.getId()); // return the id of the created pwc - + if (null != contentCopied) // Note: always null in AtomPub binding + contentCopied.setValue(true); + // To be able to provide all Atom links in the response we need // additional information: if (context.isObjectInfoRequired()) { @@ -140,6 +142,8 @@ public class InMemoryVersioningServiceIm public List getAllVersions(CallContext context, String repositoryId, String objectId, String versionSeriesId, String filter, Boolean includeAllowableActions, ExtensionsData extension, ObjectInfoHandler objectInfos) { + // Note that in AtomPub object id is null and versionSeriesId is set and in SOAP bindinf versionSeriesId is set + // and objectId is null StoredObject so; List res = new ArrayList(); if (null == versionSeriesId) @@ -148,18 +152,23 @@ public class InMemoryVersioningServiceIm throw new CmisInvalidArgumentException("getAllVersions requires a version series id, but ist was null."); so = validator.getAllVersions(context, repositoryId, objectId, versionSeriesId, extension); + if (null == objectId) + objectId = versionSeriesId; + if (!(so instanceof VersionedDocument)) { - so = validator.getObject(context, repositoryId, objectId, extension); - ObjectData objData = getObject(context, repositoryId, objectId, filter, includeAllowableActions, - IncludeRelationships.NONE,extension, objectInfos); - res.add(objData); + if (!(so instanceof DocumentVersion)) + throw new CmisInvalidArgumentException("getAllVersions requires a id of a versioned document."); + so = ((DocumentVersion)so).getParentDocument(); } + ObjectData objData = getObject(context, repositoryId, objectId, filter, includeAllowableActions, + IncludeRelationships.NONE,extension, objectInfos); + res.add(objData); VersionedDocument verDoc = (VersionedDocument) so; res = new ArrayList(); List versions = verDoc.getAllVersions(); for (DocumentVersion version : versions) { - ObjectData objData = getObject(context, repositoryId, version.getId(), filter, includeAllowableActions, + objData = getObject(context, repositoryId, version.getId(), filter, includeAllowableActions, IncludeRelationships.NONE,extension, objectInfos); res.add(objData); }