Merge V1.3 to HEAD (3087:3098)

svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3087 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3098 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3343 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-07-18 15:44:45 +00:00
parent 6564a5011e
commit 6a13cb0ca2
6 changed files with 158 additions and 141 deletions

View File

@@ -802,25 +802,6 @@ public class VersionServiceImpl extends AbstractVersionServiceImpl
}
return result;
}
/**
* Checks the given node for the version aspect. Throws an exception if it is not present.
*
* @param nodeRef the node reference
* @throws AspectMissingException
* the version aspect is not present on the node
*/
private void checkForVersionAspect(NodeRef nodeRef)
throws AspectMissingException
{
QName aspectRef = ContentModel.ASPECT_VERSIONABLE;
if (this.nodeService.hasAspect(nodeRef, aspectRef) == false)
{
// Raise exception to indicate version aspect is not present
throw new AspectMissingException(aspectRef, nodeRef);
}
}
/**
@@ -1089,14 +1070,19 @@ public class VersionServiceImpl extends AbstractVersionServiceImpl
public void deleteVersionHistory(NodeRef nodeRef)
throws AspectMissingException
{
// First check that the versionable aspect is present
checkForVersionAspect(nodeRef);
// Get the version history node for the node is question and delete it
// Get the version history node for the node is question and delete it
NodeRef versionHistoryNodeRef = getVersionHistoryNodeRef(nodeRef);
this.dbNodeService.deleteNode(versionHistoryNodeRef);
// Reset the version label property on the versionable node
this.nodeService.setProperty(nodeRef, ContentModel.PROP_VERSION_LABEL, null);
if (versionHistoryNodeRef != null)
{
// Delete the version history node
this.dbNodeService.deleteNode(versionHistoryNodeRef);
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true)
{
// Reset the version label property on the versionable node
this.nodeService.setProperty(nodeRef, ContentModel.PROP_VERSION_LABEL, null);
}
}
}
}