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