Code ReOrganization and Re-Architecture changes
[ovsdb.git] / library / src / main / java / org / opendaylight / ovsdb / lib / operations / OperationResult.java
1 /*
2  * Copyright (C) 2013 Red Hat, Inc.
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  * Authors : Madhu Venugopal
9  */
10 package org.opendaylight.ovsdb.lib.operations;
11
12 import java.util.ArrayList;
13 import java.util.List;
14
15 import org.opendaylight.ovsdb.lib.notation.UUID;
16
17 import com.fasterxml.jackson.annotation.JsonIgnore;
18 import com.fasterxml.jackson.annotation.JsonProperty;
19
20 // Section 5.2 of ovsdb draft covers the various response structures for
21 // each of the Operations covered by Transaction (Insert, Update, Delete, Mutate, etc...)
22 // It is better to have the OperationResult as an abstract parent class with individual
23 // concrete child classes for each of the operation response.
24 // TODO : But this needs proper response handling
25 // https://trello.com/c/mfTTS86k/28-generic-response-error-handling-especially-for-transact
26 // As a temporary measure, adding all the expected responses under the same response.
27
28 public class OperationResult {
29     //public abstract boolean isSuccess();
30     private int count;
31     @JsonIgnore
32     private UUID uuid;
33     private ArrayList<Object> rows;
34     private String error;
35     private String details;
36
37     public int getCount() {
38         return count;
39     }
40     public void setCount(int count) {
41         this.count = count;
42     }
43     @JsonProperty("uuid")
44     public UUID getUuid() {
45         return uuid;
46     }
47     public void setUuid(List<String> uuidList) {
48         this.uuid = new UUID(uuidList.get(1));
49     }
50     public ArrayList<Object> getRows() {
51         return rows;
52     }
53     public void setRows(ArrayList<Object> rows) {
54         this.rows = rows;
55     }
56     public String getError() {
57         return error;
58     }
59     public void setError(String error) {
60         this.error = error;
61     }
62     public String getDetails() {
63         return details;
64     }
65     public void setDetails(String details) {
66         this.details = details;
67     }
68
69     @Override
70     public String toString() {
71         return "OperationResult [count=" + count + ", uuid=" + uuid + ", rows="
72                 + rows + ", error=" + error + "]";
73     }
74 }