org.openpermis.editor.policy.command
Class PropertyChangeCommand

java.lang.Object
  extended by org.openpermis.editor.policy.command.AbstractCommand
      extended by org.openpermis.editor.policy.command.PropertyChangeCommand
All Implemented Interfaces:
Command

public class PropertyChangeCommand
extends AbstractCommand

Command that performs a property change.

Since:
0.1.0

Field Summary
private  Object bean
          The bean to modify.
private  Object newValue
          The value to set at the bean.
private  Object oldValue
          The old value of the bean.
private  String property
          The property to set.
 
Constructor Summary
PropertyChangeCommand(Object bean, String property, Object value)
          Creates a property change command for the specified bean and property.
 
Method Summary
private static String createCommandName(Object bean, String property)
          Creates a name for the command.
 void execute(org.openpermis.policy.bean.PolicyBean policy)
          Executes the command and stores necessary information to undo any changes.
 void undo(org.openpermis.policy.bean.PolicyBean policy)
          Reverts any changes performed in Command.execute(org.openpermis.policy.bean.PolicyBean).
private  void validate()
          Validates that the bean specified has the given property with set and get access.
 
Methods inherited from class org.openpermis.editor.policy.command.AbstractCommand
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bean

private final Object bean
The bean to modify.

Since:
0.1.0

property

private final String property
The property to set.

Since:
0.1.0

newValue

private final Object newValue
The value to set at the bean.

Since:
0.1.0

oldValue

private Object oldValue
The old value of the bean.

Since:
0.1.0
Constructor Detail

PropertyChangeCommand

public PropertyChangeCommand(Object bean,
                             String property,
                             Object value)
Creates a property change command for the specified bean and property.

Parameters:
bean - the bean to modify, must not be null.
property - the property to set, must not be null or empty.
value - the value to set at the property.
Since:
0.1.0
Method Detail

createCommandName

private static final String createCommandName(Object bean,
                                              String property)
Creates a name for the command.

Parameters:
bean - the bean to modify.
property - the property to set.
Returns:
the name for the command.
Since:
0.1.0

validate

private void validate()
Validates that the bean specified has the given property with set and get access.

Throws:
IllegalArgumentException - if the bean/property combo is invalid.
Since:
0.1.0

execute

public void execute(org.openpermis.policy.bean.PolicyBean policy)
Description copied from interface: Command
Executes the command and stores necessary information to undo any changes.

Specified by:
execute in interface Command
Specified by:
execute in class AbstractCommand
Parameters:
policy - the policy to execute the command on.
Since:
0.1.0

undo

public void undo(org.openpermis.policy.bean.PolicyBean policy)
Description copied from interface: Command
Reverts any changes performed in Command.execute(org.openpermis.policy.bean.PolicyBean).

Specified by:
undo in interface Command
Specified by:
undo in class AbstractCommand
Parameters:
policy - the policy to revert.
Since:
0.1.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:48
Copyright (c) 2002-2007 Ergon Informatik AG