Updating fix for bug 3989 based on discussion in OVSDB meeting
[ovsdb.git] / library / src / main / java / org / opendaylight / ovsdb / lib / operations / Operations.java
1 /*
2  * Copyright (c) 2014, 2015 EBay Software Foundation and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.ovsdb.lib.operations;
10
11 import org.opendaylight.ovsdb.lib.notation.Row;
12 import org.opendaylight.ovsdb.lib.schema.TableSchema;
13 import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
14
15 public class Operations {
16     public static Operations op = new Operations();
17
18     public <E extends TableSchema<E>> Insert<E> insert(TableSchema<E> schema) {
19         return new Insert<>(schema);
20     }
21
22     public <E extends TableSchema<E>> Insert<E> insert(TypedBaseTable<E> typedTable) {
23         return new Insert<>(typedTable);
24     }
25
26     public <E extends TableSchema<E>> Insert<E> insert(TableSchema<E> schema, Row<E> row) {
27         return new Insert<>(schema, row);
28     }
29
30     public <E extends TableSchema<E>> Update<E> update(TableSchema<E> schema) {
31         return new Update<>(schema);
32     }
33
34     public <E extends TableSchema<E>> Update<E> update(TypedBaseTable<E> typedTable) {
35         return new Update<>(typedTable);
36     }
37
38     public <E extends TableSchema<E>> Update<E> update(TableSchema<E> schema, Row<E> row) {
39         return new Update<>(schema, row);
40     }
41
42     public <E extends TableSchema<E>> Delete<E> delete(TableSchema<E> schema) {
43         return new Delete<>(schema);
44     }
45
46     public <E extends TableSchema<E>> Mutate<E> mutate(TableSchema<E> schema) {
47         return new Mutate<>(schema);
48     }
49
50     public <E extends TableSchema<E>> Mutate<E> mutate(TypedBaseTable<E> typedTable) {
51         return new Mutate<>(typedTable.getSchema());
52     }
53
54     public Commit commit(Boolean durable) {
55         return new Commit(durable);
56     }
57
58     public Abort abort() {
59         return new Abort();
60     }
61
62     public <E extends TableSchema<E>> Select<E> select(TableSchema<E> schema) {
63         return new Select<>(schema);
64     }
65
66     public Comment comment(String comment) {
67         return new Comment(comment);
68     }
69
70     /*
71      * Could not use Java keyword "assert" which clashes with the ovsdb json-rpc method.
72      * using assertion instead.
73      */
74     public Assert assertion(String lock) {
75         return new Assert(lock);
76     }
77 }