DATACMNS-469 - Removed deprecations.
This commit is contained in:
@@ -45,16 +45,6 @@ public class AuditingHandler implements InitializingBean {
|
||||
private boolean dateTimeForNow = true;
|
||||
private boolean modifyOnCreation = true;
|
||||
|
||||
/**
|
||||
* Creates a new {@link AuditingHandler}.
|
||||
*
|
||||
* @deprecated use the constructor taking a {@link MappingContext}.
|
||||
*/
|
||||
@Deprecated
|
||||
public AuditingHandler() {
|
||||
this.factory = new AuditableBeanWrapperFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link AuditableBeanWrapper} using the given {@link MappingContext} when looking up auditing metadata
|
||||
* via reflection.
|
||||
|
||||
@@ -50,19 +50,6 @@ public class IsNewAwareAuditingHandler extends AuditingHandler {
|
||||
this.isNewStrategyFactory = new MappingContextIsNewStrategyFactory(mappingContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link IsNewAwareAuditingHandler} using the given {@link IsNewStrategyFactory}.
|
||||
*
|
||||
* @param isNewStrategyFactory must not be {@literal null}.
|
||||
* @deprecated use constructor taking a {@link MappingContext} directly. Will be removed in 1.9.
|
||||
*/
|
||||
@Deprecated
|
||||
public IsNewAwareAuditingHandler(IsNewStrategyFactory isNewStrategyFactory) {
|
||||
|
||||
Assert.notNull(isNewStrategyFactory, "IsNewStrategyFactory must not be null!");
|
||||
this.isNewStrategyFactory = isNewStrategyFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the given object created or modified based on the {@link IsNewStrategy} returned by the
|
||||
* {@link IsNewStrategyFactory} configured. Will rout the calls to {@link #markCreated(Object)} and
|
||||
|
||||
@@ -37,40 +37,4 @@ public interface Page<T> extends Slice<T> {
|
||||
* @return the total amount of elements
|
||||
*/
|
||||
long getTotalElements();
|
||||
|
||||
/**
|
||||
* Returns if there is a previous page.
|
||||
*
|
||||
* @deprecated use {@link #hasPrevious()} instead.
|
||||
* @return if there is a previous page
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasPreviousPage();
|
||||
|
||||
/**
|
||||
* Returns whether the current page is the first one.
|
||||
*
|
||||
* @deprecated use {@link #isFirst()} instead.
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isFirstPage();
|
||||
|
||||
/**
|
||||
* Returns if there is a next page.
|
||||
*
|
||||
* @deprecated use {@link #hasNext()} instead.
|
||||
* @return if there is a next page
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasNextPage();
|
||||
|
||||
/**
|
||||
* Returns whether the current page is the last one.
|
||||
*
|
||||
* @deprecated use {@link #isLast()} instead.
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isLastPage();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class PageImpl<T> extends Chunk<T> implements Page<T> {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Page#getTotalPages()
|
||||
*/
|
||||
@Override
|
||||
public int getTotalPages() {
|
||||
return getSize() == 0 ? 1 : (int) Math.ceil((double) total / (double) getSize());
|
||||
}
|
||||
@@ -64,40 +65,17 @@ public class PageImpl<T> extends Chunk<T> implements Page<T> {
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Page#getTotalElements()
|
||||
*/
|
||||
@Override
|
||||
public long getTotalElements() {
|
||||
return total;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Page#hasPreviousPage()
|
||||
*/
|
||||
public boolean hasPreviousPage() {
|
||||
return hasPrevious();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Page#isFirstPage()
|
||||
*/
|
||||
public boolean isFirstPage() {
|
||||
return isFirst();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Slice#hasNext()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return hasNextPage();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Page#hasNextPage()
|
||||
*/
|
||||
public boolean hasNextPage() {
|
||||
return getNumber() + 1 < getTotalPages();
|
||||
}
|
||||
|
||||
@@ -107,15 +85,7 @@ public class PageImpl<T> extends Chunk<T> implements Page<T> {
|
||||
*/
|
||||
@Override
|
||||
public boolean isLast() {
|
||||
return isLastPage();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.domain.Page#isLastPage()
|
||||
*/
|
||||
public boolean isLastPage() {
|
||||
return !hasNextPage();
|
||||
return !hasNext();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -326,19 +326,6 @@ public class Sort implements Iterable<org.springframework.data.domain.Sort.Order
|
||||
this.nullHandling = nullHandling == null ? NullHandling.NATIVE : nullHandling;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link Sort#Sort(Direction, List)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<Order> create(Direction direction, Iterable<String> properties) {
|
||||
|
||||
List<Order> orders = new ArrayList<Sort.Order>();
|
||||
for (String property : properties) {
|
||||
orders.add(new Order(direction, property));
|
||||
}
|
||||
return orders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the order the property shall be sorted for.
|
||||
*
|
||||
|
||||
@@ -147,13 +147,6 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
*/
|
||||
boolean isTransient();
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @deprecated use {@link #isWritable()} instead, will be removed in 1.9 RC1.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean shallBePersisted();
|
||||
|
||||
/**
|
||||
* Returns whether the current property is writable, i.e. if the value held for it shall be written to the data store.
|
||||
*
|
||||
|
||||
@@ -77,6 +77,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getOwner()
|
||||
*/
|
||||
@Override
|
||||
public PersistentEntity<?, P> getOwner() {
|
||||
return owner;
|
||||
}
|
||||
@@ -85,6 +86,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -93,6 +95,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getType()
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return information.getType();
|
||||
}
|
||||
@@ -101,6 +104,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getRawType()
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getRawType() {
|
||||
return this.rawType;
|
||||
}
|
||||
@@ -109,6 +113,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getTypeInformation()
|
||||
*/
|
||||
@Override
|
||||
public TypeInformation<?> getTypeInformation() {
|
||||
return information;
|
||||
}
|
||||
@@ -117,6 +122,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getPersistentEntityType()
|
||||
*/
|
||||
@Override
|
||||
public Iterable<? extends TypeInformation<?>> getPersistentEntityType() {
|
||||
|
||||
List<TypeInformation<?>> result = new ArrayList<TypeInformation<?>>();
|
||||
@@ -142,6 +148,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getGetter()
|
||||
*/
|
||||
@Override
|
||||
public Method getGetter() {
|
||||
|
||||
if (propertyDescriptor == null) {
|
||||
@@ -161,6 +168,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getSetter()
|
||||
*/
|
||||
@Override
|
||||
public Method getSetter() {
|
||||
|
||||
if (propertyDescriptor == null) {
|
||||
@@ -180,6 +188,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getField()
|
||||
*/
|
||||
@Override
|
||||
public Field getField() {
|
||||
return field;
|
||||
}
|
||||
@@ -188,6 +197,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getSpelExpression()
|
||||
*/
|
||||
@Override
|
||||
public String getSpelExpression() {
|
||||
return null;
|
||||
}
|
||||
@@ -196,19 +206,11 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#isTransient()
|
||||
*/
|
||||
@Override
|
||||
public boolean isTransient() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#shallBePersisted()
|
||||
*/
|
||||
@Override
|
||||
public boolean shallBePersisted() {
|
||||
return isWritable();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#isWritable()
|
||||
@@ -222,6 +224,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#isAssociation()
|
||||
*/
|
||||
@Override
|
||||
public boolean isAssociation() {
|
||||
return field == null ? false : AnnotationUtils.getAnnotation(field, Reference.class) != null;
|
||||
}
|
||||
@@ -230,6 +233,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getAssociation()
|
||||
*/
|
||||
@Override
|
||||
public Association<P> getAssociation() {
|
||||
return association;
|
||||
}
|
||||
@@ -238,6 +242,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#isCollectionLike()
|
||||
*/
|
||||
@Override
|
||||
public boolean isCollectionLike() {
|
||||
return information.isCollectionLike();
|
||||
}
|
||||
@@ -246,6 +251,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#isMap()
|
||||
*/
|
||||
@Override
|
||||
public boolean isMap() {
|
||||
return Map.class.isAssignableFrom(getType());
|
||||
}
|
||||
@@ -254,6 +260,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#isArray()
|
||||
*/
|
||||
@Override
|
||||
public boolean isArray() {
|
||||
return getType().isArray();
|
||||
}
|
||||
@@ -262,6 +269,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#isEntity()
|
||||
*/
|
||||
@Override
|
||||
public boolean isEntity() {
|
||||
|
||||
TypeInformation<?> actualType = information.getActualType();
|
||||
@@ -273,6 +281,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getComponentType()
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getComponentType() {
|
||||
|
||||
if (!isMap() && !isCollectionLike()) {
|
||||
@@ -287,6 +296,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.PersistentProperty#getMapValueType()
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getMapValueType() {
|
||||
return isMap() ? information.getMapValueType().getType() : null;
|
||||
}
|
||||
|
||||
@@ -37,18 +37,6 @@ public class MappingInstantiationException extends RuntimeException {
|
||||
private final Constructor<?> constructor;
|
||||
private final List<Object> constructorArguments;
|
||||
|
||||
/**
|
||||
* Creates a {@link MappingInstantiationException} using the given message and cause.
|
||||
*
|
||||
* @deprecated use {@link #MappingInstantiationException(PersistentEntity, List, String, Exception)} instead.
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
@Deprecated
|
||||
public MappingInstantiationException(String message, Exception cause) {
|
||||
this(null, null, message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link MappingInstantiationException} for the given {@link PersistentEntity}, constructor arguments
|
||||
* and the causing exception.
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
package org.springframework.data.repository.config;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanNameGenerator;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
|
||||
/**
|
||||
@@ -27,15 +25,6 @@ import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
*/
|
||||
public interface RepositoryConfiguration<T extends RepositoryConfigurationSource> {
|
||||
|
||||
/**
|
||||
* Returns the id of the {@link BeanDefinition} the repository shall be registered under.
|
||||
*
|
||||
* @return
|
||||
* @deprecated bean ids should be determined using a {@link BeanNameGenerator} during classpath scanning.
|
||||
*/
|
||||
@Deprecated
|
||||
String getBeanId();
|
||||
|
||||
/**
|
||||
* Returns the base packages that the repository was scanned under.
|
||||
*
|
||||
|
||||
@@ -49,20 +49,6 @@ public class RepositoryConfigurationDelegate {
|
||||
private final BeanNameGenerator generator;
|
||||
private final boolean isXml;
|
||||
|
||||
/**
|
||||
* Creates a new {@link RepositoryConfigurationDelegate} for the given {@link RepositoryConfigurationSource} and
|
||||
* {@link ResourceLoader}.
|
||||
*
|
||||
* @param configurationSource must not be {@literal null}.
|
||||
* @param resourceLoader must not be {@literal null}.
|
||||
* @deprecated use constructor taking an {@link Environment}.
|
||||
*/
|
||||
@Deprecated
|
||||
public RepositoryConfigurationDelegate(RepositoryConfigurationSource configurationSource,
|
||||
ResourceLoader resourceLoader) {
|
||||
this(configurationSource, resourceLoader, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link RepositoryConfigurationDelegate} for the given {@link RepositoryConfigurationSource} and
|
||||
* {@link ResourceLoader} and {@link Environment}.
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.mockito.Mockito.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.domain.AuditorAware;
|
||||
import org.springframework.data.mapping.context.SampleMappingContext;
|
||||
|
||||
/**
|
||||
* Unit test for {@code AuditingHandler}.
|
||||
@@ -46,9 +47,8 @@ public class AuditingHandlerUnitTests {
|
||||
when(auditorAware.getCurrentAuditor()).thenReturn(user);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected AuditingHandler getHandler() {
|
||||
return new AuditingHandler();
|
||||
return new AuditingHandler(new SampleMappingContext());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,15 +22,12 @@ import static org.mockito.Mockito.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mapping.PersistentEntity;
|
||||
import org.springframework.data.mapping.PersistentProperty;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
import org.springframework.data.mapping.context.SampleMappingContext;
|
||||
import org.springframework.data.support.IsNewStrategy;
|
||||
import org.springframework.data.support.IsNewStrategyFactory;
|
||||
|
||||
/**
|
||||
* Unit test for {@code AuditingHandler}.
|
||||
@@ -41,24 +38,21 @@ import org.springframework.data.support.IsNewStrategyFactory;
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class IsNewAwareAuditingHandlerUnitTests extends AuditingHandlerUnitTests {
|
||||
|
||||
@Mock IsNewStrategyFactory factory;
|
||||
@Mock IsNewStrategy strategy;
|
||||
SampleMappingContext mappingContext;
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
when(factory.getIsNewStrategy(Mockito.any(Class.class))).thenReturn(strategy);
|
||||
this.mappingContext = new SampleMappingContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected IsNewAwareAuditingHandler getHandler() {
|
||||
return new IsNewAwareAuditingHandler(factory);
|
||||
return new IsNewAwareAuditingHandler(mock(SampleMappingContext.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delegatesToMarkCreatedForNewEntity() {
|
||||
|
||||
when(strategy.isNew(Mockito.any(Object.class))).thenReturn(true);
|
||||
AuditedUser user = new AuditedUser();
|
||||
getHandler().markAudited(user);
|
||||
|
||||
@@ -69,8 +63,8 @@ public class IsNewAwareAuditingHandlerUnitTests extends AuditingHandlerUnitTests
|
||||
@Test
|
||||
public void delegatesToMarkModifiedForNonNewEntity() {
|
||||
|
||||
when(strategy.isNew(Mockito.any(Object.class))).thenReturn(false);
|
||||
AuditedUser user = new AuditedUser();
|
||||
user.id = 1L;
|
||||
getHandler().markAudited(user);
|
||||
|
||||
assertThat(user.createdDate, is(nullValue()));
|
||||
@@ -93,4 +87,9 @@ public class IsNewAwareAuditingHandlerUnitTests extends AuditingHandlerUnitTests
|
||||
public void setsUpHandlerWithMappingContext() {
|
||||
new IsNewAwareAuditingHandler(new SampleMappingContext());
|
||||
}
|
||||
|
||||
static class Domain {
|
||||
|
||||
@Id Long id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user