[New] Allow to pass Action to Controller for actions
This commit is contained in:
parent
7005452a8c
commit
a876509eb1
|
@ -185,11 +185,7 @@ public class Controller {
|
||||||
Action action = this.activity.getElementByLocator(actionLoc);
|
Action action = this.activity.getElementByLocator(actionLoc);
|
||||||
|
|
||||||
// set this action to executed
|
// set this action to executed
|
||||||
SetActionToExecutedCommand command = new SetActionToExecutedCommand(tx);
|
toExecuted(tx, action);
|
||||||
command.setExecutionPolicy(refreshExecutionPolicy(tx, action));
|
|
||||||
command.setAction(action);
|
|
||||||
command.validate();
|
|
||||||
command.doCommand();
|
|
||||||
|
|
||||||
updateObservers();
|
updateObservers();
|
||||||
|
|
||||||
|
@ -207,6 +203,22 @@ public class Controller {
|
||||||
this.executionHandler.triggerExecution(this.realm);
|
this.executionHandler.triggerExecution(this.realm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completes the execution of the given {@link Action}
|
||||||
|
*
|
||||||
|
* @param tx
|
||||||
|
* the TX
|
||||||
|
* @param action
|
||||||
|
* the {@link Action} to set to executed
|
||||||
|
*/
|
||||||
|
public void toExecuted(StrolchTransaction tx, Action action) throws Exception {
|
||||||
|
SetActionToExecutedCommand command = new SetActionToExecutedCommand(tx);
|
||||||
|
command.setExecutionPolicy(refreshExecutionPolicy(tx, action));
|
||||||
|
command.setAction(action);
|
||||||
|
command.validate();
|
||||||
|
command.doCommand();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#STOPPED}
|
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#STOPPED}
|
||||||
*
|
*
|
||||||
|
@ -224,11 +236,7 @@ public class Controller {
|
||||||
Action action = this.activity.getElementByLocator(actionLoc);
|
Action action = this.activity.getElementByLocator(actionLoc);
|
||||||
|
|
||||||
// set this action to executed
|
// set this action to executed
|
||||||
SetActionToStoppedCommand command = new SetActionToStoppedCommand(tx);
|
toStopped(tx, action);
|
||||||
command.setExecutionPolicy(refreshExecutionPolicy(tx, action));
|
|
||||||
command.setAction(action);
|
|
||||||
command.validate();
|
|
||||||
command.doCommand();
|
|
||||||
|
|
||||||
tx.commitOnClose();
|
tx.commitOnClose();
|
||||||
}
|
}
|
||||||
|
@ -237,6 +245,22 @@ public class Controller {
|
||||||
updateObservers();
|
updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state of the {@link Action} to {@link State#STOPPED}
|
||||||
|
*
|
||||||
|
* @param tx
|
||||||
|
* the TX
|
||||||
|
* @param action
|
||||||
|
* the {@link Action} to set to stopped
|
||||||
|
*/
|
||||||
|
public void toStopped(StrolchTransaction tx, Action action) throws Exception {
|
||||||
|
SetActionToStoppedCommand command = new SetActionToStoppedCommand(tx);
|
||||||
|
command.setExecutionPolicy(refreshExecutionPolicy(tx, action));
|
||||||
|
command.setAction(action);
|
||||||
|
command.validate();
|
||||||
|
command.doCommand();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#ERROR}
|
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#ERROR}
|
||||||
*
|
*
|
||||||
|
@ -253,12 +277,8 @@ public class Controller {
|
||||||
|
|
||||||
Action action = this.activity.getElementByLocator(actionLoc);
|
Action action = this.activity.getElementByLocator(actionLoc);
|
||||||
|
|
||||||
// set this action to executed
|
// set this action to error
|
||||||
SetActionToErrorCommand command = new SetActionToErrorCommand(tx);
|
toError(tx, action);
|
||||||
command.setExecutionPolicy(refreshExecutionPolicy(tx, action));
|
|
||||||
command.setAction(action);
|
|
||||||
command.validate();
|
|
||||||
command.doCommand();
|
|
||||||
|
|
||||||
tx.commitOnClose();
|
tx.commitOnClose();
|
||||||
}
|
}
|
||||||
|
@ -267,6 +287,22 @@ public class Controller {
|
||||||
updateObservers();
|
updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state of the {@link Action} to {@link State#ERROR}
|
||||||
|
*
|
||||||
|
* @param tx
|
||||||
|
* the TX
|
||||||
|
* @param action
|
||||||
|
* the {@link Action} to set to error
|
||||||
|
*/
|
||||||
|
public void toError(StrolchTransaction tx, Action action) throws Exception {
|
||||||
|
SetActionToErrorCommand command = new SetActionToErrorCommand(tx);
|
||||||
|
command.setExecutionPolicy(refreshExecutionPolicy(tx, action));
|
||||||
|
command.setAction(action);
|
||||||
|
command.validate();
|
||||||
|
command.doCommand();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#WARNING}
|
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#WARNING}
|
||||||
*
|
*
|
||||||
|
@ -283,12 +319,8 @@ public class Controller {
|
||||||
|
|
||||||
Action action = this.activity.getElementByLocator(actionLoc);
|
Action action = this.activity.getElementByLocator(actionLoc);
|
||||||
|
|
||||||
// set this action to executed
|
// set this action to warning
|
||||||
SetActionToWarningCommand command = new SetActionToWarningCommand(tx);
|
toWarning(tx, action);
|
||||||
command.setExecutionPolicy(refreshExecutionPolicy(tx, action));
|
|
||||||
command.setAction(action);
|
|
||||||
command.validate();
|
|
||||||
command.doCommand();
|
|
||||||
|
|
||||||
tx.commitOnClose();
|
tx.commitOnClose();
|
||||||
}
|
}
|
||||||
|
@ -297,6 +329,22 @@ public class Controller {
|
||||||
updateObservers();
|
updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#WARNING}
|
||||||
|
*
|
||||||
|
* @param tx
|
||||||
|
* the TX
|
||||||
|
* @param action
|
||||||
|
* the {@link Action} to set to error
|
||||||
|
*/
|
||||||
|
public void toWarning(StrolchTransaction tx, Action action) throws Exception {
|
||||||
|
SetActionToWarningCommand command = new SetActionToWarningCommand(tx);
|
||||||
|
command.setExecutionPolicy(refreshExecutionPolicy(tx, action));
|
||||||
|
command.setAction(action);
|
||||||
|
command.validate();
|
||||||
|
command.doCommand();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#ERROR}
|
* Sets the state of the {@link Action} with the given {@link Locator} to {@link State#ERROR}
|
||||||
*
|
*
|
||||||
|
@ -366,7 +414,7 @@ public class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateObservers() {
|
public void updateObservers() {
|
||||||
StrolchRealm realm = this.executionHandler.getContainer().getRealm(this.realm);
|
StrolchRealm realm = this.executionHandler.getContainer().getRealm(this.realm);
|
||||||
if (!realm.isUpdateObservers())
|
if (!realm.isUpdateObservers())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue