Add mongodb repository config support

- Pretty much following what was done
  for jpa and redis.
- Fixes #275
This commit is contained in:
Janne Valkealahti
2016-11-13 08:23:25 +00:00
parent d322c26d5f
commit 4dbccf84fa
25 changed files with 1664 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
springShellVersion=1.1.0.RELEASE
springSecurityVersion=4.0.3.RELEASE
springDataRedisVersion=1.7.3.RELEASE
springDataMongoDbVersion=1.9.3.RELEASE
springDataCommonsVersion=1.12.3.RELEASE
springDataJpaVersion=1.10.3.RELEASE
springCloudClusterVersion=1.0.0.RELEASE

View File

@@ -31,6 +31,7 @@ include 'spring-statemachine-samples:monitoring'
include 'spring-statemachine-data'
include 'spring-statemachine-data:jpa'
include 'spring-statemachine-data:redis'
include 'spring-statemachine-data:mongodb'
rootProject.children.find {
if (it.name == 'spring-statemachine-recipes') {

View File

@@ -28,3 +28,18 @@ project('spring-statemachine-data-redis') {
testRuntime "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
}
}
project('spring-statemachine-data-mongodb') {
description = "Spring State Machine Data MongoDB"
dependencies {
compile project(":spring-statemachine-data-common")
compile "org.springframework.data:spring-data-mongodb:$springDataMongoDbVersion"
testCompile project(":spring-statemachine-test")
optional "org.eclipse.persistence:javax.persistence:$eclipsePersistenceVersion"
testCompile project(path:":spring-statemachine-data-common", configuration:"testArtifacts")
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
testRuntime "org.springframework.boot:spring-boot-starter-data-mongodb:$springBootVersion"
testRuntime "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
}
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import org.springframework.statemachine.data.ActionRepository;
/**
* A {@link ActionRepository} interface for MongoDb used for actions.
*
* @author Janne Valkealahti
*
*/
public interface MongoDbActionRepository extends ActionRepository<MongoDbRepositoryAction> {
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import org.springframework.statemachine.data.GuardRepository;
/**
* A {@link GuardRepository} interface for MongoDb used for guards.
*
* @author Janne Valkealahti
*
*/
public interface MongoDbGuardRepository extends GuardRepository<MongoDbRepositoryGuard> {
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.statemachine.data.RepositoryAction;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
* MongoDb entity for actions.
*
* @author Janne Valkealahti
*
*/
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class)
@Document(collection = "MongoDbRepositoryAction")
public class MongoDbRepositoryAction extends RepositoryAction {
@Id
private String id;
private String name;
private String spel;
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getSpel() {
return spel;
}
public void setSpel(String spel) {
this.spel = spel;
}
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.statemachine.data.RepositoryGuard;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
* MongoDb entity for actions.
*
* @author Janne Valkealahti
*
*/
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class)
@Document(collection = "MongoDbRepositoryGuard")
public class MongoDbRepositoryGuard extends RepositoryGuard {
@Id
String id;
private String name;
private String spel;
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getSpel() {
return spel;
}
public void setSpel(String spel) {
this.spel = spel;
}
}

View File

@@ -0,0 +1,239 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Reference;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.statemachine.data.RepositoryState;
import org.springframework.statemachine.state.PseudoStateKind;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
* MongoDb entity for states.
*
* @author Janne Valkealahti
*
*/
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class)
@Document(collection = "MongoDbRepositoryState")
public class MongoDbRepositoryState extends RepositoryState {
@Id
private String id;
private String machineId = "";
private String state;
private String region;
private boolean initial;
private PseudoStateKind kind;
private String submachineId;
@Reference
private MongoDbRepositoryState parentState;
@Reference
private Set<MongoDbRepositoryAction> stateActions;
@Reference
private Set<MongoDbRepositoryAction> entryActions;
@Reference
private Set<MongoDbRepositoryAction> exitActions;
private Set<String> deferredEvents;
/**
* Instantiates a new MongoDb repository state.
*/
public MongoDbRepositoryState() {
}
/**
* Instantiates a new MongoDb repository state.
*
* @param state the state
*/
public MongoDbRepositoryState(String state) {
this.state = state;
}
/**
* Instantiates a new MongoDb repository state.
*
* @param state the state
* @param initial the initial
*/
public MongoDbRepositoryState(String state, boolean initial) {
this(null, state, initial);
}
/**
* Instantiates a new MongoDb repository state.
*
* @param machineId the machine id
* @param state the state
* @param initial the initial
*/
public MongoDbRepositoryState(String machineId, String state, boolean initial) {
this(machineId, null, state, initial);
}
/**
* Instantiates a new MongoDb repository state.
*
* @param machineId the machine id
* @param parentState the parent state
* @param state the state
* @param initial the initial
*/
public MongoDbRepositoryState(String machineId, MongoDbRepositoryState parentState, String state, boolean initial) {
this(machineId, parentState, state, initial, null, null, null);
}
/**
* Instantiates a new MongoDb repository state.
*
* @param machineId the machine id
* @param parentState the parent state
* @param state the state
* @param initial the initial
* @param stateActions the state actions
* @param entryActions the entry actions
* @param exitActions the exit actions
*/
public MongoDbRepositoryState(String machineId, MongoDbRepositoryState parentState, String state, boolean initial, Set<MongoDbRepositoryAction> stateActions,
Set<MongoDbRepositoryAction> entryActions, Set<MongoDbRepositoryAction> exitActions) {
this.machineId = machineId;
this.parentState = parentState;
this.state = state;
this.initial = initial;
this.stateActions = stateActions;
this.entryActions = entryActions;
this.exitActions = exitActions;
}
@Override
public String getMachineId() {
return machineId;
}
public void setMachineId(String machineId) {
this.machineId = machineId;
}
@Override
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
@Override
public MongoDbRepositoryState getParentState() {
return parentState;
}
public void setParentState(MongoDbRepositoryState parentState) {
this.parentState = parentState;
}
@Override
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
@Override
public PseudoStateKind getKind() {
return kind;
}
public void setKind(PseudoStateKind kind) {
this.kind = kind;
}
@Override
public boolean isInitial() {
return initial;
}
public void setInitial(boolean initial) {
this.initial = initial;
}
@Override
public Set<MongoDbRepositoryAction> getStateActions() {
return stateActions;
}
public void setStateActions(Set<MongoDbRepositoryAction> stateActions) {
this.stateActions = stateActions;
}
@Override
public Set<MongoDbRepositoryAction> getEntryActions() {
return entryActions;
}
public void setEntryActions(Set<MongoDbRepositoryAction> entryActions) {
this.entryActions = entryActions;
}
@Override
public Set<MongoDbRepositoryAction> getExitActions() {
return exitActions;
}
public void setExitActions(Set<MongoDbRepositoryAction> exitActions) {
this.exitActions = exitActions;
}
@Override
public Set<String> getDeferredEvents() {
return deferredEvents;
}
public void setDeferredEvents(Set<String> deferredEvents) {
this.deferredEvents = deferredEvents;
}
@Override
public String getSubmachineId() {
return submachineId;
}
public void setSubmachineId(String submachineId) {
this.submachineId = submachineId;
}
@Override
public String toString() {
return "MongoDbRepositoryState [id=" + id + ", machineId=" + machineId + ", state=" + state + ", region=" + region
+ ", initial=" + initial + ", kind=" + kind + ", submachineId=" + submachineId + ", parentState="
+ parentState + ", stateActions=" + stateActions + ", entryActions=" + entryActions + ", exitActions="
+ exitActions + ", deferredEvents=" + deferredEvents + "]";
}
}

View File

@@ -0,0 +1,174 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Reference;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.statemachine.data.RepositoryTransition;
import org.springframework.statemachine.transition.TransitionKind;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
/**
* MongoDb entity for transitions.
*
* @author Janne Valkealahti
*
*/
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class)
@Document(collection = "MongoDbRepositoryTransition")
public class MongoDbRepositoryTransition extends RepositoryTransition {
@Id
private String id;
private String machineId = "";
@Reference
private MongoDbRepositoryState source;
@Reference
private MongoDbRepositoryState target;
private String event;
private TransitionKind kind;
@Reference
private Set<MongoDbRepositoryAction> actions;
@Reference
private MongoDbRepositoryGuard guard;
/**
* Instantiates a new MongoDb repository transition.
*/
public MongoDbRepositoryTransition() {
this(null, null, null);
}
/**
* Instantiates a new MongoDb repository transition.
*
* @param source the source
* @param target the target
* @param event the event
*/
public MongoDbRepositoryTransition(MongoDbRepositoryState source, MongoDbRepositoryState target, String event) {
this(null, source, target, event);
}
/**
* Instantiates a new MongoDb repository transition.
*
* @param machineId the machine id
* @param source the source
* @param target the target
* @param event the event
*/
public MongoDbRepositoryTransition(String machineId, MongoDbRepositoryState source, MongoDbRepositoryState target, String event) {
this(machineId, source, target, event, null);
}
/**
* Instantiates a new MongoDb repository transition.
*
* @param machineId the machine id
* @param source the source
* @param target the target
* @param event the event
* @param actions the actions
*/
public MongoDbRepositoryTransition(String machineId, MongoDbRepositoryState source, MongoDbRepositoryState target, String event, Set<MongoDbRepositoryAction> actions) {
this.machineId = machineId == null ? "" : machineId;
this.source = source;
this.target = target;
this.event = event;
this.actions = actions;
}
@Override
public String getMachineId() {
return machineId;
}
public void setMachineId(String machineId) {
this.machineId = machineId;
}
@Override
public MongoDbRepositoryState getSource() {
return source;
}
public void setSource(MongoDbRepositoryState source) {
this.source = source;
}
@Override
public MongoDbRepositoryState getTarget() {
return target;
}
public void setTarget(MongoDbRepositoryState target) {
this.target = target;
}
@Override
public String getEvent() {
return event;
}
public void setEvent(String event) {
this.event = event;
}
@Override
public Set<MongoDbRepositoryAction> getActions() {
return actions;
}
public void setActions(Set<MongoDbRepositoryAction> actions) {
this.actions = actions;
}
@Override
public MongoDbRepositoryGuard getGuard() {
return guard;
}
public void setGuard(MongoDbRepositoryGuard guard) {
this.guard = guard;
}
@Override
public TransitionKind getKind() {
return kind;
}
public void setKind(TransitionKind kind) {
this.kind = kind;
}
@Override
public String toString() {
return "MongoDbRepositoryTransition [id=" + id + ", machineId=" + machineId + ", source=" + source + ", target=" + target + ", event="
+ event + ", kind=" + kind + ", actions=" + actions + ", guard=" + guard + "]";
}
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import org.springframework.statemachine.data.StateRepository;
/**
* A {@link StateRepository} interface for MongoDb used for states.
*
* @author Janne Valkealahti
*
*/
public interface MongoDbStateRepository extends StateRepository<MongoDbRepositoryState> {
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import org.springframework.statemachine.data.StateRepository;
import org.springframework.statemachine.data.TransitionRepository;
/**
* A {@link StateRepository} interface for MongoDb used for transitions.
*
* @author Janne Valkealahti
*
*/
public interface MongoDbTransitionRepository extends TransitionRepository<MongoDbRepositoryTransition> {
}

View File

@@ -0,0 +1,125 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.keyvalue.core.KeyValueTemplate;
import org.springframework.statemachine.data.AbstractRepositoryTests;
import org.springframework.statemachine.transition.TransitionKind;
/**
* MongoDb repository config tests.
*
* @author Janne Valkealahti
*/
public class MongoDbRepositoryTests extends AbstractRepositoryTests {
@Rule
public MongoDbRule MongoDbAvailableRule = new MongoDbRule();
@Override
protected void cleanInternal() {
AnnotationConfigApplicationContext c = new AnnotationConfigApplicationContext();
c.register(TestConfig.class);
c.refresh();
MongoTemplate template = c.getBean(MongoTemplate.class);
template.dropCollection(MongoDbRepositoryAction.class);
template.dropCollection(MongoDbRepositoryGuard.class);
template.dropCollection(MongoDbRepositoryState.class);
template.dropCollection(MongoDbRepositoryTransition.class);
c.close();
}
@Test
public void testPopulate1() {
context.register(getRegisteredClasses());
context.register(Config2.class);
context.refresh();
MongoDbStateRepository stateRepository = context.getBean(MongoDbStateRepository.class);
MongoDbTransitionRepository transitionRepository = context.getBean(MongoDbTransitionRepository.class);
assertThat(stateRepository.count(), is(3l));
assertThat(transitionRepository.count(), is(3l));
List<MongoDbRepositoryState> states = new ArrayList<>();
stateRepository.findAll().iterator().forEachRemaining(states::add);
List<MongoDbRepositoryTransition> transitions = new ArrayList<>();
transitionRepository.findAll().iterator().forEachRemaining(transitions::add);
assertThat(states.size(), is(3));
assertThat(transitions.size(), is(3));
MongoDbRepositoryTransition transition1 = transitions.get(0);
assertThat(transition1.getSource(), notNullValue());
assertThat(transition1.getTarget(), notNullValue());
}
@Test
public void testRepository1() {
context.register(getRegisteredClasses());
context.refresh();
MongoDbStateRepository statesRepository = context.getBean(MongoDbStateRepository.class);
MongoDbRepositoryState stateS1 = new MongoDbRepositoryState("S1");
MongoDbRepositoryState stateS2 = new MongoDbRepositoryState("S2");
assertThat(statesRepository.count(), is(0l));
statesRepository.save(stateS1);
statesRepository.save(stateS2);
assertThat(statesRepository.count(), is(2l));
MongoDbTransitionRepository transitionsRepository = context.getBean(MongoDbTransitionRepository.class);
MongoDbRepositoryTransition transition = new MongoDbRepositoryTransition(stateS1, stateS2, "E1");
transition.setKind(TransitionKind.EXTERNAL);
transitionsRepository.save(transition);
assertThat(statesRepository.count(), is(2l));
MongoDbRepositoryTransition transition2 = transitionsRepository.findAll().iterator().next();
assertThat(transition2.getSource().getState(), is("S1"));
assertThat(transition2.getTarget().getState(), is("S2"));
assertThat(transition2.getEvent(), is("E1"));
assertThat(transition2.getKind(), is(TransitionKind.EXTERNAL));
List<MongoDbRepositoryState> findByMachineId = statesRepository.findByMachineId("");
assertThat(findByMachineId.size(), is(2));
context.close();
}
@Override
protected Class<?>[] getRegisteredClasses() {
return new Class<?>[] { TestConfig.class };
}
@Override
protected AnnotationConfigApplicationContext buildContext() {
return new AnnotationConfigApplicationContext();
}
@EnableAutoConfiguration
static class TestConfig {
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright 2016 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.statemachine.data.mongodb;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientOptions;
import com.mongodb.ServerAddress;
/**
* Rule skipping tests if MongoDb is not available from localhost with default settings.
*
* @author Janne Valkealahti
*
*/
public class MongoDbRule extends TestWatcher implements TestRule {
@Override
public Statement apply(Statement base, Description description) {
MongoClient client = null;
try {
client = new MongoClient(new ServerAddress(), MongoClientOptions.builder().connectTimeout(50).build());
client.getAddress();
} catch (Exception e) {
return super.apply(new Statement() {
@Override
public void evaluate() throws Throwable {
}
}, Description.EMPTY);
} finally {
if (client != null) {
client.close();
}
}
return super.apply(base, description);
}
}

View File

@@ -0,0 +1,71 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "SI"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S1",
"kind": "FORK"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S2"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "SF",
"kind": "END"
},
{
"@id": "5",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"region": "r2",
"parentState": "3",
"state": "S20"
},
{
"@id": "6",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"region": "r2",
"parentState": "3",
"state": "S21"
},
{
"@id": "7",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"region": "r3",
"parentState": "3",
"state": "S30"
},
{
"@id": "8",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"region": "r3",
"parentState": "3",
"state": "S31"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "6"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "8"
}
]

View File

@@ -0,0 +1,93 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "SI"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S2"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S3",
"kind": "JOIN"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S4"
},
{
"@id": "5",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"region": "r2",
"parentState": "2",
"state": "S20"
},
{
"@id": "6",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"region": "r2",
"parentState": "2",
"state": "S21"
},
{
"@id": "7",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"region": "r3",
"parentState": "2",
"state": "S30"
},
{
"@id": "8",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"region": "r3",
"parentState": "2",
"state": "S31"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "5",
"target": "6",
"event": "E2"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "7",
"target": "8",
"event": "E3"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "7",
"target": "3"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "8",
"target": "3"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "3",
"target": "4"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "4",
"target": "1",
"event": "E4"
}
]

View File

@@ -0,0 +1,60 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "READY"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S1"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S2"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S3",
"deferredEvents": ["E1", "E2"]
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "3",
"event": "E2"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "4",
"event": "E3"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "4",
"target": "2",
"event": "E4"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "4",
"target": "3",
"event": "E5"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "4",
"target": "1",
"event": "E6"
}
]

View File

@@ -0,0 +1,50 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "S1"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"submachineId": "machineS2",
"state": "S2"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S3"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"machineId": "machineS2",
"initial": true,
"state": "S21"
},
{
"@id": "5",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"machineId": "machineS2",
"state": "S22"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "3",
"event": "E2"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "4",
"target": "5",
"event": "E3"
}
]

View File

@@ -0,0 +1,46 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "S1"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S2"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S3"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryGuard",
"spel": "true"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "3",
"event": "E2",
"guard": "4"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "3",
"event": "E3",
"kind": "LOCAL"
}
]

View File

@@ -0,0 +1,52 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "S1"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S2"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"parentState": "2",
"state": "S20"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"parentState": "2",
"state": "S21"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "3",
"target": "4",
"event": "E2"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "1",
"event": "E3"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "4",
"event": "E4"
}
]

View File

@@ -0,0 +1,64 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "S1"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S2"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"parentState": "2",
"state": "S20"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"parentState": "2",
"state": "S21"
},
{
"@id": "5",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"parentState": "2",
"state": "SH",
"kind": "HISTORY_SHALLOW"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "3",
"target": "4",
"event": "E2",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "1",
"event": "E3",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "5",
"event": "E4",
"kind": "EXTERNAL"
}
]

View File

@@ -0,0 +1,58 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"region": "r1",
"initial": true,
"state": "S10"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"region": "r1",
"initial": false,
"state": "S11"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"region": "r2",
"initial": true,
"state": "S20"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"region": "r2",
"initial": false,
"state": "S21"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "3",
"target": "4",
"event": "E1",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "1",
"event": "E2",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "4",
"target": "3",
"event": "E3",
"kind": "EXTERNAL"
}
]

View File

@@ -0,0 +1,84 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "SI"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S3",
"kind": "CHOICE"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S30"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S31"
},
{
"@id": "5",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S32"
},
{
"@id": "6",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S33"
},
{
"@id": "7",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryGuard",
"name": "s30Guard"
},
{
"@id": "8",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryGuard",
"name": "s31Guard"
},
{
"@id": "9",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryGuard",
"name": "s32Guard"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "3",
"guard": "7"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "4",
"guard": "8"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "5",
"guard": "9"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "6"
}
]

View File

@@ -0,0 +1,38 @@
[
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryGuard",
"spel": "true"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryAction",
"spel": "true"
},
{
"@id": "5",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryAction",
"spel": "false"
},
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "S1"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S2"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1",
"kind": "EXTERNAL",
"guard": "3",
"actions": ["4", "5"]
}
]

View File

@@ -0,0 +1,84 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "SI"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S3",
"kind": "JUNCTION"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S30"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S31"
},
{
"@id": "5",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S32"
},
{
"@id": "6",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": false,
"state": "S33"
},
{
"@id": "7",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryGuard",
"name": "s30Guard"
},
{
"@id": "8",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryGuard",
"name": "s31Guard"
},
{
"@id": "9",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryGuard",
"name": "s32Guard"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1",
"kind": "EXTERNAL"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "3",
"guard": "7"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "4",
"guard": "8"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "5",
"guard": "9"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "6"
}
]

View File

@@ -0,0 +1,131 @@
[
{
"@id": "1",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "S1"
},
{
"@id": "2",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S2"
},
{
"@id": "3",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S3"
},
{
"@id": "4",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S4"
},
{
"@id": "5",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S5"
},
{
"@id": "6",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"initial": true,
"state": "S21",
"parentState": "2"
},
{
"@id": "7",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S22",
"parentState": "2"
},
{
"@id": "8",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S23",
"parentState": "2"
},
{
"@id": "9",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S2ENTRY1",
"parentState": "2",
"kind": "ENTRY"
},
{
"@id": "10",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S2ENTRY2",
"parentState": "2",
"kind": "ENTRY"
},
{
"@id": "11",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S2EXIT1",
"parentState": "2",
"kind": "EXIT"
},
{
"@id": "12",
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryState",
"state": "S2EXIT2",
"parentState": "2",
"kind": "EXIT"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "2",
"event": "E1"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "2",
"target": "3",
"event": "E2"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "9",
"event": "ENTRY1"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "1",
"target": "10",
"event": "ENTRY2"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "7",
"target": "11",
"event": "EXIT1"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "7",
"target": "12",
"event": "EXIT2"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "9",
"target": "7"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "10",
"target": "9"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "11",
"target": "4"
},
{
"_class": "org.springframework.statemachine.data.mongodb.MongoDbRepositoryTransition",
"source": "12",
"target": "5"
}
]