Feature uses features-parent as parent
[groupbasedpolicy.git] / renderers / opflex / src / main / java / org / opendaylight / groupbasedpolicy / renderer / opflex / lib / messages / ManagedObject.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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
15
16 import com.fasterxml.jackson.databind.JsonNode;
17 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
18 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
19
20 @JsonSerialize
21 @JsonDeserialize
22 public class ManagedObject {
23
24     public static class Property {
25
26         private String name;
27         private JsonNode data;
28
29         public String getName() {
30             return name;
31         }
32
33         public void setName(String name) {
34             this.name = name;
35         }
36
37         public JsonNode getData() {
38             return data;
39         }
40
41         public void setData(JsonNode data) {
42             this.data = data;
43         }
44
45         @Override
46         public int hashCode() {
47             final int prime = 31;
48             int result = 1;
49             result = prime * result + ((data == null) ? 0 : data.hashCode());
50             result = prime * result + ((name == null) ? 0 : name.hashCode());
51             return result;
52         }
53
54         @Override
55         public boolean equals(Object obj) {
56             if (this == obj)
57                 return true;
58             if (obj == null)
59                 return false;
60             if (getClass() != obj.getClass())
61                 return false;
62             Property other = (Property) obj;
63             if (data == null) {
64                 if (other.data != null)
65                     return false;
66             } else if (!data.asText().equals(other.getData().asText()))
67                 return false;
68             if (name == null) {
69                 if (other.name != null)
70                     return false;
71             } else if (!name.equals(other.name))
72                 return false;
73             return true;
74         }
75
76     }
77
78     private String subject;
79     private Uri uri;
80     private List<Property> properties;
81     private String parent_subject;
82     private Uri parent_uri;
83     private String parent_relation;
84     private List<Uri> children;
85
86     public String getSubject() {
87         return subject;
88     }
89
90     public void setSubject(String subject) {
91         this.subject = subject;
92     }
93
94     public Uri getUri() {
95         return uri;
96     }
97
98     public void setUri(Uri uri) {
99         this.uri = uri;
100     }
101
102     public List<Property> getProperties() {
103         return properties;
104     }
105
106     public void setProperties(List<Property> properties) {
107         this.properties = properties;
108     }
109
110     public String getParent_subject() {
111         return parent_subject;
112     }
113
114     public void setParent_subject(String parent_subject) {
115         this.parent_subject = parent_subject;
116     }
117
118     public Uri getParent_uri() {
119         return parent_uri;
120     }
121
122     public void setParent_uri(Uri parent_uri) {
123         this.parent_uri = parent_uri;
124     }
125
126     public String getParent_relation() {
127         return parent_relation;
128     }
129
130     public void setParent_relation(String parent_relation) {
131         this.parent_relation = parent_relation;
132     }
133
134     public List<Uri> getChildren() {
135         return children;
136     }
137
138     public void setChildren(List<Uri> children) {
139         this.children = children;
140     }
141
142     @Override
143     public int hashCode() {
144         final int prime = 31;
145         int result = 1;
146         result = prime * result + ((children == null) ? 0 : children.hashCode());
147         result = prime * result + ((parent_relation == null) ? 0 : parent_relation.hashCode());
148         result = prime * result + ((parent_subject == null) ? 0 : parent_subject.hashCode());
149         result = prime * result + ((parent_uri == null) ? 0 : parent_uri.hashCode());
150         result = prime * result + ((properties == null) ? 0 : properties.hashCode());
151         result = prime * result + ((subject == null) ? 0 : subject.hashCode());
152         result = prime * result + ((uri == null) ? 0 : uri.hashCode());
153         return result;
154     }
155
156     @Override
157     public boolean equals(Object obj) {
158         if (this == obj)
159             return true;
160         if (obj == null)
161             return false;
162         if (getClass() != obj.getClass())
163             return false;
164         ManagedObject other = (ManagedObject) obj;
165         if (children == null) {
166             if (other.children != null)
167                 return false;
168         } else if (!children.equals(other.children))
169             return false;
170         if (parent_relation == null) {
171             if (other.parent_relation != null)
172                 return false;
173         } else if (!parent_relation.equals(other.parent_relation))
174             return false;
175         if (parent_subject == null) {
176             if (other.parent_subject != null)
177                 return false;
178         } else if (!parent_subject.equals(other.parent_subject))
179             return false;
180         if (parent_uri == null) {
181             if (other.parent_uri != null)
182                 return false;
183         } else if (!parent_uri.equals(other.parent_uri))
184             return false;
185         if (properties == null) {
186             if (other.properties != null)
187                 return false;
188         } else if (!properties.equals(other.properties))
189             return false;
190         if (subject == null) {
191             if (other.subject != null)
192                 return false;
193         } else if (!subject.equals(other.subject))
194             return false;
195         if (uri == null) {
196             if (other.uri != null)
197                 return false;
198         } else if (!uri.equals(other.uri))
199             return false;
200         return true;
201     }
202 }