public NodeRef execute() throws Throwable { return COPY_SERVICE.copy(originalContent, ruleFolder, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS); } });
PagingResults<CopyInfo> copies = copyService.getCopies( actionedUponNodeRef, destinationParent, this.copyService.copy(actionedUponNodeRef, copyNodeRef); this.copyService.copyAndRename( actionedUponNodeRef, destinationParent,
&& this.permissionService.hasPermission(actionedUponNodeRef, PermissionService.READ).equals(AccessStatus.ALLOWED)) NodeRef copiedFrom = copyService.getOriginal(actionedUponNodeRef); if (logger.isDebugEnabled() == true)
public void testCopyWorkingCopyForAlf8863() throws Exception { // Test that TopLevelNodeNewName is null for not working copies ChildAssociationRef assocRef = nodeService.getPrimaryParent(sourceNodeRef); String newNameAfterCopy = copyService.getTopLevelNodeNewName(sourceNodeRef, rootNodeRef, ContentModel.ASSOC_CHILDREN, assocRef.getQName()); assertNull(newNameAfterCopy); // Test that TopLevelNodeNewName is NOT null for working copies NodeRef workingCopyRef = cociService.checkout(sourceNodeRef); ChildAssociationRef assocWCRef = nodeService.getPrimaryParent(workingCopyRef); newNameAfterCopy = copyService.getTopLevelNodeNewName(workingCopyRef, rootNodeRef, ContentModel.ASSOC_CHILDREN, assocWCRef.getQName()); assertNotNull(newNameAfterCopy); assertTrue(newNameAfterCopy.startsWith(TEST_NAME)); assertFalse(newNameAfterCopy.contains("(Working Copy)")); // Test copyAndRename call NodeRef copyRef = copyService.copyAndRename(workingCopyRef, rootNodeRef, ContentModel.ASSOC_CHILDREN, null, false); String copyofWCName = (String)nodeService.getProperty(copyRef, ContentModel.PROP_NAME); assertTrue(copyofWCName.startsWith(TEST_NAME)); assertFalse(copyofWCName.contains("(Working Copy)")); }
public void testCopyAndRename() { // Check a normal copy with no dup restrictions NodeRef copy = copyService.copyAndRename( sourceNodeRef, rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}copyAssoc"), false); checkCopiedNode(sourceNodeRef, copy, true, true, false); assertTrue(TEST_NAME.equals(nodeService.getProperty(copy, ContentModel.PROP_NAME))); // Create a folder and content node Map<QName, Serializable> propsFolder = new HashMap<QName, Serializable>(1); propsFolder.put(ContentModel.PROP_NAME, "tempFolder"); NodeRef folderNode = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}tempFolder"), ContentModel.TYPE_FOLDER, propsFolder).getChildRef(); Map<QName, Serializable> props = new HashMap<QName, Serializable>(1); props.put(ContentModel.PROP_NAME, TEST_NAME); NodeRef contentNode = nodeService.createNode(folderNode, ContentModel.ASSOC_CONTAINS, QName.createQName("{test}renametest"), ContentModel.TYPE_CONTENT, props).getChildRef(); // Now copy the content node with the duplicate name restriction NodeRef contentCopy = copyService.copy(contentNode, folderNode, ContentModel.ASSOC_CONTAINS, QName.createQName("{test}bobbins"), false); assertFalse(TEST_NAME.equals(nodeService.getProperty(contentCopy, ContentModel.PROP_NAME))); }
copyNodeRef = copyService.copy( currentOriginal, rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}copyAssoc"+i)); copies = copyService.getCopies(currentOriginal, pageRequest); assertEquals("Incorrect number of copies on iteration " + i, 1, copies.getPage().size()); NodeRef originalCheck = copyService.getOriginal(copyNodeRef); assertEquals("Original is not as expected. ", currentOriginal, originalCheck); copies = copyService.getCopies(currentOriginal, pageRequest); assertEquals("Incorrect number of copies on iteration " + i, 1, copies.getPage().size()); copyNodeRef = copies.getPage().get(0).getNodeRef();
/** * Copy this Node and potentially all child nodes to a new parent destination. * * @param destination Node * @param deepCopy True for a deep copy, false otherwise. * * @return The newly copied Node instance or null if failed to copy. */ public ScriptNode copy(ScriptNode destination, boolean deepCopy) { ParameterCheck.mandatory("Destination Node", destination); NodeRef copyRef = this.services.getCopyService().copyAndRename(this.nodeRef, destination.getNodeRef(), ContentModel.ASSOC_CONTAINS, null, deepCopy); ScriptNode copy = newInstance(copyRef, this.services, this.scope); return copy; }
copies = copyService.getCopies(sourceNodeRef, pageRequest); assertEquals("Incorrect number of copies", 0, copies.getPage().size()); NodeRef copy = copyService.copy( sourceNodeRef, rootNodeRef, QName.createQName("{test}copyAssoc")); checkCopiedNode(sourceNodeRef, copy, true, true, false); copies = copyService.getCopies(sourceNodeRef, pageRequest); assertEquals("Incorrect number of copies", 1, copies.getPage().size()); NodeRef copy2 = copyService.copy( sourceNodeRef, rootNodeRef, true); checkCopiedNode(sourceNodeRef, copy2, true, true, true); copies = copyService.getCopies(sourceNodeRef, pageRequest); assertEquals("Incorrect number of copies", 2, copies.getPage().size()); NodeRef copyOfCopy = copyService.copy( copy, rootNodeRef, NodeRef copyWithContent = copyService.copy( sourceNodeRef, rootNodeRef,
String newNameAfterCopy = copyService.getTopLevelNodeNewName(sourceNodeRef, targetParentRef, assocTypeQname, qname); if (newNameAfterCopy != null && !newNameAfterCopy.equals(newName)) targetNodeRef = copyService.copy( sourceNodeRef, targetParentRef,
NodeRef copyNodeRef = copyService.copy( nodeRef, rootNodeRef, copies = copyService.getCopies(nodeRef, pageRequest); assertEquals("Total count not correct", new Pair<Integer, Integer>(i, i), copies.getTotalResultCount()); assertEquals("Incorrect number of copies", (i > 10 ? 10 : i), copies.getPage().size()); copies = copyService.getCopies(nodeRef, rootNodeRef, pageRequest); assertEquals("Total count not correct", new Pair<Integer, Integer>(i, i), copies.getTotalResultCount()); assertEquals("Incorrect number of copies", (i > 10 ? 10 : i), copies.getPage().size()); NodeRef originalCheck = copyService.getOriginal(copyNodeRef); assertEquals("Original is not as expected. ", nodeRef, originalCheck); copies = copyService.getCopies(nodeRef, rootNodeRef, pageRequest); assertEquals("Total count not correct", new Pair<Integer, Integer>(i, i), copies.getTotalResultCount()); assertEquals("Incorrect number of copies", (i > 10 ? 10 : i), copies.getPage().size()); copies = copyService.getCopies(nodeRef, sourceNodeRef, pageRequest); // Some arbitrary parent assertEquals("Expected to find no copies", 0, copies.getPage().size()); NodeRef originalCheck = copyService.getOriginal(firstCopy); assertNull("Original should not be present. ", originalCheck); assertFalse("Copy should not have cm:copiedfrom aspect. ", nodeService.hasAspect(firstCopy, ContentModel.ASPECT_COPIEDFROM));
/** * Copy this Node and potentially all child nodes to a new parent destination. * * @param destination Node * @param deepCopy True for a deep copy, false otherwise. * * @return The newly copied Node instance or null if failed to copy. */ public ScriptNode copy(ScriptNode destination, boolean deepCopy) { ParameterCheck.mandatory("Destination Node", destination); NodeRef copyRef = this.services.getCopyService().copyAndRename(this.nodeRef, destination.getNodeRef(), ContentModel.ASSOC_CONTAINS, null, deepCopy); ScriptNode copy = newInstance(copyRef, this.services, this.scope); return copy; }
String newNameAfterCopy = copyService.getTopLevelNodeNewName(sourceNodeRef, targetParentRef, assocTypeQname, qname); if (newNameAfterCopy != null && !newNameAfterCopy.equals(newName)) targetNodeRef = copyService.copy( sourceNodeRef, targetParentRef,
@Override public Void execute() throws Throwable { copyService.copy(testData.taggedDoc, testData.taggedDoc2); return null; } });
PagingResults<CopyInfo> copies = copyService.getCopies( actionedUponNodeRef, destinationParent, this.copyService.copy(actionedUponNodeRef, copyNodeRef); this.copyService.copyAndRename( actionedUponNodeRef, destinationParent,
copyService.copyAndRename( actionedUponNodeRef, destinationFolder,
&& this.permissionService.hasPermission(actionedUponNodeRef, PermissionService.READ).equals(AccessStatus.ALLOWED)) NodeRef copiedFrom = copyService.getOriginal(actionedUponNodeRef); if (logger.isDebugEnabled() == true)
@Override public NodeRef execute() throws Throwable { return COPY_SERVICE.copy(testDoc_Admin, testFolder, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS); } });
copyService.copyAndRename( actionedUponNodeRef, destinationFolder,