Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.service.cmr.repository
Interface CopyService

public interface CopyService
Copy operations service interface.

This interface provides methods to copy nodes within and across workspaces and to update the state of a node, with that of another node, within and across workspaces.

Author:
Roy Wetherall

Method Summary
void
copy(NodeRef sourceNodeRef, NodeRef destinationNodeRef)
          Copies the state of one node on top of another.
copy(NodeRef sourceNodeRef, NodeRef targetParentNodeRef, QName assocTypeQName, QName assocQName)
          By default children of the source node are not copied.
copy(NodeRef sourceNodeRef, NodeRef targetParentNodeRef, QName assocTypeQName, QName assocQName, boolean copyChildren)
          Creates a copy of the given node.
copyAndRename(NodeRef sourceNodeRef, NodeRef targetParentNodeRef, QName assocTypeQName, QName assocQName, boolean copyChildren)
getCopies(NodeRef nodeRef)
          Deprecated. This method is too open-ended. See getCopies(NodeRef, PagingRequest).
PagingResults<org.alfresco.service.cmr.repository.CopyService.CopyInfo>
getCopies(NodeRef originalNodeRef, NodeRef copyParentNodeRef, PagingRequest pagingRequest)
          Get the copies of a given node
PagingResults<org.alfresco.service.cmr.repository.CopyService.CopyInfo>
getCopies(NodeRef originalNodeRef, PagingRequest pagingRequest)
          Get the copies of a given node
getOriginal(NodeRef copiedNodeRef)
          Get the original for a given copied node
getTopLevelNodeNewName(NodeRef sourceNodeRef, NodeRef targetParentRef, QName assocTypeQName, QName assocQName)
          Determines if top-level node name will be changed during copy according to policies.
Method Detail
copy
@Auditable(parameters={
  "sourceNodeRef",
  "targetParentNodeRef",
  "assocTypeQName",
  "assocQName",
  "copyChildren"
})
NodeRef copy(NodeRef sourceNodeRef,
             NodeRef targetParentNodeRef,
             QName assocTypeQName,
             QName assocQName,
             boolean copyChildren)
Creates a copy of the given node.

If the new node resides in a different workspace the new node will have the same id.

NOTE: It is up to the client code to set the name of the newly created node. Use the node service and catch the DuplicateChildNodeNameException

If the new node resides in the same workspace then the new node will have the Copy aspect applied to it which will reference the original node.

The aspects applied to source node will also be applied to destination node and all the property value will be duplicated accordingly. This is with the exception of the aspects that have been marked as having 'Non-Transferable State'. In this case the aspect will be applied to the copy, but the properties will take on the default values.

Child associations are copied onto the destination node. If the child of copied association is not present in the destination workspace the child association is not copied. This is unless is has been specified that the children of the source node should also be copied.

Target associations are copied to the destination node. If the target of the association is not present in the destination workspace then the association is not copied.

Source association are not copied.

NOTE: The top-level node has it's cm:name property removed for associations that do not allow duplicately named children in order to prevent any chance of a duplicate name clash. Reassign the cm:name property and catch the DuplicateChildNodeNameException.

Parameters:
sourceNodeRef - the node reference used as the source of the copy
targetParentNodeRef - the intended parent of the new node
assocTypeQName - the type of the new child assoc
assocQName - the qualified name of the child association from the parent to the new node
copyChildren - indicates that the children of the node should also be copied
Returns:
the new node reference

copyAndRename
@Auditable(parameters={
  "sourceNodeRef",
  "targetParentNodeRef",
  "assocTypeQName",
  "assocQName",
  "copyChildren"
})
NodeRef copyAndRename(NodeRef sourceNodeRef,
                      NodeRef targetParentNodeRef,
                      QName assocTypeQName,
                      QName assocQName,
                      boolean copyChildren)
Parameters:
sourceNodeRef - the node reference used as the source of the copy
targetParentNodeRef - the intended parent of the new node
assocTypeQName - the type of the new child assoc
assocQName - the qualified name of the child association from the parent to the new node
copyChildren - indicates that the children of the node should also be copied
Returns:
the new node reference
See Also:
Ensures the copy name is the same as the origional or is renamed to prevent duplicate names.

copy
@Auditable(parameters={
  "sourceNodeRef",
  "targetParentNodeRef",
  "assocTypeQName",
  "assocQName"
})
NodeRef copy(NodeRef sourceNodeRef,
             NodeRef targetParentNodeRef,
             QName assocTypeQName,
             QName assocQName)
By default children of the source node are not copied.
Parameters:
sourceNodeRef - the node reference used as the source of the copy
targetParentNodeRef - the intended parent of the new node
assocTypeQName - the type of the new child assoc
assocQName - the qualified name of the child association from the parent to the new node
Returns:
the new node reference
See Also:
copy(NodeRef, NodeRef, QName, QName, boolean)

copy
@Auditable(parameters={
  "sourceNodeRef",
  "destinationNodeRef"
})
void copy(NodeRef sourceNodeRef,
          NodeRef destinationNodeRef)
Copies the state of one node on top of another.

The state of destination node is overlayed with the state of the source node. Any conflicts are resolved by setting the state to that of the source node.

If data (for example an association) does not exist on the source node, but does exist on the destination node this data is NOT deleted from the destination node.

Child associations and target associations are updated on the destination based on the current state of the source node.

If the node that either a child or target association points to on the source node is not present in the destinations workspace then the association is not updated to the destination node.

All aspects found on the source node are applied to the destination node where missing. The properties of the aspects are updated accordingly except in the case where the aspect has been marked as having 'Non-Transferable State'. In this case aspect properties will take on the values already assigned to them in the destination node.

Parameters:
sourceNodeRef - the source node reference
destinationNodeRef - the destination node reference

getOriginal
@Auditable(parameters="nodeRef")
NodeRef getOriginal(NodeRef copiedNodeRef)
Get the original for a given copied node
Parameters:
copiedNodeRef - the copied node reference
Returns:
the original node reference or null if it isn't a copy or the original has been deleted

getCopies
@Auditable(parameters="nodeRef")
List<NodeRefgetCopies(NodeRef nodeRef)
Deprecated. This method is too open-ended. See getCopies(NodeRef, PagingRequest).
Gets all the copies of a given node that have been made using this service.
Parameters:
nodeRef - the original node reference
Returns:
a list of copies, empty is none

getCopies
@Auditable(parameters="originalNodeRef")
PagingResults<org.alfresco.service.cmr.repository.CopyService.CopyInfo> getCopies(NodeRef originalNodeRef,
                                                                                  PagingRequest pagingRequest)
Get the copies of a given node
Parameters:
originalNodeRef - the original node reference
pagingRequest - page request details
Returns:
the page(s) of nodes that were copied from the given node

getCopies
@Auditable(parameters={
  "originalNodeRef",
  "copyParentNodeRef"
})
PagingResults<org.alfresco.service.cmr.repository.CopyService.CopyInfo> getCopies(NodeRef originalNodeRef,
                                                                                  NodeRef copyParentNodeRef,
                                                                                  PagingRequest pagingRequest)
Get the copies of a given node
Parameters:
originalNodeRef - the original node reference
copyParentNodeRef - only find copies that are homed in this node
pagingRequest - page request details
Returns:
the page(s) of nodes that were copied from the given node

getTopLevelNodeNewName
String getTopLevelNodeNewName(NodeRef sourceNodeRef,
                              NodeRef targetParentRef,
                              QName assocTypeQName,
                              QName assocQName)
Determines if top-level node name will be changed during copy according to policies.
Parameters:
sourceNodeRef - the node reference used as the source of the copy
targetParentRef - the intended parent of the new node
assocTypeQName - the type of the new child assoc
assocQName - the qualified name of the child association from the parent to the new node
Returns:
new name if top-level node will be renamed during copy or null if it will remain the same

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.