blob: 08b5e522494054be4713ebc2287afa938b2c14d1 [file] [log] [blame]
Sho SHIMIZUe4efe452015-08-26 15:06:55 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.ovsdb.rfc.operations;
17
18import static com.google.common.base.Preconditions.checkNotNull;
19
20import java.util.List;
21
22import org.onosproject.ovsdb.rfc.notation.Condition;
23import org.onosproject.ovsdb.rfc.schema.TableSchema;
24
25import com.fasterxml.jackson.annotation.JsonIgnore;
26import com.fasterxml.jackson.annotation.JsonProperty;
27
28/**
29 * delete operation.Refer to RFC 7047 Section 5.2.
30 */
31public final class Delete implements Operation {
32
33 @JsonIgnore
34 private final TableSchema tableSchema;
35 private final String op;
36 private final List<Condition> where;
37
38 /**
39 * Constructs a Delete object.
40 * @param schema TableSchema entity
41 * @param where the List of Condition entity
42 */
43 public Delete(TableSchema schema, List<Condition> where) {
44 checkNotNull(schema, "TableSchema cannot be null");
45 checkNotNull(where, "where is not null");
46 this.tableSchema = schema;
47 this.op = Operations.DELETE.op();
48 this.where = where;
49 }
50
51 /**
52 * Returns the where member of delete operation.
53 * @return the where member of delete operation
54 */
55 public List<Condition> getWhere() {
56 return where;
57 }
58
59 @Override
60 public String getOp() {
61 return op;
62 }
63
64 @Override
65 public TableSchema getTableSchema() {
66 return tableSchema;
67 }
68
69 /**
70 * For the use of serialization.
71 * @return the table member of update operation
72 */
73 @JsonProperty
74 public String getTable() {
75 return tableSchema.name();
76 }
77}