[Major] Call validate() in EventBasedExecutionHandler and lock action/activie
This commit is contained in:
parent
f05b02e956
commit
15db21b45e
|
@ -308,6 +308,7 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
|
|||
|
||||
ExecuteActivityCommand command = new ExecuteActivityCommand(getContainer(), tx);
|
||||
command.setActivity(activity);
|
||||
command.validate();
|
||||
command.doCommand();
|
||||
|
||||
tx.commitOnClose();
|
||||
|
@ -327,9 +328,10 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
|
|||
// set this action to executed
|
||||
SetActionToExecutedCommand command = new SetActionToExecutedCommand(getContainer(), tx);
|
||||
command.setAction(action);
|
||||
command.validate();
|
||||
command.doCommand();
|
||||
|
||||
// flush so we can see that changes performed
|
||||
// flush so we can see the changes performed
|
||||
tx.flush();
|
||||
|
||||
// if the activity is now executed, remove it from the registered activities
|
||||
|
@ -349,6 +351,7 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
|
|||
|
||||
ExecuteActivityCommand execCommand = new ExecuteActivityCommand(getContainer(), tx);
|
||||
execCommand.setActivity(activity);
|
||||
execCommand.validate();
|
||||
execCommand.doCommand();
|
||||
|
||||
// flush so we can see the changes performed
|
||||
|
@ -372,6 +375,7 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
|
|||
|
||||
SetActionToWarningCommand command = new SetActionToWarningCommand(getContainer(), tx);
|
||||
command.setAction((Action) elem);
|
||||
command.validate();
|
||||
command.doCommand();
|
||||
|
||||
tx.commitOnClose();
|
||||
|
@ -388,6 +392,7 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
|
|||
|
||||
SetActionToErrorCommand command = new SetActionToErrorCommand(getContainer(), tx);
|
||||
command.setAction((Action) elem);
|
||||
command.validate();
|
||||
command.doCommand();
|
||||
|
||||
tx.commitOnClose();
|
||||
|
@ -404,6 +409,7 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
|
|||
|
||||
SetActionToStoppedCommand command = new SetActionToStoppedCommand(getContainer(), tx);
|
||||
command.setAction((Action) elem);
|
||||
command.validate();
|
||||
command.doCommand();
|
||||
|
||||
tx.commitOnClose();
|
||||
|
|
|
@ -21,6 +21,7 @@ public class ExecuteActivityCommand extends ExecutionCommand {
|
|||
@Override
|
||||
public void validate() {
|
||||
DBC.PRE.assertNotNull("activity can not be null!", this.activity);
|
||||
tx().lock(this.activity.getRootElement());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,6 +26,8 @@ public class SetActionToErrorCommand extends ExecutionCommand {
|
|||
public void validate() {
|
||||
DBC.PRE.assertNotNull("action can not be null", this.action);
|
||||
|
||||
tx().lock(this.action.getRootElement());
|
||||
|
||||
if (!this.action.getState().canSetToError()) {
|
||||
String msg = "Current state is {0} and canot be changed to {1} for action {2}";
|
||||
msg = MessageFormat.format(msg, this.action.getState(), State.ERROR, this.action.getLocator());
|
||||
|
|
|
@ -26,6 +26,8 @@ public class SetActionToExecutedCommand extends ExecutionCommand {
|
|||
public void validate() {
|
||||
DBC.PRE.assertNotNull("action can not be null", this.action);
|
||||
|
||||
tx().lock(this.action.getRootElement());
|
||||
|
||||
if (!this.action.getState().canSetToExecuted()) {
|
||||
String msg = "State {0} and canot be changed to {1} for action {2}";
|
||||
msg = MessageFormat.format(msg, this.action.getState(), State.EXECUTED, this.action.getLocator());
|
||||
|
|
|
@ -26,6 +26,8 @@ public class SetActionToStoppedCommand extends ExecutionCommand {
|
|||
public void validate() {
|
||||
DBC.PRE.assertNotNull("action can not be null", this.action);
|
||||
|
||||
tx().lock(this.action.getRootElement());
|
||||
|
||||
if (!this.action.getState().canSetToStopped()) {
|
||||
String msg = "State {0} and canot be changed to {1} for action {2}";
|
||||
msg = MessageFormat.format(msg, this.action.getState(), State.STOPPED, this.action.getLocator());
|
||||
|
|
|
@ -26,6 +26,8 @@ public class SetActionToWarningCommand extends ExecutionCommand {
|
|||
public void validate() {
|
||||
DBC.PRE.assertNotNull("action can not be null", this.action);
|
||||
|
||||
tx().lock(this.action.getRootElement());
|
||||
|
||||
if (!this.action.getState().canSetToWarning()) {
|
||||
String msg = "State {0} and canot be changed to {1} for action {2}";
|
||||
msg = MessageFormat.format(msg, this.action.getState(), State.WARNING, this.action.getLocator());
|
||||
|
|
Loading…
Reference in New Issue