use of won.bot.framework.eventbot.listener.baStateBots.BATestScriptAction in project webofneeds by researchstudio-sat.
the class BAPCStateCompleteWithFailureUriBot method setupActions.
@Override
protected List<BATestScriptAction> setupActions() {
List<BATestScriptAction> actions = new ArrayList();
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_CANCELED.getURI()), URI.create(WON_TX.STATE_ACTIVE.getURI())));
actions.add(new BATestScriptAction(false, URI.create(WON_TX.MESSAGE_EXITED.getURI()), URI.create(WON_TX.STATE_ACTIVE.getURI())));
// actions.add(new BATestScriptAction(true, URI.create(WON_BA.MESSAGE_EXITED.getURI()), URI.create(WON_BA.STATE_ACTIVE.getURI())));
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_COMPLETED.getURI()), URI.create(WON_TX.STATE_ACTIVE.getURI())));
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_COMPLETED.getURI()), URI.create(WON_TX.STATE_ACTIVE.getURI())));
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_EXIT.getURI()), URI.create(WON_TX.STATE_COMPLETED.getURI())));
actions.add(new BATestScriptAction(false, URI.create(WON_TX.MESSAGE_CANCEL.getURI()), URI.create(WON_TX.STATE_COMPLETED.getURI())));
actions.add(new BATestScriptAction(false, URI.create(WON_TX.MESSAGE_CLOSE.getURI()), URI.create(WON_TX.STATE_COMPLETED.getURI())));
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_CANNOTCOMPLETE.getURI()), URI.create(WON_TX.STATE_COMPLETED.getURI())));
actions.add(new BATestScriptAction(false, URI.create(WON_TX.MESSAGE_CANNOTCOMPLETE.getURI()), URI.create(WON_TX.STATE_COMPLETED.getURI())));
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_CLOSED.getURI()), URI.create(WON_TX.STATE_CLOSING.getURI())));
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_CLOSED.getURI()), URI.create(WON_TX.STATE_ENDED.getURI())));
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_EXIT.getURI()), URI.create(WON_TX.STATE_ENDED.getURI())));
actions.add(new BATestScriptAction(false, URI.create(WON_TX.MESSAGE_EXIT.getURI()), URI.create(WON_TX.STATE_ENDED.getURI())));
return actions;
}
use of won.bot.framework.eventbot.listener.baStateBots.BATestScriptAction in project webofneeds by researchstudio-sat.
the class AutomaticBAMessageResponderListener method handleOpenEvent.
/**
* React to open event by sending a message.
*
* @param openEvent
*/
private void handleOpenEvent(final OpenFromOtherNeedEvent openEvent) {
logger.debug("handleOpen: got open event for need: {}, connection state is: {}", openEvent.getCon().getNeedURI(), openEvent.getCon().getState());
if (openEvent.getCon().getState() != ConnectionState.CONNECTED) {
logger.warn("connection state must be CONNECTED when open is received. We don't expect open of connections created through hints.");
}
logger.debug("replying to open with message");
// register a WS-BA state machine for this need-need combination:
boolean weAreOnCoordinatorSide = areWeOnCoordinatorSide(openEvent.getCon());
logger.info("Are we on Coordinator side? " + weAreOnCoordinatorSide);
BATestBotScript script = setupStateMachine(openEvent, weAreOnCoordinatorSide);
// now, getGeneric the action from the state machine and make the right need send the message
if (isScriptFinished(script))
return;
BATestScriptAction action = script.getNextAction();
// logger.info("State of the sender before sending: {} ", action.getStateOfSenderBeforeSending());
// decide from which need to send the initial WS-BA protocol message
URI connectionToSendMessageFrom = determineConnectionToSendFrom(openEvent.getCon(), weAreOnCoordinatorSide, action);
// 2 sendMessageFromConnection(action, connectionToSendMessageFrom);
sendModelFromConnection(action, connectionToSendMessageFrom);
}
use of won.bot.framework.eventbot.listener.baStateBots.BATestScriptAction in project webofneeds by researchstudio-sat.
the class CompletingFPUriBot method setupActions.
@Override
protected List<BATestScriptAction> setupActions() {
List<BATestScriptAction> actions = new ArrayList();
;
actions.add(new BATestScriptAction(false, URI.create(WON_TX.MESSAGE_COMPLETE.getURI()), URI.create(WON_TX.STATE_ACTIVE.getURI())));
return actions;
}
use of won.bot.framework.eventbot.listener.baStateBots.BATestScriptAction in project webofneeds by researchstudio-sat.
the class CompletingSPCancelingFAilingUriBot method setupActions.
// CompletingSPCancelingFailingUriBot
@Override
protected List<BATestScriptAction> setupActions() {
List<BATestScriptAction> actions = new ArrayList();
// automatic
// actions.add(new BATestScriptAction(false, "MESSAGE_CANCEL", URI.create(WON_BA.STATE_CANCELING.getURI()), 3));
actions.add(new NopAction());
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_FAIL.getURI()), URI.create(WON_TX.STATE_CANCELING_COMPLETING.getURI())));
actions.add(new BATestScriptAction(false, URI.create(WON_TX.MESSAGE_FAILED.getURI()), URI.create(WON_TX.STATE_FAILING_ACTIVE_CANCELING_COMPLETING.getURI())));
return actions;
}
use of won.bot.framework.eventbot.listener.baStateBots.BATestScriptAction in project webofneeds by researchstudio-sat.
the class CompletingSPCancelingUriBot method setupActions.
@Override
protected List<BATestScriptAction> setupActions() {
List<BATestScriptAction> actions = new ArrayList();
// automatic
// actions.add(new BATestScriptAction(false, "MESSAGE_CANCEL", URI.create(WON_BA.STATE_COMPLETING.getURI()));
actions.add(new NopAction());
actions.add(new BATestScriptAction(true, URI.create(WON_TX.MESSAGE_CANCELED.getURI()), URI.create(WON_TX.STATE_CANCELING_COMPLETING.getURI())));
return actions;
}
Aggregations