|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.salespointframework.core.users.AbstractCapability
org.salespointframework.core.users.ActionCapability
public class ActionCapability
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.
SalesPoint
,
MenuSheet
,
UserManager
,
User
Field Summary | |
---|---|
private Action |
m_aToDo
The action guarded. |
private boolean |
m_fGranted
Is this capability granted? |
private java.lang.String |
m_sOnDeny
A message to be presented on denial. |
Constructor Summary | |
---|---|
ActionCapability(java.lang.String sName,
Action aToDo)
Create a granted capability. |
|
ActionCapability(java.lang.String sName,
java.lang.String sOnDeny,
Action aToDo,
boolean fGranted)
Create a new ActionCapability. |
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. |
Methods inherited from class org.salespointframework.core.users.AbstractCapability |
---|
getDisplayName, getDisplayName, getName, setDisplayNameResourceBundleName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private boolean m_fGranted
private Action m_aToDo
private java.lang.String m_sOnDeny
Constructor Detail |
---|
public ActionCapability(java.lang.String sName, Action aToDo)
sName
- the name of the capability.aToDo
- the Action to be guarded.public ActionCapability(java.lang.String sName, java.lang.String sOnDeny, Action aToDo, boolean fGranted)
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.Method Detail |
---|
public Capability getToggled()
getToggled
in interface Capability
getToggled
in class AbstractCapability
public boolean isGranted()
isGranted
in interface Capability
isGranted
in class AbstractCapability
public void doAction(SaleProcess p, SalesPoint sp) throws java.lang.Throwable
doAction
in interface Action
p
- the process in which to perform the actionsp
- the SalesPoint on which to perform the action.
java.lang.Throwable
- on any error that shall be reported and lead to cancellation of
the action.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |