@@ -53,8 +53,8 @@ import org.springframework.util.Assert;
|
||||
@SuppressWarnings("rawtypes")
|
||||
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.";
|
||||
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";
|
||||
|
||||
private final MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> context;
|
||||
private final JdbcConverter converter;
|
||||
@@ -268,7 +268,7 @@ class JdbcAggregateChangeExecutionContext {
|
||||
|
||||
if (roots.isEmpty()) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Cannot retrieve the resulting instance(s) unless a %s or %s action was successfully executed.",
|
||||
String.format("Cannot retrieve the resulting instance(s) unless a %s or %s action was successfully executed",
|
||||
DbAction.InsertRoot.class.getName(), DbAction.UpdateRoot.class.getName()));
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ class JdbcAggregateChangeExecutionContext {
|
||||
return pathToValue;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("DbAction of type %s is not supported.", action.getClass()));
|
||||
throw new IllegalArgumentException(String.format("DbAction of type %s is not supported", action.getClass()));
|
||||
}
|
||||
|
||||
private <T> RelationalPersistentEntity<T> getRequiredPersistentEntity(Class<T> type) {
|
||||
@@ -331,7 +331,7 @@ class JdbcAggregateChangeExecutionContext {
|
||||
private <T> void updateWithVersion(DbAction.UpdateRoot<T> update) {
|
||||
|
||||
Number previousVersion = update.getPreviousVersion();
|
||||
Assert.notNull(previousVersion, "The root aggregate cannot be updated because the version property is null.");
|
||||
Assert.notNull(previousVersion, "The root aggregate cannot be updated because the version property is null");
|
||||
|
||||
if (!accessStrategy.updateWithVersion(update.getEntity(), update.getEntityType(), previousVersion)) {
|
||||
|
||||
@@ -460,8 +460,8 @@ class JdbcAggregateChangeExecutionContext {
|
||||
@Override
|
||||
public List add(@Nullable List list, @Nullable Object qualifier, Object value) {
|
||||
|
||||
Assert.notNull(list, "List must not be null.");
|
||||
Assert.notNull(qualifier, "ListAggregator can't handle a null qualifier.");
|
||||
Assert.notNull(list, "List must not be null");
|
||||
Assert.notNull(qualifier, "ListAggregator can't handle a null qualifier");
|
||||
|
||||
int index = (int) qualifier;
|
||||
if (index >= list.size()) {
|
||||
@@ -492,7 +492,7 @@ class JdbcAggregateChangeExecutionContext {
|
||||
@Override
|
||||
public Map add(@Nullable Map map, @Nullable Object qualifier, Object value) {
|
||||
|
||||
Assert.notNull(map, "Map must not be null.");
|
||||
Assert.notNull(map, "Map must not be null");
|
||||
|
||||
map.put(qualifier, value);
|
||||
return map;
|
||||
|
||||
@@ -87,10 +87,10 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
public JdbcAggregateTemplate(ApplicationContext publisher, RelationalMappingContext context, JdbcConverter converter,
|
||||
DataAccessStrategy dataAccessStrategy) {
|
||||
|
||||
Assert.notNull(publisher, "ApplicationContext must not be null!");
|
||||
Assert.notNull(context, "RelationalMappingContext must not be null!");
|
||||
Assert.notNull(converter, "RelationalConverter must not be null!");
|
||||
Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null!");
|
||||
Assert.notNull(publisher, "ApplicationContext must not be null");
|
||||
Assert.notNull(context, "RelationalMappingContext must not be null");
|
||||
Assert.notNull(converter, "RelationalConverter must not be null");
|
||||
Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null");
|
||||
|
||||
this.publisher = publisher;
|
||||
this.context = context;
|
||||
@@ -115,10 +115,10 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
public JdbcAggregateTemplate(ApplicationEventPublisher publisher, RelationalMappingContext context,
|
||||
JdbcConverter converter, DataAccessStrategy dataAccessStrategy) {
|
||||
|
||||
Assert.notNull(publisher, "ApplicationEventPublisher must not be null!");
|
||||
Assert.notNull(context, "RelationalMappingContext must not be null!");
|
||||
Assert.notNull(converter, "RelationalConverter must not be null!");
|
||||
Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null!");
|
||||
Assert.notNull(publisher, "ApplicationEventPublisher must not be null");
|
||||
Assert.notNull(context, "RelationalMappingContext must not be null");
|
||||
Assert.notNull(converter, "RelationalConverter must not be null");
|
||||
Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null");
|
||||
|
||||
this.publisher = publisher;
|
||||
this.context = context;
|
||||
@@ -137,7 +137,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
*/
|
||||
public void setEntityCallbacks(EntityCallbacks entityCallbacks) {
|
||||
|
||||
Assert.notNull(entityCallbacks, "Callbacks must not be null.");
|
||||
Assert.notNull(entityCallbacks, "Callbacks must not be null");
|
||||
|
||||
this.entityCallbacks = entityCallbacks;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> T save(T instance) {
|
||||
|
||||
Assert.notNull(instance, "Aggregate instance must not be null!");
|
||||
Assert.notNull(instance, "Aggregate instance must not be null");
|
||||
|
||||
return performSave(instance, changeCreatorSelectorForSave(instance));
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> Iterable<T> saveAll(Iterable<T> instances) {
|
||||
|
||||
Assert.isTrue(instances.iterator().hasNext(), "Aggregate instances must not be empty!");
|
||||
Assert.isTrue(instances.iterator().hasNext(), "Aggregate instances must not be empty");
|
||||
|
||||
return performSaveAll(instances);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> T insert(T instance) {
|
||||
|
||||
Assert.notNull(instance, "Aggregate instance must not be null!");
|
||||
Assert.notNull(instance, "Aggregate instance must not be null");
|
||||
|
||||
return performSave(instance, entity -> createInsertChange(prepareVersionForInsert(entity)));
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> T update(T instance) {
|
||||
|
||||
Assert.notNull(instance, "Aggregate instance must not be null!");
|
||||
Assert.notNull(instance, "Aggregate instance must not be null");
|
||||
|
||||
return performSave(instance, entity -> createUpdateChange(prepareVersionForUpdate(entity)));
|
||||
}
|
||||
@@ -199,8 +199,8 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> T findById(Object id, Class<T> domainType) {
|
||||
|
||||
Assert.notNull(id, "Id must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(id, "Id must not be null");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
T entity = accessStrategy.findById(id, domainType);
|
||||
if (entity == null) {
|
||||
@@ -212,8 +212,8 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> boolean existsById(Object id, Class<T> domainType) {
|
||||
|
||||
Assert.notNull(id, "Id must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(id, "Id must not be null");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
return accessStrategy.existsById(id, domainType);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> Iterable<T> findAll(Class<T> domainType, Sort sort) {
|
||||
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
Iterable<T> all = accessStrategy.findAll(domainType, sort);
|
||||
return triggerAfterConvert(all);
|
||||
@@ -230,7 +230,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> Page<T> findAll(Class<T> domainType, Pageable pageable) {
|
||||
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
Iterable<T> items = triggerAfterConvert(accessStrategy.findAll(domainType, pageable));
|
||||
List<T> content = StreamSupport.stream(items.spliterator(), false).collect(Collectors.toList());
|
||||
@@ -241,7 +241,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> Iterable<T> findAll(Class<T> domainType) {
|
||||
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
Iterable<T> all = accessStrategy.findAll(domainType);
|
||||
return triggerAfterConvert(all);
|
||||
@@ -250,8 +250,8 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> Iterable<T> findAllById(Iterable<?> ids, Class<T> domainType) {
|
||||
|
||||
Assert.notNull(ids, "Ids must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(ids, "Ids must not be null");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
Iterable<T> allById = accessStrategy.findAllById(ids, domainType);
|
||||
return triggerAfterConvert(allById);
|
||||
@@ -260,8 +260,8 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <S> void delete(S aggregateRoot, Class<S> domainType) {
|
||||
|
||||
Assert.notNull(aggregateRoot, "Aggregate root must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(aggregateRoot, "Aggregate root must not be null");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
IdentifierAccessor identifierAccessor = context.getRequiredPersistentEntity(domainType)
|
||||
.getIdentifierAccessor(aggregateRoot);
|
||||
@@ -272,8 +272,8 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <S> void deleteById(Object id, Class<S> domainType) {
|
||||
|
||||
Assert.notNull(id, "Id must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(id, "Id must not be null");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
deleteTree(id, null, domainType);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> void deleteAllById(Iterable<?> ids, Class<T> domainType) {
|
||||
|
||||
Assert.isTrue(ids.iterator().hasNext(), "Ids must not be empty!");
|
||||
Assert.isTrue(ids.iterator().hasNext(), "Ids must not be empty");
|
||||
|
||||
BatchingAggregateChange<T, DeleteAggregateChange<T>> batchingAggregateChange = BatchingAggregateChange
|
||||
.forDelete(domainType);
|
||||
@@ -301,7 +301,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public void deleteAll(Class<?> domainType) {
|
||||
|
||||
Assert.notNull(domainType, "Domain type must not be null!");
|
||||
Assert.notNull(domainType, "Domain type must not be null");
|
||||
|
||||
MutableAggregateChange<?> change = createDeletingChange(domainType);
|
||||
executor.executeDelete(change);
|
||||
@@ -310,7 +310,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
@Override
|
||||
public <T> void deleteAll(Iterable<? extends T> instances, Class<T> domainType) {
|
||||
|
||||
Assert.isTrue(instances.iterator().hasNext(), "Aggregate instances must not be empty!");
|
||||
Assert.isTrue(instances.iterator().hasNext(), "Aggregate instances must not be empty");
|
||||
|
||||
BatchingAggregateChange<T, DeleteAggregateChange<T>> batchingAggregateChange = BatchingAggregateChange
|
||||
.forDelete(domainType);
|
||||
@@ -335,14 +335,14 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
Object identifier = context.getRequiredPersistentEntity(change.getEntityType())
|
||||
.getIdentifierAccessor(entityAfterExecution).getIdentifier();
|
||||
|
||||
Assert.notNull(identifier, "After saving the identifier must not be null!");
|
||||
Assert.notNull(identifier, "After saving the identifier must not be null");
|
||||
|
||||
return triggerAfterSave(entityAfterExecution, change);
|
||||
}
|
||||
|
||||
private <T> RootAggregateChange<T> beforeExecute(T aggregateRoot, Function<T, RootAggregateChange<T>> changeCreator) {
|
||||
|
||||
Assert.notNull(aggregateRoot, "Aggregate instance must not be null!");
|
||||
Assert.notNull(aggregateRoot, "Aggregate instance must not be null");
|
||||
|
||||
aggregateRoot = triggerBeforeConvert(aggregateRoot);
|
||||
|
||||
@@ -375,7 +375,7 @@ public class JdbcAggregateTemplate implements JdbcAggregateOperations {
|
||||
|
||||
Iterator<T> afterExecutionIterator = executor.executeSave(batchingAggregateChange).iterator();
|
||||
|
||||
Assert.isTrue(afterExecutionIterator.hasNext(), "Instances after execution must not be empty!");
|
||||
Assert.isTrue(afterExecutionIterator.hasNext(), "Instances after execution must not be empty");
|
||||
|
||||
return afterExecute(batchingAggregateChange, afterExecutionIterator.next());
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
|
||||
try {
|
||||
return super.readValue(((Array) value).getArray(), type);
|
||||
} catch (SQLException | ConverterNotFoundException e) {
|
||||
LOG.info("Failed to extract a value of type %s from an Array. Attempting to use standard conversions.", e);
|
||||
LOG.info("Failed to extract a value of type %s from an Array; Attempting to use standard conversions", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
|
||||
Object key) {
|
||||
RelationalPersistentEntity<T> entity = (RelationalPersistentEntity<T>) rootPath.getLeafEntity();
|
||||
|
||||
Assert.notNull(entity, "The rootPath must point to an entity.");
|
||||
Assert.notNull(entity, "The rootPath must point to an entity");
|
||||
|
||||
this.entity = entity;
|
||||
this.rootPath = rootPath;
|
||||
|
||||
@@ -148,7 +148,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
|
||||
if (affectedRows == 0) {
|
||||
|
||||
throw new OptimisticLockingFailureException(
|
||||
String.format("Optimistic lock exception on saving entity of type %s.", persistentEntity.getName()));
|
||||
String.format("Optimistic lock exception on saving entity of type %s", persistentEntity.getName()));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -166,7 +166,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
|
||||
@Override
|
||||
public <T> void deleteWithVersion(Object id, Class<T> domainType, Number previousVersion) {
|
||||
|
||||
Assert.notNull(id, "Id must not be null.");
|
||||
Assert.notNull(id, "Id must not be null");
|
||||
|
||||
RelationalPersistentEntity<T> persistentEntity = getRequiredPersistentEntity(domainType);
|
||||
|
||||
@@ -176,7 +176,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
|
||||
|
||||
if (affectedRows == 0) {
|
||||
throw new OptimisticLockingFailureException(
|
||||
String.format("Optimistic lock exception deleting entity of type %s.", persistentEntity.getName()));
|
||||
String.format("Optimistic lock exception deleting entity of type %s", persistentEntity.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
|
||||
|
||||
Long result = operations.getJdbcOperations().queryForObject(sql(domainType).getCount(), Long.class);
|
||||
|
||||
Assert.notNull(result, "The result of a count query must not be null.");
|
||||
Assert.notNull(result, "The result of a count query must not be null");
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -287,8 +287,8 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
|
||||
public Iterable<Object> findAllByPath(Identifier identifier,
|
||||
PersistentPropertyPath<? extends RelationalPersistentProperty> propertyPath) {
|
||||
|
||||
Assert.notNull(identifier, "identifier must not be null.");
|
||||
Assert.notNull(propertyPath, "propertyPath must not be null.");
|
||||
Assert.notNull(identifier, "identifier must not be null");
|
||||
Assert.notNull(propertyPath, "propertyPath must not be null");
|
||||
|
||||
PersistentPropertyPathExtension path = new PersistentPropertyPathExtension(context, propertyPath);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DefaultJdbcTypeFactory implements JdbcTypeFactory {
|
||||
@Override
|
||||
public Array createArray(Object[] value) {
|
||||
|
||||
Assert.notNull(value, "Value must not be null.");
|
||||
Assert.notNull(value, "Value must not be null");
|
||||
|
||||
Class<?> componentType = arrayColumns.getArrayType(value.getClass());
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class IdGeneratingBatchInsertStrategy implements BatchInsertStrategy {
|
||||
} else {
|
||||
ids[i] = keys.entrySet().stream().findFirst() //
|
||||
.map(Map.Entry::getValue) //
|
||||
.orElseThrow(() -> new IllegalStateException("KeyHolder contains an empty key list."));
|
||||
.orElseThrow(() -> new IllegalStateException("KeyHolder contains an empty key list"));
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
|
||||
@@ -66,8 +66,8 @@ public final class Identifier {
|
||||
*/
|
||||
public static Identifier of(SqlIdentifier name, Object value, Class<?> targetType) {
|
||||
|
||||
Assert.notNull(name, "Name must not be empty!");
|
||||
Assert.notNull(targetType, "Target type must not be null!");
|
||||
Assert.notNull(name, "Name must not be empty");
|
||||
Assert.notNull(targetType, "Target type must not be null");
|
||||
|
||||
return new Identifier(Collections.singletonList(new SingleIdentifierValue(name, value, targetType)));
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public final class Identifier {
|
||||
*/
|
||||
public static Identifier from(Map<SqlIdentifier, Object> map) {
|
||||
|
||||
Assert.notNull(map, "Map must not be null!");
|
||||
Assert.notNull(map, "Map must not be null");
|
||||
|
||||
if (map.isEmpty()) {
|
||||
return empty();
|
||||
@@ -108,8 +108,8 @@ public final class Identifier {
|
||||
*/
|
||||
public Identifier withPart(SqlIdentifier name, Object value, Class<?> targetType) {
|
||||
|
||||
Assert.notNull(name, "Name must not be null!");
|
||||
Assert.notNull(targetType, "Target type must not be null!");
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
Assert.notNull(targetType, "Target type must not be null");
|
||||
|
||||
boolean overwritten = false;
|
||||
List<SingleIdentifierValue> keys = new ArrayList<>(this.parts.size() + 1);
|
||||
@@ -187,8 +187,8 @@ public final class Identifier {
|
||||
|
||||
private SingleIdentifierValue(SqlIdentifier name, @Nullable Object value, Class<?> targetType) {
|
||||
|
||||
Assert.notNull(name, "Name must not be null.");
|
||||
Assert.notNull(targetType, "TargetType must not be null.");
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
Assert.notNull(targetType, "TargetType must not be null");
|
||||
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
|
||||
@@ -63,8 +63,8 @@ class IterableOfEntryToMapConverter implements ConditionalConverter, Converter<I
|
||||
@Override
|
||||
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||
|
||||
Assert.notNull(sourceType, "Source type must not be null.");
|
||||
Assert.notNull(targetType, "Target type must not be null.");
|
||||
Assert.notNull(sourceType, "Source type must not be null");
|
||||
Assert.notNull(targetType, "Target type must not be null");
|
||||
|
||||
if (!sourceType.isAssignableTo(TypeDescriptor.valueOf(Iterable.class)))
|
||||
return false;
|
||||
|
||||
@@ -92,7 +92,7 @@ class ResultSetAccessor {
|
||||
int index = findColumnIndex(columnName);
|
||||
return index > 0 ? JdbcUtils.getResultSetValue(resultSet, index) : null;
|
||||
} catch (SQLException o_O) {
|
||||
throw new MappingException(String.format("Could not read value %s from result set!", columnName), o_O);
|
||||
throw new MappingException(String.format("Could not read value %s from result set", columnName), o_O);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ class SqlGenerator {
|
||||
String getFindAllByProperty(Identifier parentIdentifier, @Nullable SqlIdentifier keyColumn, boolean ordered) {
|
||||
|
||||
Assert.isTrue(keyColumn != null || !ordered,
|
||||
"If the SQL statement should be ordered a keyColumn to order by must be provided.");
|
||||
"If the SQL statement should be ordered a keyColumn to order by must be provided");
|
||||
|
||||
Table table = getTable();
|
||||
|
||||
@@ -487,7 +487,7 @@ class SqlGenerator {
|
||||
SelectBuilder.SelectLimitOffset limitResult = limitable.limitOffset(pageable.getPageSize(), pageable.getOffset());
|
||||
|
||||
Assert.state(limitResult instanceof SelectBuilder.SelectOrdered, String.format(
|
||||
"The result of applying the limit-clause must be of type SelectOrdered in order to apply the order-by-clause but is of type %s.",
|
||||
"The result of applying the limit-clause must be of type SelectOrdered in order to apply the order-by-clause but is of type %s",
|
||||
select.getClass()));
|
||||
|
||||
return (SelectBuilder.SelectOrdered) limitResult;
|
||||
@@ -747,9 +747,9 @@ class SqlGenerator {
|
||||
|
||||
Join(Table joinTable, Column joinColumn, Column parentId) {
|
||||
|
||||
Assert.notNull(joinTable, "JoinTable must not be null.");
|
||||
Assert.notNull(joinColumn, "JoinColumn must not be null.");
|
||||
Assert.notNull(parentId, "ParentId must not be null.");
|
||||
Assert.notNull(joinTable, "JoinTable must not be null");
|
||||
Assert.notNull(joinColumn, "JoinColumn must not be null");
|
||||
Assert.notNull(parentId, "ParentId must not be null");
|
||||
|
||||
this.joinTable = joinTable;
|
||||
this.joinColumn = joinColumn;
|
||||
|
||||
@@ -39,9 +39,9 @@ public class SqlGeneratorSource {
|
||||
|
||||
public SqlGeneratorSource(RelationalMappingContext context, JdbcConverter converter, Dialect dialect) {
|
||||
|
||||
Assert.notNull(context, "Context must not be null.");
|
||||
Assert.notNull(converter, "Converter must not be null.");
|
||||
Assert.notNull(dialect, "Dialect must not be null.");
|
||||
Assert.notNull(context, "Context must not be null");
|
||||
Assert.notNull(converter, "Converter must not be null");
|
||||
Assert.notNull(dialect, "Dialect must not be null");
|
||||
|
||||
this.context = context;
|
||||
this.converter = converter;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Creates the {@link SqlIdentifierParameterSource} for various SQL operations, dialect identifier processing rules and
|
||||
* applicable converters.
|
||||
*
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Chirag Tailor
|
||||
* @since 2.4
|
||||
@@ -213,7 +213,7 @@ public class SqlParametersFactory {
|
||||
convertedIds.add(jdbcValue.getValue());
|
||||
}
|
||||
|
||||
Assert.state(jdbcValue != null, "JdbcValue must be not null at this point. Please report this as a bug.");
|
||||
Assert.state(jdbcValue != null, "JdbcValue must be not null at this point; Please report this as a bug");
|
||||
|
||||
SQLType jdbcType = jdbcValue.getJdbcType();
|
||||
int typeNumber = jdbcType == null ? JdbcUtils.TYPE_UNKNOWN : jdbcType.getVendorTypeNumber();
|
||||
@@ -279,7 +279,7 @@ public class SqlParametersFactory {
|
||||
|
||||
@Override
|
||||
public void setProperty(PersistentProperty<?> property, @Nullable Object value) {
|
||||
throw new UnsupportedOperationException("Cannot set value on 'null' target object.");
|
||||
throw new UnsupportedOperationException("Cannot set value on 'null' target object");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,7 +54,7 @@ public interface AggregateReference<T, ID> {
|
||||
|
||||
public IdOnlyAggregateReference(ID id) {
|
||||
|
||||
Assert.notNull(id, "Id must not be null.");
|
||||
Assert.notNull(id, "Id must not be null");
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class JdbcMappingContext extends RelationalMappingContext {
|
||||
|
||||
private static final String MISSING_PARAMETER_NAME = "A constructor parameter name must not be null to be used with Spring Data JDBC! Offending parameter: %s";
|
||||
private static final String MISSING_PARAMETER_NAME = "A constructor parameter name must not be null to be used with Spring Data JDBC; Offending parameter: %s";
|
||||
|
||||
/**
|
||||
* Creates a new {@link JdbcMappingContext}.
|
||||
|
||||
@@ -244,7 +244,7 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy {
|
||||
long result = sqlSession().selectOne(statement, parameter);
|
||||
if (result < 1) {
|
||||
|
||||
String message = String.format("The lock target does not exist. id: %s, statement: %s", id, statement);
|
||||
String message = String.format("The lock target does not exist; id: %s, statement: %s", id, statement);
|
||||
throw new EmptyResultDataAccessException(message, 1);
|
||||
}
|
||||
}
|
||||
@@ -346,7 +346,7 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy {
|
||||
|
||||
RelationalPersistentProperty baseProperty = propertyPath.getBaseProperty();
|
||||
|
||||
Assert.notNull(baseProperty, "BaseProperty must not be null.");
|
||||
Assert.notNull(baseProperty, "BaseProperty must not be null");
|
||||
|
||||
return baseProperty.getOwner().getType();
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class AbstractJdbcConfiguration implements ApplicationContextAware {
|
||||
|
||||
} catch (NoSuchBeanDefinitionException exception) {
|
||||
|
||||
LOG.warn("No dialect found. CustomConversions will be configured without dialect specific conversions.");
|
||||
LOG.warn("No dialect found; CustomConversions will be configured without dialect specific conversions");
|
||||
|
||||
return new JdbcCustomConversions();
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class DialectResolver {
|
||||
.flatMap(Optionals::toStream) //
|
||||
.findFirst() //
|
||||
.orElseThrow(() -> new NoDialectException(
|
||||
String.format("Cannot determine a dialect for %s. Please provide a Dialect.", operations)));
|
||||
String.format("Cannot determine a dialect for %s; Please provide a Dialect", operations)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,7 +66,7 @@ class JdbcAuditingRegistrar extends AuditingBeanDefinitionRegistrarSupport {
|
||||
@Override
|
||||
protected BeanDefinitionBuilder getAuditHandlerBeanDefinitionBuilder(AuditingConfiguration configuration) {
|
||||
|
||||
Assert.notNull(configuration, "AuditingConfiguration must not be null!");
|
||||
Assert.notNull(configuration, "AuditingConfiguration must not be null");
|
||||
|
||||
BeanDefinitionBuilder builder = configureDefaultAuditHandlerAttributes(configuration,
|
||||
BeanDefinitionBuilder.rootBeanDefinition(IsNewAwareAuditingHandler.class));
|
||||
|
||||
@@ -58,8 +58,8 @@ public abstract class AbstractJdbcQuery implements RepositoryQuery {
|
||||
*/
|
||||
AbstractJdbcQuery(JdbcQueryMethod queryMethod, NamedParameterJdbcOperations operations) {
|
||||
|
||||
Assert.notNull(queryMethod, "Query method must not be null!");
|
||||
Assert.notNull(operations, "NamedParameterJdbcOperations must not be null!");
|
||||
Assert.notNull(queryMethod, "Query method must not be null");
|
||||
Assert.notNull(operations, "NamedParameterJdbcOperations must not be null");
|
||||
|
||||
this.queryMethod = queryMethod;
|
||||
this.operations = operations;
|
||||
|
||||
@@ -341,9 +341,9 @@ class JdbcQueryCreator extends RelationalQueryCreator<ParametrizedQuery> {
|
||||
|
||||
Join(Table joinTable, Column joinColumn, Column parentId) {
|
||||
|
||||
Assert.notNull(joinTable, "JoinTable must not be null.");
|
||||
Assert.notNull(joinColumn, "JoinColumn must not be null.");
|
||||
Assert.notNull(parentId, "ParentId must not be null.");
|
||||
Assert.notNull(joinTable, "JoinTable must not be null");
|
||||
Assert.notNull(joinColumn, "JoinColumn must not be null");
|
||||
Assert.notNull(parentId, "ParentId must not be null");
|
||||
|
||||
this.joinTable = joinTable;
|
||||
this.joinColumn = joinColumn;
|
||||
|
||||
@@ -73,8 +73,8 @@ class QueryMapper {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
QueryMapper(Dialect dialect, JdbcConverter converter) {
|
||||
|
||||
Assert.notNull(dialect, "Dialect must not be null!");
|
||||
Assert.notNull(converter, "JdbcConverter must not be null!");
|
||||
Assert.notNull(dialect, "Dialect must not be null");
|
||||
Assert.notNull(converter, "JdbcConverter must not be null");
|
||||
|
||||
this.converter = converter;
|
||||
this.dialect = dialect;
|
||||
@@ -123,7 +123,7 @@ class QueryMapper {
|
||||
Field field = createPropertyField(entity, column.getName());
|
||||
TableLike table = column.getTable();
|
||||
|
||||
Assert.state(table != null, String.format("The column %s must have a table set.", column));
|
||||
Assert.state(table != null, String.format("The column %s must have a table set", column));
|
||||
|
||||
Column columnFromTable = table.column(field.getMappedColumnName());
|
||||
return column instanceof Aliased ? columnFromTable.as(((Aliased) column).getAlias()) : columnFromTable;
|
||||
@@ -160,9 +160,9 @@ class QueryMapper {
|
||||
Condition getMappedObject(MapSqlParameterSource parameterSource, CriteriaDefinition criteria, Table table,
|
||||
@Nullable RelationalPersistentEntity<?> entity) {
|
||||
|
||||
Assert.notNull(parameterSource, "MapSqlParameterSource must not be null!");
|
||||
Assert.notNull(criteria, "CriteriaDefinition must not be null!");
|
||||
Assert.notNull(table, "Table must not be null!");
|
||||
Assert.notNull(parameterSource, "MapSqlParameterSource must not be null");
|
||||
Assert.notNull(criteria, "CriteriaDefinition must not be null");
|
||||
Assert.notNull(table, "Table must not be null");
|
||||
|
||||
if (criteria.isEmpty()) {
|
||||
throw new IllegalArgumentException("Cannot map empty Criteria");
|
||||
@@ -667,7 +667,7 @@ class QueryMapper {
|
||||
*/
|
||||
Field(SqlIdentifier name) {
|
||||
|
||||
Assert.notNull(name, "Name must not be null!");
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ class QueryMapper {
|
||||
|
||||
super(name);
|
||||
|
||||
Assert.notNull(entity, "MongoPersistentEntity must not be null!");
|
||||
Assert.notNull(entity, "MongoPersistentEntity must not be null");
|
||||
|
||||
this.entity = entity;
|
||||
this.mappingContext = context;
|
||||
|
||||
@@ -62,7 +62,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class StringBasedJdbcQuery extends AbstractJdbcQuery {
|
||||
|
||||
private static final String PARAMETER_NEEDS_TO_BE_NAMED = "For queries with named parameters you need to provide names for method parameters. Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters.";
|
||||
private static final String PARAMETER_NEEDS_TO_BE_NAMED = "For queries with named parameters you need to provide names for method parameters; Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters";
|
||||
|
||||
private final JdbcQueryMethod queryMethod;
|
||||
private final JdbcConverter converter;
|
||||
@@ -104,12 +104,12 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
|
||||
|
||||
if (queryMethod.isSliceQuery()) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Slice queries are not supported using string-based queries. Offending method: " + queryMethod);
|
||||
"Slice queries are not supported using string-based queries; Offending method: " + queryMethod);
|
||||
}
|
||||
|
||||
if (queryMethod.isPageQuery()) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Page queries are not supported using string-based queries. Offending method: " + queryMethod);
|
||||
"Page queries are not supported using string-based queries; Offending method: " + queryMethod);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
|
||||
RelationalParameters.RelationalParameter parameter = queryMethod.getParameters().getParameter(p.getIndex());
|
||||
ResolvableType resolvableType = parameter.getResolvableType();
|
||||
Class<?> type = resolvableType.resolve();
|
||||
Assert.notNull(type, "@Query parameter type could not be resolved!");
|
||||
Assert.notNull(type, "@Query parameter type could not be resolved");
|
||||
|
||||
JdbcValue jdbcValue;
|
||||
if (value instanceof Iterable) {
|
||||
@@ -167,7 +167,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
|
||||
|
||||
Class<?> elementType = resolvableType.getGeneric(0).resolve();
|
||||
|
||||
Assert.notNull(elementType, "@Query Iterable parameter generic type could not be resolved!");
|
||||
Assert.notNull(elementType, "@Query Iterable parameter generic type could not be resolved");
|
||||
|
||||
for (Object o : (Iterable<?>) value) {
|
||||
JdbcValue elementJdbcValue = converter.writeJdbcValue(o, elementType,
|
||||
|
||||
@@ -145,7 +145,7 @@ abstract class JdbcQueryLookupStrategy implements QueryLookupStrategy {
|
||||
|
||||
if (queryMethod.hasAnnotatedQuery() && queryMethod.hasAnnotatedQueryName()) {
|
||||
LOG.warn(String.format(
|
||||
"Query method %s is annotated with both, a query and a query name. Using the declared query.", method));
|
||||
"Query method %s is annotated with both, a query and a query name; Using the declared query", method));
|
||||
}
|
||||
|
||||
StringBasedJdbcQuery query = new StringBasedJdbcQuery(queryMethod, getOperations(), this::createMapper,
|
||||
@@ -155,7 +155,7 @@ abstract class JdbcQueryLookupStrategy implements QueryLookupStrategy {
|
||||
}
|
||||
|
||||
throw new IllegalStateException(
|
||||
String.format("Did neither find a NamedQuery nor an annotated query for method %s!", method));
|
||||
String.format("Did neither find a NamedQuery nor an annotated query for method %s", method));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,8 +186,8 @@ abstract class JdbcQueryLookupStrategy implements QueryLookupStrategy {
|
||||
|
||||
super(publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations, beanfactory);
|
||||
|
||||
Assert.notNull(createStrategy, "CreateQueryLookupStrategy must not be null!");
|
||||
Assert.notNull(lookupStrategy, "DeclaredQueryLookupStrategy must not be null!");
|
||||
Assert.notNull(createStrategy, "CreateQueryLookupStrategy must not be null");
|
||||
Assert.notNull(lookupStrategy, "DeclaredQueryLookupStrategy must not be null");
|
||||
|
||||
this.createStrategy = createStrategy;
|
||||
this.lookupStrategy = lookupStrategy;
|
||||
@@ -258,7 +258,7 @@ abstract class JdbcQueryLookupStrategy implements QueryLookupStrategy {
|
||||
return new CreateIfNotFoundQueryLookupStrategy(publisher, callbacks, context, converter, dialect,
|
||||
queryMappingConfiguration, operations, beanFactory, createQueryLookupStrategy, declaredQueryLookupStrategy);
|
||||
default:
|
||||
throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s!", key));
|
||||
throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s", key));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,11 +76,11 @@ public class JdbcRepositoryFactory extends RepositoryFactorySupport {
|
||||
JdbcConverter converter, Dialect dialect, ApplicationEventPublisher publisher,
|
||||
NamedParameterJdbcOperations operations) {
|
||||
|
||||
Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null!");
|
||||
Assert.notNull(context, "RelationalMappingContext must not be null!");
|
||||
Assert.notNull(converter, "RelationalConverter must not be null!");
|
||||
Assert.notNull(dialect, "Dialect must not be null!");
|
||||
Assert.notNull(publisher, "ApplicationEventPublisher must not be null!");
|
||||
Assert.notNull(dataAccessStrategy, "DataAccessStrategy must not be null");
|
||||
Assert.notNull(context, "RelationalMappingContext must not be null");
|
||||
Assert.notNull(converter, "RelationalConverter must not be null");
|
||||
Assert.notNull(dialect, "Dialect must not be null");
|
||||
Assert.notNull(publisher, "ApplicationEventPublisher must not be null");
|
||||
|
||||
this.publisher = publisher;
|
||||
this.context = context;
|
||||
@@ -96,7 +96,7 @@ public class JdbcRepositoryFactory extends RepositoryFactorySupport {
|
||||
*/
|
||||
public void setQueryMappingConfiguration(QueryMappingConfiguration queryMappingConfiguration) {
|
||||
|
||||
Assert.notNull(queryMappingConfiguration, "QueryMappingConfiguration must not be null!");
|
||||
Assert.notNull(queryMappingConfiguration, "QueryMappingConfiguration must not be null");
|
||||
|
||||
this.queryMappingConfiguration = queryMappingConfiguration;
|
||||
}
|
||||
|
||||
@@ -160,24 +160,24 @@ public class JdbcRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extend
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
|
||||
Assert.state(this.mappingContext != null, "MappingContext is required and must not be null!");
|
||||
Assert.state(this.converter != null, "RelationalConverter is required and must not be null!");
|
||||
Assert.state(this.mappingContext != null, "MappingContext is required and must not be null");
|
||||
Assert.state(this.converter != null, "RelationalConverter is required and must not be null");
|
||||
|
||||
if (this.operations == null) {
|
||||
|
||||
Assert.state(beanFactory != null, "If no JdbcOperations are set a BeanFactory must be available.");
|
||||
Assert.state(beanFactory != null, "If no JdbcOperations are set a BeanFactory must be available");
|
||||
|
||||
this.operations = beanFactory.getBean(NamedParameterJdbcOperations.class);
|
||||
}
|
||||
|
||||
if (this.dataAccessStrategy == null) {
|
||||
|
||||
Assert.state(beanFactory != null, "If no DataAccessStrategy is set a BeanFactory must be available.");
|
||||
Assert.state(beanFactory != null, "If no DataAccessStrategy is set a BeanFactory must be available");
|
||||
|
||||
this.dataAccessStrategy = this.beanFactory.getBeanProvider(DataAccessStrategy.class) //
|
||||
.getIfAvailable(() -> {
|
||||
|
||||
Assert.state(this.dialect != null, "Dialect is required and must not be null!");
|
||||
Assert.state(this.dialect != null, "Dialect is required and must not be null");
|
||||
|
||||
SqlGeneratorSource sqlGeneratorSource = new SqlGeneratorSource(this.mappingContext, this.converter,
|
||||
this.dialect);
|
||||
|
||||
@@ -43,8 +43,8 @@ public class SimpleJdbcRepository<T, ID> implements CrudRepository<T,ID>, Paging
|
||||
|
||||
public SimpleJdbcRepository(JdbcAggregateOperations entityOperations,PersistentEntity<T, ?> entity) {
|
||||
|
||||
Assert.notNull(entityOperations, "EntityOperations must not be null.");
|
||||
Assert.notNull(entity, "Entity must not be null.");
|
||||
Assert.notNull(entityOperations, "EntityOperations must not be null");
|
||||
Assert.notNull(entity, "Entity must not be null");
|
||||
|
||||
this.entityOperations = entityOperations;
|
||||
this.entity = entity;
|
||||
|
||||
@@ -98,7 +98,7 @@ public final class JdbcUtil {
|
||||
@Deprecated
|
||||
public static int sqlTypeFor(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null.");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return sqlTypeMappings.keySet().stream() //
|
||||
.filter(k -> k.isAssignableFrom(type)) //
|
||||
@@ -116,7 +116,7 @@ public final class JdbcUtil {
|
||||
*/
|
||||
public static SQLType targetSqlTypeFor(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null.");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return sqlTypeMappings.keySet().stream() //
|
||||
.filter(k -> k.isAssignableFrom(type)) //
|
||||
|
||||
@@ -187,7 +187,7 @@ class JdbcAggregateTemplateIntegrationTests {
|
||||
entity.setName(name);
|
||||
|
||||
Manual manual = new Manual();
|
||||
manual.setContent("Accelerates to 99% of light speed. Destroys almost everything. See https://what-if.xkcd.com/1/");
|
||||
manual.setContent("Accelerates to 99% of light speed; Destroys almost everything. See https://what-if.xkcd.com/1/");
|
||||
entity.setManual(manual);
|
||||
|
||||
return entity;
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.data.relational.core.sql.SqlIdentifier;
|
||||
public class CascadingDataAccessStrategyUnitTests {
|
||||
|
||||
int errorIndex = 1;
|
||||
String[] errorMessages = { "Sorry I don't support this method. Please try again later", "Still no luck" };
|
||||
String[] errorMessages = { "Sorry I don't support this method; Please try again later", "Still no luck" };
|
||||
|
||||
DataAccessStrategy alwaysFails = mock(DataAccessStrategy.class, i -> {
|
||||
errorIndex++;
|
||||
|
||||
@@ -34,8 +34,8 @@ public interface TestUtils {
|
||||
*/
|
||||
public static String createScriptName(Class<?> testClass, String databaseType) {
|
||||
|
||||
Assert.notNull(testClass, "Test class must not be null!");
|
||||
Assert.hasText(databaseType, "Database type must not be null or empty!");
|
||||
Assert.notNull(testClass, "Test class must not be null");
|
||||
Assert.hasText(databaseType, "Database type must not be null or empty");
|
||||
|
||||
String path = String.format("%s/%s-%s.sql", testClass.getPackage().getName(), testClass.getSimpleName(),
|
||||
databaseType.toLowerCase());
|
||||
|
||||
Reference in New Issue
Block a user