public class IfsCopyCommand extends IfsCommand
po
is a non-Folder object:
overwrite
is True, existing PublicObject in
folder
will be overwritten.
overwrite
is False, a new copy will be created
with the naming convention "Copy of .." for the first copy, and
"Copy (#) of .." for all other copies.
po
is a Folder object:
overwrite
is True, the content of po
will be copied over to the existing PublicObject in
folder
with versioning semantics.
overwrite
is False, a new copy will be created
with the naming convention "Copy of .." for the first copy, and
"Copy (#) of .." for all other copies.
IfsCommand
Modifier and Type | Field and Description |
---|---|
protected IfsDetermineAclCommand |
m_DetermineAclCommand
Object that contains the logic for determining the Acl.
|
protected CommandContextPool |
m_DetermineAclContextPool
Context pool for command contexts.
|
protected IfsHandlePublicObjectVersioningCommand |
m_HandlePublicObjectVersioningCommand
Object that contains the logic for determining the Acl.
|
protected CommandContextPool |
m_HandlePublicObjectVersioningContextPool
Context pool for command contexts.
|
Constructor and Description |
---|
IfsCopyCommand()
Default Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
copy(LibrarySession session,
FolderPathResolver fpr,
PublicObject srcPO,
Folder destParentFolder,
String newName,
boolean shouldOverwrite)
Copy the PublicObject po into the specified folder.
|
protected PublicObject |
copyFolderWithNameConflictOverwrite(LibrarySession session,
FolderPathResolver fpr,
Folder fromFolder,
Folder toFolder)
Recursively copies the folder, overwriting any objects with a name conflict.
|
protected PublicObject |
copyNoNameConflict(LibrarySession session,
PublicObject srcPO,
Folder destParentFolder,
String newName)
Copies the PublicObject and adds the new PublicObject the destination
parent folder.
|
protected PublicObject |
copyNoOverwrite(LibrarySession session,
PublicObject srcPO,
Folder destParentFolder,
String poName)
Copy the PublicObject and do not overwrite.
|
protected PublicObject |
copyWithNameConflictDeleteOverwrite(LibrarySession session,
PublicObject srcPO,
Folder destParentFolder,
String newName,
PublicObject existingPO)
Copy the PublicObject and overwrite the existing object with the same name
by deleting the existing object and replacing with the new object.
|
protected PublicObject |
copyWithNameConflictOverwrite(LibrarySession session,
PublicObject srcPO,
Folder destParentFolder,
String newName)
Copy the PublicObject and overwrite the existing object with the same name.
|
CommandContext |
createCommandContext()
Returns a CommandContext to be used throughout the invocation.
|
protected PublicObject |
duplicateObject(LibrarySession session,
PublicObject srcPO,
Folder destParentFolder,
String newName)
Duplicate the PublicObject.
|
protected void |
execute(CommandContext context)
Execute a CommandContext.
|
protected void |
execute(CopyContext context)
Executes a CopyContext.
|
protected IfsDetermineAclCommand |
getDetermineAclCommand()
Return an instance of the IfsDetermineAclCommand.
|
protected IfsHandlePublicObjectVersioningCommand |
getHandlePublicObjectVersioningCommand()
Return an instance of the IfsHandlePublicObjectVersioningCommand.
|
protected void |
handlePublicObjectVersioning(LibrarySession session,
Folder destParentFolder,
PublicObject newPO)
Handles versioning the PublicObject.
|
protected PublicObject[] |
listFolder(FolderPathResolver fpr,
Folder folder,
String pattern)
Returns a list of PublicObjects in the specified folder.
|
protected AccessControlList |
performDetermineAcl(PublicObjectDefinition def,
String newName,
Folder destParentFolder,
LibrarySession session,
AccessControlList defaultAcl)
Determines the Acl to use by making a call to the inner command.
|
void |
populateNestedCommands(CommandInvoker commandInvoker)
Populates the command and context pool for determining the Acl.
|
protected void |
validateArgument(Object arg,
String name)
Validate argument input.
|
postExecute, preExecute, run
protected IfsDetermineAclCommand m_DetermineAclCommand
protected CommandContextPool m_DetermineAclContextPool
protected IfsHandlePublicObjectVersioningCommand m_HandlePublicObjectVersioningCommand
protected CommandContextPool m_HandlePublicObjectVersioningContextPool
protected void execute(CommandContext context) throws IfsException
execute
in class IfsCommand
context
- the command context.IfsException
- if execution failsprotected void execute(CopyContext context) throws IfsException
IfsException
protected void copy(LibrarySession session, FolderPathResolver fpr, PublicObject srcPO, Folder destParentFolder, String newName, boolean shouldOverwrite) throws IfsException
po
is a non-Folder object:
overwrite
is True, existing PublicObject in
folder
will be overwritten.
overwrite
is False, a new copy will be created
with the naming convention "Copy of .." for the first copy, and
"Copy (#) of .." for all other copies.
po
is a Folder object:
overwrite
is True, the content of po
will be copied over to the existing PublicObject in
folder
with versioning semantics.
overwrite
is False, a new copy will be created
with the naming convention "Copy of .." for the first copy, and
"Copy (#) of .." for all other copies.
session
- LibrarySessionsrcPO
- PublicObject to copy fromdestParentFolder
- Folder object to copy tonewName
- name of new objectshouldOverwrite
- If true, overwrite existing PublicObject in folder .
Note: overwrite behaves differently if po is a Folder.
See above for details.IfsException
- if operation failsprotected PublicObject copyNoNameConflict(LibrarySession session, PublicObject srcPO, Folder destParentFolder, String newName) throws IfsException
session
- LibrarySessionsrcPO
- source PublicObjectdestParentFolder
- newName
- name of new objectIfsException
- if the operation failsprotected PublicObject duplicateObject(LibrarySession session, PublicObject srcPO, Folder destParentFolder, String newName) throws IfsException
session
- LibrarySessionsrcPO
- source PublicObjectdestParentFolder
- newName
- name of new objectIfsException
- if the operation failsprotected PublicObject copyFolderWithNameConflictOverwrite(LibrarySession session, FolderPathResolver fpr, Folder fromFolder, Folder toFolder) throws IfsException
session
- LibrarySessionfromFolder
- the source FoldertoFolder
- the destination FolderIfsException
- if the operation failsprotected PublicObject copyWithNameConflictOverwrite(LibrarySession session, PublicObject srcPO, Folder destParentFolder, String newName) throws IfsException
session
- LibrarySessionsrcPO
- source PublicObjectdestParentFolder
- newName
- name of new objectIfsException
- if the operation failsprotected PublicObject copyWithNameConflictDeleteOverwrite(LibrarySession session, PublicObject srcPO, Folder destParentFolder, String newName, PublicObject existingPO) throws IfsException
session
- LibrarySessionsrcPO
- source PublicObjectdestParentFolder
- newName
- name of new objectexistingPO
- existing PublicObjectIfsException
- if the operation failsprotected PublicObject[] listFolder(FolderPathResolver fpr, Folder folder, String pattern) throws IfsException
fpr
- FolderPathResolverfolder
- parent folderpattern
- IfsException
- if the operation failsprotected void validateArgument(Object arg, String name) throws IfsException
arg
- object to be validatedname
- object typeIfsException
- if the operation failsprotected PublicObject copyNoOverwrite(LibrarySession session, PublicObject srcPO, Folder destParentFolder, String poName) throws IfsException
session
- LibrarySessionsrcPO
- source PublicObjectdestParentFolder
- poName
- name of new objectIfsException
- if the operation failsprotected AccessControlList performDetermineAcl(PublicObjectDefinition def, String newName, Folder destParentFolder, LibrarySession session, AccessControlList defaultAcl) throws IfsException
IfsException
protected void handlePublicObjectVersioning(LibrarySession session, Folder destParentFolder, PublicObject newPO) throws IfsException
session
- LibrarySessiondestParentFolder
- parent foldernewPO
- new PublicObjectIfsException
- if the operation failspublic void populateNestedCommands(CommandInvoker commandInvoker) throws IfsException
populateNestedCommands
in interface Command
populateNestedCommands
in class IfsCommand
commandInvoker
- the command invokerIfsException
- if the operation failsCommandInvoker
protected IfsDetermineAclCommand getDetermineAclCommand() throws IfsException
IfsException
protected IfsHandlePublicObjectVersioningCommand getHandlePublicObjectVersioningCommand() throws IfsException
IfsException
public CommandContext createCommandContext() throws IfsException
createCommandContext
in interface Command
createCommandContext
in class IfsCommand
IfsException
- if the operation failsCommandContext
Copyright © 2023. All rights reserved.