|
73 | 73 | import com.arangodb.http.BatchHttpManager; |
74 | 74 | import com.arangodb.http.BatchPart; |
75 | 75 | import com.arangodb.http.HttpManager; |
| 76 | +import com.arangodb.http.HttpResponseEntity; |
76 | 77 | import com.arangodb.http.InvocationHandlerImpl; |
77 | 78 | import com.arangodb.impl.ImplFactory; |
78 | 79 | import com.arangodb.impl.InternalBatchDriverImpl; |
@@ -408,8 +409,21 @@ public <T> T getBatchResponseByRequestId(final String requestId) throws ArangoEx |
408 | 409 | this.httpManager.setPreDefinedResponse(null); |
409 | 410 | return result; |
410 | 411 | } catch (final InvocationTargetException e) { |
411 | | - final T result = (T) createEntity(batchResponseEntity.getHttpResponseEntity(), DefaultEntity.class); |
412 | 412 | this.httpManager.setPreDefinedResponse(null); |
| 413 | + |
| 414 | + HttpResponseEntity httpResponse = batchResponseEntity.getHttpResponseEntity(); |
| 415 | + if (httpResponse.getStatusCode() >= 300) { |
| 416 | + DefaultEntity de = new DefaultEntity(); |
| 417 | + de.setCode(httpResponse.getStatusCode()); |
| 418 | + de.setError(true); |
| 419 | + if (httpResponse.getText() != null) { |
| 420 | + de.setErrorMessage(httpResponse.getText().trim()); |
| 421 | + } |
| 422 | + de.setErrorNumber(httpResponse.getStatusCode()); |
| 423 | + throw new ArangoException(de); |
| 424 | + } |
| 425 | + |
| 426 | + final T result = (T) createEntity(batchResponseEntity.getHttpResponseEntity(), DefaultEntity.class); |
413 | 427 | return result; |
414 | 428 | } catch (final Exception e) { |
415 | 429 | this.httpManager.setPreDefinedResponse(null); |
@@ -2385,6 +2399,32 @@ public IndexEntity createSkipListIndex( |
2385 | 2399 | fields); |
2386 | 2400 | } |
2387 | 2401 |
|
| 2402 | + /** |
| 2403 | + * It is possible to define a persistent index on one or more attributes (or |
| 2404 | + * paths) of documents. The index is then used in queries to locate |
| 2405 | + * documents within a given range. If the index is declared unique, then no |
| 2406 | + * two documents are allowed to have the same set of attribute values. |
| 2407 | + * |
| 2408 | + * @param collectionName |
| 2409 | + * The collection name. |
| 2410 | + * @param unique |
| 2411 | + * if set to true the index will be a unique index |
| 2412 | + * @param sparse |
| 2413 | + * if set to true the index will be sparse |
| 2414 | + * @param fields |
| 2415 | + * the fields (document attributes) the index is created on |
| 2416 | + * @return IndexEntity |
| 2417 | + * @throws ArangoException |
| 2418 | + */ |
| 2419 | + public IndexEntity createPersistentIndex( |
| 2420 | + final String collectionName, |
| 2421 | + final boolean unique, |
| 2422 | + final boolean sparse, |
| 2423 | + final String... fields) throws ArangoException { |
| 2424 | + return indexDriver.createIndex(getDefaultDatabase(), collectionName, IndexType.PERSISTENT, unique, sparse, |
| 2425 | + fields); |
| 2426 | + } |
| 2427 | + |
2388 | 2428 | /** |
2389 | 2429 | * This method creates a full text index for a collection. |
2390 | 2430 | * |
|
0 commit comments