Bug 1029: Remove dead code: samples/clustersession
[controller.git] / opendaylight / adsal / northbound / switchmanager / src / main / java / org / opendaylight / controller / switchmanager / northbound / NodeProperties.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.switchmanager.northbound;
11
12 import java.util.HashMap;
13 import java.util.HashSet;
14 import java.util.Map;
15 import java.util.Set;
16
17 import javax.xml.bind.annotation.XmlAccessType;
18 import javax.xml.bind.annotation.XmlAccessorType;
19 import javax.xml.bind.annotation.XmlElement;
20 import javax.xml.bind.annotation.XmlElementWrapper;
21 import javax.xml.bind.annotation.XmlRootElement;
22
23 import org.opendaylight.controller.sal.core.Node;
24 import org.opendaylight.controller.sal.core.Property;
25
26 import com.fasterxml.jackson.annotation.JsonIgnore;
27 import com.fasterxml.jackson.annotation.JsonProperty;
28
29 /**
30  * The class describes set of properties attached to a node
31  */
32
33 @XmlRootElement
34 @XmlAccessorType(XmlAccessType.NONE)
35 public class NodeProperties {
36     @XmlElement
37     private Node node;
38
39     @XmlElement(name="property")
40     @XmlElementWrapper
41     @JsonIgnore
42     private Set<Property> properties;
43
44     // JAXB required constructor
45     private NodeProperties() {
46         this.node = null;
47         this.properties = null;
48     }
49
50     public NodeProperties(Node node, Set<Property> properties) {
51         this.node = node;
52         this.properties = properties;
53     }
54
55     @JsonProperty(value="properties")
56     public Map<String, Property> getMapProperties() {
57         Map<String, Property> map = new HashMap<String, Property>();
58         for (Property p : properties) {
59             map.put(p.getName(), p);
60         }
61         return map;
62     }
63
64     public void setMapProperties(Map<String, Property> propertiesMap) {
65         this.properties = new HashSet<Property>(propertiesMap.values());
66     }
67
68     public Set<Property> getProperties() {
69         return properties;
70     }
71
72     public void setProperties(Set<Property> properties) {
73         this.properties = properties;
74     }
75
76     public Node getNode() {
77         return node;
78     }
79
80     public void setNode(Node node) {
81         this.node = node;
82     }
83 }