Merge "Do not instantiate constant lists on each message"
[controller.git] / opendaylight / networkconfiguration / neutron / src / main / java / org / opendaylight / controller / networkconfig / neutron / NeutronFloatingIP.java
1 /*
2  * Copyright IBM Corporation, 2013.  All rights reserved.
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
9 package org.opendaylight.controller.networkconfig.neutron;
10
11 import java.io.Serializable;
12 import java.util.Iterator;
13 import java.util.List;
14
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlElement;
18 import javax.xml.bind.annotation.XmlRootElement;
19
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22
23 public class NeutronFloatingIP implements Serializable {
24     private static final long serialVersionUID = 1L;
25
26     // See OpenStack Network API v2.0 Reference for description of
27     // annotated attributes
28
29     @XmlElement (name="id")
30     String floatingIPUUID;
31
32     @XmlElement (name="floating_network_id")
33     String floatingNetworkUUID;
34
35     @XmlElement (name="port_id")
36     String portUUID;
37
38     @XmlElement (name="fixed_ip_address")
39     String fixedIPAddress;
40
41     @XmlElement (name="floating_ip_address")
42     String floatingIPAddress;
43
44     @XmlElement (name="tenant_id")
45     String tenantUUID;
46
47     public NeutronFloatingIP() {
48     }
49
50     public String getID() { return floatingIPUUID; }
51
52     public String getFloatingIPUUID() {
53         return floatingIPUUID;
54     }
55
56     public void setFloatingIPUUID(String floatingIPUUID) {
57         this.floatingIPUUID = floatingIPUUID;
58     }
59
60     public String getFloatingNetworkUUID() {
61         return floatingNetworkUUID;
62     }
63
64     public void setFloatingNetworkUUID(String floatingNetworkUUID) {
65         this.floatingNetworkUUID = floatingNetworkUUID;
66     }
67
68     public String getPortUUID() {
69         return portUUID;
70     }
71
72     public void setPortUUID(String portUUID) {
73         this.portUUID = portUUID;
74     }
75
76     public String getFixedIPAddress() {
77         return fixedIPAddress;
78     }
79
80     public void setFixedIPAddress(String fixedIPAddress) {
81         this.fixedIPAddress = fixedIPAddress;
82     }
83
84     public String getFloatingIPAddress() {
85         return floatingIPAddress;
86     }
87
88     public void setFloatingIPAddress(String floatingIPAddress) {
89         this.floatingIPAddress = floatingIPAddress;
90     }
91
92     public String getTenantUUID() {
93         return tenantUUID;
94     }
95
96     public void setTenantUUID(String tenantUUID) {
97         this.tenantUUID = tenantUUID;
98     }
99
100     /**
101      * This method copies selected fields from the object and returns them
102      * as a new object, suitable for marshaling.
103      *
104      * @param fields
105      *            List of attributes to be extracted
106      * @return an OpenStackFloatingIPs object with only the selected fields
107      * populated
108      */
109
110     public NeutronFloatingIP extractFields(List<String> fields) {
111         NeutronFloatingIP ans = new NeutronFloatingIP();
112         Iterator<String> i = fields.iterator();
113         while (i.hasNext()) {
114             String s = i.next();
115             if (s.equals("id")) {
116                 ans.setFloatingIPUUID(this.getFloatingIPUUID());
117             }
118             if (s.equals("floating_network_id")) {
119                 ans.setFloatingNetworkUUID(this.getFloatingNetworkUUID());
120             }
121             if (s.equals("port_id")) {
122                 ans.setPortUUID(this.getPortUUID());
123             }
124             if (s.equals("fixed_ip_address")) {
125                 ans.setFixedIPAddress(this.getFixedIPAddress());
126             }
127             if (s.equals("floating_ip_address")) {
128                 ans.setFloatingIPAddress(this.getFloatingIPAddress());
129             }
130             if (s.equals("tenant_id")) {
131                 ans.setTenantUUID(this.getTenantUUID());
132             }
133         }
134         return ans;
135     }
136
137     public void initDefaults() {
138     }
139 }