Use the contextObj as is when saving the StateMachineContext

- Polish and fix some merge issues
- Relates #494
This commit is contained in:
james
2018-02-07 16:37:29 +01:00
committed by jvalkeal
parent ef8704cf44
commit 041189bb31
7 changed files with 34 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 the original author or authors.
* Copyright 2017-2018 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.
@@ -35,6 +35,14 @@ public class MongoDbRepositoryStateMachine extends RepositoryStateMachine {
private String state;
private byte[] stateMachineContext;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Override
public String getMachineId() {
return machineId;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 the original author or authors.
* Copyright 2017-2018 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.
@@ -60,8 +60,9 @@ public class MongoDbRepositoryStateMachinePersist<S, E> extends RepositoryStateM
}
@Override
protected MongoDbRepositoryStateMachine build(StateMachineContext<S, E> context, byte[] serialisedContext) {
protected MongoDbRepositoryStateMachine build(StateMachineContext<S, E> context, Object contextObj, byte[] serialisedContext) {
MongoDbRepositoryStateMachine mongodbRepositoryStateMachine = new MongoDbRepositoryStateMachine();
mongodbRepositoryStateMachine.setId(contextObj.toString());
mongodbRepositoryStateMachine.setMachineId(context.getId());
mongodbRepositoryStateMachine.setState(context.getState().toString());
mongodbRepositoryStateMachine.setStateMachineContext(serialisedContext);