Skip to content

Commit 0a0bfce

Browse files
author
Mark
committed
removed Methods with documentId (long) from ArangoDriver
1 parent 1a08e51 commit 0a0bfce

File tree

4 files changed

+9
-210
lines changed

4 files changed

+9
-210
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
v3.1.0 (2016-09-XX)
22
* removed Methods with collectionId (long) from ArangoDriver (Id is only for internal usage)
33
* changed Revision from long to String
4+
* removed Methods with documentId (long) from ArangoDriver
45

56
v3.0.1 (2016-07-08)
67
---------------------------

src/main/java/com/arangodb/ArangoDriver.java

Lines changed: 0 additions & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -746,23 +746,6 @@ public <T> DocumentEntity<T> createDocument(
746746
return documentDriver.createDocument(getDefaultDatabase(), collectionName, documentKey, value, waitForSync);
747747
}
748748

749-
/**
750-
* This method replaces the content of the document defined by documentId.
751-
*
752-
* @param collectionName
753-
* The collection's name.
754-
* @param documentId
755-
* The document's id.
756-
* @param value
757-
* An object containing the documents attributes
758-
* @return DocumentEntity<?>
759-
* @throws ArangoException
760-
*/
761-
public <T> DocumentEntity<T> replaceDocument(final String collectionName, final long documentId, final T value)
762-
throws ArangoException {
763-
return replaceDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, null, null);
764-
}
765-
766749
/**
767750
* This method replaces the content of the document defined by documentKey.
768751
*
@@ -795,36 +778,6 @@ public <T> DocumentEntity<T> replaceDocument(final String documentHandle, final
795778
return documentDriver.replaceDocument(getDefaultDatabase(), documentHandle, value, null, null);
796779
}
797780

798-
/**
799-
* This method replaces the content of the document defined by documentId.
800-
* This method offers a parameter rev (revision). If the revision of the
801-
* document on the server does not match the given revision an error is
802-
* thrown.
803-
*
804-
* @param collectionName
805-
* The collection's name.
806-
* @param documentId
807-
* The document's id.
808-
* @param value
809-
* An object containing the new attributes of the document.
810-
* @param rev
811-
* the desired revision.
812-
* @param waitForSync
813-
* if set to true the response is returned when the server has
814-
* finished.
815-
* @return a DocumentEntity object
816-
* @throws ArangoException
817-
*/
818-
public DocumentEntity<?> replaceDocument(
819-
final String collectionName,
820-
final long documentId,
821-
final Object value,
822-
final String rev,
823-
final Boolean waitForSync) throws ArangoException {
824-
return replaceDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, rev,
825-
waitForSync);
826-
}
827-
828781
/**
829782
* This method replaces the content of the document defined by documentKey.
830783
* This method offers a parameter rev (revision). If the revision of the
@@ -880,24 +833,6 @@ public <T> DocumentEntity<T> replaceDocument(
880833
return documentDriver.replaceDocument(getDefaultDatabase(), documentHandle, value, rev, waitForSync);
881834
}
882835

883-
/**
884-
* This method updates a document defined by documentId.
885-
*
886-
* @param collectionName
887-
* The collection's name.
888-
* @param documentId
889-
* The document's id.
890-
* @param value
891-
* An object containing the documents attributes
892-
* @return DocumentEntity<?>
893-
* @throws ArangoException
894-
*/
895-
public DocumentEntity<?> updateDocument(final String collectionName, final long documentId, final Object value)
896-
throws ArangoException {
897-
return updateDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, null, null,
898-
null);
899-
}
900-
901836
/**
902837
* This method updates a document defined by documentKey.
903838
*
@@ -929,29 +864,6 @@ public <T> DocumentEntity<T> updateDocument(final String documentHandle, final T
929864
return documentDriver.updateDocument(getDefaultDatabase(), documentHandle, value, null, null, null);
930865
}
931866

932-
/**
933-
* This method updates a document defined by documentId.
934-
*
935-
* @param collectionName
936-
* The collection name.
937-
* @param documentId
938-
* The document id.
939-
* @param value
940-
* An object containing the documents attributes
941-
* @param keepNull
942-
* If true null values are kept.
943-
* @return DocumentEntity<?>
944-
* @throws ArangoException
945-
*/
946-
public DocumentEntity<?> updateDocument(
947-
final String collectionName,
948-
final long documentId,
949-
final Object value,
950-
final Boolean keepNull) throws ArangoException {
951-
return updateDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, null, null,
952-
keepNull);
953-
}
954-
955867
/**
956868
* This method updates a document defined by documentKey.
957869
*
@@ -991,38 +903,6 @@ public <T> DocumentEntity<T> updateDocument(final String documentHandle, final T
991903
return documentDriver.updateDocument(getDefaultDatabase(), documentHandle, value, null, null, keepNull);
992904
}
993905

994-
/**
995-
* This method updates a document defined by documentId. This method offers
996-
* a parameter rev (revision). If the revision of the document on the server
997-
* does not match the given revision an error is thrown.
998-
*
999-
* @param collectionName
1000-
* The collection name.
1001-
* @param documentId
1002-
* The document id.
1003-
* @param value
1004-
* An object containing the documents attributes
1005-
* @param rev
1006-
* The desired revision
1007-
* @param waitForSync
1008-
* if set to true the response is returned when the server has
1009-
* finished.
1010-
* @param keepNull
1011-
* If true null values are kept.
1012-
* @return a DocumentEntity object
1013-
* @throws ArangoException
1014-
*/
1015-
public DocumentEntity<?> updateDocument(
1016-
final String collectionName,
1017-
final long documentId,
1018-
final Object value,
1019-
final String rev,
1020-
final Boolean waitForSync,
1021-
final Boolean keepNull) throws ArangoException {
1022-
return updateDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), value, rev, waitForSync,
1023-
keepNull);
1024-
}
1025-
1026906
/**
1027907
* This method updates a document defined by documentKey. This method offers
1028908
* a parameter rev (revision). If the revision of the document on the server
@@ -1094,23 +974,6 @@ public List<String> getDocuments(final String collectionName) throws ArangoExcep
1094974
return documentDriver.getDocuments(getDefaultDatabase(), collectionName);
1095975
}
1096976

1097-
/**
1098-
* The exists method determines whether a document exists given its
1099-
* identifier. Instead of returning the found document or an error, this
1100-
* method will return either true or false. It can thus be used for easy
1101-
* existence checks.
1102-
*
1103-
* @param collectionName
1104-
* The collection name.
1105-
* @param documentId
1106-
* The document id
1107-
* @return true, if the document exists
1108-
* @throws ArangoException
1109-
*/
1110-
public boolean exists(final String collectionName, final long documentId) throws ArangoException {
1111-
return exists(createDocumentHandle(collectionName, String.valueOf(documentId)));
1112-
}
1113-
1114977
/**
1115978
* The exists method determines whether a document exists given its
1116979
* identifier. Instead of returning the found document or an error, this
@@ -1151,20 +1014,6 @@ public boolean exists(final String documentHandle) throws ArangoException {
11511014
return true;
11521015
}
11531016

1154-
/**
1155-
* This method returns the current revision of a document.
1156-
*
1157-
* @param collectionName
1158-
* The collection name.
1159-
* @param documentId
1160-
* The document id
1161-
* @return the document revision number
1162-
* @throws ArangoException
1163-
*/
1164-
public String checkDocument(final String collectionName, final long documentId) throws ArangoException {
1165-
return checkDocument(createDocumentHandle(collectionName, String.valueOf(documentId)));
1166-
}
1167-
11681017
/**
11691018
* This method returns the current revision of a document.
11701019
*
@@ -1191,24 +1040,6 @@ public String checkDocument(final String documentHandle) throws ArangoException
11911040
return documentDriver.checkDocument(getDefaultDatabase(), documentHandle);
11921041
}
11931042

1194-
/**
1195-
* Returns a document entity.
1196-
*
1197-
* @param collectionName
1198-
* The collection name.
1199-
* @param documentId
1200-
* The document id
1201-
* @param clazz
1202-
* The expected class, the result from the server request is
1203-
* deserialized to an instance of this class.
1204-
* @return a DocumentEntity object
1205-
* @throws ArangoException
1206-
*/
1207-
public <T> DocumentEntity<T> getDocument(final String collectionName, final long documentId, final Class<T> clazz)
1208-
throws ArangoException {
1209-
return getDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), clazz);
1210-
}
1211-
12121043
/**
12131044
* Returns a document entity.
12141045
*
@@ -1272,20 +1103,6 @@ public <T> DocumentEntity<T> getDocument(
12721103
ifMatchRevision);
12731104
}
12741105

1275-
/**
1276-
* Deletes a document from the database.
1277-
*
1278-
* @param collectionName
1279-
* The collection name.
1280-
* @param documentId
1281-
* The document id.
1282-
* @return a DocumentEntity object
1283-
* @throws ArangoException
1284-
*/
1285-
public DocumentEntity<?> deleteDocument(final String collectionName, final long documentId) throws ArangoException {
1286-
return deleteDocument(createDocumentHandle(collectionName, String.valueOf(documentId)));
1287-
}
1288-
12891106
/**
12901107
* Deletes a document from the database.
12911108
*
@@ -1313,25 +1130,6 @@ public DocumentEntity<?> deleteDocument(final String documentHandle) throws Aran
13131130
return documentDriver.deleteDocument(getDefaultDatabase(), documentHandle, null);
13141131
}
13151132

1316-
/**
1317-
* Deletes a document from the database. This method offers a parameter rev
1318-
* (revision). If the revision of the document on the server does not match
1319-
* the given revision an error is thrown.
1320-
*
1321-
* @param collectionName
1322-
* The collection name.
1323-
* @param documentId
1324-
* The document id.
1325-
* @param rev
1326-
* The desired revision
1327-
* @return a DocumentEntity object
1328-
* @throws ArangoException
1329-
*/
1330-
public DocumentEntity<?> deleteDocument(final String collectionName, final long documentId, final String rev)
1331-
throws ArangoException {
1332-
return deleteDocument(createDocumentHandle(collectionName, String.valueOf(documentId)), rev);
1333-
}
1334-
13351133
/**
13361134
* Deletes a document from the database. This method offers a parameter rev
13371135
* (revision). If the revision of the document on the server does not match

src/test/java/com/arangodb/ArangoDriverDocumentTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ public void test_replace_404() throws ArangoException {
278278
final TestComplexEntity01 value = new TestComplexEntity01("test-user", "test user", 22);
279279
// 存在しないコレクションに追加しようとする
280280
try {
281-
driver.replaceDocument(collectionName404, 1, value, null, null);
281+
driver.replaceDocument(collectionName404, "1", value, null, null);
282282
fail("no exception was thrown");
283283
} catch (final ArangoException e) {
284284
assertThat(e.getCode(), is(404));
@@ -291,7 +291,7 @@ public void test_replace_404_2() throws ArangoException {
291291
final TestComplexEntity01 value = new TestComplexEntity01("test-user", "test user", 22);
292292
// 存在するコレクションだが、ドキュメントが存在しない
293293
try {
294-
driver.replaceDocument(collectionName, 1, value, null, null);
294+
driver.replaceDocument(collectionName, "1", value, null, null);
295295
fail("no exception was thrown");
296296
} catch (final ArangoException e) {
297297
assertThat(e.getCode(), is(404));
@@ -470,7 +470,7 @@ public void test_get_document_with_instance_creator() throws ArangoException {
470470
public void test_get_document_collection_not_found() throws ArangoException {
471471
// Get
472472
try {
473-
driver.getDocument(collectionName404, 1L, TestComplexEntity01.class);
473+
driver.getDocument(collectionName404, "1", TestComplexEntity01.class);
474474
fail("");
475475
} catch (final ArangoException e) {
476476
assertThat(e.getCode(), is(404));
@@ -483,7 +483,7 @@ public void test_get_document_collection_not_found() throws ArangoException {
483483
public void test_get_document_doc_not_found() throws ArangoException {
484484
// Get
485485
try {
486-
driver.getDocument(collectionName, 1L, TestComplexEntity01.class);
486+
driver.getDocument(collectionName, "1", TestComplexEntity01.class);
487487
fail("");
488488
} catch (final ArangoException e) {
489489
assertThat(e.getCode(), is(404));
@@ -580,7 +580,7 @@ public void test_check_document_doc_not_found() throws ArangoException {
580580
driver.createDocument(collectionName, new TestComplexEntity02(1, 2, 3), null);
581581

582582
try {
583-
driver.checkDocument(collectionName, 1);
583+
driver.checkDocument(collectionName, "1");
584584
fail();
585585
} catch (final ArangoException e) {
586586
assertThat(e.getCode(), is(404));
@@ -593,7 +593,7 @@ public void test_check_document_doc_not_exists() throws ArangoException {
593593

594594
driver.createDocument(collectionName, new TestComplexEntity02(1, 2, 3), null);
595595

596-
final boolean b = driver.exists(collectionName, 1);
596+
final boolean b = driver.exists(collectionName, "1");
597597

598598
assertThat(b, is(false));
599599
}
@@ -608,7 +608,7 @@ public void test_delete() throws ArangoException {
608608
@Test
609609
public void test_delete_doc_not_found() throws ArangoException {
610610
try {
611-
driver.deleteDocument(collectionName, 1);
611+
driver.deleteDocument(collectionName, "1");
612612
fail();
613613
} catch (final ArangoException e) {
614614
assertThat(e.getCode(), is(ErrorNums.ERROR_HTTP_NOT_FOUND));

src/test/resources/logback.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</encoder>
99
</appender>
1010

11-
<root level="debug">
11+
<root level="info">
1212
<appender-ref ref="STDOUT" />
1313
</root>
1414
</configuration>

0 commit comments

Comments
 (0)