DATAGRAPH-1441 - Polishing (Remove deprecated classes on 6.1.x).

This commit is contained in:
Michael Simons
2020-11-25 16:51:49 +01:00
parent 0daecff5d5
commit ce31512c81
8 changed files with 6 additions and 295 deletions

View File

@@ -1,44 +0,0 @@
/*
* Copyright 2011-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.neo4j.config;
import org.apiguardian.api.API;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.data.neo4j.core.Neo4jOperations;
/**
* This brings in the default callbacks required for the default implementation of {@link Neo4jOperations} to work. The
* offered support configuration class {@link AbstractNeo4jConfig} imports this and so does the Spring Boot
* autoconfiguration.
*
* @author Michael J. Simons
* @soundtrack AC/DC - High Voltage
* @since 6.0
* @deprecated since 6.0.2, now an empty implementation, not needed anymore and our default callbacks will be added directly via our
* infrastructure.
*/
@API(status = API.Status.DEPRECATED, since = "6.0")
@Deprecated
public final class Neo4jDefaultCallbacksRegistrar implements ImportBeanDefinitionRegistrar {
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry,
BeanNameGenerator beanNameGenerator) {
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright 2011-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.neo4j.config;
import org.apiguardian.api.API;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.data.neo4j.core.Neo4jOperations;
/**
* This brings in the default callbacks required for the default implementation of {@link Neo4jOperations} to work. The
* offered support configuration class {@link AbstractNeo4jConfig} imports this and so does the Spring Boot
* autoconfiguration.
*
* @author Michael J. Simons
* @soundtrack AC/DC - High Voltage
* @since 6.0
* @deprecated since 6.0.2, now an empty implementation, not needed anymore and our default callbacks will be added directly via our
* infrastructure.
*/
@API(status = API.Status.DEPRECATED, since = "6.0")
@Deprecated
public final class Neo4jDefaultReactiveCallbacksRegistrar implements ImportBeanDefinitionRegistrar {
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry,
BeanNameGenerator beanNameGenerator) {
}
}

View File

@@ -71,14 +71,11 @@ public final class EventSupport {
this.entityCallbacks = entityCallbacks;
}
@SuppressWarnings("deprecation")
public <T> T maybeCallBeforeBind(T object) {
if (object == null) {
return object;
}
T o = entityCallbacks
.callback(org.springframework.data.neo4j.repository.event.BeforeBindCallback.class, object);
return entityCallbacks.callback(BeforeBindCallback.class, o);
return entityCallbacks.callback(BeforeBindCallback.class, object);
}
}

View File

@@ -75,10 +75,11 @@ public final class ReactiveEventSupport {
this.entityCallbacks = entityCallbacks;
}
@SuppressWarnings("deprecation")
public <T> Mono<T> maybeCallBeforeBind(T object) {
return entityCallbacks
.callback(org.springframework.data.neo4j.repository.event.ReactiveBeforeBindCallback.class, object)
.flatMap(o -> entityCallbacks.callback(ReactiveBeforeBindCallback.class, o));
if (object == null) {
return Mono.empty();
}
return entityCallbacks.callback(ReactiveBeforeBindCallback.class, object);
}
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright 2011-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.neo4j.repository.event;
import org.apiguardian.api.API;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.core.Ordered;
import org.springframework.data.auditing.IsNewAwareAuditingHandler;
import org.springframework.data.mapping.callback.EntityCallback;
/**
* {@link EntityCallback} to populate auditing related fields on an entity about to be bound to a record.
*
* @author Michael J. Simons
* @soundtrack Iron Maiden - Iron Maiden
* @since 6.0
* @deprecated since 6.0.2, please use {@link org.springframework.data.neo4j.core.mapping.callback.AuditingBeforeBindCallback}.
*/
@API(status = API.Status.DEPRECATED, since = "6.0")
@Deprecated
public final class AuditingBeforeBindCallback implements BeforeBindCallback<Object>, Ordered {
private final org.springframework.data.neo4j.core.mapping.callback.AuditingBeforeBindCallback delegate;
public AuditingBeforeBindCallback(ObjectFactory<IsNewAwareAuditingHandler> auditingHandlerFactory) {
this.delegate = new org.springframework.data.neo4j.core.mapping.callback.AuditingBeforeBindCallback(
auditingHandlerFactory);
}
@Override
public Object onBeforeBind(Object entity) {
return delegate.onBeforeBind(entity);
}
@Override
public int getOrder() {
return delegate.getOrder();
}
}

View File

@@ -1,45 +0,0 @@
/*
* Copyright 2011-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.neo4j.repository.event;
import org.apiguardian.api.API;
import org.springframework.data.mapping.callback.EntityCallback;
/**
* Entity callback triggered before an Entity is bound to a record (represented by a {@link java.util.Map
* java.util.Map&lt;String, Object&gt;}).
*
* @author Michael J. Simons
* @param <T> The type of the entity.
* @since 6.0
* @soundtrack Bon Jovi - Slippery When Wet
* @deprecated since 6.0.2, please use {@link org.springframework.data.neo4j.core.mapping.callback.BeforeBindCallback}.
*/
@FunctionalInterface
@API(status = API.Status.DEPRECATED, since = "6.0")
@Deprecated
public interface BeforeBindCallback<T> extends EntityCallback<T> {
/**
* Entity callback method invoked before a domain object is saved. Can return either the same or a modified instance
* of the domain object. This method is called before converting the {@code entity} to a {@link java.util.Map}, so the
* outcome of this callback is used to create the record for the domain object.
*
* @param entity the domain object to save.
* @return the domain object to be persisted.
*/
T onBeforeBind(T entity);
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright 2011-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.neo4j.repository.event;
import org.apiguardian.api.API;
import org.reactivestreams.Publisher;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.core.Ordered;
import org.springframework.data.auditing.ReactiveIsNewAwareAuditingHandler;
import org.springframework.data.mapping.callback.EntityCallback;
/**
* Reactive {@link EntityCallback} to populate auditing related fields on an entity about to be bound to a record.
*
* @author Michael J. Simons
* @soundtrack Iron Maiden - The Number Of The Beast
* @deprecated since 6.0.2, please use {@link org.springframework.data.neo4j.core.mapping.callback.AuditingBeforeBindCallback}.
*/
@API(status = API.Status.DEPRECATED, since = "6.0")
@Deprecated
public final class ReactiveAuditingBeforeBindCallback implements ReactiveBeforeBindCallback<Object>, Ordered {
private final org.springframework.data.neo4j.core.mapping.callback.ReactiveAuditingBeforeBindCallback delegate;
public ReactiveAuditingBeforeBindCallback(ObjectFactory<ReactiveIsNewAwareAuditingHandler> auditingHandlerFactory) {
this.delegate = new org.springframework.data.neo4j.core.mapping.callback.ReactiveAuditingBeforeBindCallback(
auditingHandlerFactory);
}
@Override
public Publisher<Object> onBeforeBind(Object entity) {
return delegate.onBeforeBind(entity);
}
@Override
public int getOrder() {
return delegate.getOrder();
}
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright 2011-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.neo4j.repository.event;
import org.apiguardian.api.API;
import org.reactivestreams.Publisher;
import org.springframework.data.mapping.callback.EntityCallback;
import org.springframework.data.mapping.callback.ReactiveEntityCallbacks;
/**
* Entity callback triggered before an Entity is bound to a record (represented by a {@link java.util.Map
* java.util.Map&lt;String, Object&gt;}).
*
* @param <T> The type of the entity.
* @author Michael J. Simons
* @soundtrack Iron Maiden - Killers
* @see ReactiveEntityCallbacks
* @since 6.0
* @deprecated since 6.0.2, please use {@link org.springframework.data.neo4j.core.mapping.callback.ReactiveAuditingBeforeBindCallback}.
*/
@FunctionalInterface
@API(status = API.Status.DEPRECATED, since = "6.0")
@Deprecated
public interface ReactiveBeforeBindCallback<T> extends EntityCallback<T> {
/**
* Entity callback method invoked before a domain object is saved. Can return either the same or a modified instance
* of the domain object. This method is called before converting the {@code entity} to a {@link java.util.Map}, so the
* outcome of this callback is used to create the record for the domain object.
*
* @param entity the domain object to save.
* @return the domain object to be persisted.
*/
Publisher<T> onBeforeBind(T entity);
}