|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccc.commands.Command<T>
T
- The result type of the command.public abstract class Command<T>
Provides the basic contract for command execution.
Constructor Summary | |
---|---|
Command(IRepositoryFactory repoFactory)
Constructor. |
|
Command(ResourceRepository repository,
LogEntryRepository audit,
UserRepository userRepo,
DataRepository data)
Constructor. |
Method Summary | |
---|---|
protected void |
afterExecute(UserEntity actor,
java.util.Date happenedOn,
T result)
Event handler that executes after the command has executed successfully. |
protected void |
authorize(UserEntity actor)
Confirm that the actor may execute this command. |
protected void |
beforeExecute(UserEntity actor,
java.util.Date happenedOn)
Event handler that executes before the command has executed. |
protected abstract T |
doExecute(UserEntity actor,
java.util.Date happenedOn)
Execute the command. |
T |
execute(UserEntity actor,
java.util.Date happenedOn)
Execute the command. |
protected LogEntryRepository |
getAudit()
Accessor. |
protected CommentRepository |
getComments()
Accessor. |
DataRepository |
getData()
Accessor. |
protected GroupRepository |
getGroups()
Accessor. |
protected ResourceRepository |
getRepository()
Accessor. |
protected abstract CommandType |
getType()
Get the type of this command. |
UserRepository |
getUsers()
Accessor. |
protected void |
validate()
Validate the command's inputs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Command(ResourceRepository repository, LogEntryRepository audit, UserRepository userRepo, DataRepository data)
repository
- The ResourceDao used for CRUD operations, etc.audit
- The audit logger, for logging business actions.userRepo
- The repository for users.data
- The data repository for storing binary data.public Command(IRepositoryFactory repoFactory)
repoFactory
- The repository factory for this command.Method Detail |
---|
public final T execute(UserEntity actor, java.util.Date happenedOn)
actor
- The user who performed the command.happenedOn
- When the command was performed.
protected void validate()
protected void authorize(UserEntity actor)
The default implementation allows any actor to execute the command.
actor
- The actor performing the command.protected void afterExecute(UserEntity actor, java.util.Date happenedOn, T result)
actor
- The user who performed the command.happenedOn
- When the command was performed.result
- The result of command execution.protected void beforeExecute(UserEntity actor, java.util.Date happenedOn)
actor
- The user who performed the command.happenedOn
- When the command was performed.protected ResourceRepository getRepository()
protected LogEntryRepository getAudit()
public UserRepository getUsers()
public DataRepository getData()
protected GroupRepository getGroups()
protected CommentRepository getComments()
protected abstract T doExecute(UserEntity actor, java.util.Date happenedOn)
actor
- The user who performed the command.happenedOn
- When the command was performed.
protected abstract CommandType getType()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |