Feature uses features-parent as parent
[groupbasedpolicy.git] / renderers / opflex / src / main / java / org / opendaylight / groupbasedpolicy / renderer / opflex / lib / messages / PolicyResolveRequest.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 PolicyResolveRequest extends RpcMessage {
25
26     public static final String RESOLVE_MESSAGE = "policy_resolve";
27
28     static public class Params {
29
30         private String subject;
31         private Uri policy_uri;
32         private PolicyIdentity policy_ident;
33         private String data;
34         private int prr;
35
36         public String getSubject() {
37             return subject;
38         }
39
40         public void setSubject(String subject) {
41             this.subject = subject;
42         }
43
44         public Uri getPolicy_uri() {
45             return policy_uri;
46         }
47
48         public void setPolicy_uri(Uri policy_uri) {
49             this.policy_uri = policy_uri;
50         }
51
52         public PolicyIdentity getPolicy_ident() {
53             return policy_ident;
54         }
55
56         public void setPolicy_ident(PolicyIdentity policy_ident) {
57             this.policy_ident = policy_ident;
58         }
59
60         public String getData() {
61             return data;
62         }
63
64         public void setData(String data) {
65             this.data = data;
66         }
67
68         public int getPrr() {
69             return prr;
70         }
71
72         public void setPrr(int prr) {
73             this.prr = prr;
74         }
75     }
76
77     private JsonNode id;
78     private String method;
79     private List<Params> params;
80
81     @JsonIgnore
82     private String name;
83
84     @Override
85     public JsonNode getId() {
86         return id;
87     }
88
89     @Override
90     public void setId(JsonNode id) {
91         this.id = id;
92     }
93
94     @Override
95     public String getMethod() {
96         return method;
97     }
98
99     @Override
100     public void setMethod(String method) {
101         this.method = method;
102     }
103
104     public List<Params> getParams() {
105         return this.params;
106     }
107
108     public void setParams(List<Params> params) {
109         this.params = params;
110     }
111
112     @Override
113     public String getName() {
114         return this.name;
115     }
116
117     @Override
118     public void setName(String name) {
119         this.name = name;
120     }
121
122     public PolicyResolveRequest(String name) {
123         this.name = name;
124     }
125
126     public PolicyResolveRequest() {
127         this.name = RESOLVE_MESSAGE;
128         this.method = RESOLVE_MESSAGE;
129     }
130
131     /**
132      * Minimal check on validity of message
133      * 
134      * @return true if message has passed validity check
135      */
136     @JsonIgnore
137     @Override
138     public boolean valid() {
139         if (params == null)
140             return false;
141         if (params.get(0) == null)
142             return false;
143         return true;
144     }
145 }