users
Class ActionCapability
java.lang.Object
|
+--users.AbstractCapability
|
+--users.ActionCapability
- public class ActionCapability
- extends AbstractCapability
- implements Action
A special capability guarding an action object.
The ActionCapability is itself an Action again, so that you can write code like
this:
public class S extends SalesPoint {
...
public MenuSheet getDefaultMenuSheet() {
MenuSheet ms = new MenuSheet();
ms.addItem ("Capability Test",
(Action) getUser().getCapability("CapTest"));
return ms;
}
...
}
Assuming that the CapTest capability is represented by an ActionCapability wrapping
some other Action.
- Since:
- v2.0
- Version:
- 2.0 05/05/1999
- Author:
- Steffen Zschaler
- See Also:
SalesPoint
,
MenuSheet
,
UserManager
,
User
, Serialized Form
Method Summary |
void |
doAction(SaleProcess p,
SalesPoint sp)
If the capability is granting rights, perform the guarded action; otherwise,
print a message to the user that he/she is not granted the right to
perform this action. |
Capability |
getToggled()
Get the ActionCapability that is the inverse to this one. |
boolean |
isGranted()
Return true if this capability is granting rights. |
ActionCapability
public ActionCapability(String sName,
Action aToDo)
- Create a granted capability.
- Parameters:
sName
- the name of the capability.aToDo
- the Action to be guarded.
ActionCapability
public ActionCapability(String sName,
String sOnDeny,
Action aToDo,
boolean fGranted)
- Create a new ActionCapability.
- Parameters:
sName
- the name of the capability.sOnDeny
- a message to be popped up on denial.aToDo
- the Action to be guarded.fGranted
- true if this capability is to grant rights.
getToggled
public Capability getToggled()
- Get the ActionCapability that is the inverse to this one. I.e. if this capability grants the right to
execute a given action, the returned capability will deny this right and vice versa.
- Override:
- Never.
- Returns:
- the ActionCapability that is the inverse to this one.
- Overrides:
- getToggled in class AbstractCapability
isGranted
public boolean isGranted()
- Return true if this capability is granting rights.
- Override:
- Never.
- Returns:
- true if this capability is granting rights.
- Overrides:
- isGranted in class AbstractCapability
doAction
public void doAction(SaleProcess p,
SalesPoint sp)
throws Throwable
- If the capability is granting rights, perform the guarded action; otherwise,
print a message to the user that he/she is not granted the right to
perform this action.
- Override:
- Never.
- Specified by:
- doAction in interface Action
- Parameters:
p
- the process in which to perform the actionsp
- the SalesPoint on which to perform the action.