00f0d4b0544fd7c474efae06550e0961ef08025c
[controller.git] / opendaylight / northbound / switchmanager / src / main / java / org / opendaylight / controller / switchmanager / northbound / NodeConnectorProperties.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 import javax.xml.bind.annotation.XmlAccessType;
17 import javax.xml.bind.annotation.XmlAccessorType;
18 import javax.xml.bind.annotation.XmlElement;
19 import javax.xml.bind.annotation.XmlElementRef;
20 import javax.xml.bind.annotation.XmlElementWrapper;
21 import javax.xml.bind.annotation.XmlRootElement;
22
23 import com.fasterxml.jackson.annotation.JsonIgnore;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import org.opendaylight.controller.sal.core.NodeConnector;
26 import org.opendaylight.controller.sal.core.Property;
27
28 /**
29  * The class describes set of properties attached to a node connector
30  */
31
32 @XmlRootElement
33 @XmlAccessorType(XmlAccessType.NONE)
34 public class NodeConnectorProperties {
35     @XmlElement
36     private NodeConnector nodeconnector;
37     @XmlElementRef
38     @XmlElementWrapper
39     @JsonIgnore
40     private Set<Property> properties;
41
42     // JAXB required constructor
43     private NodeConnectorProperties() {
44         this.nodeconnector = null;
45         this.properties = null;
46     }
47
48     public NodeConnectorProperties(NodeConnector nodeconnector, Set<Property> properties) {
49         this.nodeconnector = nodeconnector;
50         this.properties = properties;
51     }
52
53     @JsonProperty(value="properties")
54     public Map<String, Property> getMapProperties() {
55         Map<String, Property> map = new HashMap<String, Property>();
56         for (Property p : properties) {
57             map.put(p.getName(), p);
58         }
59         return map;
60     }
61
62     public void setMapProperties(Map<String, Property> propertiesMap) {
63         this.properties = new HashSet<Property>(propertiesMap.values());
64     }
65
66     public Set<Property> getProperties() {
67         return properties;
68     }
69
70     public void setProperties(Set<Property> properties) {
71         this.properties = properties;
72     }
73
74     public NodeConnector getNodeConnector() {
75         return nodeconnector;
76     }
77
78     public void setNodeConnector(NodeConnector nodeconnector) {
79         this.nodeconnector = nodeconnector;
80     }
81 }