Implement named transitions
- Backport #850 - Fixes #992 Co-authored-by: Niels Hoppe <niels.hoppe@fokus.fraunhofer.de>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -886,7 +886,7 @@ public abstract class AbstractStateMachineFactory<S, E> extends LifecycleObjectS
|
||||
}
|
||||
DefaultExternalTransition<S, E> transition = new DefaultExternalTransition<S, E>(stateMap.get(source),
|
||||
stateMap.get(target), transitionData.getActions(), event, transitionData.getGuard(), trigger,
|
||||
transitionData.getSecurityRule());
|
||||
transitionData.getSecurityRule(), transitionData.getName());
|
||||
transitions.add(transition);
|
||||
|
||||
} else if (transitionData.getKind() == TransitionKind.LOCAL) {
|
||||
@@ -896,12 +896,12 @@ public abstract class AbstractStateMachineFactory<S, E> extends LifecycleObjectS
|
||||
}
|
||||
DefaultLocalTransition<S, E> transition = new DefaultLocalTransition<S, E>(stateMap.get(source),
|
||||
stateMap.get(target), transitionData.getActions(), event, transitionData.getGuard(), trigger,
|
||||
transitionData.getSecurityRule());
|
||||
transitionData.getSecurityRule(), transitionData.getName());
|
||||
transitions.add(transition);
|
||||
} else if (transitionData.getKind() == TransitionKind.INTERNAL) {
|
||||
DefaultInternalTransition<S, E> transition = new DefaultInternalTransition<S, E>(stateMap.get(source),
|
||||
transitionData.getActions(), event, transitionData.getGuard(), trigger,
|
||||
transitionData.getSecurityRule());
|
||||
transitionData.getSecurityRule(), transitionData.getName());
|
||||
transitions.add(transition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -176,14 +176,14 @@ public class StateMachineTransitionBuilder<S, E>
|
||||
* @param securityRule the security rule
|
||||
*/
|
||||
public void addTransition(S source, S target, S state, E event, Long period, Integer count, Collection<Action<S, E>> actions,
|
||||
Guard<S, E> guard, TransitionKind kind, SecurityRule securityRule) {
|
||||
Guard<S, E> guard, TransitionKind kind, SecurityRule securityRule, String name) {
|
||||
// if rule not given, get it from global
|
||||
if (securityRule == null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ConfigurationData<S, E> config = getSharedObject(ConfigurationData.class);
|
||||
securityRule = config.getTransitionSecurityRule();
|
||||
}
|
||||
transitionData.add(new TransitionData<>(source, target, state, event, period, count, actions, guard, kind, securityRule));
|
||||
transitionData.add(new TransitionData<>(source, target, state, event, period, count, actions, guard, kind, securityRule, name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,6 +48,7 @@ public abstract class AbstractTransitionConfigurer<S, E> extends
|
||||
private final Collection<Action<S, E>> actions = new ArrayList<>();
|
||||
private Guard<S, E> guard;
|
||||
private SecurityRule securityRule;
|
||||
private String name;
|
||||
|
||||
protected S getSource() {
|
||||
return source;
|
||||
@@ -88,6 +89,10 @@ public abstract class AbstractTransitionConfigurer<S, E> extends
|
||||
protected SecurityRule getSecurityRule() {
|
||||
return securityRule;
|
||||
}
|
||||
|
||||
protected String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
protected void setSource(S source) {
|
||||
this.source = source;
|
||||
@@ -142,5 +147,9 @@ public abstract class AbstractTransitionConfigurer<S, E> extends
|
||||
}
|
||||
securityRule.setExpression(expression);
|
||||
}
|
||||
|
||||
protected void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class DefaultExternalTransitionConfigurer<S, E> extends AbstractTransitio
|
||||
@Override
|
||||
public void configure(StateMachineTransitionBuilder<S, E> builder) throws Exception {
|
||||
builder.addTransition(getSource(), getTarget(), getState(), getEvent(), getPeriod(), getCount(), getActions(), getGuard(), TransitionKind.EXTERNAL,
|
||||
getSecurityRule());
|
||||
getSecurityRule(), getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,4 +116,10 @@ public class DefaultExternalTransitionConfigurer<S, E> extends AbstractTransitio
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExternalTransitionConfigurer<S, E> name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class DefaultInternalTransitionConfigurer<S, E> extends AbstractTransitio
|
||||
@Override
|
||||
public void configure(StateMachineTransitionBuilder<S, E> builder) throws Exception {
|
||||
builder.addTransition(getSource(), getTarget(), getState(), getEvent(), getPeriod(), getCount(), getActions(), getGuard(), TransitionKind.INTERNAL,
|
||||
getSecurityRule());
|
||||
getSecurityRule(), getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,4 +110,10 @@ public class DefaultInternalTransitionConfigurer<S, E> extends AbstractTransitio
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalTransitionConfigurer<S, E> name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ public class DefaultLocalTransitionConfigurer<S, E> extends AbstractTransitionCo
|
||||
@Override
|
||||
public void configure(StateMachineTransitionBuilder<S, E> builder) throws Exception {
|
||||
builder.addTransition(getSource(), getTarget(), getState(), getEvent(), getPeriod(), getCount(), getActions(), getGuard(), TransitionKind.LOCAL,
|
||||
getSecurityRule());
|
||||
getSecurityRule(), getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,5 +114,11 @@ public class DefaultLocalTransitionConfigurer<S, E> extends AbstractTransitionCo
|
||||
setSecurityRule(expression);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalTransitionConfigurer<S, E> name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -126,4 +126,13 @@ public interface TransitionConfigurer<T, S, E> extends
|
||||
*/
|
||||
T secured(String expression);
|
||||
|
||||
/**
|
||||
* Specify a name for this {@link Transition}.
|
||||
*
|
||||
* @param name the name
|
||||
* @return configurer for chaining
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
T name(String name);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,6 +39,7 @@ public class TransitionData<S, E> {
|
||||
private final Guard<S, E> guard;
|
||||
private final TransitionKind kind;
|
||||
private final SecurityRule securityRule;
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Instantiates a new transition data.
|
||||
@@ -48,7 +49,7 @@ public class TransitionData<S, E> {
|
||||
* @param event the event
|
||||
*/
|
||||
public TransitionData(S source, S target, E event) {
|
||||
this(source, target, null, event, null, null, null, null, TransitionKind.EXTERNAL, null);
|
||||
this(source, target, null, event, null, null, null, null, TransitionKind.EXTERNAL, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +64,23 @@ public class TransitionData<S, E> {
|
||||
*/
|
||||
public TransitionData(S source, S target, E event, Collection<Action<S, E>> actions,
|
||||
Guard<S, E> guard, TransitionKind kind) {
|
||||
this(source, target, null, event, null, null, actions, guard, kind, null);
|
||||
this(source, target, null, event, null, null, actions, guard, kind, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new transition data.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @param event the event
|
||||
* @param actions the actions
|
||||
* @param guard the guard
|
||||
* @param kind the kind
|
||||
* @param name the name
|
||||
*/
|
||||
public TransitionData(S source, S target, E event, Collection<Action<S, E>> actions,
|
||||
Guard<S, E> guard, TransitionKind kind, String name) {
|
||||
this(source, target, null, event, null, null, actions, guard, kind, null, name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +96,41 @@ public class TransitionData<S, E> {
|
||||
*/
|
||||
public TransitionData(S source, S target, Long period, Integer count, Collection<Action<S, E>> actions,
|
||||
Guard<S, E> guard, TransitionKind kind) {
|
||||
this(source, target, null, null, period, count, actions, guard, kind, null);
|
||||
this(source, target, null, null, period, count, actions, guard, kind, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new transition data.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @param period the period
|
||||
* @param count the count
|
||||
* @param actions the actions
|
||||
* @param guard the guard
|
||||
* @param kind the kind
|
||||
* @param name the name
|
||||
*/
|
||||
public TransitionData(S source, S target, Long period, Integer count, Collection<Action<S, E>> actions,
|
||||
Guard<S, E> guard, TransitionKind kind, String name) {
|
||||
this(source, target, null, null, period, count, actions, guard, kind, null, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new transition data.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @param period the period
|
||||
* @param count the count
|
||||
* @param actions the actions
|
||||
* @param guard the guard
|
||||
* @param kind the kind
|
||||
* @param securityRule the security rule
|
||||
*/
|
||||
public TransitionData(S source, S target, Long period, Integer count, Collection<Action<S, E>> actions,
|
||||
Guard<S, E> guard, TransitionKind kind, SecurityRule securityRule) {
|
||||
this(source, target, null, null, period, count, actions, guard, kind, securityRule, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,9 +146,10 @@ public class TransitionData<S, E> {
|
||||
* @param guard the guard
|
||||
* @param kind the kind
|
||||
* @param securityRule the security rule
|
||||
* @param name the name
|
||||
*/
|
||||
public TransitionData(S source, S target, S state, E event, Long period, Integer count, Collection<Action<S, E>> actions,
|
||||
Guard<S, E> guard, TransitionKind kind, SecurityRule securityRule) {
|
||||
Guard<S, E> guard, TransitionKind kind, SecurityRule securityRule, String name) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
this.state = state;
|
||||
@@ -108,6 +160,7 @@ public class TransitionData<S, E> {
|
||||
this.guard = guard;
|
||||
this.kind = kind;
|
||||
this.securityRule = securityRule;
|
||||
this.name = (name == null) ? "" : name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,4 +252,8 @@ public class TransitionData<S, E> {
|
||||
public SecurityRule getSecurityRule() {
|
||||
return securityRule;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,23 @@ import java.util.Collection;
|
||||
|
||||
public abstract class AbstractExternalTransition<S, E> extends AbstractTransition<S, E> implements Transition<S, E> {
|
||||
|
||||
/**
|
||||
* Instantiates a new abstract external transition.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @param actions the actions
|
||||
* @param event the event
|
||||
* @param guard the guard
|
||||
* @param trigger the trigger
|
||||
* @param securityRule the security rule
|
||||
* @param name the name
|
||||
*/
|
||||
public AbstractExternalTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions,
|
||||
E event, Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule, String name) {
|
||||
super(source, target, actions, event, TransitionKind.EXTERNAL, guard, trigger, securityRule, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new abstract external transition.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,4 +53,20 @@ public class AbstractInternalTransition<S, E> extends AbstractTransition<S, E> i
|
||||
Trigger<S, E> trigger, SecurityRule securityRule) {
|
||||
super(source, source, actions, event, TransitionKind.INTERNAL, guard, trigger, securityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new abstract internal transition.
|
||||
*
|
||||
* @param source the source
|
||||
* @param actions the actions
|
||||
* @param event the event
|
||||
* @param guard the guard
|
||||
* @param trigger the trigger
|
||||
* @param securityRule the security rule
|
||||
* @param name the name
|
||||
*/
|
||||
public AbstractInternalTransition(State<S, E> source, Collection<Action<S, E>> actions, E event, Guard<S, E> guard,
|
||||
Trigger<S, E> trigger, SecurityRule securityRule, String name) {
|
||||
super(source, source, actions, event, TransitionKind.INTERNAL, guard, trigger, securityRule, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,4 +55,21 @@ public class AbstractLocalTransition<S, E> extends AbstractTransition<S, E> impl
|
||||
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule) {
|
||||
super(source, target, actions, event, TransitionKind.LOCAL, guard, trigger, securityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new abstract local transition.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @param actions the actions
|
||||
* @param event the event
|
||||
* @param guard the guard
|
||||
* @param trigger the trigger
|
||||
* @param securityRule the security rule
|
||||
* @param name the name
|
||||
*/
|
||||
public AbstractLocalTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions, E event,
|
||||
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule, String name) {
|
||||
super(source, target, actions, event, TransitionKind.LOCAL, guard, trigger, securityRule, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2018 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,6 +47,7 @@ public abstract class AbstractTransition<S, E> implements Transition<S, E> {
|
||||
private final Guard<S, E> guard;
|
||||
private final Trigger<S, E> trigger;
|
||||
private final SecurityRule securityRule;
|
||||
private final String name;
|
||||
private CompositeActionListener<S, E> actionListener;
|
||||
|
||||
/**
|
||||
@@ -62,7 +63,23 @@ public abstract class AbstractTransition<S, E> implements Transition<S, E> {
|
||||
*/
|
||||
public AbstractTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions, E event, TransitionKind kind,
|
||||
Guard<S, E> guard, Trigger<S, E> trigger) {
|
||||
this(source, target, actions, event, kind, guard, trigger, null);
|
||||
this(source, target, actions, event, kind, guard, trigger, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new abstract transition.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @param actions the actions
|
||||
* @param event the event
|
||||
* @param kind the kind
|
||||
* @param guard the guard
|
||||
* @param trigger the trigger
|
||||
*/
|
||||
public AbstractTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions, E event, TransitionKind kind,
|
||||
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule) {
|
||||
this(source, target, actions, event, kind, guard, trigger, securityRule, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +95,7 @@ public abstract class AbstractTransition<S, E> implements Transition<S, E> {
|
||||
* @param securityRule the security rule
|
||||
*/
|
||||
public AbstractTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions, E event, TransitionKind kind,
|
||||
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule) {
|
||||
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule, String name) {
|
||||
Assert.notNull(kind, "Transition type must be set");
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
@@ -87,6 +104,7 @@ public abstract class AbstractTransition<S, E> implements Transition<S, E> {
|
||||
this.guard = guard;
|
||||
this.trigger = trigger;
|
||||
this.securityRule = securityRule;
|
||||
this.name = (name == null) ? "" : name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,6 +152,11 @@ public abstract class AbstractTransition<S, E> implements Transition<S, E> {
|
||||
public State<S, E> getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Action<S, E>> getActions() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class DefaultExternalTransition<S, E> extends AbstractExternalTransition<
|
||||
Guard<S, E> guard, Trigger<S, E> trigger) {
|
||||
super(source, target, actions, event, guard, trigger);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new default external transition.
|
||||
*
|
||||
@@ -55,4 +55,21 @@ public class DefaultExternalTransition<S, E> extends AbstractExternalTransition<
|
||||
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule) {
|
||||
super(source, target, actions, event, guard, trigger, securityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new default external transition.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @param actions the actions
|
||||
* @param event the event
|
||||
* @param guard the guard
|
||||
* @param trigger the trigger
|
||||
* @param securityRule the security rule
|
||||
* @param name the name
|
||||
*/
|
||||
public DefaultExternalTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions, E event,
|
||||
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule, String name) {
|
||||
super(source, target, actions, event, guard, trigger, securityRule, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,4 +53,20 @@ public class DefaultInternalTransition<S, E> extends AbstractInternalTransition<
|
||||
Trigger<S, E> trigger, SecurityRule securityRule) {
|
||||
super(source, actions, event, guard, trigger, securityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new default internal transition.
|
||||
*
|
||||
* @param source the source
|
||||
* @param actions the actions
|
||||
* @param event the event
|
||||
* @param guard the guard
|
||||
* @param trigger the trigger
|
||||
* @param securityRule the security rule
|
||||
* @param name the name
|
||||
*/
|
||||
public DefaultInternalTransition(State<S, E> source, Collection<Action<S, E>> actions, E event, Guard<S, E> guard,
|
||||
Trigger<S, E> trigger, SecurityRule securityRule, String name) {
|
||||
super(source, actions, event, guard, trigger, securityRule, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,6 +56,23 @@ public class DefaultLocalTransition<S, E> extends AbstractLocalTransition<S, E>
|
||||
super(source, target, actions, event, guard, trigger, securityRule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new default local transition.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @param actions the actions
|
||||
* @param event the event
|
||||
* @param guard the guard
|
||||
* @param trigger the trigger
|
||||
* @param securityRule the security rule
|
||||
* @param name the name
|
||||
*/
|
||||
public DefaultLocalTransition(State<S, E> source, State<S, E> target, Collection<Action<S, E>> actions, E event,
|
||||
Guard<S, E> guard, Trigger<S, E> trigger, SecurityRule securityRule, String name) {
|
||||
super(source, target, actions, event, guard, trigger, securityRule, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefaultLocalTransition [getSource()=" + getSource() + ", getTarget()=" + getTarget() + "]";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2018 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -99,6 +99,13 @@ public interface Transition<S, E> {
|
||||
* @return the security rule
|
||||
*/
|
||||
SecurityRule getSecurityRule();
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Adds the action listener.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,7 +68,7 @@ public class StateMachineModelTests {
|
||||
|
||||
|
||||
Collection<TransitionData<String, String>> transitions = new ArrayList<>();
|
||||
TransitionData<String, String> transitionData1 = new TransitionData<String, String>("S1", "S2", null, "E1", null, null, null, null, TransitionKind.EXTERNAL, null);
|
||||
TransitionData<String, String> transitionData1 = new TransitionData<String, String>("S1", "S2", null, "E1", null, null, null, null, TransitionKind.EXTERNAL, null, "");
|
||||
transitions.add(transitionData1);
|
||||
Map<String, List<ChoiceData<String, String>>> choices = new HashMap<>();
|
||||
Map<String, List<JunctionData<String, String>>> junctions = new HashMap<>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2018 the original author or authors.
|
||||
* Copyright 2015-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -151,6 +151,11 @@ public class StateContextExpressionMethodsTests {
|
||||
@Override
|
||||
public void removeActionListener(ActionListener<SpelStates, SpelEvents> listener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static class MockStatemachine implements StateMachine<SpelStates, SpelEvents> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2020 the original author or authors.
|
||||
* Copyright 2016-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -425,12 +425,12 @@ public class UmlModelParser {
|
||||
if (cprentries != null && cprentries.size() == 1) {
|
||||
addTransitionData(new TransitionData<String, String>(resolveName(transition.getSource()),
|
||||
cprentries.get(0).getName(), signal.getName(), UmlUtils.resolveTransitionActions(transition, resolver),
|
||||
guard, UmlUtils.mapUmlTransitionType(transition)));
|
||||
guard, UmlUtils.mapUmlTransitionType(transition), transition.getName()));
|
||||
}
|
||||
} else {
|
||||
addTransitionData(new TransitionData<String, String>(resolveName(transition.getSource()),
|
||||
resolveName(transition.getTarget()), signal.getName(), UmlUtils.resolveTransitionActions(transition, resolver),
|
||||
guard, UmlUtils.mapUmlTransitionType(transition)));
|
||||
guard, UmlUtils.mapUmlTransitionType(transition), transition.getName()));
|
||||
}
|
||||
}
|
||||
} else if (event instanceof TimeEvent) {
|
||||
@@ -443,7 +443,7 @@ public class UmlModelParser {
|
||||
}
|
||||
addTransitionData(new TransitionData<String, String>(resolveName(transition.getSource()),
|
||||
resolveName(transition.getTarget()), period, count, UmlUtils.resolveTransitionActions(transition, resolver),
|
||||
guard, UmlUtils.mapUmlTransitionType(transition)));
|
||||
guard, UmlUtils.mapUmlTransitionType(transition), transition.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,7 +452,7 @@ public class UmlModelParser {
|
||||
if (shouldCreateAnonymousTransition(transition)) {
|
||||
addTransitionData(new TransitionData<String, String>(resolveName(transition.getSource()), resolveName(transition.getTarget()),
|
||||
null, UmlUtils.resolveTransitionActions(transition, resolver), resolveGuard(transition),
|
||||
UmlUtils.mapUmlTransitionType(transition)));
|
||||
UmlUtils.mapUmlTransitionType(transition), transition.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user