Skip to content

Commit aa2e7a0

Browse files
committed
Add changes to java dev docs to previous versions
1 parent 1794376 commit aa2e7a0

File tree

21 files changed

+678
-20
lines changed

21 files changed

+678
-20
lines changed

content/riak/kv/2.0.0/developing/getting-started/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project's dependencies. Here is a Maven example:
3131
<dependency>
3232
<groupId>com.basho.riak</groupId>
3333
<artifactId>riak-client</artifactId>
34-
<version>2.0.0</version>
34+
<version>2.1.1</version>
3535
</dependency
3636
</dependencies>
3737
```

content/riak/kv/2.0.0/developing/getting-started/java/crud-operations.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ StoreValue storeOp = new StoreValue.Builder(quoteObject)
3030
.build();
3131
```
3232

33-
In line 76 we use our `client` object to execute the storage operation:
33+
We then use our `client` object to execute the storage operation:
3434

3535
```java
3636
StoreValue.Response response = client.execute(storeOp);
@@ -53,6 +53,24 @@ If the values are equal, as they should be, the Java client will say
5353
`Success! The object we created and the object we fetched have the same
5454
value`. If not, then the client will throw an exception.
5555

56+
## Updating Objects
57+
58+
Once we've read the object back in from Riak, we can update the object
59+
and store it back as we did before with the `StoreValue` object:
60+
61+
```java
62+
fetchedObject.setValue(BinaryValue.create("You can be my wingman any time."));
63+
StoreValue updateOp = new StoreValue.Builder(fetchedObject)
64+
.withLocation(quoteObjectLocation)
65+
.build();
66+
StoreValue.Response updateOpResp = client.execute(updateOp);
67+
```
68+
69+
For more in depth information on updating objects and sibling resolution in
70+
Riak, see [Updating Objects](/riak/kv/2.0.0/developing/usage/updating-objects/)
71+
and [Conflict Resolution](/riak/kv/2.0.0/developing/usage/conflict-resolution/)
72+
documentation.
73+
5674
## Deleting Objects
5775

5876
Now that we've stored and then fetched the object, we can delete it by
@@ -117,3 +135,49 @@ If we fetch the object (using the same method we showed up above and in
117135
"copiesOwned": 3
118136
}
119137
```
138+
139+
Since we really like Moby Dick, let's buy a couple more copies
140+
and update the POJO.
141+
142+
To update the POJO, we would use `UpdateValue` by
143+
extending a new `BookUpdate` class as follows:
144+
145+
```java
146+
public static class BookUpdate extends UpdateValue.Update<Book> {
147+
private final Book update;
148+
public BookUpdate(Book update){
149+
this.update = update;
150+
}
151+
152+
@Override
153+
public Book apply(Book t) {
154+
if(t == null) {
155+
t = new Book();
156+
}
157+
158+
t.author = update.author;
159+
t.body = update.body;
160+
t.copiesOwned = update.copiesOwned;
161+
t.isbn = update.isbn;
162+
t.title = update.title;
163+
164+
return t;
165+
}
166+
}
167+
```
168+
169+
Then using the `BookUpdate` class with our `mobyDick` object:
170+
171+
```java
172+
mobyDick.copiesOwned = 5;
173+
BookUpdate updatedBook = new BookUpdate(mobyDick);
174+
175+
UpdateValue updateValue = new UpdateValue.Builder(mobyDickLocation)
176+
.withUpdate(updatedBook).build();
177+
UpdateValue.Response response = client.execute(updateValue);
178+
```
179+
180+
For more in depth information on updating objects and sibling resolution in
181+
Riak, see [Updating Objects](/riak/kv/2.0.0/developing/usage/updating-objects/)
182+
and [Conflict Resolution](/riak/kv/2.0.0/developing/usage/conflict-resolution/)
183+
documention.

content/riak/kv/2.0.1/developing/getting-started/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project's dependencies. Here is a Maven example:
3131
<dependency>
3232
<groupId>com.basho.riak</groupId>
3333
<artifactId>riak-client</artifactId>
34-
<version>2.0.0</version>
34+
<version>2.1.1</version>
3535
</dependency
3636
</dependencies>
3737
```

content/riak/kv/2.0.1/developing/getting-started/java/crud-operations.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ StoreValue storeOp = new StoreValue.Builder(quoteObject)
3030
.build();
3131
```
3232

33-
In line 76 we use our `client` object to execute the storage operation:
33+
We then use our `client` object to execute the storage operation:
3434

3535
```java
3636
StoreValue.Response response = client.execute(storeOp);
@@ -53,6 +53,24 @@ If the values are equal, as they should be, the Java client will say
5353
`Success! The object we created and the object we fetched have the same
5454
value`. If not, then the client will throw an exception.
5555

56+
## Updating Objects
57+
58+
Once we've read the object back in from Riak, we can update the object
59+
and store it back as we did before with the `StoreValue` object:
60+
61+
```java
62+
fetchedObject.setValue(BinaryValue.create("You can be my wingman any time."));
63+
StoreValue updateOp = new StoreValue.Builder(fetchedObject)
64+
.withLocation(quoteObjectLocation)
65+
.build();
66+
StoreValue.Response updateOpResp = client.execute(updateOp);
67+
```
68+
69+
For more in depth information on updating objects and sibling resolution in
70+
Riak, see [Updating Objects](/riak/kv/2.0.1/developing/usage/updating-objects/)
71+
and [Conflict Resolution](/riak/kv/2.0.1/developing/usage/conflict-resolution/)
72+
documentation.
73+
5674
## Deleting Objects
5775

5876
Now that we've stored and then fetched the object, we can delete it by
@@ -117,3 +135,49 @@ If we fetch the object (using the same method we showed up above and in
117135
"copiesOwned": 3
118136
}
119137
```
138+
139+
Since we really like Moby Dick, let's buy a couple more copies
140+
and update the POJO.
141+
142+
To update the POJO, we would use `UpdateValue` by
143+
extending a new `BookUpdate` class as follows:
144+
145+
```java
146+
public static class BookUpdate extends UpdateValue.Update<Book> {
147+
private final Book update;
148+
public BookUpdate(Book update){
149+
this.update = update;
150+
}
151+
152+
@Override
153+
public Book apply(Book t) {
154+
if(t == null) {
155+
t = new Book();
156+
}
157+
158+
t.author = update.author;
159+
t.body = update.body;
160+
t.copiesOwned = update.copiesOwned;
161+
t.isbn = update.isbn;
162+
t.title = update.title;
163+
164+
return t;
165+
}
166+
}
167+
```
168+
169+
Then using the `BookUpdate` class with our `mobyDick` object:
170+
171+
```java
172+
mobyDick.copiesOwned = 5;
173+
BookUpdate updatedBook = new BookUpdate(mobyDick);
174+
175+
UpdateValue updateValue = new UpdateValue.Builder(mobyDickLocation)
176+
.withUpdate(updatedBook).build();
177+
UpdateValue.Response response = client.execute(updateValue);
178+
```
179+
180+
For more in depth information on updating objects and sibling resolution in
181+
Riak, see [Updating Objects](/riak/kv/2.0.1/developing/usage/updating-objects/)
182+
and [Conflict Resolution](/riak/kv/2.0.1/developing/usage/conflict-resolution/)
183+
documention.

content/riak/kv/2.0.2/developing/getting-started/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project's dependencies. Here is a Maven example:
3131
<dependency>
3232
<groupId>com.basho.riak</groupId>
3333
<artifactId>riak-client</artifactId>
34-
<version>2.0.0</version>
34+
<version>2.1.1</version>
3535
</dependency
3636
</dependencies>
3737
```

content/riak/kv/2.0.2/developing/getting-started/java/crud-operations.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ StoreValue storeOp = new StoreValue.Builder(quoteObject)
3030
.build();
3131
```
3232

33-
In line 76 we use our `client` object to execute the storage operation:
33+
We then use our `client` object to execute the storage operation:
3434

3535
```java
3636
StoreValue.Response response = client.execute(storeOp);
@@ -53,6 +53,24 @@ If the values are equal, as they should be, the Java client will say
5353
`Success! The object we created and the object we fetched have the same
5454
value`. If not, then the client will throw an exception.
5555

56+
## Updating Objects
57+
58+
Once we've read the object back in from Riak, we can update the object
59+
and store it back as we did before with the `StoreValue` object:
60+
61+
```java
62+
fetchedObject.setValue(BinaryValue.create("You can be my wingman any time."));
63+
StoreValue updateOp = new StoreValue.Builder(fetchedObject)
64+
.withLocation(quoteObjectLocation)
65+
.build();
66+
StoreValue.Response updateOpResp = client.execute(updateOp);
67+
```
68+
69+
For more in depth information on updating objects and sibling resolution in
70+
Riak, see [Updating Objects](/riak/kv/2.0.2/developing/usage/updating-objects/)
71+
and [Conflict Resolution](/riak/kv/2.0.2/developing/usage/conflict-resolution/)
72+
documentation.
73+
5674
## Deleting Objects
5775

5876
Now that we've stored and then fetched the object, we can delete it by
@@ -117,3 +135,49 @@ If we fetch the object (using the same method we showed up above and in
117135
"copiesOwned": 3
118136
}
119137
```
138+
139+
Since we really like Moby Dick, let's buy a couple more copies
140+
and update the POJO.
141+
142+
To update the POJO, we would use `UpdateValue` by
143+
extending a new `BookUpdate` class as follows:
144+
145+
```java
146+
public static class BookUpdate extends UpdateValue.Update<Book> {
147+
private final Book update;
148+
public BookUpdate(Book update){
149+
this.update = update;
150+
}
151+
152+
@Override
153+
public Book apply(Book t) {
154+
if(t == null) {
155+
t = new Book();
156+
}
157+
158+
t.author = update.author;
159+
t.body = update.body;
160+
t.copiesOwned = update.copiesOwned;
161+
t.isbn = update.isbn;
162+
t.title = update.title;
163+
164+
return t;
165+
}
166+
}
167+
```
168+
169+
Then using the `BookUpdate` class with our `mobyDick` object:
170+
171+
```java
172+
mobyDick.copiesOwned = 5;
173+
BookUpdate updatedBook = new BookUpdate(mobyDick);
174+
175+
UpdateValue updateValue = new UpdateValue.Builder(mobyDickLocation)
176+
.withUpdate(updatedBook).build();
177+
UpdateValue.Response response = client.execute(updateValue);
178+
```
179+
180+
For more in depth information on updating objects and sibling resolution in
181+
Riak, see [Updating Objects](/riak/kv/2.0.2/developing/usage/updating-objects/)
182+
and [Conflict Resolution](/riak/kv/2.0.2/developing/usage/conflict-resolution/)
183+
documention.

content/riak/kv/2.0.4/developing/getting-started/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project's dependencies. Here is a Maven example:
3131
<dependency>
3232
<groupId>com.basho.riak</groupId>
3333
<artifactId>riak-client</artifactId>
34-
<version>2.0.0</version>
34+
<version>2.1.1</version>
3535
</dependency
3636
</dependencies>
3737
```

content/riak/kv/2.0.4/developing/getting-started/java/crud-operations.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ StoreValue storeOp = new StoreValue.Builder(quoteObject)
3030
.build();
3131
```
3232

33-
In line 76 we use our `client` object to execute the storage operation:
33+
We then use our `client` object to execute the storage operation:
3434

3535
```java
3636
StoreValue.Response response = client.execute(storeOp);
@@ -53,6 +53,24 @@ If the values are equal, as they should be, the Java client will say
5353
`Success! The object we created and the object we fetched have the same
5454
value`. If not, then the client will throw an exception.
5555

56+
## Updating Objects
57+
58+
Once we've read the object back in from Riak, we can update the object
59+
and store it back as we did before with the `StoreValue` object:
60+
61+
```java
62+
fetchedObject.setValue(BinaryValue.create("You can be my wingman any time."));
63+
StoreValue updateOp = new StoreValue.Builder(fetchedObject)
64+
.withLocation(quoteObjectLocation)
65+
.build();
66+
StoreValue.Response updateOpResp = client.execute(updateOp);
67+
```
68+
69+
For more in depth information on updating objects and sibling resolution in
70+
Riak, see [Updating Objects](/riak/kv/2.0.4/developing/usage/updating-objects/)
71+
and [Conflict Resolution](/riak/kv/2.0.4/developing/usage/conflict-resolution/)
72+
documentation.
73+
5674
## Deleting Objects
5775

5876
Now that we've stored and then fetched the object, we can delete it by
@@ -117,3 +135,49 @@ If we fetch the object (using the same method we showed up above and in
117135
"copiesOwned": 3
118136
}
119137
```
138+
139+
Since we really like Moby Dick, let's buy a couple more copies
140+
and update the POJO.
141+
142+
To update the POJO, we would use `UpdateValue` by
143+
extending a new `BookUpdate` class as follows:
144+
145+
```java
146+
public static class BookUpdate extends UpdateValue.Update<Book> {
147+
private final Book update;
148+
public BookUpdate(Book update){
149+
this.update = update;
150+
}
151+
152+
@Override
153+
public Book apply(Book t) {
154+
if(t == null) {
155+
t = new Book();
156+
}
157+
158+
t.author = update.author;
159+
t.body = update.body;
160+
t.copiesOwned = update.copiesOwned;
161+
t.isbn = update.isbn;
162+
t.title = update.title;
163+
164+
return t;
165+
}
166+
}
167+
```
168+
169+
Then using the `BookUpdate` class with our `mobyDick` object:
170+
171+
```java
172+
mobyDick.copiesOwned = 5;
173+
BookUpdate updatedBook = new BookUpdate(mobyDick);
174+
175+
UpdateValue updateValue = new UpdateValue.Builder(mobyDickLocation)
176+
.withUpdate(updatedBook).build();
177+
UpdateValue.Response response = client.execute(updateValue);
178+
```
179+
180+
For more in depth information on updating objects and sibling resolution in
181+
Riak, see [Updating Objects](/riak/kv/2.0.4/developing/usage/updating-objects/)
182+
and [Conflict Resolution](/riak/kv/2.0.4/developing/usage/conflict-resolution/)
183+
documention.

content/riak/kv/2.0.5/developing/getting-started/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project's dependencies. Here is a Maven example:
3131
<dependency>
3232
<groupId>com.basho.riak</groupId>
3333
<artifactId>riak-client</artifactId>
34-
<version>2.0.0</version>
34+
<version>2.1.1</version>
3535
</dependency
3636
</dependencies>
3737
```

0 commit comments

Comments
 (0)