sort out signature of extraceField method
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCPortPair.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  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 package org.opendaylight.neutron.spi;
9
10 import java.io.Serializable;
11 import java.util.HashMap;
12 import java.util.Iterator;
13 import java.util.List;
14 import java.util.Map;
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 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
20
21 @XmlRootElement
22 @XmlAccessorType(XmlAccessType.NONE)
23 public class NeutronSFCPortPair extends NeutronObject<NeutronSFCPortPair>
24         implements Serializable, INeutronObject<NeutronSFCPortPair> {
25
26     private static final long serialVersionUID = 1L;
27
28     // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
29     // for description of annotated attributes
30     @XmlElement(name = "name")
31     String name;
32
33     @XmlElement(name = "ingress")
34     String ingressPortUUID;
35
36     @XmlElement(name = "egress")
37     String egressPortUUID;
38
39     @XmlElement(name = "service_function_parameters")
40     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
41     Map<String, String> serviceFunctionParameters;
42
43     public NeutronSFCPortPair() {
44     }
45
46     public String getName() {
47         return name;
48     }
49
50     public void setName(String name) {
51         this.name = name;
52     }
53
54     public String getIngressPortUUID() {
55         return ingressPortUUID;
56     }
57
58     public void setIngressPortUUID(String ingressPortUUID) {
59         this.ingressPortUUID = ingressPortUUID;
60     }
61
62     public String getEgressPortUUID() {
63         return egressPortUUID;
64     }
65
66     public void setEgressPortUUID(String egressPortUUID) {
67         this.egressPortUUID = egressPortUUID;
68     }
69
70     public Map<String, String> getServiceFunctionParameters() {
71         return serviceFunctionParameters;
72     }
73
74     public void setServiceFunctionParameters(Map<String, String> serviceFunctionParameters) {
75         this.serviceFunctionParameters = serviceFunctionParameters;
76     }
77
78     /**
79      * This method copies selected fields from the object and returns them
80      * as a new object, suitable for marshaling.
81      *
82      * @param fields List of attributes to be extracted
83      * @return an OpenStack Neutron SFC Port Pair object with only the selected fields
84      * populated
85      */
86
87     public NeutronSFCPortPair extractFields(List<String> fields) {
88         NeutronSFCPortPair ans = new NeutronSFCPortPair();
89         Iterator<String> i = fields.iterator();
90         while (i.hasNext()) {
91             String s = i.next();
92             if (s.equals("id")) {
93                 ans.setID(this.getID());
94             }
95             if (s.equals("tenant_id")) {
96                 ans.setTenantID(this.getTenantID());
97             }
98             if (s.equals("name")) {
99                 ans.setName(this.getName());
100             }
101             if (s.equals("ingress")) {
102                 ans.setIngressPortUUID(this.getIngressPortUUID());
103             }
104             if (s.equals("egress")) {
105                 ans.setEgressPortUUID(this.getEgressPortUUID());
106             }
107             if (s.equals("service_function_parameters")) {
108                 ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
109             }
110         }
111         return ans;
112     }
113
114     @Override
115     public String toString() {
116         return "NeutronSFCPortPair[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\'' + ", ingressPortUUID='"
117                 + ingressPortUUID + '\'' + ", egressPortUUID='" + egressPortUUID + '\'' + ", serviceFunctionParameters="
118                 + serviceFunctionParameters + ']';
119     }
120 }