Skip to content

Commit 0efabec

Browse files
author
Mark
committed
Merge remote-tracking branch 'origin/4.1'
2 parents d27f4dd + 57a293e commit 0efabec

File tree

8 files changed

+852
-18
lines changed

8 files changed

+852
-18
lines changed

ChangeLog

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
v4.1.7 (2017-01-26)
2+
---------------------------
3+
* fixed importDocuments, insertDocuments to work with raw Jsons (issue #91)
4+
5+
v4.1.6 (2017-01-18)
6+
---------------------------
7+
* added serializer support for enclosing types
8+
9+
v4.1.5 (2017-01-12)
10+
---------------------------
11+
* fixed VPack String serialization (UTF-8 encoding)
12+
* fixed VPack parsing of fields of type Object
13+
* fixed VPack serializing of array with null values (issue #88)
14+
* added configuration for custom annotations within VPack de-/serialization
15+
* added support of transient modifier within VPack de-/serialization
16+
17+
v4.1.4 (2016-12-19)
18+
---------------------------
19+
* added VPack serializer/de-serializer for java.util.UUID
20+
* fixed VPack parsing (issue #65, #80, #82)
21+
22+
v4.1.3 (2016-11-22)
23+
---------------------------
24+
* fixed error while serializing long values with VPackBuilder
25+
* added bulk import API
26+
27+
v4.1.2 (2016-11-10)
28+
---------------------------
29+
* fixed GraphEntity for ArangoDatabase.getGraphs() (field name is null)
30+
* added VelocyPack UTC_DATE parsing to Json String (ISO 8601)
31+
* added configuration methods for VPackParser in ArangoDBAsync.Builder
32+
* added VPackJsonSerializer for VPackParser
33+
134
v4.1.1 (2016-11-09)
235
---------------------------
336
* changed json parsing of VelocyPack types not known in json

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.arangodb</groupId>
66
<artifactId>arangodb-java-driver-async</artifactId>
7-
<version>4.1.2-SNAPSHOT</version>
7+
<version>4.1.8-SNAPSHOT</version>
88
<inceptionYear>2016</inceptionYear>
99
<packaging>jar</packaging>
1010

@@ -211,7 +211,7 @@
211211
<dependency>
212212
<groupId>com.arangodb</groupId>
213213
<artifactId>arangodb-java-driver</artifactId>
214-
<version>4.1.1</version>
214+
<version>4.1.7</version>
215215
</dependency>
216216
<dependency>
217217
<groupId>ch.qos.logback</groupId>

src/main/java/com/arangodb/ArangoCollectionAsync.java

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.arangodb.entity.CollectionRevisionEntity;
3030
import com.arangodb.entity.DocumentCreateEntity;
3131
import com.arangodb.entity.DocumentDeleteEntity;
32+
import com.arangodb.entity.DocumentImportEntity;
3233
import com.arangodb.entity.DocumentUpdateEntity;
3334
import com.arangodb.entity.IndexEntity;
3435
import com.arangodb.entity.MultiDocumentEntity;
@@ -39,6 +40,7 @@
3940
import com.arangodb.model.DocumentCreateOptions;
4041
import com.arangodb.model.DocumentDeleteOptions;
4142
import com.arangodb.model.DocumentExistsOptions;
43+
import com.arangodb.model.DocumentImportOptions;
4244
import com.arangodb.model.DocumentReadOptions;
4345
import com.arangodb.model.DocumentReplaceOptions;
4446
import com.arangodb.model.DocumentUpdateOptions;
@@ -137,6 +139,63 @@ public <T> CompletableFuture<MultiDocumentEntity<DocumentCreateEntity<T>>> inser
137139
insertDocumentsResponseDeserializer(values, params));
138140
}
139141

142+
/**
143+
* Imports documents
144+
*
145+
* @param values
146+
* a list of Objects that will be stored as documents
147+
* @return information about the import
148+
* @throws ArangoDBException
149+
*/
150+
public CompletableFuture<DocumentImportEntity> importDocuments(final Collection<?> values) {
151+
return importDocuments(values, new DocumentImportOptions());
152+
}
153+
154+
/**
155+
* Imports documents
156+
*
157+
* @param values
158+
* a list of Objects that will be stored as documents
159+
* @param options
160+
* Additional options, can be null
161+
* @return information about the import
162+
* @throws ArangoDBException
163+
*/
164+
public CompletableFuture<DocumentImportEntity> importDocuments(
165+
final Collection<?> values,
166+
final DocumentImportOptions options) {
167+
return executor.execute(importDocumentsRequest(values, options), DocumentImportEntity.class);
168+
}
169+
170+
/**
171+
* Imports documents
172+
*
173+
* @param values
174+
* JSON-encoded array of objects that will be stored as documents
175+
* @return information about the import
176+
* @throws ArangoDBException
177+
*/
178+
public CompletableFuture<DocumentImportEntity> importDocuments(final String values) {
179+
return executor.execute(importDocumentsRequest(values, new DocumentImportOptions()),
180+
DocumentImportEntity.class);
181+
}
182+
183+
/**
184+
* Imports documents
185+
*
186+
* @param values
187+
* JSON-encoded array of objects that will be stored as documents
188+
* @param options
189+
* Additional options, can be null
190+
* @return information about the import
191+
* @throws ArangoDBException
192+
*/
193+
public CompletableFuture<DocumentImportEntity> importDocuments(
194+
final String values,
195+
final DocumentImportOptions options) {
196+
return executor.execute(importDocumentsRequest(values, options), DocumentImportEntity.class);
197+
}
198+
140199
/**
141200
* Reads a single document
142201
*

src/main/java/com/arangodb/ArangoDBAsync.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import java.io.IOException;
2424
import java.io.InputStream;
25+
import java.lang.annotation.Annotation;
2526
import java.util.Collection;
2627
import java.util.Properties;
2728
import java.util.concurrent.CompletableFuture;
@@ -49,10 +50,15 @@
4950
import com.arangodb.model.UserCreateOptions;
5051
import com.arangodb.model.UserUpdateOptions;
5152
import com.arangodb.velocypack.VPack;
53+
import com.arangodb.velocypack.VPackAnnotationFieldFilter;
54+
import com.arangodb.velocypack.VPackAnnotationFieldNaming;
5255
import com.arangodb.velocypack.VPackDeserializer;
5356
import com.arangodb.velocypack.VPackInstanceCreator;
57+
import com.arangodb.velocypack.VPackJsonDeserializer;
58+
import com.arangodb.velocypack.VPackJsonSerializer;
5459
import com.arangodb.velocypack.VPackParser;
5560
import com.arangodb.velocypack.VPackSerializer;
61+
import com.arangodb.velocypack.ValueType;
5662
import com.arangodb.velocystream.Request;
5763
import com.arangodb.velocystream.Response;
5864

@@ -172,6 +178,20 @@ public <T> Builder registerSerializer(final Class<T> clazz, final VPackSerialize
172178
return this;
173179
}
174180

181+
/**
182+
* Register a special serializer for a member class which can only be identified by its enclosing class.
183+
*
184+
* @param clazz
185+
* type of the enclosing class
186+
* @param serializer
187+
* serializer to register
188+
* @return builder
189+
*/
190+
public <T> Builder registerEnclosingSerializer(final Class<T> clazz, final VPackSerializer<T> serializer) {
191+
vpackBuilder.registerEnclosingSerializer(clazz, serializer);
192+
return this;
193+
}
194+
175195
public <T> Builder registerDeserializer(final Class<T> clazz, final VPackDeserializer<T> deserializer) {
176196
vpackBuilder.registerDeserializer(clazz, deserializer);
177197
return this;
@@ -182,6 +202,46 @@ public <T> Builder registerInstanceCreator(final Class<T> clazz, final VPackInst
182202
return this;
183203
}
184204

205+
public Builder registerJsonDeserializer(final ValueType type, final VPackJsonDeserializer deserializer) {
206+
vpackParser.registerDeserializer(type, deserializer);
207+
return this;
208+
}
209+
210+
public Builder registerJsonDeserializer(
211+
final String attribute,
212+
final ValueType type,
213+
final VPackJsonDeserializer deserializer) {
214+
vpackParser.registerDeserializer(attribute, type, deserializer);
215+
return this;
216+
}
217+
218+
public <T> Builder registerJsonSerializer(final Class<T> clazz, final VPackJsonSerializer<T> serializer) {
219+
vpackParser.registerSerializer(clazz, serializer);
220+
return this;
221+
}
222+
223+
public <T> Builder registerJsonSerializer(
224+
final String attribute,
225+
final Class<T> clazz,
226+
final VPackJsonSerializer<T> serializer) {
227+
vpackParser.registerSerializer(attribute, clazz, serializer);
228+
return this;
229+
}
230+
231+
public <T extends Annotation> Builder annotationFieldFilter(
232+
final Class<T> type,
233+
final VPackAnnotationFieldFilter<T> fieldFilter) {
234+
vpackBuilder.annotationFieldFilter(type, fieldFilter);
235+
return this;
236+
}
237+
238+
public <T extends Annotation> Builder annotationFieldNaming(
239+
final Class<T> type,
240+
final VPackAnnotationFieldNaming<T> fieldNaming) {
241+
vpackBuilder.annotationFieldNaming(type, fieldNaming);
242+
return this;
243+
}
244+
185245
public ArangoDBAsync build() {
186246
return new ArangoDBAsync(asyncBuilder(), vpackBuilder.build(),
187247
vpackBuilder.serializeNullValues(true).build(), vpackParser, collectionCache, syncBuilder());

0 commit comments

Comments
 (0)