ccc.commands
Class CommandFactory

java.lang.Object
  extended by ccc.commands.CommandFactory

public class CommandFactory
extends java.lang.Object

Factory for command objects.

Author:
Civic Computing Ltd.

Constructor Summary
CommandFactory(ResourceRepository repository, LogEntryRepository audit, DataRepository data)
          Constructor.
 
Method Summary
 Command<? extends ResourceEntity> createAliasCommand(Alias alias)
          Create a 'create alias' command.
 Command<java.lang.Void> createDeleteResourceCmd(java.util.UUID resourceId)
          Create a 'delete resource' command.
 Command<FileEntity> createFileCommand(java.util.UUID parentFolder, File file, java.lang.String title, java.lang.String description, ResourceName resourceName, RevisionMetadata rm, java.io.InputStream dataStream)
          Create a 'create file' command.
 Command<FolderEntity> createFolderCommand(java.util.UUID parentId, java.lang.String name, java.lang.String title)
          Create a 'create folder' command.
 Command<PageEntity> createPageCommand(java.util.UUID parentId, Page page)
          Create a 'create page' command.
 Command<java.lang.Void> createRootCommand(FolderEntity f)
          Create a 'create root' command.
 Command<Search> createSearchCommand(java.util.UUID parentId, java.lang.String title)
          Create a 'create search' command.
 Command<? extends ResourceEntity> createTemplateCommand(Template template)
          Create a 'create template' command.
 Command<java.lang.Void> lockResourceCommand(java.util.UUID resourceId)
          Create a 'lock resource' command.
 Command<ResourceSummary> publishResource(java.util.UUID resourceId)
          Create a 'publish resource' command.
 Command<java.lang.Void> unlockResourceCommand(java.util.UUID resourceId)
          Create an 'unlock resource' command.
 Command<java.lang.Void> unpublishResourceCommand(java.util.UUID resourceId)
          Create an 'unpublish resource' command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandFactory

public CommandFactory(ResourceRepository repository,
                      LogEntryRepository audit,
                      DataRepository data)
Constructor.

Parameters:
repository - The ResourceDao used for CRUD operations, etc.
audit - The audit logger, for logging business actions.
data - The data repository for storing binary data.
Method Detail

createDeleteResourceCmd

public Command<java.lang.Void> createDeleteResourceCmd(java.util.UUID resourceId)
Create a 'delete resource' command.

Parameters:
resourceId - The id of the resource to delete.
Returns:
The corresponding command.

createTemplateCommand

public Command<? extends ResourceEntity> createTemplateCommand(Template template)
Create a 'create template' command.

Parameters:
template - Details of the template to create.
Returns:
The corresponding command.

createAliasCommand

public Command<? extends ResourceEntity> createAliasCommand(Alias alias)
Create a 'create alias' command.

Parameters:
alias - Details of the alias to create.
Returns:
The corresponding command.

createFileCommand

public Command<FileEntity> createFileCommand(java.util.UUID parentFolder,
                                             File file,
                                             java.lang.String title,
                                             java.lang.String description,
                                             ResourceName resourceName,
                                             RevisionMetadata rm,
                                             java.io.InputStream dataStream)
Create a 'create file' command.

Parameters:
parentFolder - The folder in which the file will be created.
file - The details of the file.
title - The file's title.
description - The file's description.
resourceName - The file's name.
rm - Details of the revision.
dataStream - The stream containing the contents of the file.
Returns:
The corresponding command.

createFolderCommand

public Command<FolderEntity> createFolderCommand(java.util.UUID parentId,
                                                 java.lang.String name,
                                                 java.lang.String title)
Create a 'create folder' command.

Parameters:
name - The name of the folder.
parentId - The folder's parent.
title - The folder's title.
Returns:
The corresponding command.

createRootCommand

public Command<java.lang.Void> createRootCommand(FolderEntity f)
Create a 'create root' command.

Parameters:
f - The folder to create.
Returns:
The corresponding command.

createPageCommand

public Command<PageEntity> createPageCommand(java.util.UUID parentId,
                                             Page page)
Create a 'create page' command.

Parameters:
parentId - The parent folder in which the page will be created.
page - The page to create.
Returns:
The corresponding command.

createSearchCommand

public Command<Search> createSearchCommand(java.util.UUID parentId,
                                           java.lang.String title)
Create a 'create search' command.

Parameters:
title - The search's title.
parentId - The search's parent folder.
Returns:
The corresponding command.

publishResource

public Command<ResourceSummary> publishResource(java.util.UUID resourceId)
Create a 'publish resource' command.

Parameters:
resourceId - The ID of the resource to publish.
Returns:
The corresponding command.

lockResourceCommand

public Command<java.lang.Void> lockResourceCommand(java.util.UUID resourceId)
Create a 'lock resource' command.

Parameters:
resourceId - The ID of the resource to lock.
Returns:
The corresponding command.

unlockResourceCommand

public Command<java.lang.Void> unlockResourceCommand(java.util.UUID resourceId)
Create an 'unlock resource' command.

Parameters:
resourceId - The ID of the resource to unlock;
Returns:
The corresponding command.

unpublishResourceCommand

public Command<java.lang.Void> unpublishResourceCommand(java.util.UUID resourceId)
Create an 'unpublish resource' command.

Parameters:
resourceId - The ID of the resource to unpublish.
Returns:
The corresponding command.


Copyright © 2010. All Rights Reserved.