com.sapportals.wcm.command

Class Command

java.lang.Object
  extended by com.sapportals.wcm.command.Command
Direct Known Subclasses:
AttachIndexToFolderCommand, CopyToClipboardCommand, Macro, PasteFromClipboardCommand, QBCUpdateCommand, ResourceCommand

public abstract class Command
extends Object

Command package is a layer between CM repository layer and the user interface. This class provides a uniform execution interface which is directly coupled to user interface components.

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 Summary
Command()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command()
Method Detail

failed

public boolean failed()

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26

Review-comment -> isFailed()

Returns:
boolean value

getRootCauseException

public Exception getRootCauseException()

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26

Returns:
Exception

getMessage

public String getMessage()

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26

Returns:
message

setMessage

public void setMessage(String message)

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26

Parameters:
message -

getMessageKey

public String getMessageKey()

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26

Returns:
message key

setMessageKey

public void setMessageKey(String messageKey)

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26

Parameters:
messageKey -

isSystemError

public final 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.

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26

Returns:
boolean value

execute

public final boolean execute()
Executes a command without throwing exceptions. In the case of an exception the exception is handled internally by setting the command into error state (see method failed()). Before execution a validation check is executed.

Returns:
execution state (successful / not successful)

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


canExecute

public final boolean canExecute()
                         throws WcmException
Check preconditions to execute a command.

Returns:
boolean value
Throws:
WcmException - Must be handled by caller!

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


isSupported

public final boolean isSupported()
                          throws WcmException
Precondition to execute command (e.g. supported by repository).

Returns:
boolean value
Throws:
WcmException - Must be handled by caller!

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


isAccessible

public final boolean isAccessible()
                           throws WcmException
Precondition to execute command (access rights are given to execute command).

Returns:
boolean value
Throws:
WcmException - Must be handled by caller!

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


executeImpl

protected abstract void executeImpl()
                             throws Exception
Implementation to execute a command.

Throws:
Exception - Exceptions are handled generally by the execute() method.

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


canExecuteDefaultImpl

protected final boolean canExecuteDefaultImpl()
                                       throws WcmException
Default implementation of canExecute() check. Can be called in implementation of canExecuteImpl(). (For convenience purpose).

Throws:
WcmException - Must be handled by caller!

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


canExecuteImpl

protected abstract boolean canExecuteImpl()
                                   throws WcmException
Default implementation of precondition to execute a command. Usually this is a boolean combination of isAccessible() and isSupported() and others. For convenience the implementation can call canExecuteDefaultImpl().

Throws:
WcmException - Must be handled by caller!

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


isAccessibleImpl

protected abstract boolean isAccessibleImpl()
                                     throws WcmException
Implementation to check access rights to execute a command.

Example: To rename a file at least read and write access permission have to be set.

Throws:
WcmException - Must be handled by caller!

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


isSupportedImpl

protected abstract boolean isSupportedImpl()
                                    throws WcmException
Implementation to check if a system configuration supports the execution of a command.

Throws:
WcmException - Must be handled by caller!

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26


validateImpl

protected abstract void validateImpl()
                              throws ValidationException
Implementation of validation which is called before a command is executed.

Throws:
ValidationException -

Review-reader Dirk Sabiwalsky

Review-date 2001/11/26

Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-CM [sap.com] tc/km/nonwduideprecated api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2014 SAP AG Complete Copyright Notice