public abstract class Command extends Object
Example: RenameCommand can be combined with a input field and a
button. The input field can ask for command state (isAccessible()
,
isSupported()
, etc.) and the button action can execute the
command.
Furthermore command layer defines a centralized error handling.
Copyright 2004 SAP AG
Constructor and Description |
---|
Command() |
Modifier and Type | Method and Description |
---|---|
boolean |
canExecute()
Check preconditions to execute a command.
|
protected boolean |
canExecuteDefaultImpl()
Default implementation of
canExecute() check. |
protected abstract boolean |
canExecuteImpl()
Default implementation of precondition to execute a command.
|
boolean |
execute()
Executes a command without throwing exceptions.
|
protected abstract void |
executeImpl()
Implementation to execute a command.
|
boolean |
failed()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
Review-comment isFailed()
|
String |
getMessage()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
|
String |
getMessageKey()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
|
Exception |
getRootCauseException()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
|
boolean |
isAccessible()
Precondition to execute command (access rights are given to execute command).
|
protected abstract boolean |
isAccessibleImpl()
Implementation to check access rights to execute a command.
|
boolean |
isSupported()
Precondition to execute command (e.g. supported by repository).
|
protected abstract boolean |
isSupportedImpl()
Implementation to check if a system configuration supports the execution of a command.
|
boolean |
isSystemError()
If a command can't generate a resource bundle message key, the error was a system error and
the message attribute contains the original exception message.
|
void |
setMessage(String message)
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
|
void |
setMessageKey(String messageKey)
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
|
protected abstract void |
validateImpl()
Implementation of validation which is called before a command is executed.
|
public boolean failed()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
Review-comment isFailed()
public Exception getRootCauseException()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
public String getMessage()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
public void setMessage(String message)
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
message
- public String getMessageKey()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
public void setMessageKey(String messageKey)
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
messageKey
- public final boolean isSystemError()
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
public final boolean execute()
failed()
).
Before execution a validation check is executed.Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
public final boolean canExecute() throws WcmException
WcmException
- Must be handled by caller!
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
public final boolean isSupported() throws WcmException
WcmException
- Must be handled by caller!
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
public final boolean isAccessible() throws WcmException
WcmException
- Must be handled by caller!
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
protected abstract void executeImpl() throws Exception
Exception
- Exceptions are handled generally by the execute()
method.
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
protected final boolean canExecuteDefaultImpl() throws WcmException
canExecute()
check. Can be called
in implementation of canExecuteImpl()
. (For convenience purpose).WcmException
- Must be handled by caller!
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
protected abstract boolean canExecuteImpl() throws WcmException
isAccessible()
and isSupported()
and
others. For convenience the implementation can call canExecuteDefaultImpl()
.WcmException
- Must be handled by caller!
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
protected abstract boolean isAccessibleImpl() throws WcmException
Example: To rename a file at least read and write access permission have to be set.
WcmException
- Must be handled by caller!
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
protected abstract boolean isSupportedImpl() throws WcmException
WcmException
- Must be handled by caller!
Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
protected abstract void validateImpl() throws ValidationException
ValidationException
- Review-reader Dirk Sabiwalsky
Review-date 2001/11/26
Access Rights |
---|
SC | DC | Public Part | ACH |
---|---|---|---|
[sap.com] KMC-CM
|
[sap.com]
|
api
|
EP-KM-CM
|
[sap.com] KMC-WPC
|
[sap.com] tc/kmc/wpc/wpcfacade
|
api
|
EP-PIN-WPC-WCM
|
Copyright 2018 SAP AG Complete Copyright Notice