You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2011/07/25 13:07:32 UTC
svn commit: r1150629 - in /chemistry/opencmis/trunk:
chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/
chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apa...
Author: fmui
Date: Mon Jul 25 11:07:31 2011
New Revision: 1150629
URL: http://svn.apache.org/viewvc?rev=1150629&view=rev
Log:
CMIS-403: fixed version-history link
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java?rev=1150629&r1=1150628&r2=1150629&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java Mon Jul 25 11:07:31 2011
@@ -136,6 +136,7 @@ public final class Constants {
public static final String PARAM_SUB_RELATIONSHIP_TYPES = "includeSubRelationshipTypes";
public static final String PARAM_TYPE_ID = "typeId";
public static final String PARAM_UNFILE_OBJECTS = "unfileObjects";
+ public static final String PARAM_VERSION_SERIES_ID = "versionSeries";
public static final String PARAM_VERSIONIG_STATE = "versioningState";
public static final String PARAM_Q = "q";
public static final String PARAM_SEARCH_ALL_VERSIONS = "searchAllVersions";
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java?rev=1150629&r1=1150628&r2=1150629&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java Mon Jul 25 11:07:31 2011
@@ -179,7 +179,9 @@ public final class AtomPubUtils {
}
if (info.getVersionSeriesId() != null) {
- entry.writeVersionHistoryLink(compileUrl(baseUrl, RESOURCE_VERSIONS, info.getVersionSeriesId()));
+ UrlBuilder vsUrl = compileUrlBuilder(baseUrl, RESOURCE_VERSIONS, info.getId());
+ vsUrl.addParameter(Constants.PARAM_VERSION_SERIES_ID, info.getVersionSeriesId());
+ entry.writeVersionHistoryLink(vsUrl.toString());
}
if (!info.isCurrentVersion()) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java?rev=1150629&r1=1150628&r2=1150629&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java Mon Jul 25 11:07:31 2011
@@ -19,7 +19,6 @@
package org.apache.chemistry.opencmis.server.impl.atompub;
import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ENTRY;
-import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_VERSIONS;
import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
@@ -99,20 +98,16 @@ public class VersioningService {
HttpServletRequest request, HttpServletResponse response) throws Exception {
// get parameters
String objectId = getStringParameter(request, Constants.PARAM_ID);
+ String versionSeriesId = getStringParameter(request, Constants.PARAM_VERSION_SERIES_ID);
String filter = getStringParameter(request, Constants.PARAM_FILTER);
Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
// execute
- List<ObjectData> versions = service.getAllVersions(repositoryId, objectId, null, filter,
+ List<ObjectData> versions = service.getAllVersions(repositoryId, objectId, versionSeriesId, filter,
includeAllowableActions, null);
- if (versions == null) {
- throw new CmisRuntimeException("Versions are null!");
- }
-
- ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
- if (objectInfo == null) {
- throw new CmisRuntimeException("Version Series Info is missing!");
+ if (versions == null || versions.isEmpty()) {
+ throw new CmisRuntimeException("Version list is null or empty!");
}
// set headers
@@ -125,17 +120,20 @@ public class VersioningService {
feed.startFeed(true);
// write basic Atom feed elements
- feed.writeFeedElements(objectInfo.getId(), objectInfo.getCreatedBy(), objectInfo.getName(), objectInfo
- .getLastModificationDate(), null, null);
+ ObjectInfo latestObjectInfo = service.getObjectInfo(repositoryId, versions.get(0).getId());
+ ObjectInfo firstObjectInfo = service.getObjectInfo(repositoryId, versions.get(versions.size() - 1).getId());
+
+ feed.writeFeedElements(versionSeriesId, firstObjectInfo.getCreatedBy(), latestObjectInfo.getName(),
+ latestObjectInfo.getLastModificationDate(), null, null);
// write links
UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
feed.writeServiceLink(baseUrl.toString(), repositoryId);
- feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_VERSIONS, objectInfo.getId()), null);
-
- feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, objectId));
+ if (objectId != null) {
+ feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, objectId));
+ }
// write entries
AtomEntry entry = new AtomEntry(feed.getWriter());