Added range type to subject-feature-definition/parameter
[groupbasedpolicy.git] / renderers / opflex / src / main / java / org / opendaylight / groupbasedpolicy / renderer / opflex / lib / messages / EndpointResolveRequest.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 EndpointResolveRequest extends RpcMessage {
25
26     public static final String EP_RESOLVE_REQUEST_MESSAGE = "endpoint_resolve";
27
28     static public class Params {
29         private String subject;
30         private Uri endpoint_uri;
31         private EndpointIdentity endpoint_ident;
32         private int prr;
33
34         public String getSubject() {
35             return subject;
36         }
37         public void setSubject(String subject) {
38             this.subject = subject;
39         }
40         public Uri getEndpoint_uri() {
41             return endpoint_uri;
42         }
43         public void setEndpoint_uri(Uri endpoint_uri) {
44             this.endpoint_uri = endpoint_uri;
45         }
46         public EndpointIdentity getEndpoint_ident() {
47             return endpoint_ident;
48         }
49         public void setEndpoint_ident(EndpointIdentity endpoint_ident) {
50             this.endpoint_ident = endpoint_ident;
51         }
52         public int getPrr() {
53             return prr;
54         }
55         public void setPrr(int prr) {
56             this.prr = prr;
57         }
58     }
59     private JsonNode id;
60     private String method;
61     private List<Params> params;
62
63     @JsonIgnore
64     private String name;
65
66     @Override
67     public JsonNode getId() {
68         return id;
69     }
70
71     @Override
72     public void setId(JsonNode id) {
73         this.id = id;
74     }
75
76     @Override
77     public String getMethod() {
78         return method;
79     }
80
81     @Override
82     public void setMethod(String method) {
83         this.method = method;
84     }
85
86     public List<Params> getParams() {
87         return this.params;
88     }
89
90     public void setParams(List<Params> params) {
91         this.params = params;
92     }
93
94     @Override
95     public String getName() {
96         return this.name;
97     }
98
99     @Override
100     public void setName(String name) {
101         this.name = name;
102     }
103
104     public EndpointResolveRequest(String name) {
105         this.name = name;
106     }
107
108     public EndpointResolveRequest() {
109         this.name = EP_RESOLVE_REQUEST_MESSAGE;
110     }
111
112     /**
113      * Minimal check on validity of message
114      * @return true if message has passed validity check
115      */
116     @JsonIgnore
117     @Override
118     public boolean valid() {
119         if (params == null)
120             return false;
121         if (params.get(0) == null)
122             return false;
123         return true;
124     }
125 }