1
2
3
4
5
6 package org.openrdf.repository.memento;
7
8 import org.openrdf.model.Resource;
9 import org.openrdf.model.URI;
10 import org.openrdf.model.Value;
11 import org.openrdf.repository.RepositoryConnection;
12 import org.openrdf.repository.RepositoryException;
13
14
15
16
17
18
19
20
21 class AddCommand implements Command {
22 private Resource subj;
23
24 private URI pred;
25
26 private Value obj;
27
28 private Resource[] ctx;
29
30 public AddCommand(Resource subj, URI pred, Value obj, Resource... ctx) {
31 super();
32 this.subj = subj;
33 this.pred = pred;
34 this.obj = obj;
35 this.ctx = ctx;
36 }
37
38 public void undo(RepositoryConnection conn) throws RepositoryException {
39 conn.remove(subj, pred, obj, ctx);
40 }
41
42 public void redo(RepositoryConnection conn) throws RepositoryException {
43 conn.add(subj, pred, obj, ctx);
44 }
45 }