diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml
index 88749a35c5..d21456287e 100644
--- a/config/alfresco/core-services-context.xml
+++ b/config/alfresco/core-services-context.xml
@@ -349,15 +349,12 @@
-
-
+
+
-
-
-
diff --git a/config/alfresco/messages/version-service.properties b/config/alfresco/messages/version-service.properties
index 6d7a741cfb..24462679e1 100644
--- a/config/alfresco/messages/version-service.properties
+++ b/config/alfresco/messages/version-service.properties
@@ -6,3 +6,5 @@ version_service.err_unsupported=The current implementation of the version servic
version_service.err_one_preceeding=The current implementation of the version service only supports one preceeding version.
version_service.err_restore_no_version=The node {0} cannot be restore since there is no version information available for this node.
version_service.err_revert_mismatch=The version provided to revert to does not come from the nodes version history.
+version_service.initial_version=Initial version
+version_service.auto_version=Auto version
diff --git a/source/java/org/alfresco/repo/security/permissions/impl/PermissionServiceImpl.java b/source/java/org/alfresco/repo/security/permissions/impl/PermissionServiceImpl.java
index 9073501937..cb246f5cdf 100644
--- a/source/java/org/alfresco/repo/security/permissions/impl/PermissionServiceImpl.java
+++ b/source/java/org/alfresco/repo/security/permissions/impl/PermissionServiceImpl.java
@@ -283,6 +283,13 @@ public class PermissionServiceImpl implements PermissionServiceSPI, Initializing
{
return authorityType;
}
+
+ @Override
+ public String toString()
+ {
+ return accessStatus + " " + this.permission + " - " +
+ this.authority + " (" + this.authorityType + ")";
+ }
@Override
public boolean equals(Object o)
diff --git a/source/java/org/alfresco/repo/version/VersionServiceImpl.java b/source/java/org/alfresco/repo/version/VersionServiceImpl.java
index 388b9068c0..03a111787f 100644
--- a/source/java/org/alfresco/repo/version/VersionServiceImpl.java
+++ b/source/java/org/alfresco/repo/version/VersionServiceImpl.java
@@ -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);
+ }
+ }
}
}
diff --git a/source/java/org/alfresco/repo/version/VersionServiceImplTest.java b/source/java/org/alfresco/repo/version/VersionServiceImplTest.java
index 1f78d2876f..b04fe1b1a1 100644
--- a/source/java/org/alfresco/repo/version/VersionServiceImplTest.java
+++ b/source/java/org/alfresco/repo/version/VersionServiceImplTest.java
@@ -549,4 +549,64 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
});
}
+
+ public void testAddRemoveVersionableAspect()
+ {
+ HashMap props2 = new HashMap();
+ props2.put(ContentModel.PROP_NAME, "test.txt");
+ final NodeRef nodeRef = this.dbNodeService.createNode(
+ rootNodeRef,
+ ContentModel.ASSOC_CHILDREN,
+ QName.createQName("{test}MyVersionableNode2"),
+ TEST_TYPE_QNAME,
+ props2).getChildRef();
+ this.dbNodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
+
+ setComplete();
+ endTransaction();
+
+ TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork