Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit 11ccf89

Browse files
author
a-brandt
committed
Documentation updates
1 parent 67915b9 commit 11ccf89

33 files changed

+1834
-1060
lines changed

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
<dependency>
3030
<groupId>org.codehaus.jettison</groupId>
3131
<artifactId>jettison</artifactId>
32-
<version>1.3.3</version>
32+
<version>1.3.5</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>log4j</groupId>
3636
<artifactId>log4j</artifactId>
37-
<version>1.2.16</version>
37+
<version>1.2.17</version>
3838
</dependency>
3939
<dependency>
4040
<groupId>junit</groupId>
@@ -50,12 +50,12 @@
5050
<dependency>
5151
<groupId>com.google.guava</groupId>
5252
<artifactId>guava</artifactId>
53-
<version>16.0.1</version>
53+
<version>17.0</version>
5454
</dependency>
5555
<dependency>
5656
<groupId>org.apache.commons</groupId>
5757
<artifactId>commons-lang3</artifactId>
58-
<version>3.2.1</version>
58+
<version>3.3.2</version>
5959
</dependency>
6060
</dependencies>
6161
<build>

src/main/java/com/tinkerpop/blueprints/impls/arangodb/ArangoDBEdge.java

Lines changed: 72 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,152 +8,153 @@
88

99
package com.tinkerpop.blueprints.impls.arangodb;
1010

11-
import com.tinkerpop.blueprints.impls.arangodb.client.*;
12-
1311
import com.tinkerpop.blueprints.Direction;
1412
import com.tinkerpop.blueprints.Edge;
1513
import com.tinkerpop.blueprints.Vertex;
14+
import com.tinkerpop.blueprints.impls.arangodb.client.ArangoDBException;
15+
import com.tinkerpop.blueprints.impls.arangodb.client.ArangoDBSimpleEdge;
1616
import com.tinkerpop.blueprints.util.ExceptionFactory;
1717
import com.tinkerpop.blueprints.util.StringFactory;
1818

1919
/**
20+
* The arangodb edge class
21+
*
2022
* @author Achim Brandt (http://www.triagens.de)
2123
* @author Johannes Gocke (http://www.triagens.de)
24+
* @author Guido Schwab (http://www.triagens.de)
2225
*/
2326

24-
public class ArangoDBEdge extends ArangoDBElement implements Edge
25-
{
27+
public class ArangoDBEdge extends ArangoDBElement implements Edge {
2628
/**
27-
* the _from vertex
29+
* the _from vertex
2830
*/
2931
private Vertex outVertex = null;
30-
32+
3133
/**
32-
* the _to vertex
34+
* the _to vertex
3335
*/
3436
private Vertex inVertex = null;
35-
36-
static ArangoDBEdge create (ArangoDBGraph graph, Object id, Vertex outVertex, Vertex inVertex, String label) {
37-
String key = (id != null) ? id.toString() : null;
38-
37+
38+
static ArangoDBEdge create(ArangoDBGraph graph, Object id, Vertex outVertex, Vertex inVertex, String label) {
39+
String key = (id != null) ? id.toString() : null;
40+
3941
if (outVertex instanceof ArangoDBVertex && inVertex instanceof ArangoDBVertex) {
4042
ArangoDBVertex from = (ArangoDBVertex) outVertex;
4143
ArangoDBVertex to = (ArangoDBVertex) inVertex;
42-
44+
4345
try {
44-
ArangoDBSimpleEdge v = graph.client.createEdge(graph.getRawGraph(), key, label, from.getRawVertex(), to.getRawVertex(), null);
46+
ArangoDBSimpleEdge v = graph.client.createEdge(graph.getRawGraph(), key, label, from.getRawVertex(),
47+
to.getRawVertex(), null);
4548
return build(graph, v, outVertex, inVertex);
4649
} catch (ArangoDBException e) {
4750
if (e.errorNumber() == 1210) {
4851
throw ExceptionFactory.vertexWithIdAlreadyExists(id);
4952
}
5053
throw new IllegalArgumentException(e.getMessage());
51-
}
54+
}
5255
}
5356
throw new IllegalArgumentException("Wrong vertex class.");
54-
57+
5558
}
56-
57-
static ArangoDBEdge load (ArangoDBGraph graph, Object id) {
59+
60+
static ArangoDBEdge load(ArangoDBGraph graph, Object id) {
5861
if (id == null) {
5962
throw ExceptionFactory.edgeIdCanNotBeNull();
6063
}
61-
62-
String key = id.toString();
64+
65+
String key = id.toString();
6366

6467
ArangoDBEdge edge = graph.edgeCache.get(key);
6568
if (edge != null) {
6669
return edge;
6770
}
68-
71+
6972
try {
7073
ArangoDBSimpleEdge v = graph.client.getEdge(graph.getRawGraph(), key);
71-
return build(graph, v, null ,null);
74+
return build(graph, v, null, null);
7275
} catch (ArangoDBException e) {
7376
// do nothing
7477
return null;
75-
}
78+
}
7679
}
77-
78-
static ArangoDBEdge build (ArangoDBGraph graph, ArangoDBSimpleEdge simpleEdge, Vertex outVertex, Vertex inVertex) {
80+
81+
static ArangoDBEdge build(ArangoDBGraph graph, ArangoDBSimpleEdge simpleEdge, Vertex outVertex, Vertex inVertex) {
7982
String id = simpleEdge.getDocumentKey();
80-
83+
8184
ArangoDBEdge vert = graph.edgeCache.get(id);
8285
if (vert != null) {
8386
vert.setDocument(simpleEdge);
8487
return vert;
8588
}
86-
89+
8790
ArangoDBEdge newEdge = new ArangoDBEdge(graph, simpleEdge, outVertex, inVertex);
8891
graph.edgeCache.put(newEdge.getRaw().getDocumentKey(), newEdge);
89-
return newEdge;
92+
return newEdge;
9093
}
9194

9295
private ArangoDBEdge(ArangoDBGraph graph, ArangoDBSimpleEdge edge, Vertex outVertex, Vertex inVertex) {
9396
this.graph = graph;
9497
this.document = edge;
9598
this.outVertex = outVertex;
96-
this.inVertex= inVertex;
99+
this.inVertex = inVertex;
97100
}
98-
99-
public Vertex getVertex(Direction direction) throws IllegalArgumentException
100-
{
101-
if (direction.equals(Direction.IN))
102-
{
103-
if (inVertex == null) {
104-
Object id = document.getProperty(ArangoDBSimpleEdge._TO);
105-
inVertex = graph.getVertex(getKey(id));
106-
}
107-
return inVertex;
108-
}
109-
else if (direction.equals(Direction.OUT))
110-
{
111-
if (outVertex == null) {
112-
Object id = document.getProperty(ArangoDBSimpleEdge._FROM);
113-
outVertex = graph.getVertex(getKey(id));
114-
}
115-
return outVertex;
116-
}
117-
else
118-
{
119-
throw ExceptionFactory.bothIsNotSupported();
120-
}
101+
102+
public Vertex getVertex(Direction direction) throws IllegalArgumentException {
103+
if (direction.equals(Direction.IN)) {
104+
if (inVertex == null) {
105+
Object id = document.getProperty(ArangoDBSimpleEdge._TO);
106+
inVertex = graph.getVertex(getKey(id));
107+
}
108+
return inVertex;
109+
} else if (direction.equals(Direction.OUT)) {
110+
if (outVertex == null) {
111+
Object id = document.getProperty(ArangoDBSimpleEdge._FROM);
112+
outVertex = graph.getVertex(getKey(id));
113+
}
114+
return outVertex;
115+
} else {
116+
throw ExceptionFactory.bothIsNotSupported();
117+
}
121118
}
122-
123-
private String getKey (Object id) {
124-
if (id == null) {
119+
120+
private String getKey(Object id) {
121+
if (id == null) {
125122
return "";
126123
}
127-
124+
128125
String[] parts = id.toString().split("/");
129-
126+
130127
if (parts.length > 1) {
131128
return parts[1];
132129
}
133-
130+
134131
return parts[0];
135132
}
136133

137-
public String getLabel()
138-
{
134+
public String getLabel() {
139135
Object l = document.getProperty(ArangoDBSimpleEdge._LABEL);
140136
if (l != null) {
141137
return l.toString();
142138
}
143-
139+
144140
return null;
145141
}
146-
147-
public ArangoDBSimpleEdge getRawEdge () {
142+
143+
/**
144+
* Returns the arangodb raw edge
145+
*
146+
* @return a ArangoDBSimpleEdge
147+
*/
148+
public ArangoDBSimpleEdge getRawEdge() {
148149
return (ArangoDBSimpleEdge) document;
149150
}
150-
151+
151152
@Override
152-
public String toString() {
153-
return StringFactory.edgeString(this);
154-
}
155-
156-
public void remove () {
153+
public String toString() {
154+
return StringFactory.edgeString(this);
155+
}
156+
157+
public void remove() {
157158
if (document.isDeleted()) {
158159
return;
159160
}
@@ -165,12 +166,12 @@ public void remove () {
165166
}
166167
graph.edgeCache.remove(key);
167168
}
168-
169-
public void save () throws ArangoDBException {
169+
170+
public void save() throws ArangoDBException {
170171
if (document.isDeleted()) {
171172
return;
172173
}
173174
graph.client.saveEdge(graph.getRawGraph(), (ArangoDBSimpleEdge) document);
174175
}
175-
176+
176177
}

0 commit comments

Comments
 (0)