Feature uses features-parent as parent
[groupbasedpolicy.git] / renderers / opflex / src / main / java / org / opendaylight / groupbasedpolicy / renderer / opflex / lib / messages / StateReportRequest.java
1 /*
2  * Copyright (C) 2014 Cisco Systems, 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 : Thomas Bachman
9  */
10 package org.opendaylight.groupbasedpolicy.renderer.opflex.lib.messages;
11
12 import java.util.List;
13
14 import org.opendaylight.groupbasedpolicy.renderer.opflex.jsonrpc.RpcMessage;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
16
17 import com.fasterxml.jackson.annotation.JsonIgnore;
18 import com.fasterxml.jackson.databind.JsonNode;
19 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
20 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
21
22 @JsonSerialize
23 @JsonDeserialize
24 public class StateReportRequest extends RpcMessage {
25
26     public static final String STATE_MESSAGE = "report_state";
27
28     static public class Params {
29
30         private Uri object;
31         private List<ManagedObject> observable;
32
33         public Uri getObject() {
34             return object;
35         }
36
37         public void setObject(Uri object) {
38             this.object = object;
39         }
40
41         public List<ManagedObject> getObservable() {
42             return observable;
43         }
44
45         public void setObservable(List<ManagedObject> observable) {
46             this.observable = observable;
47         }
48     }
49
50     private JsonNode id;
51     private String method;
52     private List<Params> params;
53
54     @JsonIgnore
55     private String name;
56
57     @Override
58     public JsonNode getId() {
59         return id;
60     }
61
62     @Override
63     public void setId(JsonNode id) {
64         this.id = id;
65     }
66
67     @Override
68     public String getMethod() {
69         return method;
70     }
71
72     @Override
73     public void setMethod(String method) {
74         this.method = method;
75     }
76
77     public List<Params> getParams() {
78         return this.params;
79     }
80
81     public void setParams(List<Params> params) {
82         this.params = params;
83     }
84
85     @Override
86     public String getName() {
87         return this.name;
88     }
89
90     @Override
91     public void setName(String name) {
92         this.name = name;
93     }
94
95     public StateReportRequest(String name) {
96         this.name = name;
97     }
98
99     public StateReportRequest() {
100         this.name = STATE_MESSAGE;
101         this.method = STATE_MESSAGE;
102     }
103
104     /**
105      * Minimal check on validity of message
106      * 
107      * @return true if message has passed validity check
108      */
109     @JsonIgnore
110     @Override
111     public boolean valid() {
112         if (params == null)
113             return false;
114         if (params.get(0) == null)
115             return false;
116         return true;
117     }
118 }