Added range type to subject-feature-definition/parameter
[groupbasedpolicy.git] / groupbasedpolicy / 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.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         private Uri object;
30         private List<ManagedObject> observable;
31         public Uri getObject() {
32             return object;
33         }
34         public void setObject(Uri object) {
35             this.object = object;
36         }
37         public List<ManagedObject> getObservable() {
38             return observable;
39         }
40         public void setObservable(List<ManagedObject> observable) {
41             this.observable = observable;
42         }
43     }
44     private JsonNode id;
45     private String method;
46     private List<Params> params;
47
48     @JsonIgnore
49     private String name;
50
51     @Override
52     public JsonNode getId() {
53         return id;
54     }
55
56     @Override
57     public void setId(JsonNode id) {
58         this.id = id;
59     }
60
61     @Override
62     public String getMethod() {
63         return method;
64     }
65
66     @Override
67     public void setMethod(String method) {
68         this.method = method;
69     }
70
71     public List<Params> getParams() {
72         return this.params;
73     }
74
75     public void setParams(List<Params> params) {
76         this.params = params;
77     }
78
79     @Override
80     public String getName() {
81         return this.name;
82     }
83
84     @Override
85     public void setName(String name) {
86         this.name = name;
87     }
88
89     public StateReportRequest(String name) {
90         this.name = name;
91     }
92
93     public StateReportRequest() {
94         this.name = STATE_MESSAGE;
95         this.method = STATE_MESSAGE;
96     }
97
98     /**
99      * Minimal check on validity of message
100      * @return true if message has passed validity check
101      */
102     @JsonIgnore
103     @Override
104     public boolean valid() {
105         if (params == null)
106             return false;
107         if (params.get(0) == null)
108             return false;
109         return true;
110     }
111 }