Skip to content

Commit c492c54

Browse files
committed
fix merge error
1 parent c2d7acb commit c492c54

File tree

4 files changed

+36
-24
lines changed

4 files changed

+36
-24
lines changed

src/main/java/com/arangodb/springframework/core/ArangoOperations.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ <T> MultiDocumentEntity<DocumentCreateEntity<T>> insertAll(
451451
* @return information about the documents
452452
* @throws DataAccessException
453453
*/
454-
default <T> MultiDocumentEntity<DocumentCreateEntity<T>> insertAll(Iterable<T> values, Class<T> entityClass)
454+
default <T> MultiDocumentEntity<DocumentCreateEntity<T>> insertAll(Iterable<? extends T> values, Class<T> entityClass)
455455
throws DataAccessException {
456456
return insertAll(values, new DocumentCreateOptions(), entityClass);
457457
}
@@ -488,10 +488,10 @@ default <T> DocumentCreateEntity<T> insert(T value) throws DataAccessException {
488488
* @throws DataAccessException
489489
* @since ArangoDB 3.4
490490
*/
491-
<T> void repsert(T value, AqlQueryOptions options) throws DataAccessException;
491+
<T> T repsert(T value, AqlQueryOptions options) throws DataAccessException;
492492

493493
default <T> T repsert(T value) throws DataAccessException {
494-
repsert(value, new AqlQueryOptions());
494+
return repsert(value, new AqlQueryOptions());
495495
}
496496

497497
/**
@@ -505,9 +505,9 @@ default <T> T repsert(T value) throws DataAccessException {
505505
* @throws DataAccessException
506506
* @since ArangoDB 3.4
507507
*/
508-
<T> Iterable<T> repsertAll(Iterable<? extends T> values, Class<T> entityClass, AqlQueryOptions options) throws DataAccessException;
508+
<T> Iterable<T> repsertAll(Iterable<T> values, Class<? super T> entityClass, AqlQueryOptions options) throws DataAccessException;
509509

510-
default <T> Iterable<T> repsertAll(Iterable<? extends T> values, Class<T> entityClass) throws DataAccessException {
510+
default <T> Iterable<T> repsertAll(Iterable<T> values, Class<? super T> entityClass) throws DataAccessException {
511511
return repsertAll(values, entityClass, new AqlQueryOptions());
512512
}
513513

src/main/java/com/arangodb/springframework/core/convert/resolver/DefaultResolverFactory.java

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.lang.annotation.Annotation;
2424
import java.util.Optional;
2525

26+
import com.arangodb.ArangoDBException;
2627
import org.springframework.beans.BeansException;
2728
import org.springframework.beans.factory.ObjectProvider;
2829
import org.springframework.context.ApplicationContext;
@@ -45,32 +46,39 @@ public class DefaultResolverFactory implements ResolverFactory, ApplicationConte
4546
@SuppressWarnings("unchecked")
4647
@Override
4748
public <A extends Annotation> Optional<ReferenceResolver<A>> getReferenceResolver(final A annotation) {
48-
ReferenceResolver<A> resolver = null;
49-
if (annotation instanceof Ref) {
50-
resolver = (ReferenceResolver<A>) new RefResolver(template.getObject(), transactionBridge.getIfUnique());
49+
try {
50+
if (annotation instanceof Ref) {
51+
return Optional.of((ReferenceResolver<A>) new RefResolver(template.getObject(), transactionBridge.getIfUnique()));
52+
}
53+
} catch (final Exception e) {
54+
throw new ArangoDBException(e);
5155
}
52-
return Optional.ofNullable(resolver);
56+
return Optional.empty();
5357
}
5458

5559
@SuppressWarnings("unchecked")
5660
@Override
5761
public <A extends Annotation> Optional<RelationResolver<A>> getRelationResolver(final A annotation,
5862
final Class<? extends Annotation> collectionType) {
5963
RelationResolver<A> resolver = null;
60-
if (annotation instanceof From) {
61-
if (collectionType == Edge.class) {
62-
resolver = (RelationResolver<A>) new EdgeFromResolver(template.getObject(), transactionBridge.getIfUnique());
63-
} else if (collectionType == Document.class) {
64-
resolver = (RelationResolver<A>) new DocumentFromResolver(template.getObject(), transactionBridge.getIfUnique());
65-
}
66-
} else if (annotation instanceof To) {
67-
if (collectionType == Edge.class) {
68-
resolver = (RelationResolver<A>) new EdgeToResolver(template.getObject(), transactionBridge.getIfUnique());
69-
} else if (collectionType == Document.class) {
70-
resolver = (RelationResolver<A>) new DocumentToResolver(template.getObject(), transactionBridge.getIfUnique());
64+
try {
65+
if (annotation instanceof From) {
66+
if (collectionType == Edge.class) {
67+
resolver = (RelationResolver<A>) new EdgeFromResolver(template.getObject(), null);
68+
} else if (collectionType == Document.class) {
69+
resolver = (RelationResolver<A>) new DocumentFromResolver(template.getObject(), null);
70+
}
71+
} else if (annotation instanceof To) {
72+
if (collectionType == Edge.class) {
73+
resolver = (RelationResolver<A>) new EdgeToResolver(template.getObject(), null);
74+
} else if (collectionType == Document.class) {
75+
resolver = (RelationResolver<A>) new DocumentToResolver(template.getObject(), null);
76+
}
77+
} else if (annotation instanceof Relations) {
78+
resolver = (RelationResolver<A>) new RelationsResolver(template.getObject(), null);
7179
}
72-
} else if (annotation instanceof Relations) {
73-
resolver = (RelationResolver<A>) new RelationsResolver(template.getObject(), transactionBridge.getIfUnique());
80+
} catch (final Exception e) {
81+
throw new ArangoDBException(e);
7482
}
7583
return Optional.ofNullable(resolver);
7684
}

src/main/java/com/arangodb/springframework/core/template/ArangoTemplate.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import com.arangodb.springframework.core.mapping.ArangoPersistentEntity;
3333
import com.arangodb.springframework.core.mapping.ArangoPersistentProperty;
3434
import com.arangodb.springframework.core.mapping.event.*;
35-
import com.arangodb.springframework.core.template.DefaultUserOperation.CollectionCallback;
3635
import com.arangodb.springframework.core.util.ArangoExceptionTranslator;
3736
import com.arangodb.springframework.core.util.MetadataUtils;
3837
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
@@ -723,6 +722,11 @@ public CollectionOperations collection(final Class<?> entityClass) throws DataAc
723722
return collection(_collection(entityClass, false));
724723
}
725724

725+
@Override
726+
public CollectionOperations collection(String name) throws DataAccessException {
727+
return ArangoOperations.super.collection(name);
728+
}
729+
726730
@Override
727731
public CollectionOperations collection(final String name, final CollectionCreateOptions options)
728732
throws DataAccessException {

src/main/java/com/arangodb/springframework/repository/SimpleArangoRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public <S extends T> Optional<S> findOne(final Example<S> example) {
301301
*/
302302
@Override
303303
public <S extends T> Iterable<S> findAll(final Example<S> example) {
304-
return (ArangoCursor) findAllInternal((Pageable) null, example, new HashMap<>());
304+
return (ArangoCursor<S>) findAllInternal((Pageable) null, example, new HashMap<>());
305305
}
306306

307307
/**

0 commit comments

Comments
 (0)