|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.util.entity.AbstractBasicEntity
org.torweg.pulse.accesscontrol.CommandMatcher
@Entity public class CommandMatcher
A CommandMatcher is an entity used to restrict the execution of
Commands.
It has an Attribute permission, being the necessary Permission to execute Commands matched by this CommandMatcher. It also has the Attributes locale, bundle, action,
sitemapNodeId and parameters, that are used to check if a CommandMatcher matches a Command. Since a Command also has
the last five Attributes, it is matched by a CommandMatcher,
if each Attribute of the CommandMatcher is either null or equal to its correspondent of the Command. As to the Parameters, a subset is sufficent, too.
| Constructor Summary | |
|---|---|
protected |
CommandMatcher()
Deprecated. |
|
CommandMatcher(Permission newPermission)
The Constructor that sets the Permission needed to
execute a matching Command. |
| Method Summary | |
|---|---|
void |
addParameter(Parameter param)
Adds a Parameter to the <CommandMatcher's Parameters. |
static CommandMatcher |
buildMatcher(org.jdom.Element command)
Builds the CommandMatcher defined in the mapping XML. |
org.jdom.Element |
deserializeToJDOM()
Serializes the state of the CommandMatcher as a JDOM Element. |
java.lang.String |
getAction()
Returns the action of the CommandMatcher. |
Bundle |
getBundle()
Returns the Bundle of the CommandMatcher. |
java.util.Locale |
getLocale()
Returns the Locale of the CommandMatcher. |
Parameter |
getParameter(java.lang.String paramName)
Returns the Parameter named paramName, if it is associated with
the CommandMatcher. |
java.util.List<Parameter> |
getParameters()
Returns a shallow copy of the CommandMatcher's Collection
of Parameters. |
Permission |
getPermission()
Returns the Permission of the CommandMatcher. |
java.lang.Long |
getSitemapNodeId()
Returns the CommandMatcher's SitemapNode id. |
boolean |
matchesCommand(Command command)
Checks if the Command is matched by the CommandMatcher. |
boolean |
removeParameter(java.lang.String paramName)
Removes the Parameter named paramName from the CommandMatcher's Collection of Parameters, if it is part
of it. |
void |
setAction(java.lang.String newAction)
Sets the action of the CommandMatcher. |
void |
setBundle(Bundle newBundle)
Sets the Bundle of the CommandMatcher. |
void |
setLocale(java.util.Locale newLocale)
Sets the Locale of the CommandMatcher. |
void |
setPermission(Permission newPermission)
Sets the Permission of the CommandMatcher. |
void |
setSitemapNodeId(java.lang.Long newSitemapNodeId)
Sets the SitemapNode id of the CommandMatcher. |
net.sf.json.JSONObject |
toJSON()
Serializes the state of the CommandMatcher as a JSONObject. |
java.lang.String |
toString()
Returns a String representation of the CommandMatcher. |
| Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity |
|---|
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
@Deprecated protected CommandMatcher()
public CommandMatcher(Permission newPermission)
Constructor that sets the Permission needed to
execute a matching Command.
newPermission - the Permission needed to execute a matching Command| Method Detail |
|---|
public final java.util.Locale getLocale()
Locale of the CommandMatcher.
Locale of the CommandMatcher or nullpublic final void setLocale(java.util.Locale newLocale)
Locale of the CommandMatcher.
newLocale - the new Locale of the CommandMatcherpublic final Bundle getBundle()
Bundle of the CommandMatcher.
Bundle of the CommandMatcher or nullpublic final void setBundle(Bundle newBundle)
Bundle of the CommandMatcher.
newBundle - the new Bundle of the CommandMatcherpublic final java.lang.String getAction()
CommandMatcher.
CommandMatcher or nullpublic final void setAction(java.lang.String newAction)
CommandMatcher.
newAction - the new action of the CommandMatcherpublic final java.lang.Long getSitemapNodeId()
CommandMatcher's SitemapNode id.
CommandMatcher's SitemapNode id or nullpublic final void setSitemapNodeId(java.lang.Long newSitemapNodeId)
SitemapNode id of the CommandMatcher.
newSitemapNodeId - the new SitemapNode id of the CommandMatcherpublic final java.util.List<Parameter> getParameters()
CommandMatcher's Collection
of Parameters.
Attention: Since the returned List is not a reference to the
CommandMatcher's internal Collection, any modifications
to its state will get lost. However, modifications to the state of the
List's elements will be consistent.
For example: Adding/Deleting a Parameter to/from the List
will not have any effect, when the CommandMatcher is saved. On
the other hand, modifications to a Parameter in the List
will be made persistent, when the Parameter is saved.
Parameters associated with the CommandMatcherpublic final Parameter getParameter(java.lang.String paramName)
Parameter named paramName, if it is associated with
the CommandMatcher.
paramName - the name of the Parameter to be sought-after
Parameter named paramName or nullpublic final void addParameter(Parameter param)
Parameter to the <CommandMatcher's Parameters. The Parameter will not be added, if the CommandMatcher already contains a Parameter of the same name. In
this case, its values will be added to the existing Parameter.
param - the Parameter to be addedpublic final boolean removeParameter(java.lang.String paramName)
Parameter named paramName from the CommandMatcher's Collection of Parameters, if it is part
of it.
paramName - the name of the Parameter to be removed
CommandMatcher's Collection changed
as a result of the callpublic final Permission getPermission()
Permission of the CommandMatcher.
Permission of the CommandMatcherpublic final void setPermission(Permission newPermission)
Permission of the CommandMatcher.
newPermission - the new Permission of the CommandMatcherpublic final boolean matchesCommand(Command command)
Command is matched by the CommandMatcher.
If the Attributes bundle, action, locale and sitemapNodeId of the
CommandMatcher are either null or equal to their
correspondent of the Command, and the Parameters attached
to the CommandMatcher are a subset of those attached to the
Command, it's a match.
command - the Command to be checked for a match with the CommandMatcher
true if the CommandMatcher matches the Commandpublic final java.lang.String toString()
String representation of the CommandMatcher.
toString in class java.lang.ObjectString representation of the CommandMatcherpublic final org.jdom.Element deserializeToJDOM()
CommandMatcher as a JDOM Element.
CommandMatcherher} as a JDOM Elementpublic static CommandMatcher buildMatcher(org.jdom.Element command)
CommandMatcher defined in the mapping XML.
Sample mapping XML snippet:
<command action="actionname" locale="de_DE">
<parameter name="param1">
<value>value1.1</value>
<value>value1.2</value>
</parameter>
<parameter name="param2"/>
<parameter name="param3">
<value>value3</value>
</parameter>
</command>
The above sample is full blown. The following example shows the minimal
mapping:
<command action="actionname"/>
command - the command XML
CommandMatcher defined in the mapping XMLpublic final net.sf.json.JSONObject toJSON()
CommandMatcher as a JSONObject.
CommandMatcher as a JSONObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||