DATAJDBC-453 - Polishing.

Remove unused AggregateChangeExecutionContext. Extract MutableAggregateChange interface and use it to encapsulate the implementation class. Expose MutableAggregateChange in entity callbacks where mutation of the MutableAggregateChange is intended.

Fix generics and license headers, tweak Javadoc.

Original pull request: #197.
This commit is contained in:
Mark Paluch
2020-03-30 14:07:43 +02:00
parent 51b6784579
commit 6769528068
21 changed files with 214 additions and 159 deletions

View File

@@ -56,7 +56,6 @@ class AggregateChangeExecutor {
}
return root;
}
private void execute(DbAction<?> action, JdbcAggregateChangeExecutionContext executionContext) {
@@ -85,5 +84,4 @@ class AggregateChangeExecutor {
throw new DbActionExecutionException(action, e);
}
}
}

View File

@@ -34,7 +34,6 @@ import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.PersistentPropertyAccessor;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.relational.core.conversion.AggregateChangeExecutionContext;
import org.springframework.data.relational.core.conversion.DbAction;
import org.springframework.data.relational.core.conversion.DbActionExecutionResult;
import org.springframework.data.relational.core.conversion.RelationalEntityVersionUtils;
@@ -49,7 +48,7 @@ import org.springframework.util.Assert;
/**
* @author Jens Schauder
*/
class JdbcAggregateChangeExecutionContext implements AggregateChangeExecutionContext {
class JdbcAggregateChangeExecutionContext {
private static final String UPDATE_FAILED = "Failed to update entity [%s]. Id [%s] not found in database.";
private static final String UPDATE_FAILED_OPTIMISTIC_LOCKING = "Failed to update entity [%s]. The entity was updated since it was rea or it isn't in the database at all.";

View File

@@ -38,6 +38,11 @@ import org.springframework.data.relational.core.mapping.RelationalPersistentProp
import org.springframework.data.relational.domain.Identifier;
import org.springframework.lang.Nullable;
/**
* Unit tests for {@link JdbcAggregateChangeExecutionContext}.
*
* @author Jens Schauder
*/
public class JdbcAggregateChangeExecutorContextUnitTests {
RelationalMappingContext context = new RelationalMappingContext();

View File

@@ -28,6 +28,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.annotation.Id;
import org.springframework.data.domain.PageRequest;