ccc.commands
Class UpdateFileCommand

java.lang.Object
  extended by ccc.commands.Command<T>
      extended by ccc.commands.UpdateFileCommand

public class UpdateFileCommand
extends Command<T>

Command: update an existing file.

Author:
Civic Computing Ltd.

Constructor Summary
UpdateFileCommand(IRepositoryFactory repoFactory, java.util.UUID fileId, File fileDelta, java.lang.String comment, boolean isMajorEdit, java.io.InputStream dataStream)
          Constructor.
 
Method Summary
 FileEntity doExecute(UserEntity actor, java.util.Date happenedOn)
          Execute the command.
protected  CommandType getType()
          Get the type of this command.
protected  void update(ResourceEntity resource, UserEntity actor, java.util.Date happenedOn)
          Record that a resource has been updated (generates a log entry).
 
Methods inherited from class ccc.commands.Command
afterExecute, authorize, beforeExecute, execute, getAudit, getComments, getData, getGroups, getRepository, getUsers, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdateFileCommand

public UpdateFileCommand(IRepositoryFactory repoFactory,
                         java.util.UUID fileId,
                         File fileDelta,
                         java.lang.String comment,
                         boolean isMajorEdit,
                         java.io.InputStream dataStream)
Constructor.

Parameters:
repoFactory - The repository factory for this command.
fileId - The id of the file to update.
dataStream - The input stream from which the bytes for the new file should be read.
fileDelta - The delta describing changes to the file's metadata.
comment - Comment describing the change.
isMajorEdit - Is this a major change.
Method Detail

doExecute

public FileEntity doExecute(UserEntity actor,
                            java.util.Date happenedOn)
Execute the command.

Specified by:
doExecute in class Command<FileEntity>
Parameters:
actor - The user who performed the command.
happenedOn - When the command was performed.
Returns:
The result of the command, of type T.

getType

protected CommandType getType()
Get the type of this command.

Specified by:
getType in class Command<FileEntity>
Returns:
The type as an enum.

update

protected void update(ResourceEntity resource,
                      UserEntity actor,
                      java.util.Date happenedOn)
Record that a resource has been updated (generates a log entry).

Parameters:
resource - The resource that was updated.
actor - The actor who performed the update.
happenedOn - The date the update took place.


Copyright © 2010. All Rights Reserved.