|
21 | 21 | package com.arangodb.springframework.repository.query; |
22 | 22 |
|
23 | 23 | import com.arangodb.model.AqlQueryOptions; |
24 | | -import com.arangodb.springframework.annotation.Document; |
25 | | -import com.arangodb.springframework.annotation.Edge; |
26 | 24 | import com.arangodb.springframework.core.ArangoOperations; |
27 | 25 | import com.arangodb.springframework.core.util.AqlUtils; |
28 | 26 | import com.arangodb.springframework.repository.query.ArangoParameters.ArangoParameter; |
29 | 27 | import org.springframework.context.ApplicationContext; |
30 | 28 | import org.springframework.context.expression.BeanFactoryAccessor; |
31 | 29 | import org.springframework.context.expression.BeanFactoryResolver; |
32 | | -import org.springframework.core.annotation.AnnotationUtils; |
33 | 30 | import org.springframework.expression.Expression; |
34 | 31 | import org.springframework.expression.ParserContext; |
35 | 32 | import org.springframework.expression.spel.standard.SpelExpressionParser; |
@@ -111,22 +108,17 @@ private Collection<String> allCollectionNames(Map<String, Object> bindVars) { |
111 | 108 | bindVars.entrySet().stream() |
112 | 109 | .filter(entry -> entry.getKey().startsWith("@")) |
113 | 110 | .map(Map.Entry::getValue) |
114 | | - .map(value -> value instanceof Class ? getCollectionName((Class<?>) value): value.toString()) |
115 | | - .filter(Objects::nonNull) |
| 111 | + .map(this::asCollectionName) |
| 112 | + .map(AqlUtils::buildCollectionName) |
116 | 113 | .forEach(allCollections::add); |
117 | 114 | return allCollections; |
118 | 115 | } |
119 | 116 |
|
120 | | - private String getCollectionName(Class<?> value) { |
121 | | - Document document = AnnotationUtils.findAnnotation(value, Document.class); |
122 | | - if (document != null) { |
123 | | - return document.value(); |
| 117 | + private String asCollectionName(Object value) { |
| 118 | + if (value instanceof Class<?>) { |
| 119 | + return mappingContext.getRequiredPersistentEntity((Class<?>) value).getCollection(); |
124 | 120 | } |
125 | | - Edge edge = AnnotationUtils.findAnnotation(value, Edge.class); |
126 | | - if (edge != null) { |
127 | | - return edge.value(); |
128 | | - } |
129 | | - return null; |
| 121 | + return value.toString(); |
130 | 122 | } |
131 | 123 |
|
132 | 124 | @Override |
|
0 commit comments