Merged DEV/CMIS_10 to HEAD

18731: SAIL-169: CMIS REST versioning compliance
      - Rendering of "via" link for working copy and "current-version" and "working-copy" links for documents
      - Added ability to dereference object IDs in cmisproperty() template function
      - Fixed broken CMIS index page


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18896 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2010-02-27 13:24:10 +00:00
parent 396dbb6ef7
commit 73f11285b7
3 changed files with 16 additions and 8 deletions

View File

@@ -28,8 +28,8 @@ public class CMISObjectNotFoundException extends CMISServiceException
{ {
private static final long serialVersionUID = 1726826685938651586L; private static final long serialVersionUID = 1726826685938651586L;
public CMISObjectNotFoundException(String objectId) public CMISObjectNotFoundException(String message)
{ {
super("Unable to find Object " + objectId, "objectNotFound", 404); super(message, "objectNotFound", 404);
} }
} }

View File

@@ -977,12 +977,12 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
NodeRef nodeRef = new NodeRef(nodeRefString); NodeRef nodeRef = new NodeRef(nodeRefString);
if (!nodeService.exists(nodeRef)) if (!nodeService.exists(nodeRef))
{ {
throw new CMISObjectNotFoundException(objectId); throw new CMISObjectNotFoundException("Unable to find object " + objectId);
} }
VersionHistory versionHistory = versionService.getVersionHistory(nodeRef); VersionHistory versionHistory = versionService.getVersionHistory(nodeRef);
if (versionHistory == null) if (versionHistory == null)
{ {
throw new CMISObjectNotFoundException(objectId); throw new CMISObjectNotFoundException("Unable to find object " + objectId);
} }
try try
{ {
@@ -994,7 +994,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
} }
catch (VersionDoesNotExistException e) catch (VersionDoesNotExistException e)
{ {
throw new CMISObjectNotFoundException(objectId); throw new CMISObjectNotFoundException("Unable to find object " + objectId);
} }
} }
else if (requiredType.isAssignableFrom(NodeRef.class)) else if (requiredType.isAssignableFrom(NodeRef.class))
@@ -1011,7 +1011,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
NodeRef nodeRef = new NodeRef(objectId); NodeRef nodeRef = new NodeRef(objectId);
if (!nodeService.exists(nodeRef)) if (!nodeService.exists(nodeRef))
{ {
throw new CMISObjectNotFoundException(objectId); throw new CMISObjectNotFoundException("Unable to find object " + objectId);
} }
if (isVersionable) if (isVersionable)
{ {
@@ -1192,7 +1192,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
VersionHistory versionHistory = versionService.getVersionHistory(versionSeries); VersionHistory versionHistory = versionService.getVersionHistory(versionSeries);
if (versionHistory == null) if (versionHistory == null)
{ {
throw new CMISObjectNotFoundException(objectId); throw new CMISObjectNotFoundException(objectId + " has no major version");
} }
Version current = versionService.getCurrentVersion(versionSeries); Version current = versionService.getCurrentVersion(versionSeries);
while (current != null && current.getVersionType() != VersionType.MAJOR) while (current != null && current.getVersionType() != VersionType.MAJOR)
@@ -1201,7 +1201,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
} }
if (current == null) if (current == null)
{ {
throw new CMISObjectNotFoundException(objectId); throw new CMISObjectNotFoundException(objectId + " has no major version");
} }
return current.getFrozenStateNodeRef(); return current.getFrozenStateNodeRef();
} }

View File

@@ -174,6 +174,14 @@ public class TemplateNode extends BasePermissionsNode implements NamespacePrefix
return this.services.getNodeService().exists(this.nodeRef); return this.services.getNodeService().exists(this.nodeRef);
} }
/**
* @return <code>true</code> if this node is a working copy
*/
public boolean getIsWorkingCopy()
{
return this.services.getNodeService().hasAspect(this.nodeRef, ContentModel.ASPECT_WORKING_COPY);
}
/** /**
* @return Returns the type. * @return Returns the type.
*/ */