ALF-14964 add an additional check to the onAddAspect method to ensure that the node in question had the Versionable aspect before we proceeded to add Versionable properties

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42509 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Harpritt Kalsi
2012-10-11 08:41:56 +00:00
parent f78f18fdb7
commit 9bd6f02bf7

View File

@@ -357,7 +357,9 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
*/ */
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName) public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
{ {
if (this.nodeService.exists(nodeRef) == true && aspectTypeQName.equals(ContentModel.ASPECT_VERSIONABLE) == true) if (this.nodeService.exists(nodeRef) == true
&& this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true
&& aspectTypeQName.equals(ContentModel.ASPECT_VERSIONABLE) == true)
{ {
boolean initialVersion = true; boolean initialVersion = true;
Boolean value = (Boolean)this.nodeService.getProperty(nodeRef, ContentModel.PROP_INITIAL_VERSION); Boolean value = (Boolean)this.nodeService.getProperty(nodeRef, ContentModel.PROP_INITIAL_VERSION);