mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
cm:copiedfrom aspect is not applied to copies of type not derived from cm:object
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29292 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -596,7 +596,12 @@ public class CopyServiceImpl implements CopyService
|
||||
originalAssoc.getTargetRef(),
|
||||
ContentModel.ASSOC_ORIGINAL);
|
||||
}
|
||||
// We create the link if the source is a cm:object
|
||||
QName sourceTypeQName = internalNodeService.getType(sourceNodeRef);
|
||||
if (dictionaryService.isSubClass(sourceTypeQName, ContentModel.TYPE_CMOBJECT))
|
||||
{
|
||||
internalNodeService.createAssociation(copyTarget, sourceNodeRef, ContentModel.ASSOC_ORIGINAL);
|
||||
}
|
||||
|
||||
// Copy permissions
|
||||
copyPermissions(sourceNodeRef, copyTarget);
|
||||
|
@@ -619,6 +619,31 @@ public class CopyServiceImplTest extends TestCase
|
||||
assertNull("Original should not be present. ", originalCheck);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the behaviour of the aspect when copying types not derived from <b>cm:object</b>
|
||||
*/
|
||||
public void testCopiedFromAspect_NonObject()
|
||||
{
|
||||
// Create the node used for copying
|
||||
ChildAssociationRef childAssocRef = nodeService.createNode(
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}test"),
|
||||
ContentModel.TYPE_BASE,
|
||||
createTypePropertyBag());
|
||||
NodeRef nodeRef = childAssocRef.getChildRef();
|
||||
// If we copy this, there should not be a cm:source association
|
||||
NodeRef copyNodeRef = copyService.copy(
|
||||
nodeRef,
|
||||
rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("{test}copyAssoc"));
|
||||
|
||||
assertFalse(
|
||||
"cm:copiedfrom should not be present",
|
||||
nodeService.hasAspect(copyNodeRef, ContentModel.ASPECT_COPIEDFROM));
|
||||
}
|
||||
|
||||
public void testCopyNodeWithRules()
|
||||
{
|
||||
// Create a new rule and add it to the source noderef
|
||||
|
Reference in New Issue
Block a user