Added range type to subject-feature-definition/parameter
[groupbasedpolicy.git] / renderers / opflex / src / main / java / org / opendaylight / groupbasedpolicy / renderer / opflex / lib / messages / PolicyUnresolveRequest.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 PolicyUnresolveRequest extends RpcMessage {
25
26     public static final String UNRESOLVE_MESSAGE = "policy_unresolve";
27
28     static public class Params {
29         private String subject;
30         private Uri policy_uri;
31         private PolicyIdentity policy_ident;
32         public String getSubject() {
33             return subject;
34         }
35         public void setSubject(String subject) {
36             this.subject = subject;
37         }
38         public Uri getPolicy_uri() {
39             return policy_uri;
40         }
41         public void setPolicy_uri(Uri policy_uri) {
42             this.policy_uri = policy_uri;
43         }
44         public PolicyIdentity getPolicy_ident() {
45             return policy_ident;
46         }
47         public void setPolicy_ident(PolicyIdentity policy_ident) {
48             this.policy_ident = policy_ident;
49         }
50     }
51     private JsonNode id;
52     private String method;
53     private List<Params> params;
54
55     @JsonIgnore
56     private String name;
57
58     @Override
59     public JsonNode getId() {
60         return id;
61     }
62
63     @Override
64     public void setId(JsonNode id) {
65         this.id = id;
66     }
67
68     @Override
69     public String getMethod() {
70         return method;
71     }
72
73     @Override
74     public void setMethod(String method) {
75         this.method = method;
76     }
77
78     public List<Params> getParams() {
79         return this.params;
80     }
81
82     public void setParams(List<Params> params) {
83         this.params = params;
84     }
85
86     @Override
87     public String getName() {
88         return this.name;
89     }
90
91     @Override
92     public void setName(String name) {
93         this.name = name;
94     }
95
96     public PolicyUnresolveRequest(String name) {
97         this.name = name;
98     }
99
100     public PolicyUnresolveRequest() {
101         this.name = UNRESOLVE_MESSAGE;
102         this.method = UNRESOLVE_MESSAGE;
103     }
104
105     /**
106      * Minimal check on validity of message
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 }