diff --git a/source/java/org/alfresco/cmis/CMISObjectNotFoundException.java b/source/java/org/alfresco/cmis/CMISObjectNotFoundException.java index 92ae86e2a4..74b17e47cc 100644 --- a/source/java/org/alfresco/cmis/CMISObjectNotFoundException.java +++ b/source/java/org/alfresco/cmis/CMISObjectNotFoundException.java @@ -28,8 +28,8 @@ public class CMISObjectNotFoundException extends CMISServiceException { 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); } } diff --git a/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java b/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java index 22f2ac8b6b..059f17edaa 100644 --- a/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java +++ b/source/java/org/alfresco/cmis/mapping/CMISServicesImpl.java @@ -977,12 +977,12 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, NodeRef nodeRef = new NodeRef(nodeRefString); if (!nodeService.exists(nodeRef)) { - throw new CMISObjectNotFoundException(objectId); + throw new CMISObjectNotFoundException("Unable to find object " + objectId); } VersionHistory versionHistory = versionService.getVersionHistory(nodeRef); if (versionHistory == null) { - throw new CMISObjectNotFoundException(objectId); + throw new CMISObjectNotFoundException("Unable to find object " + objectId); } try { @@ -994,7 +994,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, } catch (VersionDoesNotExistException e) { - throw new CMISObjectNotFoundException(objectId); + throw new CMISObjectNotFoundException("Unable to find object " + objectId); } } else if (requiredType.isAssignableFrom(NodeRef.class)) @@ -1011,7 +1011,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, NodeRef nodeRef = new NodeRef(objectId); if (!nodeService.exists(nodeRef)) { - throw new CMISObjectNotFoundException(objectId); + throw new CMISObjectNotFoundException("Unable to find object " + objectId); } if (isVersionable) { @@ -1192,7 +1192,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, VersionHistory versionHistory = versionService.getVersionHistory(versionSeries); if (versionHistory == null) { - throw new CMISObjectNotFoundException(objectId); + throw new CMISObjectNotFoundException(objectId + " has no major version"); } Version current = versionService.getCurrentVersion(versionSeries); while (current != null && current.getVersionType() != VersionType.MAJOR) @@ -1201,7 +1201,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware, } if (current == null) { - throw new CMISObjectNotFoundException(objectId); + throw new CMISObjectNotFoundException(objectId + " has no major version"); } return current.getFrozenStateNodeRef(); } diff --git a/source/java/org/alfresco/repo/template/TemplateNode.java b/source/java/org/alfresco/repo/template/TemplateNode.java index d061af669d..7d81ce898f 100644 --- a/source/java/org/alfresco/repo/template/TemplateNode.java +++ b/source/java/org/alfresco/repo/template/TemplateNode.java @@ -173,6 +173,14 @@ public class TemplateNode extends BasePermissionsNode implements NamespacePrefix { return this.services.getNodeService().exists(this.nodeRef); } + + /** + * @return true 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.