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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.";
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user