chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r927337 - in /incubator/chemistry/trunk/opencmis: opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/ opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/ opencmis-client/openc...
Date Thu, 25 Mar 2010 10:42:34 GMT
Author: fmui
Date: Thu Mar 25 10:42:34 2010
New Revision: 927337

URL: http://svn.apache.org/viewvc?rev=927337&view=rev
Log:
straightened version handling on client and server (related to CMIS-181)
added some object caching improvements
some cleanups

Modified:
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/VersioningServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java
    incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java
    incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/provider/VersioningService.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/DocumentInfo.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/FolderInfo.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomPubUtils.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/VersioningService.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/VersioningServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfo.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfoImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-support/src/main/java/org/apache/opencmis/server/support/ObjectInfoHelper.java

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-api/src/main/java/org/apache/opencmis/client/api/CmisObject.java
Thu Mar 25 10:42:34 2010
@@ -160,14 +160,23 @@ public interface CmisObject extends Obje
   // session handling
 
   /**
-   * returns true, if this object has pending changes which are not synced with the backend.
-   * 
-   * @return
+   * Returns true, if this object has pending changes which are not synced with the backend.
    */
   boolean isChanged();
 
   /**
+   * Returns the timestamp (in milliseconds) of the last refresh.
+   */
+  long getRefreshTimestamp();
+
+  /**
    * Reloads the data from the repository.
    */
   void refresh();
+
+  /**
+   * Reloads the data from the repository if the last refresh did not occur within
+   * <code>durationInMillis</code>.
+   */
+  void refreshIfOld(long durationInMillis);
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/AbstractPersistentCmisObject.java
Thu Mar 25 10:42:34 2010
@@ -72,6 +72,7 @@ public abstract class AbstractPersistent
   private List<Relationship> relationships;
   private OperationContext creationContext;
   private boolean isChanged = false;
+  private long refreshTimestamp;
 
   private final ReentrantReadWriteLock fLock = new ReentrantReadWriteLock();
 
@@ -820,6 +821,21 @@ public abstract class AbstractPersistent
   /*
    * (non-Javadoc)
    * 
+   * @see org.apache.opencmis.client.api.CmisObject#getRefreshTimestamp()
+   */
+  public long getRefreshTimestamp() {
+    readLock();
+    try {
+      return this.refreshTimestamp;
+    }
+    finally {
+      readUnlock();
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
    * @see
    * org.apache.opencmis.client.api.CmisObject#refresh(org.apache.opencmis.client.api.OperationContext
    * )
@@ -844,6 +860,23 @@ public abstract class AbstractPersistent
     }
   }
 
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.api.CmisObject#refreshIfOld(long)
+   */
+  public void refreshIfOld(long durationInMillis) {
+    writeLock();
+    try {
+      if (this.refreshTimestamp < System.currentTimeMillis() - durationInMillis) {
+        refresh();
+      }
+    }
+    finally {
+      writeUnlock();
+    }
+  }
+
   // --- internal ---
 
   /**

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-client-impl/src/main/java/org/apache/opencmis/client/runtime/PersistentDocumentImpl.java
Thu Mar 25 10:42:34 2010
@@ -205,9 +205,10 @@ public class PersistentDocumentImpl exte
    */
   public List<Document> getAllVersions(OperationContext context) {
     String objectId = getObjectId();
+    String versionSeriesId = getVersionSeriesId();
 
     List<ObjectData> versions = getProvider().getVersioningService().getAllVersions(
-        getRepositoryId(), objectId, context.getFilterString(),
+        getRepositoryId(), objectId, versionSeriesId, context.getFilterString(),
         context.isIncludeAllowableActions(), null);
 
     ObjectFactory objectFactory = getSession().getObjectFactory();

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/atompub/VersioningServiceImpl.java
Thu Mar 25 10:42:34 2010
@@ -35,6 +35,7 @@ import org.apache.opencmis.commons.api.E
 import org.apache.opencmis.commons.enums.IncludeRelationships;
 import org.apache.opencmis.commons.exceptions.CmisConnectionException;
 import org.apache.opencmis.commons.exceptions.CmisInvalidArgumentException;
+import org.apache.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.opencmis.commons.impl.Constants;
 import org.apache.opencmis.commons.impl.ReturnVersion;
@@ -246,20 +247,35 @@ public class VersioningServiceImpl exten
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.provider.VersioningService#getAllVersions(java.lang.String,
+   * @see org.apache.opencmis.commons.provider.VersioningService#getAllVersions(java.lang.String,
    * java.lang.String, java.lang.String, java.lang.Boolean,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.apache.opencmis.commons.api.ExtensionsData)
    */
   public List<ObjectData> getAllVersions(String repositoryId, String versionSeriesId,
       String filter, Boolean includeAllowableActions, ExtensionsData extension) {
+    throw new CmisNotSupportedException("Not supported by Atom binding! "
+        + "Use 'getAllVersions(String repositoryId, String objectId, String versionSeriesId,
"
+        + "String filter, Boolean includeAllowableActions, ExtensionsData extension)' instead!'");
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.opencmis.client.provider.VersioningService#getAllVersions(java.lang.String,
+   * java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.client.provider.ExtensionsData)
+   */
+  public List<ObjectData> getAllVersions(String repositoryId, String objectId,
+      String versionSeriesId, String filter, Boolean includeAllowableActions,
+      ExtensionsData extension) {
     List<ObjectData> result = new ArrayList<ObjectData>();
 
     // find the link
-    String link = loadLink(repositoryId, versionSeriesId, Constants.REL_VERSIONHISTORY,
+    String link = loadLink(repositoryId, objectId, Constants.REL_VERSIONHISTORY,
         Constants.MEDIATYPE_FEED);
 
     if (link == null) {
-      throwLinkException(repositoryId, versionSeriesId, Constants.REL_VERSIONHISTORY,
+      throwLinkException(repositoryId, objectId, Constants.REL_VERSIONHISTORY,
           Constants.MEDIATYPE_FEED);
     }
 
@@ -350,5 +366,4 @@ public class VersioningServiceImpl exten
 
     return object.getProperties();
   }
-
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/VersioningServiceImpl.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/VersioningServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/main/java/org/apache/opencmis/client/provider/spi/webservices/VersioningServiceImpl.java
Thu Mar 25 10:42:34 2010
@@ -120,9 +120,11 @@ public class VersioningServiceImpl exten
    * 
    * @see org.apache.opencmis.client.provider.VersioningService#checkIn(java.lang.String,
    * org.apache.opencmis.client.provider.Holder, java.lang.Boolean,
-   * org.apache.opencmis.client.provider.PropertiesData, org.apache.opencmis.client.provider.ContentStreamData,
-   * java.lang.String, java.util.List, org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.ExtensionsData)
+   * org.apache.opencmis.client.provider.PropertiesData,
+   * org.apache.opencmis.client.provider.ContentStreamData, java.lang.String, java.util.List,
+   * org.apache.opencmis.client.provider.AccessControlList,
+   * org.apache.opencmis.client.provider.AccessControlList,
+   * org.apache.opencmis.client.provider.ExtensionsData)
    */
   public void checkIn(String repositoryId, Holder<String> objectId, Boolean major,
       PropertiesData properties, ContentStreamData contentStream, String checkinComment,
@@ -151,6 +153,19 @@ public class VersioningServiceImpl exten
   /*
    * (non-Javadoc)
    * 
+   * @see org.apache.opencmis.commons.provider.VersioningService#getAllVersions(java.lang.String,
+   * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+   * org.apache.opencmis.commons.api.ExtensionsData)
+   */
+  public List<ObjectData> getAllVersions(String repositoryId, String objectId,
+      String versionSeriesId, String filter, Boolean includeAllowableActions,
+      ExtensionsData extension) {
+    return getAllVersions(repositoryId, versionSeriesId, filter, includeAllowableActions,
extension);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
    * @see org.apache.opencmis.client.provider.VersioningService#getAllVersions(java.lang.String,
    * java.lang.String, java.lang.String, java.lang.Boolean,
    * org.apache.opencmis.client.provider.ExtensionsData)
@@ -187,8 +202,9 @@ public class VersioningServiceImpl exten
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.provider.VersioningService#getObjectOfLatestVersion(java.lang.String,
-   * java.lang.String, java.lang.Boolean, java.lang.String, java.lang.Boolean,
+   * @see
+   * org.apache.opencmis.client.provider.VersioningService#getObjectOfLatestVersion(java.lang.String
+   * , java.lang.String, java.lang.Boolean, java.lang.String, java.lang.Boolean,
    * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
    * java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
    */
@@ -215,8 +231,8 @@ public class VersioningServiceImpl exten
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.VersioningService#getPropertiesOfLatestVersion(java.lang.String,
-   * java.lang.String, java.lang.Boolean, java.lang.String,
+   * org.apache.opencmis.client.provider.VersioningService#getPropertiesOfLatestVersion(java.lang
+   * .String, java.lang.String, java.lang.Boolean, java.lang.String,
    * org.apache.opencmis.client.provider.ExtensionsData)
    */
   public PropertiesData getPropertiesOfLatestVersion(String repositoryId, String VersionSeriesId,

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadOnlyTests.java
Thu Mar 25 10:42:34 2010
@@ -528,7 +528,7 @@ public abstract class AbstractSimpleRead
         PropertyIds.CMIS_BASE_TYPE_ID).getFirstValue();
     if (isVersionable(typeName)) {
       List<ObjectData> allVersions = getProvider().getVersioningService().getAllVersions(
-          getTestRepositoryId(), versionSeriesId, "*", Boolean.FALSE, null);
+          getTestRepositoryId(), objectId, versionSeriesId, "*", Boolean.FALSE, null);
       assertNotNull(allVersions);
       assertTrue(allVersions.size() > 0);
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-client/opencmis-provider-impl/src/test/java/org/apache/opencmis/client/provider/framework/AbstractSimpleReadWriteTests.java
Thu Mar 25 10:42:34 2010
@@ -365,7 +365,7 @@ public abstract class AbstractSimpleRead
 
     // there must be only one version in the version series
     List<ObjectData> allVersions = getProvider().getVersioningService().getAllVersions(
-        getTestRepositoryId(), getVersionSeriesId(docId), "*", Boolean.FALSE, null);
+        getTestRepositoryId(), docId, getVersionSeriesId(docId), "*", Boolean.FALSE, null);
     assertNotNull(allVersions);
     assertEquals(1, allVersions.size());
 
@@ -404,7 +404,7 @@ public abstract class AbstractSimpleRead
     assertFalse(isCheckedOut(docId));
 
     // there must be exactly two versions in the version series
-    allVersions = getProvider().getVersioningService().getAllVersions(getTestRepositoryId(),
+    allVersions = getProvider().getVersioningService().getAllVersions(getTestRepositoryId(),
docId,
         getVersionSeriesId(docId), "*", Boolean.FALSE, null);
     assertNotNull(allVersions);
     assertEquals(2, allVersions.size());

Modified: incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/provider/VersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/provider/VersioningService.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/provider/VersioningService.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-commons/opencmis-commons-api/src/main/java/org/apache/opencmis/commons/provider/VersioningService.java
Thu Mar 25 10:42:34 2010
@@ -50,7 +50,11 @@ public interface VersioningService {
   public PropertiesData getPropertiesOfLatestVersion(String repositoryId, String versionSeriesId,
       Boolean major, String filter, ExtensionsData extension);
 
+  public List<ObjectData> getAllVersions(String repositoryId, String objectId,
+      String versionSeriesId, String filter, Boolean includeAllowableActions,
+      ExtensionsData extension);
+
+  @Deprecated
   public List<ObjectData> getAllVersions(String repositoryId, String versionSeriesId,
       String filter, Boolean includeAllowableActions, ExtensionsData extension);
-
 }

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/DocumentInfo.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/DocumentInfo.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/DocumentInfo.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/DocumentInfo.java
Thu Mar 25 10:42:34 2010
@@ -28,7 +28,7 @@ public class DocumentInfo extends Object
     setHasAcl(true);
     setHasContent(true);
     setHasParent(true);
-    setHasVersionHistory(false);
+    setVersionSeriesId(null);
     setIsCurrentVersion(true);
     setRelationshipSourceIds(null);
     setRelationshipTargetIds(null);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/FolderInfo.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/FolderInfo.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/FolderInfo.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-fileshare/src/main/java/org/apache/opencmis/fileshare/FolderInfo.java
Thu Mar 25 10:42:34 2010
@@ -29,7 +29,7 @@ public class FolderInfo extends ObjectIn
     setFileName(null);
     setHasAcl(true);
     setHasContent(false);
-    setHasVersionHistory(false);
+    setVersionSeriesId(null);
     setIsCurrentVersion(true);
     setRelationshipSourceIds(null);
     setRelationshipTargetIds(null);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomPubUtils.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomPubUtils.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomPubUtils.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/AtomPubUtils.java
Thu Mar 25 10:42:34 2010
@@ -321,8 +321,9 @@ public final class AtomPubUtils {
       }
     }
 
-    if (info.hasVersionHistory()) {
-      entry.writeVersionHistoryLink(compileUrl(baseUrl, RESOURCE_VERSIONS, info.getId()));
+    if (info.getVersionSeriesId() != null) {
+      entry.writeVersionHistoryLink(compileUrl(baseUrl, RESOURCE_VERSIONS, info
+          .getVersionSeriesId()));
     }
 
     if (!info.isCurrentVersion()) {

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/VersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/VersioningService.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/VersioningService.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/atompub/VersioningService.java
Thu Mar 25 10:42:34 2010
@@ -101,23 +101,23 @@ public class VersioningService {
     CmisVersioningService service = factory.getVersioningService();
 
     // get parameters
-    String objectId = getStringParameter(request, Constants.PARAM_ID);
+    String versionSeriesId = getStringParameter(request, Constants.PARAM_ID);
     String filter = getStringParameter(request, Constants.PARAM_FILTER);
     Boolean includeAllowableActions = getBooleanParameter(request,
         Constants.PARAM_ALLOWABLE_ACTIONS);
 
     // execute
     ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-    List<ObjectData> versions = service.getAllVersions(context, repositoryId, objectId,
filter,
-        includeAllowableActions, null, objectInfoHolder);
+    List<ObjectData> versions = service.getAllVersions(context, repositoryId, versionSeriesId,
+        filter, includeAllowableActions, null, objectInfoHolder);
 
     if (versions == null) {
       throw new CmisRuntimeException("Versions are null!");
     }
 
-    ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(objectId);
+    ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(versionSeriesId);
     if (objectInfo == null) {
-      throw new CmisRuntimeException("Object Info is missing!");
+      throw new CmisRuntimeException("Version Series Info is missing!");
     }
 
     // set headers
@@ -140,7 +140,7 @@ public class VersioningService {
 
     feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_VERSIONS, objectInfo.getId()), null);
 
-    feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, objectId));
+    feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, versionSeriesId));
 
     // write entries
     AtomEntry entry = new AtomEntry(feed.getWriter());

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/test/java/org/apache/opencmis/server/impl/AtomEntryParserTest.java
Thu Mar 25 10:42:34 2010
@@ -19,7 +19,8 @@
 package org.apache.opencmis.server.impl;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -27,7 +28,6 @@ import java.io.ByteArrayOutputStream;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.opencmis.commons.PropertyIds;
 import org.apache.opencmis.commons.provider.ContentStreamData;
-import org.apache.opencmis.commons.provider.PropertyData;
 import org.apache.opencmis.commons.provider.PropertyStringData;
 import org.apache.opencmis.server.impl.atompub.AtomEntryParser;
 import org.junit.Test;

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/VersioningServiceImpl.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/VersioningServiceImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/VersioningServiceImpl.java
Thu Mar 25 10:42:34 2010
@@ -59,6 +59,12 @@ public class VersioningServiceImpl exten
         null);
   }
 
+  public List<ObjectData> getAllVersions(String repositoryId, String objectId, String
versionSeriesId,
+      String filter, Boolean includeAllowableActions, ExtensionsData extension) {
+
+    return getAllVersions(repositoryId, versionSeriesId, filter, includeAllowableActions,
extension);
+  }
+  
   public List<ObjectData> getAllVersions(String repositoryId, String versionSeriesId,
       String filter, Boolean includeAllowableActions, ExtensionsData extension) {
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java
Thu Mar 25 10:42:34 2010
@@ -84,19 +84,19 @@ public class AtomLinkInfoProvider {
       DocumentVersion ver = (DocumentVersion) so;
       DocumentVersion pwc = ver.getParentDocument().getPwc();
       objInfo.setIsCurrentVersion (ver == ver.getParentDocument().getLatestVersion(false));

-      objInfo.setHasVersionHistory(true);
+      objInfo.setVersionSeriesId(ver.getParentDocument().getId()); 
       objInfo.setWorkingCopyId(pwc==null ? null : pwc.getId());
       objInfo.setWorkingCopyOriginalId(pwc==ver ? ver.getParentDocument().getLatestVersion(false).getId()
: null);
     } else if (so instanceof VersionedDocument) {
       VersionedDocument doc = (VersionedDocument) so;
       DocumentVersion pwc = doc.getPwc();
       objInfo.setIsCurrentVersion (false); 
-      objInfo.setHasVersionHistory(true);
+      objInfo.setVersionSeriesId(doc.getId());
       objInfo.setWorkingCopyId(pwc==null ? null : pwc.getId());
       objInfo.setWorkingCopyOriginalId(null);      
     } else { // unversioned document
       objInfo.setIsCurrentVersion (true); 
-      objInfo.setHasVersionHistory(false);
+      objInfo.setVersionSeriesId(null);
       objInfo.setWorkingCopyId(null);
       objInfo.setWorkingCopyOriginalId(null);
     }

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfo.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfo.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfo.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfo.java
Thu Mar 25 10:42:34 2010
@@ -74,10 +74,10 @@ public interface ObjectInfo {
   boolean isCurrentVersion();
 
   /**
-   * Returns <code>true</code> if the object is a document and it is versionable,
<code>false</code>
-   * otherwise.
+   * Returns the version series id if the object is a document and it is versionable,
+   * <code>null</code> otherwise.
    */
-  boolean hasVersionHistory();
+  String getVersionSeriesId();
 
   /**
    * Returns the working copy id if the object is a document and a working copy exists,

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfoImpl.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfoImpl.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-spi/src/main/java/org/apache/opencmis/server/spi/ObjectInfoImpl.java
Thu Mar 25 10:42:34 2010
@@ -39,7 +39,7 @@ public class ObjectInfoImpl implements O
   private String fTypeId;
   private BaseObjectTypeIds fBaseObjectTypeId;
   private boolean fIsCurrentVersion = true;
-  private boolean fHasVersionHistory = false;
+  private String fVersionSeriesId = null;
   private String fWorkingCopyId = null;
   private String fWorkingCopyOriginalId = null;
   private boolean fHasContent = true;
@@ -127,12 +127,12 @@ public class ObjectInfoImpl implements O
     fIsCurrentVersion = currentVersion;
   }
 
-  public boolean hasVersionHistory() {
-    return fHasVersionHistory;
+  public String getVersionSeriesId() {
+    return fVersionSeriesId;
   }
 
-  public void setHasVersionHistory(boolean hasVersionHistory) {
-    fHasVersionHistory = hasVersionHistory;
+  public void setVersionSeriesId(String versionSeriesId) {
+    fVersionSeriesId = versionSeriesId;
   }
 
   public String getWorkingCopyId() {

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-support/src/main/java/org/apache/opencmis/server/support/ObjectInfoHelper.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-support/src/main/java/org/apache/opencmis/server/support/ObjectInfoHelper.java?rev=927337&r1=927336&r2=927337&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-support/src/main/java/org/apache/opencmis/server/support/ObjectInfoHelper.java
(original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-support/src/main/java/org/apache/opencmis/server/support/ObjectInfoHelper.java
Thu Mar 25 10:42:34 2010
@@ -208,12 +208,12 @@ public class ObjectInfoHelper
         // versioning information: 
         if (isVersioned) {          
           objInfo.setIsCurrentVersion(getBooleanProperty(properties, PropertyIds.CMIS_IS_LATEST_VERSION));

-          objInfo.setHasVersionHistory(true);
+          objInfo.setVersionSeriesId(getStringProperty(properties, PropertyIds.CMIS_VERSION_SERIES_ID));
           objInfo.setWorkingCopyId(getStringProperty(properties, PropertyIds.CMIS_VERSION_SERIES_CHECKED_OUT_ID));
           objInfo.setWorkingCopyOriginalId(getStringProperty(properties, PropertyIds.CMIS_VERSION_SERIES_CHECKED_OUT_ID));
         } else { // unversioned document
           objInfo.setIsCurrentVersion (true); 
-          objInfo.setHasVersionHistory(false);
+          objInfo.setVersionSeriesId(null);
           objInfo.setWorkingCopyId(null);
           objInfo.setWorkingCopyOriginalId(null);
         }



Mime
View raw message