|
29 | 29 | import org.springframework.context.ApplicationContext; |
30 | 30 | import org.springframework.context.ApplicationContextAware; |
31 | 31 |
|
32 | | -import com.arangodb.springframework.annotation.Document; |
33 | 32 | import com.arangodb.springframework.annotation.Edge; |
34 | 33 | import com.arangodb.springframework.annotation.From; |
35 | 34 | import com.arangodb.springframework.annotation.Ref; |
@@ -60,27 +59,26 @@ public <A extends Annotation> Optional<ReferenceResolver<A>> getReferenceResolve |
60 | 59 | @Override |
61 | 60 | public <A extends Annotation> Optional<RelationResolver<A>> getRelationResolver(final A annotation, |
62 | 61 | final Class<? extends Annotation> collectionType) { |
63 | | - RelationResolver<A> resolver = null; |
64 | 62 | try { |
65 | 63 | if (annotation instanceof From) { |
66 | 64 | 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); |
| 65 | + return Optional.of((RelationResolver<A>) new EdgeFromResolver(template.getObject(), transactionBridge.getIfUnique())); |
70 | 66 | } |
71 | | - } else if (annotation instanceof To) { |
| 67 | + return Optional.of((RelationResolver<A>) new DocumentFromResolver(template.getObject(), transactionBridge.getIfUnique())); |
| 68 | + } |
| 69 | + if (annotation instanceof To) { |
72 | 70 | 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); |
| 71 | + return Optional.of((RelationResolver<A>) new EdgeToResolver(template.getObject(), transactionBridge.getIfUnique())); |
76 | 72 | } |
77 | | - } else if (annotation instanceof Relations) { |
78 | | - resolver = (RelationResolver<A>) new RelationsResolver(template.getObject(), null); |
| 73 | + return Optional.of((RelationResolver<A>) new DocumentToResolver(template.getObject(), transactionBridge.getIfUnique())); |
| 74 | + } |
| 75 | + if (annotation instanceof Relations) { |
| 76 | + return Optional.of((RelationResolver<A>) new RelationsResolver(template.getObject(), transactionBridge.getIfUnique())); |
79 | 77 | } |
80 | 78 | } catch (final Exception e) { |
81 | 79 | throw new ArangoDBException(e); |
82 | 80 | } |
83 | | - return Optional.ofNullable(resolver); |
| 81 | + return Optional.empty(); |
84 | 82 | } |
85 | 83 |
|
86 | 84 | @Override |
|
0 commit comments