Separating renderers into features.
[groupbasedpolicy.git] / renderers / opflex / src / main / java / org / opendaylight / groupbasedpolicy / renderer / opflex / lib / messages / EndpointUndeclareRequest.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
20 public class EndpointUndeclareRequest extends RpcMessage {
21
22     public static final String UNDECLARE_MESSAGE = "endpoint_undeclare";
23
24     static public class Params {
25         private String subject;
26         private Uri endpoint_uri;
27
28                 public String getSubject() {
29                         return subject;
30                 }
31                 public void setSubject(String subject) {
32                         this.subject = subject;
33                 }
34                 public Uri getEndpoint_uri() {
35                         return endpoint_uri;
36                 }
37                 public void setEndpoint_uri(Uri endpoint_uri) {
38                         this.endpoint_uri = endpoint_uri;
39                 }
40     }
41     private JsonNode id;
42     private String method;
43     private List<Params> params;
44
45     @JsonIgnore
46     private String name;
47
48     @Override
49     public JsonNode getId() {
50         return id;
51     }
52
53     @Override
54     public void setId(JsonNode id) {
55         this.id = id;
56     }
57
58     @Override
59     public String getMethod() {
60         return method;
61     }
62
63     @Override
64     public void setMethod(String method) {
65         this.method = method;
66     }
67
68     public List<Params> getParams() {
69         return this.params;
70     }
71
72     public void setParams(List<Params> params) {
73         this.params = params;
74     }
75
76     @Override
77     public String getName() {
78         return this.name;
79     }
80
81     @Override
82     public void setName(String name) {
83         this.name = name;
84     }
85
86     public EndpointUndeclareRequest(String name) {
87         this.name = name;
88     }
89
90     public EndpointUndeclareRequest() {
91         this.name = UNDECLARE_MESSAGE;
92         this.method = UNDECLARE_MESSAGE;
93     }
94
95     /**
96      * Minimal check on validity of message
97      * @return true if message has passed validity check
98      */
99     @JsonIgnore
100     @Override
101     public boolean valid() {
102         if (params == null)
103             return false;
104         if (params.get(0) == null)
105             return false;
106
107         return true;
108     }
109
110 }